Skip to content

Commit a8e1186

Browse files
committed
Auto merge of #132435 - workingjubilee:rollup-3mgogw9, r=workingjubilee
Rollup of 9 pull requests Successful merges: - #131168 (Fix `target_os` for `mipsel-sony-psx`) - #132209 (Fix validation when lowering `?` trait bounds) - #132294 (Bump Fuchsia) - #132357 (Improve missing_abi lint) - #132385 (compiler: Move `rustc_target::spec::abi::Abi` to `rustc_abi::ExternAbi`) - #132403 (continue `TypingMode` refactor) - #132417 (macOS: Document the difference between Clang's `-darwin` and `-macosx` targets) - #132421 (Remove `""` case from RISC-V `llvm_abiname` match statement) - #132422 (llvm: Match new LLVM 128-bit integer alignment on sparc) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 24254ef + acd839d commit a8e1186

File tree

75 files changed

+364
-220
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+364
-220
lines changed

Cargo.lock

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3204,9 +3204,11 @@ dependencies = [
32043204
"rand",
32053205
"rand_xoshiro",
32063206
"rustc_data_structures",
3207+
"rustc_feature",
32073208
"rustc_index",
32083209
"rustc_macros",
32093210
"rustc_serialize",
3211+
"rustc_span",
32103212
"tracing",
32113213
]
32123214

@@ -3749,11 +3751,11 @@ dependencies = [
37493751
name = "rustc_hir_pretty"
37503752
version = "0.0.0"
37513753
dependencies = [
3754+
"rustc_abi",
37523755
"rustc_ast",
37533756
"rustc_ast_pretty",
37543757
"rustc_hir",
37553758
"rustc_span",
3756-
"rustc_target",
37573759
]
37583760

37593761
[[package]]
@@ -3938,14 +3940,14 @@ dependencies = [
39383940
name = "rustc_lint_defs"
39393941
version = "0.0.0"
39403942
dependencies = [
3943+
"rustc_abi",
39413944
"rustc_ast",
39423945
"rustc_data_structures",
39433946
"rustc_error_messages",
39443947
"rustc_hir",
39453948
"rustc_macros",
39463949
"rustc_serialize",
39473950
"rustc_span",
3948-
"rustc_target",
39493951
"serde",
39503952
]
39513953

@@ -4054,6 +4056,7 @@ version = "0.0.0"
40544056
dependencies = [
40554057
"either",
40564058
"itertools",
4059+
"rustc_abi",
40574060
"rustc_apfloat",
40584061
"rustc_arena",
40594062
"rustc_ast",
@@ -4069,7 +4072,6 @@ dependencies = [
40694072
"rustc_pattern_analysis",
40704073
"rustc_session",
40714074
"rustc_span",
4072-
"rustc_target",
40734075
"rustc_trait_selection",
40744076
"tracing",
40754077
]

compiler/rustc_abi/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ bitflags = "2.4.1"
99
rand = { version = "0.8.4", default-features = false, optional = true }
1010
rand_xoshiro = { version = "0.6.0", optional = true }
1111
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
12+
rustc_feature = { path = "../rustc_feature", optional = true }
1213
rustc_index = { path = "../rustc_index", default-features = false }
1314
rustc_macros = { path = "../rustc_macros", optional = true }
1415
rustc_serialize = { path = "../rustc_serialize", optional = true }
16+
rustc_span = { path = "../rustc_span", optional = true }
1517
tracing = "0.1"
1618
# tidy-alphabetical-end
1719

@@ -22,8 +24,10 @@ default = ["nightly", "randomize"]
2224
# without depending on rustc_data_structures, rustc_macros and rustc_serialize
2325
nightly = [
2426
"dep:rustc_data_structures",
27+
"dep:rustc_feature",
2528
"dep:rustc_macros",
2629
"dep:rustc_serialize",
30+
"dep:rustc_span",
2731
"rustc_index/nightly",
2832
]
2933
randomize = ["dep:rand", "dep:rand_xoshiro", "nightly"]

compiler/rustc_target/src/spec/abi/mod.rs renamed to compiler/rustc_abi/src/extern_abi/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ use rustc_span::{Span, Symbol};
77
#[cfg(test)]
88
mod tests;
99

10+
use ExternAbi as Abi;
11+
1012
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Debug)]
1113
#[derive(HashStable_Generic, Encodable, Decodable)]
12-
pub enum Abi {
14+
pub enum ExternAbi {
1315
// Some of the ABIs come first because every time we add a new ABI, we have to re-bless all the
1416
// hashing tests. These are used in many places, so giving them stable values reduces test
1517
// churn. The specific values are meaningless.

compiler/rustc_abi/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// tidy-alphabetical-start
22
#![cfg_attr(feature = "nightly", allow(internal_features))]
33
#![cfg_attr(feature = "nightly", doc(rust_logo))]
4+
#![cfg_attr(feature = "nightly", feature(assert_matches))]
45
#![cfg_attr(feature = "nightly", feature(rustc_attrs))]
56
#![cfg_attr(feature = "nightly", feature(rustdoc_internals))]
67
#![cfg_attr(feature = "nightly", feature(step_trait))]
@@ -28,8 +29,15 @@ mod layout;
2829
#[cfg(test)]
2930
mod tests;
3031

32+
#[cfg(feature = "nightly")]
33+
mod extern_abi;
34+
3135
pub use callconv::{Heterogeneous, HomogeneousAggregate, Reg, RegKind};
3236
#[cfg(feature = "nightly")]
37+
pub use extern_abi::{
38+
AbiDisabled, AbiUnsupported, ExternAbi, all_names, enabled_names, is_enabled, is_stable, lookup,
39+
};
40+
#[cfg(feature = "nightly")]
3341
pub use layout::{FIRST_VARIANT, FieldIdx, Layout, TyAbiInterface, TyAndLayout, VariantIdx};
3442
pub use layout::{LayoutCalculator, LayoutCalculatorError};
3543

compiler/rustc_ast/src/ast.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2810,6 +2810,8 @@ pub struct ModSpans {
28102810
/// E.g., `extern { .. }` or `extern "C" { .. }`.
28112811
#[derive(Clone, Encodable, Decodable, Debug)]
28122812
pub struct ForeignMod {
2813+
/// Span of the `extern` keyword.
2814+
pub extern_span: Span,
28132815
/// `unsafe` keyword accepted syntactically for macro DSLs, but not
28142816
/// semantically by Rust.
28152817
pub safety: Safety,

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ pub fn walk_ty<T: MutVisitor>(vis: &mut T, ty: &mut P<Ty>) {
525525
}
526526

527527
fn walk_foreign_mod<T: MutVisitor>(vis: &mut T, foreign_mod: &mut ForeignMod) {
528-
let ForeignMod { safety, abi: _, items } = foreign_mod;
528+
let ForeignMod { extern_span: _, safety, abi: _, items } = foreign_mod;
529529
visit_safety(vis, safety);
530530
items.flat_map_in_place(|item| vis.flat_map_foreign_item(item));
531531
}

compiler/rustc_ast/src/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ impl WalkItemKind for ItemKind {
366366
}
367367
ModKind::Unloaded => {}
368368
},
369-
ItemKind::ForeignMod(ForeignMod { safety: _, abi: _, items }) => {
369+
ItemKind::ForeignMod(ForeignMod { extern_span: _, safety: _, abi: _, items }) => {
370370
walk_list!(visitor, visit_foreign_item, items);
371371
}
372372
ItemKind::GlobalAsm(asm) => try_visit!(visitor.visit_inline_asm(asm)),

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -677,9 +677,8 @@ impl<'a> AstValidator<'a> {
677677
Self::check_decl_no_pat(&bfty.decl, |span, _, _| {
678678
self.dcx().emit_err(errors::PatternFnPointer { span });
679679
});
680-
if let Extern::Implicit(_) = bfty.ext {
681-
let sig_span = self.sess.source_map().next_point(ty.span.shrink_to_lo());
682-
self.maybe_lint_missing_abi(sig_span, ty.id);
680+
if let Extern::Implicit(extern_span) = bfty.ext {
681+
self.maybe_lint_missing_abi(extern_span, ty.id);
683682
}
684683
}
685684
TyKind::TraitObject(bounds, ..) => {
@@ -953,7 +952,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
953952
walk_list!(self, visit_attribute, &item.attrs);
954953
return; // Avoid visiting again.
955954
}
956-
ItemKind::ForeignMod(ForeignMod { abi, safety, .. }) => {
955+
ItemKind::ForeignMod(ForeignMod { extern_span, abi, safety, .. }) => {
957956
self.with_in_extern_mod(*safety, |this| {
958957
let old_item = mem::replace(&mut this.extern_mod, Some(item.span));
959958
this.visibility_not_permitted(
@@ -977,7 +976,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
977976
}
978977

979978
if abi.is_none() {
980-
this.maybe_lint_missing_abi(item.span, item.id);
979+
this.maybe_lint_missing_abi(*extern_span, item.id);
981980
}
982981
visit::walk_item(this, item);
983982
this.extern_mod = old_item;
@@ -1350,13 +1349,13 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
13501349
if let FnKind::Fn(
13511350
_,
13521351
_,
1353-
FnSig { span: sig_span, header: FnHeader { ext: Extern::Implicit(_), .. }, .. },
1352+
FnSig { header: FnHeader { ext: Extern::Implicit(extern_span), .. }, .. },
13541353
_,
13551354
_,
13561355
_,
13571356
) = fk
13581357
{
1359-
self.maybe_lint_missing_abi(*sig_span, id);
1358+
self.maybe_lint_missing_abi(*extern_span, id);
13601359
}
13611360

13621361
// Functions without bodies cannot have patterns.

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ pub(crate) unsafe fn create_module<'ll>(
148148
target_data_layout =
149149
target_data_layout.replace("-p270:32:32-p271:32:32-p272:64:64", "");
150150
}
151+
if sess.target.arch.starts_with("sparc") {
152+
// LLVM 20 updates the sparc layout to correctly align 128 bit integers to 128 bit.
153+
// See https://github.com/llvm/llvm-project/pull/106951
154+
target_data_layout = target_data_layout.replace("-i128:128", "");
155+
}
151156
}
152157

153158
// Ensure the data-layout values hardcoded remain the defaults.

0 commit comments

Comments
 (0)