-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Use edition = "2024"
in the compiler
#129636
base: master
Are you sure you want to change the base?
Conversation
rustbot has assigned @albertlarsan68. Use |
This comment has been minimized.
This comment has been minimized.
2d3f18c
to
47c874d
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks right to me.
It's gratifying to see how much the Lifetime Capture Rules 2024 really clean things up, in particular by allowing lifetime elision to be used in many more places.
@@ -1294,7 +1294,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> { | |||
// responsibility of lowering. This may create a mismatch between the resolution | |||
// AST found (`region_def_id`) which points to HRTB, and what HIR allows. | |||
// ``` | |||
// fn foo(x: impl for<'a> Trait<'a, Assoc = impl Copy + 'a>) {} | |||
// fn foo(x: impl for<'a> Trait<'a, Assoc = impl Copy >) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// fn foo(x: impl for<'a> Trait<'a, Assoc = impl Copy >) {} | |
// fn foo(x: impl for<'a> Trait<'a, Assoc = impl Copy>) {} |
compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/static_impl_trait.rs
Outdated
Show resolved
Hide resolved
☔ The latest upstream changes (presumably #129665) made this pull request unmergeable. Please resolve the merge conflicts. |
8d11dbf
to
3675f01
Compare
I think this is ready. |
This PR changes Stable MIR cc @oli-obk, @celinval, @ouz-a Some changes occurred in coverage instrumentation. cc @Zalathar rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead. cc @rust-lang/rust-analyzer
cc @davidtwco, @compiler-errors, @TaKO8Ki Some changes occurred in exhaustiveness checking cc @Nadrieril Some changes occurred in coverage instrumentation. cc @Zalathar Some changes occurred in compiler/rustc_sanitizers cc @rust-lang/project-exploit-mitigations, @rcvalle Some changes occurred to the CTFE / Miri interpreter cc @rust-lang/miri Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
r? compiler |
d4e9137
to
b7420ee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove Captures
now that we have explicit use
syntax?
I thought tidy
requires safety comments for unsafe blocks? 🤔 I feel somewhat :/ about wrapping set_var
in an unsafe
block without explaining why that's correct. I guess it's always SAFETY: rustc is single threaded up until this point
? I am not totally confident that this holds for all unsafe
blocks, so alternatively, please open an issue tracking the fact that we may unsoundly use [set|remove]_env
in the compiler
apart from that r=me, cc @rust-lang/compiler @rust-lang/compiler-contributors |
I'll have to wait until
That's a good point. Yeah, I'll open a tracking issue for that (and enforcing |
We have a handful of unsafe blocks without comments, such as rust/compiler/rustc_index/src/slice.rs Lines 137 to 138 in a5cf8bb
rust/compiler/rustc_data_structures/src/tagged_ptr/copy.rs Lines 153 to 155 in a5cf8bb
Considering the strange way we handle formatting, I wouldn't speculate about what tidy is doing here. |
Well the entire point of this is to give everyone a chance to audit their use of |
@@ -51,9 +51,13 @@ fn detect_llvm_link() -> (&'static str, &'static str) { | |||
fn restore_library_path() { | |||
let key = tracked_env_var_os("REAL_LIBRARY_PATH_VAR").expect("REAL_LIBRARY_PATH_VAR"); | |||
if let Some(env) = tracked_env_var_os("REAL_LIBRARY_PATH") { | |||
env::set_var(&key, env); | |||
unsafe { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one (and the others that are not immediately obvious) should get a FIXME, like the warning suggests.
@@ -3,7 +3,9 @@ use super::UnstableFeatures; | |||
#[test] | |||
fn rustc_bootstrap_parsing() { | |||
let is_bootstrap = |env, krate| { | |||
std::env::set_var("RUSTC_BOOTSTRAP", env); | |||
unsafe { | |||
std::env::set_var("RUSTC_BOOTSTRAP", env); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would affect other concurrent tests, right?
☔ The latest upstream changes (presumably #129283) made this pull request unmergeable. Please resolve the merge conflicts. |
00e426a
to
d22fb9a
Compare
The answer is no, unfortunately. It's also unclear to me whether we can ask cargo to only check the unstable features in the crates we're building rather than all the crates in the workspace. I've tried and couldn't do it: the presence of the unstable edition 2024 feature anywhere + cargo's TL;DR: to my knowledge, we can't easily enforce on CI to not use cargo unstable features (including edition 2024) in the following crates that need to build on stable:
|
Hm... I probably should hold back rustc_lexer from edition 2024 as well. @bors r- |
☔ The latest upstream changes (presumably #130724) made this pull request unmergeable. Please resolve the merge conflicts. |
as well as these 2 crates I've just learned r-a also uses (via #131997)
|
Self-explanatory.
This involves changing all of the compiler crates' edition to
2024
(except forcodegen_gcc
andcodegen_cranelift
andpattern_analysis
), and massively simplifying opaques and their lifetimes. I think the overwhelming majority of functions look significantly better now.There are some other changes sprinkled in too, such as how env var functions are now unsafe.