Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 06306c0

Browse files
committed
Auto merge of rust-lang#138071 - jieyouxu:rollup-a19djgi, r=jieyouxu
Rollup of 29 pull requests Successful merges: - rust-lang#135733 (Implement `&pin const self` and `&pin mut self` sugars) - rust-lang#137107 (Override default `Write` methods for cursor-like types) - rust-lang#137303 (Remove `MaybeForgetReturn` suggestion) - rust-lang#137327 (Undeprecate env::home_dir) - rust-lang#137358 (Match Ergonomics 2024: add context and examples to the unstable book) - rust-lang#137534 ([rustdoc] hide item that is not marked as doc(inline) and whose src is doc(hidden)) - rust-lang#137565 (Try to point of macro expansion from resolver and method errors if it involves macro var) - rust-lang#137612 (Update bootstrap to edition 2024) - rust-lang#137637 (Check dyn flavor before registering upcast goal on wide pointer cast in MIR typeck) - rust-lang#137643 (Add DWARF test case for non-C-like `repr128` enums) - rust-lang#137685 (self-contained linker: conservatively default to `-znostart-stop-gc` on x64 linux) - rust-lang#137744 (Re-add `Clone`-derive on `Thir`) - rust-lang#137758 (fix usage of ty decl macro fragments in attributes) - rust-lang#137764 (Ensure that negative auto impls are always applicable) - rust-lang#137772 (Fix char count in `Display` for `ByteStr`) - rust-lang#137798 (ci: use ubuntu 24 on arm large runner) - rust-lang#137802 (miri native-call support: all previously exposed provenance is accessible to the callee) - rust-lang#137805 (adjust Layout debug printing to match the internal field name) - rust-lang#137808 (Do not require that unsafe fields lack drop glue) - rust-lang#137820 (Clarify why InhabitedPredicate::instantiate_opt exists) - rust-lang#137825 (Provide more context on resolve error caused from incorrect RTN) - rust-lang#137827 (Add timestamp to unstable feature usage metrics) - rust-lang#137832 (Fix crash in BufReader::peek()) - rust-lang#137910 (Improve error message for `AsyncFn` trait failure for RPIT) - rust-lang#137920 (interpret/provenance_map: consistently use range_is_empty) - rust-lang#138038 (Update `compiler-builtins` to 0.1.151) - rust-lang#138046 (trim channel value in `get_closest_merge_commit`) - rust-lang#138052 (strip `-Wlinker-messages` wrappers from `rust-lld` rmake test) - rust-lang#138053 (Increase the max. custom try jobs requested to `20`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 30f168e + 1c22311 commit 06306c0

File tree

144 files changed

+2018
-867
lines changed

Some content is hidden

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

144 files changed

+2018
-867
lines changed

compiler/rustc_abi/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1812,7 +1812,7 @@ where
18121812
f.debug_struct("Layout")
18131813
.field("size", size)
18141814
.field("align", align)
1815-
.field("abi", backend_repr)
1815+
.field("backend_repr", backend_repr)
18161816
.field("fields", fields)
18171817
.field("largest_niche", largest_niche)
18181818
.field("uninhabited", uninhabited)

compiler/rustc_ast/src/ast.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2641,6 +2641,8 @@ pub enum SelfKind {
26412641
Value(Mutability),
26422642
/// `&'lt self`, `&'lt mut self`
26432643
Region(Option<Lifetime>, Mutability),
2644+
/// `&'lt pin const self`, `&'lt pin mut self`
2645+
Pinned(Option<Lifetime>, Mutability),
26442646
/// `self: TYPE`, `mut self: TYPE`
26452647
Explicit(P<Ty>, Mutability),
26462648
}
@@ -2650,6 +2652,8 @@ impl SelfKind {
26502652
match self {
26512653
SelfKind::Region(None, mutbl) => mutbl.ref_prefix_str().to_string(),
26522654
SelfKind::Region(Some(lt), mutbl) => format!("&{lt} {}", mutbl.prefix_str()),
2655+
SelfKind::Pinned(None, mutbl) => format!("&pin {}", mutbl.ptr_str()),
2656+
SelfKind::Pinned(Some(lt), mutbl) => format!("&{lt} pin {}", mutbl.ptr_str()),
26532657
SelfKind::Value(_) | SelfKind::Explicit(_, _) => {
26542658
unreachable!("if we had an explicit self, we wouldn't be here")
26552659
}
@@ -2666,11 +2670,13 @@ impl Param {
26662670
if ident.name == kw::SelfLower {
26672671
return match self.ty.kind {
26682672
TyKind::ImplicitSelf => Some(respan(self.pat.span, SelfKind::Value(mutbl))),
2669-
TyKind::Ref(lt, MutTy { ref ty, mutbl })
2670-
| TyKind::PinnedRef(lt, MutTy { ref ty, mutbl })
2673+
TyKind::Ref(lt, MutTy { ref ty, mutbl }) if ty.kind.is_implicit_self() => {
2674+
Some(respan(self.pat.span, SelfKind::Region(lt, mutbl)))
2675+
}
2676+
TyKind::PinnedRef(lt, MutTy { ref ty, mutbl })
26712677
if ty.kind.is_implicit_self() =>
26722678
{
2673-
Some(respan(self.pat.span, SelfKind::Region(lt, mutbl)))
2679+
Some(respan(self.pat.span, SelfKind::Pinned(lt, mutbl)))
26742680
}
26752681
_ => Some(respan(
26762682
self.pat.span.to(self.ty.span),
@@ -2712,6 +2718,15 @@ impl Param {
27122718
tokens: None,
27132719
}),
27142720
),
2721+
SelfKind::Pinned(lt, mutbl) => (
2722+
mutbl,
2723+
P(Ty {
2724+
id: DUMMY_NODE_ID,
2725+
kind: TyKind::PinnedRef(lt, MutTy { ty: infer_ty, mutbl }),
2726+
span,
2727+
tokens: None,
2728+
}),
2729+
),
27152730
};
27162731
Param {
27172732
attrs,

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
926926
if let Some(first_char) = constraint.ident.as_str().chars().next()
927927
&& first_char.is_ascii_lowercase()
928928
{
929-
tracing::info!(?data, ?data.inputs);
930929
let err = match (&data.inputs[..], &data.output) {
931930
([_, ..], FnRetTy::Default(_)) => {
932931
errors::BadReturnTypeNotation::Inputs { span: data.inputs_span }

compiler/rustc_ast_lowering/src/path.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
268268
}
269269
GenericArgs::Parenthesized(data) => match generic_args_mode {
270270
GenericArgsMode::ReturnTypeNotation => {
271-
tracing::info!(?data, ?data.inputs);
272271
let err = match (&data.inputs[..], &data.output) {
273272
([_, ..], FnRetTy::Default(_)) => {
274273
BadReturnTypeNotation::Inputs { span: data.inputs_span }

compiler/rustc_ast_pretty/src/pprust/state.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,6 +1783,13 @@ impl<'a> State<'a> {
17831783
self.print_mutability(*m, false);
17841784
self.word("self")
17851785
}
1786+
SelfKind::Pinned(lt, m) => {
1787+
self.word("&");
1788+
self.print_opt_lifetime(lt);
1789+
self.word("pin ");
1790+
self.print_mutability(*m, true);
1791+
self.word("self")
1792+
}
17861793
SelfKind::Explicit(typ, m) => {
17871794
self.print_mutability(*m, false);
17881795
self.word("self");

compiler/rustc_attr_parsing/src/parser.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,15 @@ impl<'a> MetaItemListParserContext<'a> {
473473
{
474474
self.inside_delimiters.next();
475475
return Some(MetaItemOrLitParser::Lit(lit));
476+
} else if let Some(TokenTree::Delimited(.., Delimiter::Invisible(_), inner_tokens)) =
477+
self.inside_delimiters.peek()
478+
{
479+
self.inside_delimiters.next();
480+
return MetaItemListParserContext {
481+
inside_delimiters: inner_tokens.iter().peekable(),
482+
dcx: self.dcx,
483+
}
484+
.next();
476485
}
477486

478487
// or a path.

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2120,8 +2120,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
21202120
//
21212121
// Note that other checks (such as denying `dyn Send` -> `dyn
21222122
// Debug`) are in `rustc_hir_typeck`.
2123-
if let ty::Dynamic(src_tty, _src_lt, _) = *src_tail.kind()
2124-
&& let ty::Dynamic(dst_tty, dst_lt, _) = *dst_tail.kind()
2123+
if let ty::Dynamic(src_tty, _src_lt, ty::Dyn) = *src_tail.kind()
2124+
&& let ty::Dynamic(dst_tty, dst_lt, ty::Dyn) = *dst_tail.kind()
21252125
&& src_tty.principal().is_some()
21262126
&& dst_tty.principal().is_some()
21272127
{

compiler/rustc_codegen_cranelift/patches/0029-stdlib-Disable-f16-and-f128-in-compiler-builtins.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ index 7165c3e48af..968552ad435 100644
1616

1717
[dependencies]
1818
core = { path = "../core", public = true }
19-
-compiler_builtins = { version = "=0.1.150", features = ['rustc-dep-of-std'] }
20-
+compiler_builtins = { version = "=0.1.150", features = ['rustc-dep-of-std', 'no-f16-f128'] }
19+
-compiler_builtins = { version = "=0.1.151", features = ['rustc-dep-of-std'] }
20+
+compiler_builtins = { version = "=0.1.151", features = ['rustc-dep-of-std', 'no-f16-f128'] }
2121

2222
[dev-dependencies]
2323
rand = { version = "0.8.5", default-features = false, features = ["alloc"] }

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3382,6 +3382,35 @@ fn add_lld_args(
33823382
// this, `wasm-component-ld`, which is overridden if this option is passed.
33833383
if !sess.target.is_like_wasm {
33843384
cmd.cc_arg("-fuse-ld=lld");
3385+
3386+
// On ELF platforms like at least x64 linux, GNU ld and LLD have opposite defaults on some
3387+
// section garbage-collection features. For example, the somewhat popular `linkme` crate and
3388+
// its dependents rely in practice on this difference: when using lld, they need `-z
3389+
// nostart-stop-gc` to prevent encapsulation symbols and sections from being
3390+
// garbage-collected.
3391+
//
3392+
// More information about all this can be found in:
3393+
// - https://maskray.me/blog/2021-01-31-metadata-sections-comdat-and-shf-link-order
3394+
// - https://lld.llvm.org/ELF/start-stop-gc
3395+
//
3396+
// So when using lld, we restore, for now, the traditional behavior to help migration, but
3397+
// will remove it in the future.
3398+
// Since this only disables an optimization, it shouldn't create issues, but is in theory
3399+
// slightly suboptimal. However, it:
3400+
// - doesn't have any visible impact on our benchmarks
3401+
// - reduces the need to disable lld for the crates that depend on this
3402+
//
3403+
// Note that lld can detect some cases where this difference is relied on, and emits a
3404+
// dedicated error to add this link arg. We could make use of this error to emit an FCW. As
3405+
// of writing this, we don't do it, because lld is already enabled by default on nightly
3406+
// without this mitigation: no working project would see the FCW, so we do this to help
3407+
// stabilization.
3408+
//
3409+
// FIXME: emit an FCW if linking fails due its absence, and then remove this link-arg in the
3410+
// future.
3411+
if sess.target.llvm_target == "x86_64-unknown-linux-gnu" {
3412+
cmd.link_arg("-znostart-stop-gc");
3413+
}
33853414
}
33863415

33873416
if !flavor.is_gnu() {

compiler/rustc_const_eval/src/interpret/memory.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -955,18 +955,13 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
955955

956956
/// Handle the effect an FFI call might have on the state of allocations.
957957
/// This overapproximates the modifications which external code might make to memory:
958-
/// We set all reachable allocations as initialized, mark all provenances as exposed
958+
/// We set all reachable allocations as initialized, mark all reachable provenances as exposed
959959
/// and overwrite them with `Provenance::WILDCARD`.
960-
pub fn prepare_for_native_call(
961-
&mut self,
962-
id: AllocId,
963-
initial_prov: M::Provenance,
964-
) -> InterpResult<'tcx> {
965-
// Expose provenance of the root allocation.
966-
M::expose_provenance(self, initial_prov)?;
967-
960+
///
961+
/// The allocations in `ids` are assumed to be already exposed.
962+
pub fn prepare_for_native_call(&mut self, ids: Vec<AllocId>) -> InterpResult<'tcx> {
968963
let mut done = FxHashSet::default();
969-
let mut todo = vec![id];
964+
let mut todo = ids;
970965
while let Some(id) = todo.pop() {
971966
if !done.insert(id) {
972967
// We already saw this allocation before, don't process it again.

0 commit comments

Comments
 (0)