-
Notifications
You must be signed in to change notification settings - Fork 573
Rustc pull update #2735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Rustc pull update #2735
Conversation
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
…r=jieyouxu build-manifest: Add `rust-mingw` also as extension for "pc-windows-gnu" hosts. This should enable `rustup component add --target aarch64-pc-windows-gnullvm rust-mingw` when running an `x86_64-pc-windows-gnullvm` toolchain (and vice-versa). Which itself enables proper cross-compiling of Windows ARM64 binaries on a Windows x64 host without using commercial MSVC. CC @mati865
mGCA: Support array expression as direct const arguments tracking issue: rust-lang/rust#132980 resolve: rust-lang/rust#150612 Support array expression as direct const arguments (e. g. [1, 2, N]) in min_generic_const_args. todo: * [x] Rebase another mGCA PR * [x] Add more test case * [x] Modify clippy code
mGCA: Move tests for assoc const bindings (formerly ACE) into dedicated directory & replace more mentions of ACE Split out of PR rust-lang/rust#150843. As discussed. Somewhat obvious underlying principle: If the test checks basic or core parts of assoc const bindings and nothing else, move it, otherwise leave it even if it contains ACEs. Motivation: It makes a lot easier for me to continue working on ACE efficiently. r? @BoxyUwU
Destabilise `target-spec-json` Per rust-lang/compiler-team#944: > Per rust-lang/rust#71009, the ability to load target spec JSONs was stabilised accidentally. Within the team, we've always considered the format to be unstable and have changed it freely. This has been feasible as custom targets can only be used with core, like any other target, and so custom targets de-facto require nightly to be used (i.e. to build core manually or use Cargo's -Zbuild-std). > > Current build-std RFCs (rust-lang/rfcs#3873, rust-lang/rfcs#3874) propose a mechanism for building core on stable (at the request of Rust for Linux), which combined with a stable target-spec-json format, permit the current format to be used much more widely on stable toolchains. This would prevent us from improving the format - making it less tied to LLVM, switching to TOML, enabling keys in the spec to be stabilised individually, etc. > > De-stabilising the format gives us the opportunity to improve the format before it is too challenging to do so. Internal company toolchains and projects like Rust for Linux already use target-spec-json, but must use nightly at some point while doing so, so while it could be inconvenient for those users to destabilise this, it is hoped that an minimal alternative that we could choose to stabilise can be proposed relatively quickly.
Add `f16` inline ASM support for s390x tracking issue: rust-lang/rust#116909 cc rust-lang/rust#125398 Support the `f16x8` type in inline assembly. Only with the `nnp-assist` feature are there any instructions that make use of this type. Based on the riscv implementation I now cast to `i16x8` when that feature is not enabled. As far as I'm aware there are no instructions operating on `f16` scalar values. Should we still add support for using them in inline assembly? r? @tgross35 cc @uweigand
Improve span for "unresolved intra doc link" on `deprecated` attribute Follow-up of rust-lang/rust#150721. To make this work, I replaced the `Symbol` by an `Ident` to keep the `Span` information. cc @folkertdev r? @camelid
rustc-dev-guide subtree update Subtree update of `rustc-dev-guide` to e905666. Created using https://github.com/rust-lang/josh-sync. r? @ghost
fix: added missing backtick in triagebot.toml Adds the missing backtick (`) in triagebot.toml cc: @Urgau
…ouxu Don't suggest replacing closure parameter with type name When a closure has an inferred parameter type like `|ch|` and the expected type differs in borrowing (e.g., `char` vs `&char`), the suggestion would incorrectly propose `|char|` instead of something valid like `|ch: char|`. This happened because the code couldn't walk explicit `&` references in the HIR when the type is inferred, and fell back to replacing the entire parameter span with the expected type name. Fix by only emitting the suggestion when we can properly identify the `&` syntax to remove. Fixes rust-lang/rust#150693
…uwer Rollup of 14 pull requests Successful merges: - rust-lang/rust#150151 (Destabilise `target-spec-json`) - rust-lang/rust#150826 (Add `f16` inline ASM support for s390x) - rust-lang/rust#150883 (Improve span for "unresolved intra doc link" on `deprecated` attribute) - rust-lang/rust#150934 (Move some checks from `check_doc_attrs` directly into `rustc_attr_parsing`) - rust-lang/rust#150943 (Port `#[must_not_suspend]` to attribute parser) - rust-lang/rust#150990 (std: sys: net: uefi: Make TcpStream Send) - rust-lang/rust#150995 (core: ptr: split_at_mut: fix typo in safety doc) - rust-lang/rust#150998 (Relax test expectation for @__llvm_profile_runtime_user) - rust-lang/rust#151002 (Remove a workaround for a bug (take 2)) - rust-lang/rust#151005 (Fix typo in `MaybeUninit` docs) - rust-lang/rust#151011 (Update books) - rust-lang/rust#151029 (rustc-dev-guide subtree update) - rust-lang/rust#151032 (fix: added missing backtick in triagebot.toml) - rust-lang/rust#151035 (Don't suggest replacing closure parameter with type name) r? @ghost
…ros, r=petrochenkov Explicitly export core and std macros Currently all core and std macros are automatically added to the prelude via #[macro_use]. However a situation arose where we want to add a new macro `assert_matches` but don't want to pull it into the standard prelude for compatibility reasons. By explicitly exporting the macros found in the core and std crates we get to decide on a per macro basis and can later add them via the rust_20xx preludes. Closes rust-lang/rust#53977 Unlocks rust-lang/rust#137487 Reference PR: - rust-lang/reference#2077 # Stabilization report lib Everything N/A or already covered by lang report except, breaking changes: The unstable and never intended for public use `format_args_nl` macro is no longer publicly accessible as requested by @petrochenkov. Affects <10 crates including dependencies. # Stabilization report lang ## Summary Explicitly export core and std macros. This change if merged would change the code injected into user crates to no longer include #[macro_use] on extern crate core and extern crate std. This change is motivated by a near term goal and a longer term goal. The near term goal is to allow a macro to be defined at the std or core crate root but not have it be part of the implicit prelude. Such macros can then be separately promoted to the prelude in a new edition. Specifically this is blocking the stabilization of assert_matches rust-lang/rust#137487. The longer term goal is to gradually deprecate #[macro_use]. By no longer requiring it for standard library usage, this serves as a step towards that goal. For more information see rust-lang/rust#53977. PR link: rust-lang/rust#139493 Tracking: - rust-lang/rust#147319 Reference PRs: - rust-lang/rust#139493 cc @rust-lang/lang @rust-lang/lang-advisors ### What is stabilized Stabilization: * `#[macro_use]` is no longer automatically included in the crate root module. This allows the explicit import of macros in the `core` and `std` prelude e.g. `pub use crate::dbg;`. * `ambiguous_panic_imports` lint. Code that previously passed without warnings, but included the following or equivalent - only pertaining to core vs std panic - will now receive a warning: ```rust #![no_std] extern crate std; use std::prelude::v1::*; fn xx() { panic!(); // resolves to core::panic //~^ WARNING `panic` is ambiguous //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! } ``` This lint is tied to a new exception to the name resolution logic in [compiler/rustc_resolve/src/ident.rs](https://github.com/rust-lang/rust/pull/139493/files#diff-c046507afdba3b0705638f53fffa156cbad72ed17aa01d96d7bd1cc10b8d9bce) similar to an exception added for rust-lang/rust#145575. Specifically this only happens if the import of two builtin macros is ambiguous and they are named `sym::panic`. I.e. this can only happen for `core::panic` and `std::panic`. While there are some tiny differences in what syntax is allowed in `std::panic` vs `core::panic` in editions 2015 and 2018, [see](rust-lang/rust#139493 (comment)). The behavior at runtime will always be the same if it compiles, implying minimal risk in what specific macro is resolved. At worst some closed source project not captured by crater will stop compiling because a different panic is resolved than previously and they were using obscure syntax like `panic!(&String::new())`. ## Design N/A ### Reference > What updates are needed to the Reference? Link to each PR. If the Reference is missing content needed for describing this feature, discuss that. - rust-lang/reference#2077 ### RFC history > What RFCs have been accepted for this feature? N/A ### Answers to unresolved questions N/A ### Post-RFC changes > What other user-visible changes have occurred since the RFC was accepted? Describe both changes that the lang team accepted (and link to those decisions) as well as changes that are being presented to the team for the first time in this stabilization report. N/A ### Key points > What decisions have been most difficult and what behaviors to be stabilized have proved most contentious? Summarize the major arguments on all sides and link to earlier documents and discussions. - Nothing was really contentious. ### Nightly extensions > Are there extensions to this feature that remain unstable? How do we know that we are not accidentally committing to those? N/A ### Doors closed > What doors does this stabilization close for later changes to the language? E.g., does this stabilization make any other RFCs, lang experiments, or known in-flight proposals more difficult or impossible to do later? No known doors are closed. ## Feedback ### Call for testing > Has a "call for testing" been done? If so, what feedback was received? No. ### Nightly use > Do any known nightly users use this feature? Counting instances of `#![feature(FEATURE_NAME)]` on GitHub with grep might be informative. N/A ## Implementation ### Major parts > Summarize the major parts of the implementation and provide links into the code and to relevant PRs. > > See, e.g., this breakdown of the major parts of async closures: > > - <https://rustc-dev-guide.rust-lang.org/coroutine-closures.html> The key change is [compiler/rustc_builtin_macros/src/standard_library_imports.rs](https://github.com/rust-lang/rust/pull/139493/files#diff-be08752823b8f862bb0c7044ef049b0f4724dbde39306b98dea2adb82ec452b0) removing the macro_use inject and the `v1.rs` preludes now explicitly `pub use`ing the macros https://github.com/rust-lang/rust/pull/139493/files#diff-a6f9f476d41575b19b399c6d236197355556958218fd035549db6d584dbdea1d + https://github.com/rust-lang/rust/pull/139493/files#diff-49849ff961ebc978f98448c8990cf7aae8e94cb03db44f016011aa8400170587. ### Coverage > Summarize the test coverage of this feature. > > Consider what the "edges" of this feature are. We're particularly interested in seeing tests that assure us about exactly what nearby things we're not stabilizing. Tests should of course comprehensively demonstrate that the feature works. Think too about demonstrating the diagnostics seen when common mistakes are made and the feature is used incorrectly. > > Within each test, include a comment at the top describing the purpose of the test and what set of invariants it intends to demonstrate. This is a great help to our review. > > Describe any known or intentional gaps in test coverage. > > Contextualize and link to test folders and individual tests. A variety of UI tests including edge cases have been added. ### Outstanding bugs > What outstanding bugs involve this feature? List them. Should any block the stabilization? Discuss why or why not. An old bug is made more noticeable by this change rust-lang/rust#145577 but it was recommended to not block on it rust-lang/rust#139493 (comment). ### Outstanding FIXMEs > What FIXMEs are still in the code for that feature and why is it OK to leave them there? ``` // Turn ambiguity errors for core vs std panic into warnings. // FIXME: Remove with lang team approval. ``` https://github.com/rust-lang/rust/pull/139493/files#diff-c046507afdba3b0705638f53fffa156cbad72ed17aa01d96d7bd1cc10b8d9bce ### Tool changes > What changes must be made to our other tools to support this feature. Has this work been done? Link to any relevant PRs and issues. - ~~rustfmt~~ - ~~rust-analyzer~~ - ~~rustdoc (both JSON and HTML)~~ - ~~cargo~~ - ~~clippy~~ - ~~rustup~~ - ~~docs.rs~~ No known changes needed or expected. ### Breaking changes > If this stabilization represents a known breaking change, link to the crater report, the analysis of the crater report, and to all PRs we've made to ecosystem projects affected by this breakage. Discuss any limitations of what we're able to know about or to fix. Breaking changes: * It's possible for user code to invoke an ambiguity by defining their own macros with standard library names and glob importing them, e.g. `use nom::*` importing `nom::dbg`. In practice this happens rarely based on crater data. The 3 public crates where this was an issue, have been fixed. The ambiguous panic import is more common and affects a non-trivial amount of the public - and likely private - crate ecosystem. To avoid a breaking change, a new future incompatible lint was added ambiguous_panic_imports see rust-lang/rust#147319. This allows current code to continue compiling, albeit with a new warning. Future editions of Rust make this an error and future versions of Rust can choose to make this error. Technically this is a breaking change, but crater gives us the confidence that the impact will be at worst a new warning for 99+% of public and private crates. ```rust #![no_std] extern crate std; use std::prelude::v1::*; fn xx() { panic!(); // resolves to core::panic //~^ WARNING `panic` is ambiguous //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! } ``` * Code using `#![no_implicit_prelude]` *and* Rust edition 2015 will no longer automatically have access to the prelude macros. The following works on nightly but would stop working with this change: ```rust #![no_implicit_prelude] // Uncomment to fix error. // use std::vec; fn main() { let _ = vec![3, 6]; } ``` Inversely with this change the `panic` and `unreachable` macro will always be in the prelude even if `#![no_implicit_prelude]` is specified. Error matrix when using `#![no_implicit_prelude]`, ✅ means compiler passes 🚫 means compiler error: Configuration | Rust 2015 | Rust 2018+ --------------|-----------|----------- Nightly (panic\|unreachable) macro | ✅ | 🚫 PR (panic\|unreachable) macro | ✅ | ✅ Nightly (column\|concat\|file\|line\|module_path\|stringify) macro | ✅ | ✅ PR (column\|concat\|file\|line\|module_path\|stringify) macro | ✅ | ✅ Nightly remaining macros | ✅ | 🚫 PR remaining macros | 🚫 | 🚫 Addressing this issue is deemed expensive. Crater found no instance of this pattern in use. Affected code can fix the issue by directly importing the macros. The new behavior matches the behavior of `#![no_implicit_prelude]` in Rust editions 2018 and beyond and it's intuitive meaning. Crater report: - https://crater-reports.s3.amazonaws.com/pr-139493-2/index.html (latest run, but partial run) - https://crater-reports.s3.amazonaws.com/pr-139493-1/index.html (previous full run, one fix missing) Crater analysis: - Discussed in breaking changes. PRs to affected crates: - Michael-F-Bryan/gcode-rs#57 - stbuehler/rust-ipcrypt#1 - jcreekmore/dmidecode#55 ## Type system, opsem ### Compile-time checks > What compilation-time checks are done that are needed to prevent undefined behavior? > > Link to tests demonstrating that these checks are being done. N/A ### Type system rules > What type system rules are enforced for this feature and what is the purpose of each? N/A ### Sound by default? > Does the feature's implementation need specific checks to prevent UB, or is it sound by default and need specific opt-in to perform the dangerous/unsafe operations? If it is not sound by default, what is the rationale? N/A ### Breaks the AM? > Can users use this feature to introduce undefined behavior, or use this feature to break the abstraction of Rust and expose the underlying assembly-level implementation? Describe this if so. N/A ## Common interactions ### Temporaries > Does this feature introduce new expressions that can produce temporaries? What are the scopes of those temporaries? N/A ### Drop order > Does this feature raise questions about the order in which we should drop values? Talk about the decisions made here and how they're consistent with our earlier decisions. N/A ### Pre-expansion / post-expansion > Does this feature raise questions about what should be accepted pre-expansion (e.g. in code covered by `#[cfg(false)]`) versus what should be accepted post-expansion? What decisions were made about this? N/A ### Edition hygiene > If this feature is gated on an edition, how do we decide, in the context of the edition hygiene of tokens, whether to accept or reject code. E.g., what token do we use to decide? N/A ### SemVer implications > Does this feature create any new ways in which library authors must take care to prevent breaking downstreams when making minor-version releases? Describe these. Are these new hazards "major" or "minor" according to [RFC 1105](https://rust-lang.github.io/rfcs/1105-api-evolution.html)? No. ### Exposing other features > Are there any other unstable features whose behavior may be exposed by this feature in any way? What features present the highest risk of that? No. ## History > List issues and PRs that are important for understanding how we got here. - This change was asked for here rust-lang/rust#137487 (comment) ## Acknowledgments > Summarize contributors to the feature by name for recognition and so that those people are notified about the stabilization. Does anyone who worked on this *not* think it should be stabilized right now? We'd like to hear about that if so. More or less solo developed by @Voultapher with some help from @petrochenkov. ## Open items > List any known items that have not yet been completed and that should be before this is stabilized. None.
…lcnr Optimize canonicalizer flag checks. The most important change here relates to type folding: we now check the flags up front, instead of doing it in `inner_fold_ty` after checking the cache and doing a match. This is a small perf win, and matches other similar folders (e.g. `CanonicalInstantiator`). Likewise for const folding, we now check the flags first. (There is no cache for const folding.) Elsewhere we don't check flags before folding a predicate (unnecessary, because `fold_predicate` already checks the flags itself before doing anything else), and invert the flag checks in a couple of methods to match the standard order. r? @lcnr
…elmann Fix perf of `check_crate_level` refactor Fixes the perf of rust-lang/rust#150930 The problem is that `allowed_targets` allocates a `Vec` (also moves a comment around to a move useful place) r? @jdonszelmann
Add a dist component for libgccjit Companion to rust-lang/rust#150538. try-job: dist-x86_64-linux
avoid phi node for pointers flowing into Vec appends Elide temporary allocations in patterns like `vec.append(slice.to_vec())` related discussion: https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/nocapture.20and.20allocation.20elimination
Only use SSA locals in SimplifyComparisonIntegral Fixes rust-lang/rust#150904. The place may be modified from the comparison statement to the switchInt terminator. Best reviewed commit by commit.
remove multiple unhelpful `reason = "..."` values from `#[unstable(...)]` invocations
The vast majority of `#[unstable()]` attributes already has no explicit reason specified. This PR removes the `reason = "..."` value for the following unhelpful or meaningless reasons:
* "recently added"
* "new API"
* "recently redesigned"
* "unstable"
An example of how the message looks with and without a reason:
```rust
fn main() {
Vec::<()>::into_parts;
Vec::<()>::const_make_global;
}
```
```
error[E0658]: use of unstable library feature `box_vec_non_null`: new API
--> src/main.rs:2:5
|
2 | Vec::<()>::into_parts;
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #130364 <rust-lang/rust#130364> for more information
= help: add `#![feature(box_vec_non_null)]` to the crate attributes to enable
= note: this compiler was built on 2026-01-15; consider upgrading it if it is out of date
error[E0658]: use of unstable library feature `const_heap`
--> src/main.rs:3:5
|
3 | Vec::<()>::const_make_global;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #79597 <rust-lang/rust#79597> for more information
= help: add `#![feature(const_heap)]` to the crate attributes to enable
= note: this compiler was built on 2026-01-15; consider upgrading it if it is out of date
```
Most of the remaining reasons after this are something similar to "this is an implementation detail for XYZ" or "this is not public". If this PR is approved, I'll look into those next.
The PR also removes the `fd_read` feature gate. It only consists of one attribute applied to an implementation inside a module that is already private and unstable and should not be needed.
New MIR Pass: SsaRangePropagation As an alternative to rust-lang/rust#150192. Introduces a new pass that propagates the known ranges of SSA locals. We can know the ranges of SSA locals at some locations for the following code: ```rust fn foo(a: u32) { let b = a < 9; if b { let c = b; // c is true since b is whitin the range [1, 2) let d = a < 8; // d is true since b whitin the range [0, 9) } } ``` This PR only implements a trivial range: we know one value on switch, assert, and assume.
Add scalar support for offload This PR adds scalar support to the offload feature. The scalar management has two main parts: On the host side, each scalar arg is casted to `ix` type, zero extended to `i64` and passed to the kernel like that. On the device, the each scalar arg (`i64` at that point), is truncated to `ix` and then casted to the original type. r? @ZuseZ4
Add new "hide deprecated items" setting in rustdoc This PR adds a new JS setting which allows the JS to hide deprecated items. This is especially useful for crates like `std` which accumulates deprecated items but never removes them. Nicely enough, the "deprecation" information was already in the search index, meaning I didn't need to change anything there. Before this PR, it was only used to make the deprecated items rank lower. Well now it's also used to generate an extra CSS class, allowing the JS setting to work. This is taking over rust-lang/rust#149551. This feature got approved by the rustdoc team in the [meeting of december](https://rust-lang.zulipchat.com/#narrow/channel/393423-t-rustdoc.2Fmeetings/topic/2025-12-08/near/562553156). You can give it a try [here](https://rustdoc.crud.net/imperio/hide-deprecated-items/foo/index.html). r? @lolbinarycat
Fix terminal width dependent tests [#t-compiler > What is -Zui-testing=no and why are we using it](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/What.20is.20-Zui-testing.3Dno.20and.20why.20are.20we.20using.20it/with/568842970) See zulip thread. I've verified locally that this lets me run the ui test suite without problems even with a very thin terminal 😆
add basic `TokenStream` api tests There were none so far. Especially helpful for rust-lang/rust#130856.
rustc-dev-guide subtree update Subtree update of `rustc-dev-guide` to 64f0f77. Created using https://github.com/rust-lang/josh-sync. r? @ghost
Rollup of 8 pull requests Successful merges: - rust-lang/rust#149587 (coverage: Sort the expansion tree to help choose a single BCB for child expansions) - rust-lang/rust#150071 (Add dist step for Enzyme) - rust-lang/rust#150288 (Add scalar support for offload) - rust-lang/rust#151091 (Add new "hide deprecated items" setting in rustdoc) - rust-lang/rust#151255 (rustdoc: Fix ICE when deprecated note is not resolved on the correct `DefId`) - rust-lang/rust#151375 (Fix terminal width dependent tests) - rust-lang/rust#151384 (add basic `TokenStream` api tests) - rust-lang/rust#151391 (rustc-dev-guide subtree update) r? @ghost
Stabilize `-Zremap-path-scope` # Stabilization report of `--remap-path-scope` ## Summary RFC 3127 trim-paths aims to improve the current status of sanitizing paths emitted by the compiler via the `--remap-path-prefix=FROM=TO` command line flag, by offering a profile setting named `trim-paths` in Cargo to sanitize absolute paths introduced during compilation that may be embedded in the compiled binary executable or library. As part of that RFC the compiler was asked to add the `--remap-path-scope` command-line flag to control the scoping of how paths get remapped in the resulting binary. Tracking: - rust-lang/rust#111540 ### What is stabilized The rustc `--remap-path-scope` flag is being stabilized by this PR. It defines which scopes of paths should be remapped by `--remap-path-prefix`. This flag accepts a comma-separated list of values and may be specified multiple times, in which case the scopes are aggregated together. The valid scopes are: - `macro` - apply remappings to the expansion of `std::file!()` macro. This is where paths in embedded panic messages come from - `diagnostics` - apply remappings to printed compiler diagnostics - `debuginfo` - apply remappings to debug informations - `coverage` - apply remappings to coverage informations - `object` - apply remappings to all paths in compiled executables or libraries, but not elsewhere. Currently an alias for `macro,coverage,debuginfo`. - `all` (default) - an alias for all of the above, also equivalent to supplying only `--remap-path-prefix` without `--remap-path-scope`. #### Example ```sh # With `object` scope only the build outputs will be remapped, the diagnostics won't be remapped. rustc --remap-path-prefix=$(PWD)=/remapped --remap-path-scope=object main.rs ``` ### What isn't stabilized None of the Cargo facility is being stabilized in this stabilization PR, only the `--remap-path-scope` flag in `rustc` is being stabilized. ## Design ### RFC history - [RFC3127 - trim-paths](https://rust-lang.github.io/rfcs/3127-trim-paths.html) ### Answers to unresolved questions > What questions were left unresolved by the RFC? How have they been answered? Link to any relevant lang decisions. There are no unresolved questions regarding `--remap-path-scope`. (The tracking issue list a bunch of unresolved questions but they are for `--remap-path-prefix` or the bigger picture `trim-paths` in Cargo and are not related the functionality provided by `--remap-path-scope`.) ### Post-RFC changes The RFC described more scopes, in particularly regarding split debuginfo. Those scopes where removed after analysis by `michaelwoerister` of all the possible combinations in rust-lang/rust#111540 (comment). ### Nightly extensions There are no nightly extensions. ### Doors closed We are committing to having to having a flag that control which paths are being remapped based on a "scope". ## Feedback ### Call for testing > Has a "call for testing" been done? If so, what feedback was received? No call for testing has been done per se but feedback has been received on both the rust-lang/rust and rust-lang/cargo tracking issue. The feedback was mainly related to deficiencies in *our best-effort* `--remap-path-prefix` implementation, in particular regarding linkers added paths, which does not change anything for `--remap-path-scope`. ### Nightly use > Do any known nightly users use this feature? Counting instances of `#![feature(FEATURE_NAME)]` on GitHub with grep might be informative. Except for Cargo unstable `trim-paths` there doesn't appear any committed use [on GitHub](https://github.com/search?q=%22--remap-path-scope%22+NOT+path%3A%2F%5Esrc%5C%2Fcargo%5C%2Fcore%5C%2Fcompiler%5C%2F%2F+NOT+path%3A%2F%5Etext%5C%2F%2F+NOT+path%3A%2F%5Erust%5C%2Fsrc%5C%2Fdoc%5C%2Funstable-book%5C%2Fsrc%5C%2Fcompiler-flags%5C%2F%2F+NOT+path%3A%2F%5Esrc%5C%2Fdoc%5C%2Funstable-book%5C%2Fsrc%5C%2Fcompiler-flags%5C%2F%2F+NOT+path%3A%2F%5Ecollector%5C%2Fcompile-benchmarks%5C%2Fcargo-0%5C.87%5C.1%5C%2Fsrc%5C%2Fcargo%5C%2Fcore%5C%2Fcompiler%5C%2F%2F&type=code). ## Implementation ### Major parts - https://github.com/rust-lang/rust/blob/b3f8586fb1e4859678d6b231e780ff81801d2282/compiler/rustc_session/src/config.rs#L1373-L1384 - https://github.com/rust-lang/rust/blob/b3f8586fb1e4859678d6b231e780ff81801d2282/compiler/rustc_session/src/session.rs#L1526 - https://github.com/rust-lang/rust/blob/b3f8586fb1e4859678d6b231e780ff81801d2282/compiler/rustc_span/src/lib.rs#L352-L372 ### Coverage - [`tests/run-make/split-debuginfo/rmake.rs`](https://github.com/rust-lang/rust/blob/9725c4baacef19345e13f91b27e66e10ef5592ae/tests/run-make/split-debuginfo/rmake.rs#L7) - [`tests/ui/errors/remap-path-prefix.rs`](https://github.com/rust-lang/rust/blob/9725c4baacef19345e13f91b27e66e10ef5592ae/tests/ui/errors/remap-path-prefix.rs#L4) - [`tests/ui/errors/remap-path-prefix-macro.rs`](https://github.com/rust-lang/rust/blob/9725c4baacef19345e13f91b27e66e10ef5592ae/tests/ui/errors/remap-path-prefix-macro.rs#L1-L4) - [`tests/run-make/remap-path-prefix-dwarf/rmake.rs `](https://github.com/rust-lang/rust/blob/9725c4baacef19345e13f91b27e66e10ef5592ae/tests/run-make/remap-path-prefix-dwarf/rmake.rs) - [`tests/run-make/remap-path-prefix/rmake.rs`](https://github.com/rust-lang/rust/blob/9725c4baacef19345e13f91b27e66e10ef5592ae/tests/run-make/remap-path-prefix/rmake.rs) - [`tests/ui/errors/remap-path-prefix-diagnostics.rs`](https://github.com/rust-lang/rust/blob/9725c4baacef19345e13f91b27e66e10ef5592ae/tests/ui/errors/remap-path-prefix-diagnostics.rs) ### Outstanding bugs > What outstanding bugs involve this feature? List them. Should any block the stabilization? Discuss why or why not. There are no outstanding bugs regarding `--remap-path-scope`. ### Outstanding FIXMEs > What FIXMEs are still in the code for that feature and why is it OK to leave them there? There are no FIXME regarding `--remap-path-scope` in it-self. ### Tool changes > What changes must be made to our other tools to support this feature. Has this work been done? Link to any relevant PRs and issues. - rustdoc (both JSON, HTML and doctest) - `rustdoc` has support for `--remap-path-prefix`, it should probably also get support for `--remap-path-scope`, although rustdoc maybe want to adapt the scopes for it's use (replace `debuginfo` with `documentation` for example). ## History > List issues and PRs that are important for understanding how we got here. - rust-lang/rust#115214 - rust-lang/rust#122450 - rust-lang/rust#139550 - rust-lang/rust#140716 ## Acknowledgments > Summarize contributors to the feature by name for recognition and so that those people are notified about the stabilization. Does anyone who worked on this *not* think it should be stabilized right now? We'd like to hear about that if so. - @cbeuw - @michaelwoerister - @weihanglo - @Urgau @rustbot labels +T-compiler +needs-fcp +F-trim-paths r? @davidtwco
FCW Lint when using an ambiguously glob imported trait Related to rust-lang/rust#147992. Report a lint when using an ambiguously glob import trait, this is a FCW because this should not be allowed. r? @petrochenkov
Create x86_64-unknown-linux-gnuasan target which enables ASAN by default As suggested, in order to distribute sanitizer instrumented standard libraries without introducing new rustc flags, this adds a new dedicated target. With the target, we can distribute the instrumented standard libraries through a separate rustup component. > A tier 2 target must have value to people other than its maintainers. (It may still be a niche target, but it must not be exclusively useful for an inherently closed group.) The target is useful to anyone who wants to use ASAN with a stable compiler or the ease to not have to recompiled all standard libraries for full coverage. > A tier 2 target must have a designated team of developers (the “target maintainers”) available to consult on target-specific build-breaking issues, or if necessary to develop target-specific language or library implementation details. This team must have at least 2 developers. > * The target maintainers should not only fix target-specific issues, but should use any such issue as an opportunity to educate the Rust community about portability to their target, and enhance documentation of the target. I pledge myself and the folks from the Exploit Mitigations Project Group (rcvalle@ & 1c3t3a@) as target maintainers to fix target-specific issues and educate the Rust community about their use. > The target must not place undue burden on Rust developers not specifically concerned with that target. Rust developers are expected to not gratuitously break a tier 2 target, but are not expected to become experts in every tier 2 target, and are not expected to provide target-specific implementations for every tier 2 target. Understood. The target should not have negative impact for anyone not using it. > The target must provide documentation for the Rust community explaining how to build for the target using cross-compilation, and explaining how to run tests for the target. If at all possible, this documentation should show how to run Rust programs and tests for the target using emulation, to allow anyone to do so. If the target cannot be feasibly emulated, the documentation should explain how to obtain and work with physical hardware, cloud systems, or equivalent. `src/doc/rustc/src/platform-support/x86_64-unknown-linux-gnuasan.md` should provide the necessary documentation on how to build the target or compile programs with it. In the way the target can be emulated it should not differ from the tier 1 target `x86_64-unknown-linux-gnu`. > The target must document its baseline expectations for the features or versions of CPUs, operating systems, libraries, runtime environments, and similar. The baseline expectation mirror `x86_64-unknown-linux-gnu`. > If introducing a new tier 2 or higher target that is identical to an existing Rust target except for the baseline expectations for the features or versions of CPUs, operating systems, libraries, runtime environments, and similar, then the proposed target must document to the satisfaction of the approving teams why the specific difference in baseline expectations provides sufficient value to justify a separate target. > * Note that in some cases, based on the usage of existing targets within the Rust community, Rust developers or a target’s maintainers may wish to modify the baseline expectations of a target, or split an existing target into multiple targets with different baseline expectations. A proposal to do so will be treated similarly to the analogous promotion, demotion, or removal of a target, according to this policy, with the same team approvals required. > * For instance, if an OS version has become obsolete and unsupported, a target for that OS may raise its baseline expectations for OS version (treated as though removing a target corresponding to the older versions), or a target for that OS may split out support for older OS versions into a lower-tier target (treated as though demoting a target corresponding to the older versions, and requiring justification for a new target at a lower tier for the older OS versions). This has been outlined sufficiently. We should not enabled ASAN in the default target and are therefore creating a new tier 2 target to bridge the gap until `build-std` stabilized. > Tier 2 targets must not leave any significant portions of core or the standard library unimplemented or stubbed out, unless they cannot possibly be supported on the target. > * The right approach to handling a missing feature from a target may depend on whether the target seems likely to develop the feature in the future. In some cases, a target may be co-developed along with Rust support, and Rust may gain new features on the target as that target gains the capabilities to support those features. > * As an exception, a target identical to an existing tier 1 target except for lower baseline expectations for the OS, CPU, or similar, may propose to qualify as tier 2 (but not higher) without support for std if the target will primarily be used in no_std applications, to reduce the support burden for the standard library. In this case, evaluation of the proposed target’s value will take this limitation into account. All of std that is supported by `x86_64-unknown-linux-gnu` is also supported. > The code generation backend for the target should not have deficiencies that invalidate Rust safety properties, as evaluated by the Rust compiler team. (This requirement does not apply to arbitrary security enhancements or mitigations provided by code generation backends, only to those properties needed to ensure safe Rust code cannot cause undefined behavior or other unsoundness.) If this requirement does not hold, the target must clearly and prominently document any such limitations as part of the target’s entry in the target tier list, and ideally also via a failing test in the testsuite. The Rust compiler team must be satisfied with the balance between these limitations and the difficulty of implementing the necessary features. > * For example, if Rust relies on a specific code generation feature to ensure that safe code cannot overflow the stack, the code generation for the target should support that feature. > * If the Rust compiler introduces new safety properties (such as via new capabilities of a compiler backend), the Rust compiler team will determine if they consider those new safety properties a best-effort improvement for specific targets, or a required property for all Rust targets. In the latter case, the compiler team may require the maintainers of existing targets to either implement and confirm support for the property or update the target tier list with documentation of the missing property. The entire point is to have more security instead of less ;) The safety properties provided are already present in the compiler, just not enabled by default. > If the target supports C code, and the target has an interoperable calling convention for C code, the Rust target must support that C calling convention for the platform via extern "C". The C calling convention does not need to be the default Rust calling convention for the target, however. Understood. > The target must build reliably in CI, for all components that Rust’s CI considers mandatory. Understood and the reason for introducing the tier 2 target. > The approving teams may additionally require that a subset of tests pass in CI, such as enough to build a functional “hello world” program, ./x.py test --no-run, or equivalent “smoke tests”. In particular, this requirement may apply if the target builds host tools, or if the tests in question provide substantial value via early detection of critical problems. Understood. > Building the target in CI must not take substantially longer than the current slowest target in CI, and should not substantially raise the maintenance burden of the CI infrastructure. This requirement is subjective, to be evaluated by the infrastructure team, and will take the community importance of the target into account. Understood. > Tier 2 targets should, if at all possible, support cross-compiling. Tier 2 targets should not require using the target as the host for builds, even if the target supports host tools. Understood. No need to use this target as the host (no benefit of having ASAN enabled for compiling). > In addition to the legal requirements for all targets (specified in the tier 3 requirements), because a tier 2 target typically involves the Rust project building and supplying various compiled binaries, incorporating the target and redistributing any resulting compiled binaries (e.g. built libraries, host tools if any) must not impose any onerous license requirements on any members of the Rust project, including infrastructure team members and those operating CI systems. This is a subjective requirement, to be evaluated by the approving teams. > * As an exception to this, if the target’s primary purpose is to build components for a Free and Open Source Software (FOSS) project licensed under “copyleft” terms (terms which require licensing other code under compatible FOSS terms), such as kernel modules or plugins, then the standard libraries for the target may potentially be subject to copyleft terms, as long as such terms are satisfied by Rust’s existing practices of providing full corresponding source code. Note that anything added to the Rust repository itself must still use Rust’s standard license terms. Understood, no legal differences between this target and `x86_64-unknown-linux-gnu`. > Tier 2 targets must not impose burden on the authors of pull requests, or other developers in the community, to ensure that tests pass for the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on tests failing for the target. Do not send automated messages or notifications (via any medium, including via @) to a PR author or others involved with a PR regarding the PR breaking tests on a tier 2 target, unless they have opted into such messages. > * Backlinks such as those generated by the issue/PR tracker when linking to an issue or PR are not considered a violation of this policy, within reason. However, such messages (even on a separate repository) must not generate notifications to anyone involved with a PR who has not requested such notifications. Understood. > The target maintainers should regularly run the testsuite for the target, and should fix any test failures in a reasonably timely fashion. Understood. > All requirements for tier 3 apply. Requirements for tier 3 are listed below. > A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.) I pledge to do my best maintaining it and we can also include the folks from the Exploit Mitigations Project Group (rcvalle@ & 1c3t3a@). > Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target. We've chosen `x86_64-unknown-linux-gnuasan` as the name which was suggested on [#t-compiler/major changes > Create new Tier 2 targets with sanitizers… compiler-team#951 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Create.20new.20Tier.202.20targets.20with.20sanitizers.E2.80.A6.20compiler-team.23951/near/564482315). > Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility. For example, if the name of the target makes people extremely likely to form incorrect beliefs about what it targets, the name should be changed or augmented to disambiguate it. There should be no confusion, it's clear that it's the original target with ASAN enabled. > If possible, use only letters, numbers, dashes and underscores for the name. Periods (.) are known to cause issues in Cargo. Only letters, numbers and dashes used. > Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users. There are no unusual requirements to build or use it. It's the original `x86_64-unknown-linux-gnu` target with ASAN enabled as a default sanitizer. > The target must not introduce license incompatibilities. There are no license implications. > Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0). Given, by reusing the existing ASAN code. > The target must not cause the Rust tools or libraries built for any other host (even when supporting cross-compilation to the target) to depend on any new dependency less permissive than the Rust licensing policy. This applies whether the dependency is a Rust crate that would require adding new license exceptions (as specified by the tidy tool in the rust-lang/rust repository), or whether the dependency is a native library or binary. In other words, the introduction of the target must not cause a user installing or running a version of Rust or the Rust tools to be subject to any new license requirements. There are no new dependencies/features required. > Compiling, linking, and emitting functional binaries, libraries, or other code for the target (whether hosted on the target itself or cross-compiling from another target) must not depend on proprietary (non-FOSS) libraries. Host tools built for the target itself may depend on the ordinary runtime libraries supplied by the platform and commonly used by other applications built for the target, but those libraries must not be required for code generation for the target; cross-compilation to the target must not require such libraries at all. For instance, rustc built for the target may depend on a common proprietary C runtime library or console output library, but must not depend on a proprietary code generation library or code optimization library. Rust's license permits such combinations, but the Rust project has no interest in maintaining such combinations within the scope of Rust itself, even at tier 3. It's using open source tools only. > "onerous" here is an intentionally subjective term. At a minimum, "onerous" legal/licensing terms include but are not limited to: non-disclosure requirements, non-compete requirements, contributor license agreements (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms, requirements conditional on the employer or employment of any particular Rust developers, revocable terms, any requirements that create liability for the Rust project or its developers or users, or any requirements that adversely affect the livelihood or prospects of the Rust project or its developers or users. There are no such terms present. > Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions. Understood. > This requirement does not prevent part or all of this policy from being cited in an explicit contract or work agreement (e.g. to implement or maintain support for a target). This requirement exists to ensure that a developer or team responsible for reviewing and approving a target does not face any legal threats or obligations that would prevent them from freely exercising their judgment in such approval, even if such judgment involves subjective matters or goes beyond the letter of these requirements. Understood. > Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions. The goal is to have ASAN instrumented standard library variants of the existing `x86_64-unknown-linux-gnu` target, so all should be present. > The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary. I think the explanation in platform support doc is enough to make this aspect clear. > Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via @) to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages. Backlinks such as those generated by the issue/PR tracker when linking to an issue or PR are not considered a violation of this policy, within reason. However, such messages (even on a separate repository) must not generate notifications to anyone involved with a PR who has not requested such notifications. Understood. > Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target. Understood. > In particular, this may come up when working on closely related targets, such as variations of the same architecture with different features. Avoid introducing unconditional uses of features that another variation of the target may not have; use conditional compilation or runtime detection, as appropriate, to let each target run code supported by that target. I don't believe this PR is affected by this. > Tier 3 targets must be able to produce assembly using at least one of rustc's supported backends from any host target. (Having support in a fork of the backend is not sufficient, it must be upstream.) The target should work on all rustc versions that correctly compile for `x86_64-unknown-linux-gnu`.
Test that -Zbuild-std=core works on a variety of profiles See [#t-infra > Non-blocking testing for -Zbuild-std?](https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/Non-blocking.20testing.20for.20-Zbuild-std.3F/with/565837190) for some background. This is an incredibly CPU-hungry run-make-cargo test, but at least on my desktop the entire suite only takes a minute.
Fix typos: 'occured' -> 'occurred' and 'non_existant' -> 'non_existent'
`rustc_queries!`: Don't push the `(cache)` modifier twice Due to some kind of merge/rebase mishap in rust-lang/rust#101307 and rust-lang/rust#101173, we ended up with two copies of this query modifier. Thankfully the redundant copy was harmless. - rust-lang/rust#101307 - rust-lang/rust#101173
Rollup of 6 pull requests Successful merges: - rust-lang/rust#147611 (Stabilize `-Zremap-path-scope`) - rust-lang/rust#149058 (FCW Lint when using an ambiguously glob imported trait) - rust-lang/rust#149644 (Create x86_64-unknown-linux-gnuasan target which enables ASAN by default) - rust-lang/rust#150524 (Test that -Zbuild-std=core works on a variety of profiles) - rust-lang/rust#151394 (Fix typos: 'occured' -> 'occurred' and 'non_existant' -> 'non_existent') - rust-lang/rust#151396 (`rustc_queries!`: Don't push the `(cache)` modifier twice) r? @ghost
This updates the rust-version file to 5c49c4f7c8393c861b849441d27f5d40e0f1e33b.
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: rust-lang/rust@5c49c4f Filtered ref: 866efc3 Upstream diff: rust-lang/rust@44a5b55...5c49c4f This merge was created using https://github.com/rust-lang/josh-sync.
Collaborator
|
Thanks for the PR. If you have write access, feel free to merge this PR if it does not need reviews. You can request a review using |
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.