Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 30918eb

Browse files
committedMar 3, 2025
Auto merge of rust-lang#137918 - matthiaskrgr:rollup-7rozmxw, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - rust-lang#132388 (Implement `#[cfg]` in `where` clauses) - rust-lang#134900 (Fix parsing of ranges after unary operators) - rust-lang#136938 (Remove `:` from `stack-protector-heuristics-effect.rs` Filecheck Pattern) - rust-lang#137054 (Make phantom variance markers transparent) - rust-lang#137525 (Simplify parallelization in test-float-parse) - rust-lang#137618 (Skip `tidy` in pre-push hook if the user is deleting a remote branch) - rust-lang#137685 (self-contained linker: conservatively default to `-znostart-stop-gc`) - rust-lang#137741 (Stop using `hash_raw_entry` in `CodegenCx::const_str`) - rust-lang#137849 (Revert "Remove Win SDK 10.0.26100.0 from CI") - rust-lang#137862 (ensure we always print all --print options in help) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 81d8edc + 5f3394b commit 30918eb

File tree

60 files changed

+3632
-410
lines changed

Some content is hidden

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

60 files changed

+3632
-410
lines changed
 

‎compiler/rustc_codegen_ssa/src/back/link.rs

+26
Original file line numberDiff line numberDiff line change
@@ -3438,6 +3438,32 @@ fn add_lld_args(
34383438
// this, `wasm-component-ld`, which is overridden if this option is passed.
34393439
if !sess.target.is_like_wasm {
34403440
cmd.cc_arg("-fuse-ld=lld");
3441+
3442+
// GNU ld and LLD have opposite defaults on some section garbage-collection features. For
3443+
// example, the somewhat popular `linkme` crate and its dependents rely in practice on this
3444+
// difference: when using lld, they need `-z nostart-stop-gc` to prevent encapsulation
3445+
// symbols and sections from being garbage-collected.
3446+
//
3447+
// More information about all this can be found in:
3448+
// - https://maskray.me/blog/2021-01-31-metadata-sections-comdat-and-shf-link-order
3449+
// - https://lld.llvm.org/ELF/start-stop-gc
3450+
//
3451+
// So when using lld, we restore, for now, the traditional behavior to help migration, but
3452+
// will remove it in the future.
3453+
// Since this only disables an optimization, it shouldn't create issues, but is in theory
3454+
// slightly suboptimal. However, it:
3455+
// - doesn't have any visible impact on our benchmarks
3456+
// - reduces the need to disable lld for the crates that depend on this
3457+
//
3458+
// Note that lld can detect some cases where this difference is relied on, and emits a
3459+
// dedicated error to add this link arg. We could make use of this error to emit an FCW. As
3460+
// of writing this, we don't do it, because lld is already enabled by default on nightly
3461+
// without this mitigation: no working project would see the FCW, so we do this to help
3462+
// stabilization.
3463+
//
3464+
// FIXME: emit an FCW if linking fails due its absence, and then remove this link-arg in the
3465+
// future.
3466+
cmd.link_arg("-znostart-stop-gc");
34413467
}
34423468

34433469
if !flavor.is_gnu() {

‎compiler/rustc_expand/src/base.rs

+16
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ pub enum Annotatable {
5353
Param(ast::Param),
5454
FieldDef(ast::FieldDef),
5555
Variant(ast::Variant),
56+
WherePredicate(ast::WherePredicate),
5657
Crate(ast::Crate),
5758
}
5859

@@ -71,6 +72,7 @@ impl Annotatable {
7172
Annotatable::Param(p) => p.span,
7273
Annotatable::FieldDef(sf) => sf.span,
7374
Annotatable::Variant(v) => v.span,
75+
Annotatable::WherePredicate(wp) => wp.span,
7476
Annotatable::Crate(c) => c.spans.inner_span,
7577
}
7678
}
@@ -89,6 +91,7 @@ impl Annotatable {
8991
Annotatable::Param(p) => p.visit_attrs(f),
9092
Annotatable::FieldDef(sf) => sf.visit_attrs(f),
9193
Annotatable::Variant(v) => v.visit_attrs(f),
94+
Annotatable::WherePredicate(wp) => wp.visit_attrs(f),
9295
Annotatable::Crate(c) => c.visit_attrs(f),
9396
}
9497
}
@@ -107,6 +110,7 @@ impl Annotatable {
107110
Annotatable::Param(p) => visitor.visit_param(p),
108111
Annotatable::FieldDef(sf) => visitor.visit_field_def(sf),
109112
Annotatable::Variant(v) => visitor.visit_variant(v),
113+
Annotatable::WherePredicate(wp) => visitor.visit_where_predicate(wp),
110114
Annotatable::Crate(c) => visitor.visit_crate(c),
111115
}
112116
}
@@ -128,6 +132,7 @@ impl Annotatable {
128132
| Annotatable::Param(..)
129133
| Annotatable::FieldDef(..)
130134
| Annotatable::Variant(..)
135+
| Annotatable::WherePredicate(..)
131136
| Annotatable::Crate(..) => panic!("unexpected annotatable"),
132137
}
133138
}
@@ -223,6 +228,13 @@ impl Annotatable {
223228
}
224229
}
225230

231+
pub fn expect_where_predicate(self) -> ast::WherePredicate {
232+
match self {
233+
Annotatable::WherePredicate(wp) => wp,
234+
_ => panic!("expected where predicate"),
235+
}
236+
}
237+
226238
pub fn expect_crate(self) -> ast::Crate {
227239
match self {
228240
Annotatable::Crate(krate) => krate,
@@ -446,6 +458,10 @@ pub trait MacResult {
446458
None
447459
}
448460

461+
fn make_where_predicates(self: Box<Self>) -> Option<SmallVec<[ast::WherePredicate; 1]>> {
462+
None
463+
}
464+
449465
fn make_crate(self: Box<Self>) -> Option<ast::Crate> {
450466
// Fn-like macros cannot produce a crate.
451467
unreachable!()
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.