Skip to content

Commit 20f0108

Browse files
committed
Auto merge of #138202 - jhpratt:rollup-kqrl5xn, r=jhpratt
Rollup of 12 pull requests Successful merges: - #137337 (Add verbatim linker to AIXLinker) - #137363 (compiler: factor Windows x86-32 ABI impl into its own file) - #137537 (Prevent `rmake.rs` from using unstable features, and fix 3 run-make tests that currently do) - #137606 (add a "future" edition) - #137957 (Remove i586-pc-windows-msvc) - #138000 (atomic: clarify that failing conditional RMW operations are not 'writes') - #138013 (Add post-merge analysis CI workflow) - #138033 (rustdoc: Add attribute-related tests for rustdoc JSON.) - #138137 (setTargetTriple now accepts Triple rather than string) - #138173 (Delay bug for negative auto trait rather than ICEing) - #138184 (Allow anyone to relabel `CI-spurious-*`) - #138187 (remove clones) r? `@ghost` `@rustbot` modify labels: rollup
2 parents f5a1ef7 + dad4c8b commit 20f0108

File tree

43 files changed

+644
-99
lines changed

Some content is hidden

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

43 files changed

+644
-99
lines changed

.github/workflows/post-merge.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Workflow that runs after a merge to master, analyses changes in test executions
2+
# and posts the result to the merged PR.
3+
4+
name: Post merge analysis
5+
6+
on:
7+
push:
8+
branches:
9+
- master
10+
11+
jobs:
12+
analysis:
13+
runs-on: ubuntu-24.04
14+
if: github.repository == 'rust-lang/rust'
15+
permissions:
16+
pull-requests: write
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Perform analysis and send PR
20+
run: |
21+
# Get closest bors merge commit
22+
PARENT_COMMIT=`git rev-list --author='bors <bors@rust-lang.org>' -n1 --first-parent HEAD^1`
23+
24+
# Find PR for the current commit
25+
HEAD_PR=`gh pr list --search "${{ github.sha }}" --state merged --json number --jq '.[0].number'`
26+
27+
echo "Parent: ${PARENT_COMMIT}"
28+
echo "HEAD: ${{ github.sha }} (#${HEAD_PR})"
29+
30+
cd src/ci/citool
31+
32+
echo "Post-merge analysis result" > output.log
33+
cargo run --release post-merge-analysis ${PARENT_COMMIT} ${{ github.sha }} >> output.log
34+
cat output.log
35+
36+
gh pr comment ${HEAD_PR} -F output.log

Cargo.lock

+11
Original file line numberDiff line numberDiff line change
@@ -2526,6 +2526,16 @@ version = "0.2.0"
25262526
source = "registry+https://github.com/rust-lang/crates.io-index"
25272527
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
25282528

2529+
[[package]]
2530+
name = "os_pipe"
2531+
version = "1.2.1"
2532+
source = "registry+https://github.com/rust-lang/crates.io-index"
2533+
checksum = "5ffd2b0a5634335b135d5728d84c5e0fd726954b87111f7506a61c502280d982"
2534+
dependencies = [
2535+
"libc",
2536+
"windows-sys 0.59.0",
2537+
]
2538+
25292539
[[package]]
25302540
name = "overload"
25312541
version = "0.1.1"
@@ -3050,6 +3060,7 @@ dependencies = [
30503060
"gimli 0.31.1",
30513061
"libc",
30523062
"object 0.36.7",
3063+
"os_pipe",
30533064
"regex",
30543065
"serde_json",
30553066
"similar",

compiler/rustc_builtin_macros/src/autodiff.rs

+10-19
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ mod llvm_enzyme {
286286
let orig_annotatable: Annotatable = match item {
287287
Annotatable::Item(ref mut iitem) => {
288288
if !iitem.attrs.iter().any(|a| a.id == attr.id) {
289-
iitem.attrs.push(attr.clone());
289+
iitem.attrs.push(attr);
290290
}
291291
if !iitem.attrs.iter().any(|a| a.id == inline_never.id) {
292292
iitem.attrs.push(inline_never.clone());
@@ -295,7 +295,7 @@ mod llvm_enzyme {
295295
}
296296
Annotatable::AssocItem(ref mut assoc_item, i @ Impl) => {
297297
if !assoc_item.attrs.iter().any(|a| a.id == attr.id) {
298-
assoc_item.attrs.push(attr.clone());
298+
assoc_item.attrs.push(attr);
299299
}
300300
if !assoc_item.attrs.iter().any(|a| a.id == inline_never.id) {
301301
assoc_item.attrs.push(inline_never.clone());
@@ -322,7 +322,7 @@ mod llvm_enzyme {
322322
let d_annotatable = if is_impl {
323323
let assoc_item: AssocItemKind = ast::AssocItemKind::Fn(asdf);
324324
let d_fn = P(ast::AssocItem {
325-
attrs: thin_vec![d_attr.clone(), inline_never],
325+
attrs: thin_vec![d_attr, inline_never],
326326
id: ast::DUMMY_NODE_ID,
327327
span,
328328
vis,
@@ -332,12 +332,8 @@ mod llvm_enzyme {
332332
});
333333
Annotatable::AssocItem(d_fn, Impl)
334334
} else {
335-
let mut d_fn = ecx.item(
336-
span,
337-
d_ident,
338-
thin_vec![d_attr.clone(), inline_never],
339-
ItemKind::Fn(asdf),
340-
);
335+
let mut d_fn =
336+
ecx.item(span, d_ident, thin_vec![d_attr, inline_never], ItemKind::Fn(asdf));
341337
d_fn.vis = vis;
342338
Annotatable::Item(d_fn)
343339
};
@@ -446,7 +442,7 @@ mod llvm_enzyme {
446442

447443
if primal_ret && n_active == 0 && x.mode.is_rev() {
448444
// We only have the primal ret.
449-
body.stmts.push(ecx.stmt_expr(black_box_primal_call.clone()));
445+
body.stmts.push(ecx.stmt_expr(black_box_primal_call));
450446
return body;
451447
}
452448

@@ -471,7 +467,7 @@ mod llvm_enzyme {
471467
if primal_ret {
472468
// We have both primal ret and active floats.
473469
// primal ret is first, by construction.
474-
exprs.push(primal_call.clone());
470+
exprs.push(primal_call);
475471
}
476472

477473
// Now construct default placeholder for each active float.
@@ -538,16 +534,11 @@ mod llvm_enzyme {
538534
return body;
539535
}
540536
[arg] => {
541-
ret = ecx.expr_call(
542-
new_decl_span,
543-
blackbox_call_expr.clone(),
544-
thin_vec![arg.clone()],
545-
);
537+
ret = ecx.expr_call(new_decl_span, blackbox_call_expr, thin_vec![arg.clone()]);
546538
}
547539
args => {
548540
let ret_tuple: P<ast::Expr> = ecx.expr_tuple(span, args.into());
549-
ret =
550-
ecx.expr_call(new_decl_span, blackbox_call_expr.clone(), thin_vec![ret_tuple]);
541+
ret = ecx.expr_call(new_decl_span, blackbox_call_expr, thin_vec![ret_tuple]);
551542
}
552543
}
553544
assert!(has_ret(&d_sig.decl.output));
@@ -567,7 +558,7 @@ mod llvm_enzyme {
567558
let args: ThinVec<_> =
568559
idents[1..].iter().map(|arg| ecx.expr_path(ecx.path_ident(span, *arg))).collect();
569560
let self_expr = ecx.expr_self(span);
570-
ecx.expr_method_call(span, self_expr, primal, args.clone())
561+
ecx.expr_method_call(span, self_expr, primal, args)
571562
} else {
572563
let args: ThinVec<_> =
573564
idents.iter().map(|arg| ecx.expr_path(ecx.path_ident(span, *arg))).collect();

compiler/rustc_builtin_macros/src/standard_library_imports.rs

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ pub fn inject(
6060
Edition2018 => sym::rust_2018,
6161
Edition2021 => sym::rust_2021,
6262
Edition2024 => sym::rust_2024,
63+
EditionFuture => sym::rust_future,
6364
}])
6465
.map(|&symbol| Ident::new(symbol, span))
6566
.collect();

compiler/rustc_codegen_ssa/src/back/linker.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1655,9 +1655,9 @@ impl<'a> Linker for AixLinker<'a> {
16551655
}
16561656
}
16571657

1658-
fn link_dylib_by_name(&mut self, name: &str, _verbatim: bool, _as_needed: bool) {
1658+
fn link_dylib_by_name(&mut self, name: &str, verbatim: bool, _as_needed: bool) {
16591659
self.hint_dynamic();
1660-
self.link_or_cc_arg(format!("-l{name}"));
1660+
self.link_or_cc_arg(if verbatim { String::from(name) } else { format!("-l{name}") });
16611661
}
16621662

16631663
fn link_dylib_by_path(&mut self, path: &Path, _as_needed: bool) {
@@ -1668,7 +1668,7 @@ impl<'a> Linker for AixLinker<'a> {
16681668
fn link_staticlib_by_name(&mut self, name: &str, verbatim: bool, whole_archive: bool) {
16691669
self.hint_static();
16701670
if !whole_archive {
1671-
self.link_or_cc_arg(format!("-l{name}"));
1671+
self.link_or_cc_arg(if verbatim { String::from(name) } else { format!("-l{name}") });
16721672
} else {
16731673
let mut arg = OsString::from("-bkeepfile:");
16741674
arg.push(find_native_static_library(name, verbatim, self.sess));

compiler/rustc_hir_analysis/src/check/always_applicable.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ pub(crate) fn check_negative_auto_trait_impl<'tcx>(
124124
// be implemented here to handle non-ADT rigid types.
125125
Ok(())
126126
} else {
127-
span_bug!(tcx.def_span(impl_def_id), "incoherent impl of negative auto trait");
127+
Err(tcx.dcx().span_delayed_bug(
128+
tcx.def_span(impl_def_id),
129+
"incoherent impl of negative auto trait",
130+
))
128131
}
129132
}
130133
}

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,12 @@ extern "C" LLVMContextRef LLVMRustContextCreate(bool shouldDiscardNames) {
152152
}
153153

154154
extern "C" void LLVMRustSetNormalizedTarget(LLVMModuleRef M,
155-
const char *Triple) {
156-
unwrap(M)->setTargetTriple(Triple::normalize(Triple));
155+
const char *Target) {
156+
#if LLVM_VERSION_GE(21, 0)
157+
unwrap(M)->setTargetTriple(Triple(Triple::normalize(Target)));
158+
#else
159+
unwrap(M)->setTargetTriple(Triple::normalize(Target));
160+
#endif
157161
}
158162

159163
extern "C" void LLVMRustPrintPassTimings(RustStringRef OutBuf) {

compiler/rustc_span/src/edition.rs

+27-2
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,27 @@ pub enum Edition {
2323
Edition2021,
2424
/// The 2024 edition
2525
Edition2024,
26+
/// The future edition - this variant will always exist and features associated with this
27+
/// edition can be moved to the next 20XX edition when it is established and it is confirmed
28+
/// that those features will be part of that edition.
29+
///
30+
/// This variant allows edition changes to be implemented before being assigned to a concrete
31+
/// edition - primarily when there are two different unstable behaviours that need tested across
32+
/// an edition boundary.
33+
///
34+
/// This edition will be permanently unstable and any features associated with this edition
35+
/// must also be behind a feature gate.
36+
EditionFuture,
2637
}
2738

2839
// Must be in order from oldest to newest.
29-
pub const ALL_EDITIONS: &[Edition] =
30-
&[Edition::Edition2015, Edition::Edition2018, Edition::Edition2021, Edition::Edition2024];
40+
pub const ALL_EDITIONS: &[Edition] = &[
41+
Edition::Edition2015,
42+
Edition::Edition2018,
43+
Edition::Edition2021,
44+
Edition::Edition2024,
45+
Edition::EditionFuture,
46+
];
3147

3248
pub const EDITION_NAME_LIST: &str = "2015|2018|2021|2024";
3349

@@ -42,6 +58,7 @@ impl fmt::Display for Edition {
4258
Edition::Edition2018 => "2018",
4359
Edition::Edition2021 => "2021",
4460
Edition::Edition2024 => "2024",
61+
Edition::EditionFuture => "future",
4562
};
4663
write!(f, "{s}")
4764
}
@@ -54,6 +71,7 @@ impl Edition {
5471
Edition::Edition2018 => "rust_2018_compatibility",
5572
Edition::Edition2021 => "rust_2021_compatibility",
5673
Edition::Edition2024 => "rust_2024_compatibility",
74+
Edition::EditionFuture => "edition_future_compatibility",
5775
}
5876
}
5977

@@ -63,6 +81,7 @@ impl Edition {
6381
Edition::Edition2018 => true,
6482
Edition::Edition2021 => true,
6583
Edition::Edition2024 => true,
84+
Edition::EditionFuture => false,
6685
}
6786
}
6887

@@ -85,6 +104,11 @@ impl Edition {
85104
pub fn at_least_rust_2024(self) -> bool {
86105
self >= Edition::Edition2024
87106
}
107+
108+
/// Are we allowed to use features from the future edition?
109+
pub fn at_least_edition_future(self) -> bool {
110+
self >= Edition::EditionFuture
111+
}
88112
}
89113

90114
impl FromStr for Edition {
@@ -95,6 +119,7 @@ impl FromStr for Edition {
95119
"2018" => Ok(Edition::Edition2018),
96120
"2021" => Ok(Edition::Edition2021),
97121
"2024" => Ok(Edition::Edition2024),
122+
"future" => Ok(Edition::EditionFuture),
98123
_ => Err(()),
99124
}
100125
}

compiler/rustc_span/src/symbol.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1718,6 +1718,7 @@ symbols! {
17181718
rust_cold_cc,
17191719
rust_eh_catch_typeinfo,
17201720
rust_eh_personality,
1721+
rust_future,
17211722
rust_logo,
17221723
rust_out,
17231724
rustc,

compiler/rustc_target/src/callconv/mod.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ mod sparc64;
3131
mod wasm;
3232
mod x86;
3333
mod x86_64;
34+
mod x86_win32;
3435
mod x86_win64;
3536
mod xtensa;
3637

@@ -649,7 +650,11 @@ impl<'a, Ty> FnAbi<'a, Ty> {
649650
};
650651
let reg_struct_return = cx.x86_abi_opt().reg_struct_return;
651652
let opts = x86::X86Options { flavor, regparm, reg_struct_return };
652-
x86::compute_abi_info(cx, self, opts);
653+
if spec.is_like_msvc {
654+
x86_win32::compute_abi_info(cx, self, opts);
655+
} else {
656+
x86::compute_abi_info(cx, self, opts);
657+
}
653658
}
654659
"x86_64" => match abi {
655660
ExternAbi::SysV64 { .. } => x86_64::compute_abi_info(cx, self),

compiler/rustc_target/src/callconv/x86.rs

+2-22
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ where
3636
if t.abi_return_struct_as_int || opts.reg_struct_return {
3737
// According to Clang, everyone but MSVC returns single-element
3838
// float aggregates directly in a floating-point register.
39-
if !t.is_like_msvc && fn_abi.ret.layout.is_single_fp_element(cx) {
39+
if fn_abi.ret.layout.is_single_fp_element(cx) {
4040
match fn_abi.ret.layout.size.bytes() {
4141
4 => fn_abi.ret.cast_to(Reg::f32()),
4242
8 => fn_abi.ret.cast_to(Reg::f64()),
@@ -64,31 +64,11 @@ where
6464
continue;
6565
}
6666

67-
// FIXME: MSVC 2015+ will pass the first 3 vector arguments in [XYZ]MM0-2
68-
// See https://reviews.llvm.org/D72114 for Clang behavior
69-
7067
let t = cx.target_spec();
7168
let align_4 = Align::from_bytes(4).unwrap();
7269
let align_16 = Align::from_bytes(16).unwrap();
7370

74-
if t.is_like_msvc
75-
&& arg.layout.is_adt()
76-
&& let Some(max_repr_align) = arg.layout.max_repr_align
77-
&& max_repr_align > align_4
78-
{
79-
// MSVC has special rules for overaligned arguments: https://reviews.llvm.org/D72114.
80-
// Summarized here:
81-
// - Arguments with _requested_ alignment > 4 are passed indirectly.
82-
// - For backwards compatibility, arguments with natural alignment > 4 are still passed
83-
// on stack (via `byval`). For example, this includes `double`, `int64_t`,
84-
// and structs containing them, provided they lack an explicit alignment attribute.
85-
assert!(
86-
arg.layout.align.abi >= max_repr_align,
87-
"abi alignment {:?} less than requested alignment {max_repr_align:?}",
88-
arg.layout.align.abi,
89-
);
90-
arg.make_indirect();
91-
} else if arg.layout.is_aggregate() {
71+
if arg.layout.is_aggregate() {
9272
// We need to compute the alignment of the `byval` argument. The rules can be found in
9373
// `X86_32ABIInfo::getTypeStackAlignInBytes` in Clang's `TargetInfo.cpp`. Summarized
9474
// here, they are:

0 commit comments

Comments
 (0)