diff options
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/emitter.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 7 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/tests.rs | 24 |
3 files changed, 24 insertions, 15 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index d322cbe9d9b..922846775f6 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -337,9 +337,7 @@ pub trait Emitter: Translate { && last_name != name { let descr = macro_kind.descr(); - format!( - " which comes from the expansion of the {descr} `{last_name}`", - ) + format!(" which comes from the expansion of the {descr} `{last_name}`",) } else { "".to_string() }; @@ -1935,7 +1933,9 @@ impl EmitterWriter { is_multiline, ) } - if let DisplaySuggestion::Add = show_code_change && is_item_attribute { + if let DisplaySuggestion::Add = show_code_change + && is_item_attribute + { // The suggestion adds an entire line of code, ending on a newline, so we'll also // print the *following* line, to provide context of what we're advising people to // do. Otherwise you would only see contextless code that can be confused for diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 63226504d37..da74ee6391a 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -507,6 +507,7 @@ pub enum StashKey { CallAssocMethod, TraitMissingMethod, OpaqueHiddenTypeMismatch, + MaybeForgetReturn, } fn default_track_diagnostic(d: &mut Diagnostic, f: &mut dyn FnMut(&mut Diagnostic)) { @@ -1673,7 +1674,11 @@ impl HandlerInner { let _ = write!( &mut out, "delayed span bug: {}\n{}\n", - bug.inner.styled_message().iter().filter_map(|(msg, _)| msg.as_str()).collect::<String>(), + bug.inner + .styled_message() + .iter() + .filter_map(|(msg, _)| msg.as_str()) + .collect::<String>(), &bug.note ); } diff --git a/compiler/rustc_errors/src/tests.rs b/compiler/rustc_errors/src/tests.rs index 0e729b71680..79a2af7f38f 100644 --- a/compiler/rustc_errors/src/tests.rs +++ b/compiler/rustc_errors/src/tests.rs @@ -151,12 +151,14 @@ fn misformed_fluent() { primary: box TranslateError::One { kind: TranslateErrorKind::PrimaryBundleMissing, .. }, fallback: box TranslateError::One { kind: TranslateErrorKind::Fluent { errs }, .. }, } = &err - && let [FluentError::ResolverError(ResolverError::Reference( - ReferenceKind::Message { id, .. } - | ReferenceKind::Variable { id, .. }, - ))] = &**errs + && let [ + FluentError::ResolverError(ResolverError::Reference( + ReferenceKind::Message { id, .. } | ReferenceKind::Variable { id, .. }, + )), + ] = &**errs && id == "name" - {} else { + { + } else { panic!("{err:#?}") }; assert_eq!( @@ -176,12 +178,14 @@ fn misformed_fluent() { primary: box TranslateError::One { kind: TranslateErrorKind::PrimaryBundleMissing, .. }, fallback: box TranslateError::One { kind: TranslateErrorKind::Fluent { errs }, .. }, } = &err - && let [FluentError::ResolverError(ResolverError::Reference( - ReferenceKind::Message { id, .. } - | ReferenceKind::Variable { id, .. }, - ))] = &**errs + && let [ + FluentError::ResolverError(ResolverError::Reference( + ReferenceKind::Message { id, .. } | ReferenceKind::Variable { id, .. }, + )), + ] = &**errs && id == "oops" - {} else { + { + } else { panic!("{err:#?}") }; assert_eq!( |
