Skip to content

Tell rustfmt to use the 2024 edition in ./x.py fmt #139214

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 4 commits into from
Apr 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions compiler/rustc_codegen_cranelift/example/gen_block_iterate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,25 @@
#![feature(gen_blocks)]

fn foo() -> impl Iterator<Item = u32> {
gen { yield 42; for x in 3..6 { yield x } }
gen {
yield 42;
for x in 3..6 {
yield x
}
}
}

fn moved() -> impl Iterator<Item = u32> {
let mut x = "foo".to_string();
gen move {
yield 42;
if x == "foo" { return }
if x == "foo" {
return;
}
x.clear();
for x in 3..6 { yield x }
for x in 3..6 {
yield x
}
}
}

Expand All @@ -32,5 +41,4 @@ fn main() {
let mut iter = moved();
assert_eq!(iter.next(), Some(42));
assert_eq!(iter.next(), None);

}
4 changes: 0 additions & 4 deletions compiler/rustc_codegen_cranelift/rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
ignore = [
"example/gen_block_iterate.rs", # uses edition 2024
]

# Matches rustfmt.toml of rustc
style_edition = "2024"
use_small_heuristics = "Max"
Expand Down
1 change: 0 additions & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ ignore = [

# These are ignored by a standard cargo fmt run.
"compiler/rustc_codegen_cranelift/scripts",
"compiler/rustc_codegen_cranelift/example/gen_block_iterate.rs", # uses edition 2024
"compiler/rustc_codegen_gcc/tests",
# Code automatically generated and included.
"compiler/rustc_codegen_gcc/src/intrinsic/archs.rs",
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fn rustfmt(
// Avoid the submodule config paths from coming into play. We only allow a single global config
// for the workspace for now.
cmd.arg("--config-path").arg(src.canonicalize().unwrap());
cmd.arg("--edition").arg("2021");
cmd.arg("--edition").arg("2024");
cmd.arg("--unstable-features");
cmd.arg("--skip-children");
if check {
Expand Down
2 changes: 1 addition & 1 deletion src/etc/test-float-parse/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "test-float-parse"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false

[dependencies]
Expand Down
38 changes: 19 additions & 19 deletions src/etc/test-float-parse/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use traits::{Float, Generator, Int};
use validate::CheckError;

/// Test generators.
mod gen {
mod gen_ {
pub mod exhaustive;
pub mod exponents;
pub mod fuzz;
Expand Down Expand Up @@ -136,24 +136,24 @@ where
{
if F::BITS <= MAX_BITS_FOR_EXHAUUSTIVE {
// Only run exhaustive tests if there is a chance of completion.
TestInfo::register::<F, gen::exhaustive::Exhaustive<F>>(tests);
TestInfo::register::<F, gen_::exhaustive::Exhaustive<F>>(tests);
}

gen::fuzz::Fuzz::<F>::set_iterations(cfg.fuzz_count);

TestInfo::register::<F, gen::exponents::LargeExponents<F>>(tests);
TestInfo::register::<F, gen::exponents::SmallExponents<F>>(tests);
TestInfo::register::<F, gen::fuzz::Fuzz<F>>(tests);
TestInfo::register::<F, gen::integers::LargeInt<F>>(tests);
TestInfo::register::<F, gen::integers::SmallInt>(tests);
TestInfo::register::<F, gen::long_fractions::RepeatingDecimal>(tests);
TestInfo::register::<F, gen::many_digits::RandDigits<F>>(tests);
TestInfo::register::<F, gen::sparse::FewOnesFloat<F>>(tests);
TestInfo::register::<F, gen::sparse::FewOnesInt<F>>(tests);
TestInfo::register::<F, gen::spot_checks::RegressionCheck>(tests);
TestInfo::register::<F, gen::spot_checks::Special>(tests);
TestInfo::register::<F, gen::subnorm::SubnormComplete<F>>(tests);
TestInfo::register::<F, gen::subnorm::SubnormEdgeCases<F>>(tests);
gen_::fuzz::Fuzz::<F>::set_iterations(cfg.fuzz_count);

TestInfo::register::<F, gen_::exponents::LargeExponents<F>>(tests);
TestInfo::register::<F, gen_::exponents::SmallExponents<F>>(tests);
TestInfo::register::<F, gen_::fuzz::Fuzz<F>>(tests);
TestInfo::register::<F, gen_::integers::LargeInt<F>>(tests);
TestInfo::register::<F, gen_::integers::SmallInt>(tests);
TestInfo::register::<F, gen_::long_fractions::RepeatingDecimal>(tests);
TestInfo::register::<F, gen_::many_digits::RandDigits<F>>(tests);
TestInfo::register::<F, gen_::sparse::FewOnesFloat<F>>(tests);
TestInfo::register::<F, gen_::sparse::FewOnesInt<F>>(tests);
TestInfo::register::<F, gen_::spot_checks::RegressionCheck>(tests);
TestInfo::register::<F, gen_::spot_checks::Special>(tests);
TestInfo::register::<F, gen_::subnorm::SubnormComplete<F>>(tests);
TestInfo::register::<F, gen_::subnorm::SubnormEdgeCases<F>>(tests);
}

/// Configuration for a single test.
Expand Down Expand Up @@ -343,7 +343,7 @@ fn launch_tests(tests: &mut [TestInfo], cfg: &Config) -> Duration {
///
/// This calls the generator's iterator multiple times (in parallel) and validates each output.
fn test_runner<F: Float, G: Generator<F>>(test: &TestInfo, cfg: &Config) {
let gen = G::new();
let gen_ = G::new();
let executed = AtomicU64::new(0);
let failures = AtomicU64::new(0);

Expand Down Expand Up @@ -387,7 +387,7 @@ fn test_runner<F: Float, G: Generator<F>>(test: &TestInfo, cfg: &Config) {

// Run the test iterations in parallel. Each thread gets a string buffer to write
// its check values to.
let res = gen.par_bridge().try_for_each_init(String::new, check_one);
let res = gen_.par_bridge().try_for_each_init(String::new, check_one);

let elapsed = started.elapsed();
let executed = executed.into_inner();
Expand Down
2 changes: 1 addition & 1 deletion tests/mir-opt/coroutine_drop_cleanup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

// EMIT_MIR coroutine_drop_cleanup.main-{closure#0}.coroutine_drop.0.mir
fn main() {
let gen = #[coroutine]
let gen_ = #[coroutine]
|| {
let _s = String::new();
yield;
Expand Down
Loading