mirror of https://github.com/rust-lang/rust.git
Rollup merge of #125477 - nnethercote:missed-rustfmt, r=compiler-errors
Run rustfmt on files that need it. Somehow these files aren't properly formatted. By default `x fmt` and `x tidy` only check files that have changed against master, so if an ill-formatted file somehow slips in it can stay that way as long as it doesn't get modified(?) I found these when I ran `x fmt` explicitly on every `.rs` file in the repo, while working on https://github.com/rust-lang/compiler-team/issues/750.
This commit is contained in:
commit
eb6297eb6f
|
@ -29,8 +29,8 @@ use rustc_middle::middle::debugger_visualizer::{DebuggerVisualizerFile, Debugger
|
||||||
use rustc_middle::middle::exported_symbols;
|
use rustc_middle::middle::exported_symbols;
|
||||||
use rustc_middle::middle::exported_symbols::SymbolExportKind;
|
use rustc_middle::middle::exported_symbols::SymbolExportKind;
|
||||||
use rustc_middle::middle::lang_items;
|
use rustc_middle::middle::lang_items;
|
||||||
use rustc_middle::mir::BinOp;
|
|
||||||
use rustc_middle::mir::mono::{CodegenUnit, CodegenUnitNameBuilder, MonoItem};
|
use rustc_middle::mir::mono::{CodegenUnit, CodegenUnitNameBuilder, MonoItem};
|
||||||
|
use rustc_middle::mir::BinOp;
|
||||||
use rustc_middle::query::Providers;
|
use rustc_middle::query::Providers;
|
||||||
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
|
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
|
||||||
use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
|
use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
|
||||||
|
|
|
@ -139,10 +139,9 @@ where
|
||||||
ErrorHandled::TooGeneric(span)
|
ErrorHandled::TooGeneric(span)
|
||||||
}
|
}
|
||||||
err_inval!(AlreadyReported(guar)) => ErrorHandled::Reported(guar, span),
|
err_inval!(AlreadyReported(guar)) => ErrorHandled::Reported(guar, span),
|
||||||
err_inval!(Layout(LayoutError::ReferencesError(guar))) => ErrorHandled::Reported(
|
err_inval!(Layout(LayoutError::ReferencesError(guar))) => {
|
||||||
ReportedErrorInfo::tainted_by_errors(guar),
|
ErrorHandled::Reported(ReportedErrorInfo::tainted_by_errors(guar), span)
|
||||||
span,
|
}
|
||||||
),
|
|
||||||
// Report remaining errors.
|
// Report remaining errors.
|
||||||
_ => {
|
_ => {
|
||||||
let (our_span, frames) = get_span_and_frames();
|
let (our_span, frames) = get_span_and_frames();
|
||||||
|
|
|
@ -116,8 +116,7 @@ fn load_dep_graph(sess: &Session) -> LoadResult<(Arc<SerializedDepGraph>, WorkPr
|
||||||
|
|
||||||
if let LoadResult::Ok { data: (work_products_data, start_pos) } = load_result {
|
if let LoadResult::Ok { data: (work_products_data, start_pos) } = load_result {
|
||||||
// Decode the list of work_products
|
// Decode the list of work_products
|
||||||
let Ok(mut work_product_decoder) =
|
let Ok(mut work_product_decoder) = MemDecoder::new(&work_products_data[..], start_pos)
|
||||||
MemDecoder::new(&work_products_data[..], start_pos)
|
|
||||||
else {
|
else {
|
||||||
sess.dcx().emit_warn(errors::CorruptFile { path: &work_products_path });
|
sess.dcx().emit_warn(errors::CorruptFile { path: &work_products_path });
|
||||||
return LoadResult::DataOutOfDate;
|
return LoadResult::DataOutOfDate;
|
||||||
|
|
|
@ -62,7 +62,9 @@ impl<'tcx> LateLintPass<'tcx> for ForLoopsOverFallibles {
|
||||||
};
|
};
|
||||||
|
|
||||||
let (article, ty, var) = match adt.did() {
|
let (article, ty, var) = match adt.did() {
|
||||||
did if cx.tcx.is_diagnostic_item(sym::Option, did) && ref_mutability.is_some() => ("a", "Option", "Some"),
|
did if cx.tcx.is_diagnostic_item(sym::Option, did) && ref_mutability.is_some() => {
|
||||||
|
("a", "Option", "Some")
|
||||||
|
}
|
||||||
did if cx.tcx.is_diagnostic_item(sym::Option, did) => ("an", "Option", "Some"),
|
did if cx.tcx.is_diagnostic_item(sym::Option, did) => ("an", "Option", "Some"),
|
||||||
did if cx.tcx.is_diagnostic_item(sym::Result, did) => ("a", "Result", "Ok"),
|
did if cx.tcx.is_diagnostic_item(sym::Result, did) => ("a", "Result", "Ok"),
|
||||||
_ => return,
|
_ => return,
|
||||||
|
|
|
@ -98,7 +98,7 @@ fn fmt_thousands_sep(mut n: f64, sep: char) -> String {
|
||||||
(0, true) => write!(output, "{:06.2}", n / base as f64).unwrap(),
|
(0, true) => write!(output, "{:06.2}", n / base as f64).unwrap(),
|
||||||
(0, false) => write!(output, "{:.2}", n / base as f64).unwrap(),
|
(0, false) => write!(output, "{:.2}", n / base as f64).unwrap(),
|
||||||
(_, true) => write!(output, "{:03}", n as usize / base).unwrap(),
|
(_, true) => write!(output, "{:03}", n as usize / base).unwrap(),
|
||||||
_ => write!(output, "{}", n as usize / base).unwrap()
|
_ => write!(output, "{}", n as usize / base).unwrap(),
|
||||||
}
|
}
|
||||||
if pow != 0 {
|
if pow != 0 {
|
||||||
output.push(sep);
|
output.push(sep);
|
||||||
|
|
|
@ -60,7 +60,14 @@ fn check_cli<const N: usize>(paths: [&str; N]) {
|
||||||
macro_rules! std {
|
macro_rules! std {
|
||||||
($host:ident => $target:ident, stage = $stage:literal) => {
|
($host:ident => $target:ident, stage = $stage:literal) => {
|
||||||
compile::Std::new(
|
compile::Std::new(
|
||||||
Compiler { host: TargetSelection::from_user(concat!(stringify!($host), "-", stringify!($host))), stage: $stage },
|
Compiler {
|
||||||
|
host: TargetSelection::from_user(concat!(
|
||||||
|
stringify!($host),
|
||||||
|
"-",
|
||||||
|
stringify!($host)
|
||||||
|
)),
|
||||||
|
stage: $stage,
|
||||||
|
},
|
||||||
TargetSelection::from_user(concat!(stringify!($target), "-", stringify!($target))),
|
TargetSelection::from_user(concat!(stringify!($target), "-", stringify!($target))),
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
@ -83,7 +90,14 @@ macro_rules! doc_std {
|
||||||
macro_rules! rustc {
|
macro_rules! rustc {
|
||||||
($host:ident => $target:ident, stage = $stage:literal) => {
|
($host:ident => $target:ident, stage = $stage:literal) => {
|
||||||
compile::Rustc::new(
|
compile::Rustc::new(
|
||||||
Compiler { host: TargetSelection::from_user(concat!(stringify!($host), "-", stringify!($host))), stage: $stage },
|
Compiler {
|
||||||
|
host: TargetSelection::from_user(concat!(
|
||||||
|
stringify!($host),
|
||||||
|
"-",
|
||||||
|
stringify!($host)
|
||||||
|
)),
|
||||||
|
stage: $stage,
|
||||||
|
},
|
||||||
TargetSelection::from_user(concat!(stringify!($target), "-", stringify!($target))),
|
TargetSelection::from_user(concat!(stringify!($target), "-", stringify!($target))),
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
@ -141,10 +155,14 @@ fn check_missing_paths_for_x_test_tests() {
|
||||||
|
|
||||||
// Skip if not a test directory.
|
// Skip if not a test directory.
|
||||||
if path.ends_with("tests/auxiliary") || !path.is_dir() {
|
if path.ends_with("tests/auxiliary") || !path.is_dir() {
|
||||||
continue
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert!(tests_remap_paths.iter().any(|item| path.ends_with(*item)), "{} is missing in PATH_REMAP tests list.", path.display());
|
assert!(
|
||||||
|
tests_remap_paths.iter().any(|item| path.ends_with(*item)),
|
||||||
|
"{} is missing in PATH_REMAP tests list.",
|
||||||
|
path.display()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +203,8 @@ fn alias_and_path_for_library() {
|
||||||
&[std!(A => A, stage = 0), std!(A => A, stage = 1)]
|
&[std!(A => A, stage = 0), std!(A => A, stage = 1)]
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut cache = run_build(&["library".into(), "core".into()], configure("doc", &["A-A"], &["A-A"]));
|
let mut cache =
|
||||||
|
run_build(&["library".into(), "core".into()], configure("doc", &["A-A"], &["A-A"]));
|
||||||
assert_eq!(first(cache.all::<doc::Std>()), &[doc_std!(A => A, stage = 0)]);
|
assert_eq!(first(cache.all::<doc::Std>()), &[doc_std!(A => A, stage = 0)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -199,11 +199,15 @@ than building it.
|
||||||
if !["A-A", "B-B", "C-C"].contains(&target_str.as_str()) {
|
if !["A-A", "B-B", "C-C"].contains(&target_str.as_str()) {
|
||||||
let mut has_target = false;
|
let mut has_target = false;
|
||||||
|
|
||||||
let missing_targets_hashset: HashSet<_> = STAGE0_MISSING_TARGETS.iter().map(|t| t.to_string()).collect();
|
let missing_targets_hashset: HashSet<_> =
|
||||||
let duplicated_targets: Vec<_> = stage0_supported_target_list.intersection(&missing_targets_hashset).collect();
|
STAGE0_MISSING_TARGETS.iter().map(|t| t.to_string()).collect();
|
||||||
|
let duplicated_targets: Vec<_> =
|
||||||
|
stage0_supported_target_list.intersection(&missing_targets_hashset).collect();
|
||||||
|
|
||||||
if !duplicated_targets.is_empty() {
|
if !duplicated_targets.is_empty() {
|
||||||
println!("Following targets supported from the stage0 compiler, please remove them from STAGE0_MISSING_TARGETS list.");
|
println!(
|
||||||
|
"Following targets supported from the stage0 compiler, please remove them from STAGE0_MISSING_TARGETS list."
|
||||||
|
);
|
||||||
for duplicated_target in duplicated_targets {
|
for duplicated_target in duplicated_targets {
|
||||||
println!(" {duplicated_target}");
|
println!(" {duplicated_target}");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
pub mod ci;
|
pub mod ci;
|
||||||
pub mod git;
|
pub mod git;
|
||||||
pub mod metrics;
|
pub mod metrics;
|
||||||
pub mod util;
|
|
||||||
pub mod stage0_parser;
|
pub mod stage0_parser;
|
||||||
|
pub mod util;
|
||||||
|
|
Loading…
Reference in New Issue