Rustc pull update#22663
Merged
Merged
Conversation
Specify target list for `#[export_stable]` Work towards removing the `ALL_TARGETS` list. r? @mejrs
remove AliasTy::def_id() this is part of rust-lang/rust#156181 as well as part of rust-lang/rust#152245 this immediately uses [the recently-introduced `Alias<>` type](rust-lang/rust#156538) to narrow the kinds of aliases allowed in various places in code fyi @lcnr r? @BoxyUwU
`rust-analyzer` subtree update Subtree update of `rust-analyzer` to ff5fcc7. Created using https://github.com/rust-lang/josh-sync. r? @ghost
Stop excluding `stdarch` test crates from `rust-src` In the past, this exclusion saved 30MB of heavy intrinsics data from ending up in `rust-src`. However, this filter has been outdated since rust-lang/stdarch#1894, which moved the data to `library/stdarch/intrinsics_data`. These intrinsics have also shrunk since then, and now sit around 12MB (300KB when compressed). So this specific change only adds a few KBs: | `rust-src` | compressed | unpacked | | ---------- | ---------- | -------- | | before | 8.01 MB | 76.5 MB | | after | 8.06 MB | 76.9 MB | The motivation for this change would be simplifying integration of the `stdarch` test suite into `cg_clif`. For completeness, if we instead fixed the filter to point to the new data location, we'd shrink the dist to: | `rust-src` | compressed | unpacked | | ---------- | ---------- | -------- | | filtered | 7.64 MB | 64.7 MB | cc @bjorn3
…r=Amanieu Add temporary scope to assert_eq and assert_ne This is a follow-up to rust-lang/rust#155431
…pan, r=BoxyUwU Fix misattributed type inference error span for index expressions If `arr[idx.into()]` appears inside a cast or binary op, the type inference error gets blamed on the wrong expression. **Before:** - `[1, 2, 3][bad_idx.into()] as i32` → error points at `[1, 2, 3][bad_idx.into()]` (the whole indexing expr) - `0 + [1, 2, 3][bad_idx.into()]` → error points at `+` **After:** - Both cases point at `.into()`, which is where the ambiguity actually is. In `cast.rs`, before resolving the cast expression type, we check if it's an index with an unresolved index type. If so, resolve the index sub-expression first at its own span so the error lands there. If that already errored, skip the broader resolution to avoid duplicates. In `op.rs`, after writing the method call for an overloaded binary op, if the return type still has inference variables and the RHS is an index expression, force resolution of the index type at its span. Fixes rust-lang/rust#156738 r? compiler
simplify some `proc_macro` things Each commit should be reviewable on its own. Locally, this also resulted in some slightly better perf results.
move rustc_type_ir Term things to term_kind.rs - `TyKind`, `AliasTy`, and `AliasTyKind` live in `ty_kind.rs` - `ConstKind`, [`UnevaluatedConst`, and `UnevaluatedConstKind`](rust-lang/project-const-generics#115) live in `const_kind.rs` - `TermKind`, `AliasTerm`, and `AliasTermKind` live in... `generic_arg.rs` and `predicate.rs` ??? create a new file, `term_kind.rs`, that holds `TermKind`, `AliasTerm`, and `AliasTermKind` (note that `Ty`, `Const`, and `Term` live in `rustc_middle`, not `rustc_type_ir`)
…nt-ty-privacy-vist, r=BoxyUwU Remove strict invariant node_type on hir_type during ty privacy visit closes: rust-lang/rust#157772 r? @BoxyUwU
…eholder-ice, r=BoxyUwU trait solver: Resolve region vars in max universe Fixes rust-lang/rust#157862 The ICE comes from computing the max universe of a region constraint after a region var has already been unified with something else. In that state, asking universe_of_lt directly can hit None and panic. This makes the region visitor opportunistically resolve ReVars first, then inspect the resolved region. Type and const infer vars stay as-is because this path already bails on non-region inference before it needs more structure from them.
…petrochenkov
delegation: add support for infers in generics
This PR adds support for generating generic params for lifetimes and types/consts infers (`'_`. `_`). We support only single infers, if they are nested then we do nothing and eventually an error will be emitted after inheriting this unsound signature (i.e., `reuse foo::<Vec<_>>` is not supported).
The basic idea is:
```rust
fn foo<'a, 'b: 'b, T, const N: usize>() {}
reuse foo::<'_, String, _> as bar;
// Desugaring:
fn bar<'b, const N: usize>() {
foo::<'b, String, N>()
}
```
So we generated params and lifetimes for provided infers. Note that in case of lifetimes we may have early and late bound lifetimes in child segment. We process only early-bound lifetimes as they are present in signature function generics (`tcx.generics_of(sig_id)`). Moreover since this PR we started to explicitly propagate early-bound lifetimes in generated delegation's call, so the warning about specifying lifetimes when late-bound lifetimes are present is suppressed for delegation segments.
Next, we limit the number of processed infers with the number of generic params in the signature function, so if we have `fn foo<X, Y>() {}` and we wrote `reuse foo::<_, _, _, _>;` we will not generate 4 generic params in delegation, we will generate 2 (`X` and `Y`), two remaining infers will not be processed and this will result in an error.
Considering free-to-trait reuses this PR extends the number of supported cases, as now we always generate `Self` generic param when needed:
```rust
trait Trait<'a, X> {
fn method<'b, const M: usize>(&self) where 'b:'b { }
fn r#static<'b, Y, const B: bool>() { }
}
impl <'a, X> Trait<'a, X> for () { }
reuse Trait::<'_, _>::method::<'_, _> as foo;
reuse <_ as Trait<'_, _>>::method::<'_, _> as foo1;
reuse <() as Trait<'_, _>>::method::<'_, _> as foo2;
reuse <_ as Trait<'_, _>>::r#static::<_, _> as foo3;
reuse <() as Trait<'_, _>>::r#static::<_, _> as foo4;
reuse Trait::<'_, _>::r#static::<_, _> as foo5;
// Desugaring:
#[attr = Inline(Hint)]
fn foo<'a, 'b, Self, X, const M: _>(self: _) -> _ where 'a:'a,
'b:'b { <Self as Trait::<'a, X>>::method::<'b, M>(self) }
#[attr = Inline(Hint)]
fn foo1<'a, 'b, Self, X, const M: _>(self: _) -> _ where 'a:'a,
'b:'b { <Self as Trait::<'a, X>>::method::<'b, M>(self) }
#[attr = Inline(Hint)]
fn foo2<'a, 'b, X, const M: _>(self: _) -> _ where 'a:'a,
'b:'b { <() as Trait::<'a, X>>::method::<'b, M>(self) }
#[attr = Inline(Hint)]
fn foo3<'a, Self, X, Y, const B: _>() -> _ where
'a:'a { <Self as Trait::<'a, X>>::r#static::<Y, B>() }
#[attr = Inline(Hint)]
fn foo4<'a, X, Y, const B: _>() -> _ where
'a:'a { <() as Trait::<'a, X>>::r#static::<Y, B>() }
#[attr = Inline(Hint)]
fn foo5<'a, Self, X, Y, const B: _>() -> _ where
'a:'a { <Self as Trait::<'a, X>>::r#static::<Y, B>() }
```
Note that we generated `Self` in `foo5` reuse. With that done the error about self-type specification is removed.
Finally this PR greatly simplifies generic args for signature inheritance generation code.
Part of rust-lang/rust#118212.
r? @petrochenkov
…iction, r=WaffleLapkin Lift the same-signature restriction for `extern "tail"` tracking issue: rust-lang/rust#157427 The `extern "tail"` calling convention uses callee cleanup (i.e. the callee restores the stack, not the caller). Hence, the same-signature restriction that is normally required to codegen tail calls does not apply. We need the ABI to deviate from `extern "Rust"` to make sure indirect arguments are passed by stack offset, not via a pointer into the caller's stack frame (the value would potentially be overwritten). For standard tail calls we work around this problem by storing the value in the caller's caller, but for `extern "tail"` that doesn't work reliably because the signatures can be different. I'm not sure about unsized arguments. That feature seems really broken, so I'm not sure how much work we should put into trying to do something reasonable there. Fundamentally I don't think we can support unsized arguments in `extern "tail"` calls. Also we can't really promote using this yet due to `tailcc` being a bit broken on LLVM 22 on x86_64. r? WaffleLapkin cc @bjorn3
Optimize network address parser
Motivated by working with datasets of IP addresses.
First commit adds more examples for each case in the benchmark suite.
Second commit splits `read_number()` into seperate methods for the the `max_digits` `Some(_)` and `None` cases, which by itself significantly helps code generation.
Hoist reading the first digit which is always required.
The path for unlimited digits then no longer has to count digits at all.
Drive-by "fixes" the 10 digit debug assertion (which would be insufficient in base 16). Not actually used anywhere near the limit.
`./x bench library/coretests --test-args addr_parser` before -> after on AMD Ryzen 9 9950X:
net::addr_parser::bench_parse_ipaddr_v4 81.73ns/iter +/- 0.60 -> 62.36ns/iter +/- 0.12
net::addr_parser::bench_parse_ipaddr_v6_compress 303.70ns/iter +/- 1.29 -> 212.80ns/iter +/- 1.25
net::addr_parser::bench_parse_ipaddr_v6_full 453.06ns/iter +/- 7.89 -> 294.88ns/iter +/- 0.91
net::addr_parser::bench_parse_ipaddr_v6_v4 301.41ns/iter +/- 1.52 -> 224.82ns/iter +/- 0.99
net::addr_parser::bench_parse_ipv4 87.24ns/iter +/- 0.32 -> 52.94ns/iter +/- 0.33
net::addr_parser::bench_parse_ipv6_compress 277.92ns/iter +/- 3.29 -> 195.98ns/iter +/- 1.10
net::addr_parser::bench_parse_ipv6_full 402.48ns/iter +/- 22.20 -> 276.37ns/iter +/- 4.05
net::addr_parser::bench_parse_ipv6_v4 276.78ns/iter +/- 1.18 -> 216.04ns/iter +/- 1.20
net::addr_parser::bench_parse_socket_v4 105.18ns/iter +/- 0.79 -> 69.20ns/iter +/- 0.46
net::addr_parser::bench_parse_socket_v6 378.69ns/iter +/- 5.25 -> 274.82ns/iter +/- 0.95
net::addr_parser::bench_parse_socket_v6_scope_id 336.61ns/iter +/- 2.36 -> 258.56ns/iter +/- 0.89
net::addr_parser::bench_parse_socketaddr_v4 118.20ns/iter +/- 0.66 -> 78.86ns/iter +/- 0.22
net::addr_parser::bench_parse_socketaddr_v6 429.17ns/iter +/- 5.70 -> 315.69ns/iter +/- 1.48
Extract all instance shim variants into new `ShimKind` enum They tend to have similar handling -- e.g., they should be the only input to the `mir_shims` query -- so it's cleaner to group them together. This will also make potential future refactorings easier, such as only carrying `GenericArgsRef` for instances that actually use it (e.g., `Item`) but not others (e.g., `CloneShim`). cc https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/moving.20ty.3A.3AInstance.2Eargs.20into.20ty.3A.3AInstanceKind.20variants r? @oli-obk
…chenkov Resolver: local/external split of `resolve_ident_in_module_non_globs_unadjusted` This PR splits the function `resolve_ident_in_module_non_globs_unadjusted` into 2 variants: - one for local modules, which is the same work as before - other for external modules, which requires less work In preperations for parallel import resolution and overall resolver refactor. r? @petrochenkov
Follow goto and drop when linting unreachable code Those drops and gotos are compiler-generated and do not correspond to user code. Skip them when looking for unreachable code to lint.
Move derive tests into their dedicated folder Hi, I've moved some derive tests into their dedicated folder. Part of rust-lang/rust#133895 @zedddie r? @Teapot4195
…time_binder_ambiguity, r=BoxyUwU don't ice on non-lifetime binders under `-Zassumptions-on-binders` fixes rust-lang/rust#157778 w/ `-Znext-solver=globally -Zassumptions-on-binders` and a non-lifetime binder we hit `assert!(max_universe < u)` in `pull_region_outlives_constraints_out_of_universe` and ICE. the machinery here is region-outlives only, but a `for<T>` binder leaves a placeholder type in universe `u` that the region-only rewrite can't pull out, so an alias outlives like `<!T as Trait>::Assoc: 'r` reaches that assert still in `u`. just report ambiguity in that case, same as the `None => Ambiguity` bails right next to it — now it errors normally (E0284) instead of ICEing. r? @lcnr
Reorganize `tests/ui/issues` [8/N] Part of [GSoC'26 project](https://rust-lang.zulipchat.com/#narrow/channel/421156-gsoc/topic/Project.3A.20Reorganizing.20tests.2Fui.2Fissues) r? Kivooeo @Teapot4195
…, r=Mark-Simulacrum Make `char::is_private_use` and `char::is_assigned` unstably public See also rust-lang/rust#157944, rust-lang/rust#154849. These functions are used in the implementation of `char::escape_debug()`, and there's no reason to force crates to duplicate data tables that std has to ship anyway. `is_assigned` is especially useful because crates relying on the stability guarantees of the other Unicode methods in `char` may wish to reject unassigned characters where those guarantees do not hold. I'll add a tracking issue if this is approved. The `is_assigned` vs `is_unassigned` bikeshed probably needs libs-API review before merging? @rustbot label A-Unicode T-libs-api r? @Mark-Simulacrum
Reorganize `tests/ui/issues` [9/N] Part of [GSoC'26 project](https://rust-lang.zulipchat.com/#narrow/channel/421156-gsoc/topic/Project.3A.20Reorganizing.20tests.2Fui.2Fissues) r? Kivooeo @Teapot4195
Update mingw-w64 C toolchain
c-variadic: test that we use equality up to free lifetimes tracking issue: rust-lang/rust#44930 Test that we use equality up to free lifetimes, and correctly consider `for<'a> &'a` to be different from `&'static`. I'm not sure if I'm missing any type subtleties here? Because it seems like the current implementation already has the behavior that we want. (and that `==` on `Ty` has this behavior). Also see rust-lang/rust#155697 (comment) and rust-lang/rust#155697 (comment). cc @theemathas r? RalfJung,lcnr
Reorganize `tests/ui/issues` [10/N] Part of [GSoC'26 project](https://rust-lang.zulipchat.com/#narrow/channel/421156-gsoc/topic/Project.3A.20Reorganizing.20tests.2Fui.2Fissues) r? Kivooeo @Teapot4195
…ic, r=TaKO8Ki format: ignore println newline in foreign format hints fixes rust-lang/rust#158216 `println!` adds a newline before the unused-arg diagnostic checks for printf-style formats. that made a trailing `%` look like `%` plus ` `, so rustc printed a weird unsupported conversion specifier note. imo the least risky fix is to leave normal format parsing alone and only strip that synthetic newline for the foreign-format hint scan. idk if there is much more to do here, the ui tests cover the reported case plus the older trailing-percent baselines. lgtm to me, ltm this keeps the behavior narrow.
Move target checking for #[lang] to the attribute parser Work towards removing the `ALL_TARGETS` list. r? @mejrs
Use `cfg_select` in `std::os` rust-lang/rust#81969 replaced `cgf_if` with bare `cfg`, but since `cfg_select` is now built in, it shouldn't pose a problem to rust-analyzer any more, so we should be able to go back to better code.
Only load the feature list once in the entire resolver I saw that a bunch of code in ast validation and other early logic just had the features query called once and stored the result. Let's see what the resolver does with that.
FromUtf8Error::into_utf8_lossy better example and suggest use This handles rust-lang/rust#129436 (comment) and refers to https://github.com/rust-lang/rust/pull/129439/changes#r1763510354 r? @tgross35
Reorganize `tests/ui/issues` [13/N] Part of [GSoC'26 project](https://rust-lang.zulipchat.com/#narrow/channel/421156-gsoc/topic/Project.3A.20Reorganizing.20tests.2Fui.2Fissues) r? Kivooeo @Teapot4195
Add arg splat experiment initial tuple impl ### Description This PR is part of the argument splatting lang experiment, and FFI overloading / C++ interop project goals: - rust-lang/rust#153629 - https://rust-lang.github.io/rust-project-goals/2026/overloading-for-ffi.html - https://rust-lang.github.io/rust-project-goals/2025h2/interop-problem-map.html Example code using existing unstable features: - https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=f42a3754a63a3d9365670e57257053d5 Discussion of implementation strategy: - [#t-lang > On overloading @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/On.20overloading/near/579590336) The PR is the initial implementation of the feature: - `splat` incomplete feature gate - `#[splat]` attribute on function arguments - Splatted function argument TypeInfo - `#[splat]` function parameter check at THIR level - splatted MIR lowering (as tupled arguments) - feature gate and UI tests for item type filtering, non-splattable arguments, splattable tuples, generics, and the "overloading at home" example - about half the diff (1100 lines) is tests and test output Once this PR merges, we can add further functionality, then test it out in interop tools. ### Perf Impact We expect a 0.1% regression on 5 primary and 0.2% regression on 4 secondary benchmarks in this PR, based on [this perf run](rust-lang/rust#158251 (comment)). We tried a number of different ways to improve perf. Limiting splat to the 255th or lower argument is a simple hack that gives good perf, and is good enough for an experiment. This PR series already has significant perf wins in rust-lang/rust#155223 - [0.3% perf improvement across 45 primary benchmarks](rust-lang/rust#155223 (comment)). We're spending a small amount of that perf for the new feature in this PR. ### Out of Scope for this PR - Change codegen to de-tuple caller and callee - Better diagnostics - Full support for splatted function pointer arguments
Various borrowck cleanups and param_env/opaque_types_defined_by query simplifications for typeck children Various things I noticed while figuring out how to best allow changing some borrowck errors into FCWs cc @rust-lang/types for the typeck children stuff, in case I missed some memo and am undoing some work r? @ghost need perf first
Use rigidness marker in fast_reject Make use of rigidness marker to reject rigid-alias-non-alias or incompatible rigid-alias-rigid-alias relating. r? lcnr
cg_LLVM: Stop needing an alloca for volatile loads This ended up also being reimplementing it to not use `load` of the `llvm_type`, since without doing that everything blew up horribly. cc the zulip conversation [#t-opsem > Defining volatile splitting @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/136281-t-opsem/topic/Defining.20volatile.20splitting/near/597451615). And while I'm here, improve the tests to check that the unaligned ones are actually unaligned, since `unaligned_volatile_load::<u8>` doesn't actually test anything. r? @nikic cc @RalfJung MCP tracking issue rust-lang/rust#153250
…yukang Suggest `>=` for `=>` typo in closure and call argument positions The parser suggests replacing `=>` with `>=` when it looks like a typo in a comparison, but it skipped the suggestion whenever a comma was an expected token. That excluded closure bodies used as call arguments, such as `iter.position(|x| x => &y)`, which is the case reported in rust-lang/rust#149805. The comma exclusion was there to avoid suggesting `>=` for a missing comma between match arms, where `=>` is a real arm arrow. Those cases have a close brace in the expected token set, while the comparison cases do not, so this gates on the close brace instead of the comma. The existing `if`/`let`/`match` cases keep working, and the missing-comma-in-match suggestion is unaffected. Fixes rust-lang/rust#149805
…001999 perf: Make stable_crate_ids reads lock-free after crate loading
…GuillaumeGomez,traviscross Attribute docs `deprecated` , `warn`, `allow`, `cfg`, `deny`, and `forbid` Added documentation for built-in `deprecated` , `warn`, `allow`, `cfg`, `deny`, and `forbid` attributes using the #[doc(attribute = "...")] mechanism. Part of rust-lang/rust#157604 @rustbot r? @GuillaumeGomez cc @fmease cc @mejrs
Fixup the refactoring errors in #156246 r? @lcnr
Move `check_ffi_pure` into the attribute parser Updates rust-lang/rust#153101 convert `FfiPureParser` to a full `AttributeParser` so its `finalize` can check for a sibling `#[ffi_const]` and reject `#[ffi_pure]` during attribute parsing, replacing `check_ffi_pure` in `rustc_passes`. r? @JonathanBrouwer
Add safety section for SliceIndex::get_unchecked(mut) This PR adds `# Safety` sections to the documentation for the unsafe `SliceIndex::get_unchecked` and `SliceIndex::get_unchecked_mut` trait methods. The existing documentation already described the undefined behavior conditions for out-of-bounds indices and dangling slice pointers. This change keeps that content unchanged, but moves it under the standard rustdoc `# Safety` heading expected for unsafe functions. No behavior changes.
std: truncate thread names on NetBSD NetBSD [enforces limits on the length of thread names](https://man.netbsd.org/pthread_setname_np.3#DESCRIPTION). On all similar platforms (e.g. Linux, macOS) we truncate the Rust name so that at least some of the name is visible in the OS. CC @semarie
…arksonn Eliminate double length check in `Vec::into_array` Linked issue: rust-lang/rust#148082 As an aside, has the question of whether `Vec::into_boxed_slice` and `RawVec::into_box` should be `#[inline]` been considered? That might allow length information to be retained and used for optimization.
…ons, r=Kivooeo Guard clone suggestion against empty obligation errors Fixes rust-lang/rust#148631
Update Enzyme submodule This fixes a cross-compilation bug in Enzyme (cc @sgasho), as well as a TypeAnalysis canonicalization bug I encountered during my TypeTree work. r? oli-obk
Cleanup `NumBuffer` comment and replace `ilog(10)` with `ilog10()` A [nice person from mastodon](https://toot.cat/@jamey/116815991086205506) pointed out that a `FIXME` comment should have been removed alongside the others in rust-lang/rust#157976, and also pointed out that the documentation mentions that `ilog10` is more optimized than `ilog(10)`. Shouldn't matter much here but since I already made a PR to remove the FIXME comment... r? @Amanieu
…uwer Rollup of 15 pull requests Successful merges: - rust-lang/rust#153697 (Add arg splat experiment initial tuple impl) - rust-lang/rust#158360 (Various borrowck cleanups and param_env/opaque_types_defined_by query simplifications for typeck children) - rust-lang/rust#158438 (Use rigidness marker in fast_reject) - rust-lang/rust#157127 (cg_LLVM: Stop needing an alloca for volatile loads) - rust-lang/rust#158376 (Suggest `>=` for `=>` typo in closure and call argument positions) - rust-lang/rust#158185 (perf: Make stable_crate_ids reads lock-free after crate loading) - rust-lang/rust#158244 (Attribute docs `deprecated` , `warn`, `allow`, `cfg`, `deny`, and `forbid` ) - rust-lang/rust#158355 (Fixup the refactoring errors in rust-lang/rust#156246) - rust-lang/rust#158361 (Move `check_ffi_pure` into the attribute parser) - rust-lang/rust#158382 (Add safety section for SliceIndex::get_unchecked(mut)) - rust-lang/rust#158399 (std: truncate thread names on NetBSD) - rust-lang/rust#158418 (Eliminate double length check in `Vec::into_array`) - rust-lang/rust#158430 (Guard clone suggestion against empty obligation errors) - rust-lang/rust#158446 (Update Enzyme submodule) - rust-lang/rust#158448 (Cleanup `NumBuffer` comment and replace `ilog(10)` with `ilog10()`)
Update cargo submodules 6 commits in a595d0da21f228b7fdae64d3d5c0e527ea66bb59..a335d47ff8036918d3d548dabd513dc0444096a9 2026-06-20 13:42:59 +0000 to 2026-06-26 20:39:41 +0000 - fix(diag): Remove sometimes-invalid removal suggestions (rust-lang/cargo#17139) - feat: Add `-Zhint-msrv` flag (rust-lang/cargo#17106) - fix: LockManager use OS-aware flock shim (rust-lang/cargo#17128) - fix: flaky test: sparse_blocking_count (rust-lang/cargo#17130) - Add Solaris fcntl file locking (rust-lang/cargo#17110) - fix(test): skip dwp uplift test without packed debuginfo (rust-lang/cargo#17127) r? ghost
…-to-aliasconst, r=BoxyUwU,khyperia Rename UnevaluatedConst to AliasConst refer: rust-lang/project-const-generics#115 r? @khyperia I only renamed the type system version to `AliasConst`/`AliasConstKind`. I did not rename MIR’s `UnevaluatedConst`, it currently holds direct def_id instead of kind variant we have in type-system. I also left `rustc_public`’s `UnevaluatedConst` unchanged.
std: fix xous dns ipv6 parsing off-by-one the ipv6 arm read the 16-byte address from offset+1 instead of offset, unlike the ipv4 arm. this mis-parsed every ipv6 result and let the slice reach offset+17 while the bounds check only guards offset+16, so a malformed dns response could index past the 4096-byte buffer and panic.
Move `std::io::Error` into `core` ACP: rust-lang/libs-team#755 Tracking issue: rust-lang/rust#154046 Related: rust-lang/rust#155574 Related: rust-lang/rust#152918 ## Description Moves `std::io::Error` into `core`, deferring `Box`-adjacent methods to incoherent implementations in `alloc`, and `RawOsError` methods to `std`. This requires some substantial changes to the internals of `Error`, but none of them are breaking changes or externally visible. Notably, I've replaced usage of `Box` with a wrapper around a pointer and an appropriate drop function. This requires the addition of quite a few lines of unsafe, but is required to work around `Box` only being accessible from `alloc`. Additionally, an atomic pointer to a VTable is used for working with `RawOsError` in `core`, since we cannot know the required implementations without `std`. As mention in [this comment](rust-lang/rust#155625 (comment)), there may be concern around having a static `AtomicPtr` in `core` for certain users. I've added a configuration option `no_io_statics` which (similar to `no_sync`/etc. in `alloc`) can be used to prevent their inclusion in `core`. When active, the fallback default implementation will always be used. --- ## Notes * This PR adopts the VTable technique from rust-lang/rust#152918 * This PR builds on my previous PR rust-lang/rust#155574 * No AI tooling of any kind was used during the creation of this PR.
This updates the rust-version file to 7fb284d9037fa54f6a9b24261c82b394472cbfd7.
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: rust-lang/rust@7fb284d Filtered ref: a5454c1 Upstream diff: rust-lang/rust@942ac9c...7fb284d This merge was created using https://github.com/rust-lang/josh-sync.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Latest update from rustc.