From 1ecc9aa513993865b1290e3ba49ce9431e23a74c Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sat, 5 Apr 2025 19:19:56 +0300 Subject: [PATCH] [WIP] compiletest: Make diagnostic kind mandatory on line annotations --- src/tools/compiletest/src/errors.rs | 45 ++++---- src/tools/compiletest/src/header.rs | 3 +- src/tools/compiletest/src/json.rs | 41 +++++-- src/tools/compiletest/src/runtest.rs | 90 +++++++++------ src/tools/compiletest/src/runtest/ui.rs | 6 +- .../issues/ice-generic-type-alias-105742.rs | 26 ++--- tests/ui/array-slice-vec/array-not-vector.rs | 8 +- tests/ui/array-slice-vec/slice-mut.rs | 6 +- .../defaults-not-assumed-fail.rs | 2 +- .../associated-types/associated-types-eq-3.rs | 6 +- .../associated-types-path-2.rs | 4 +- tests/ui/associated-types/substs-ppaux.rs | 32 +++--- tests/ui/binop/shift-various-bad-types.rs | 2 +- tests/ui/blind/blind-item-item-shadow.rs | 2 +- .../block-must-not-have-result-while.rs | 2 +- tests/ui/block-result/issue-13624.rs | 4 +- tests/ui/block-result/issue-5500.rs | 6 +- .../borrowck-report-with-custom-diagnostic.rs | 12 +- tests/ui/borrowck/issue-81899.rs | 4 +- .../borrowck/issue-88434-minimal-example.rs | 4 +- ...ssue-88434-removal-index-should-be-less.rs | 4 +- ...ptr-to-trait-obj-different-regions-misc.rs | 2 +- tests/ui/coercion/coerce-mut.rs | 6 +- tests/ui/coercion/coercion-slice.rs | 2 +- tests/ui/coercion/mut-mut-wont-coerce.rs | 2 +- .../const_param_ty_impl_no_structural_eq.rs | 4 +- tests/ui/const-generics/defaults/mismatch.rs | 10 +- .../ui/const-generics/issues/issue-100313.rs | 2 +- .../min_const_generics/invalid-patterns.rs | 4 +- tests/ui/consts/const-array-oob.rs | 2 +- tests/ui/consts/const-err-late.rs | 2 +- tests/ui/consts/const-err-multi.rs | 6 +- .../const-eval/const-eval-overflow-4b.rs | 2 +- .../const-pointer-values-in-various-types.rs | 4 +- .../const-eval/heap/alloc_intrinsic_errors.rs | 4 +- tests/ui/consts/const-eval/issue-44578.rs | 2 +- tests/ui/consts/const-eval/issue-50814-2.rs | 2 +- tests/ui/consts/const-eval/issue-50814.rs | 2 +- .../const-eval/panic-assoc-never-type.rs | 2 +- tests/ui/consts/const-eval/raw-bytes.rs | 24 ++-- tests/ui/consts/const-eval/ub-enum.rs | 2 +- .../consts/const-eval/ub-incorrect-vtable.rs | 12 +- tests/ui/consts/const-eval/ub-int-array.rs | 6 +- tests/ui/consts/const-eval/ub-nonnull.rs | 2 +- tests/ui/consts/const-eval/ub-ref-ptr.rs | 8 +- tests/ui/consts/const-eval/ub-uninhabit.rs | 8 +- tests/ui/consts/const-eval/ub-wide-ptr.rs | 34 +++--- .../const-eval/union-const-eval-field.rs | 2 +- tests/ui/consts/const-eval/union-ub.rs | 2 +- tests/ui/consts/const-eval/unwind-abort.rs | 2 +- .../const-eval/validate_uninhabited_zsts.rs | 2 +- .../const-len-underflow-separate-spans.rs | 2 +- .../consts/const-mut-refs/mut_ref_in_final.rs | 2 +- .../mut_ref_in_final_dynamic_check.rs | 6 +- tests/ui/consts/const-pattern-irrefutable.rs | 16 +-- tests/ui/consts/const-tup-index-span.rs | 2 +- tests/ui/consts/const-unstable-intrinsic.rs | 12 +- tests/ui/consts/const_refs_to_static_fail.rs | 4 +- .../const_refs_to_static_fail_invalid.rs | 12 +- .../ui/consts/issue-17718-const-bad-values.rs | 2 +- tests/ui/consts/issue-39974.rs | 2 +- .../ui/consts/miri_unleashed/assoc_const_2.rs | 2 +- .../miri_unleashed/const_refers_to_static.rs | 2 +- .../const_refers_to_static_cross_crate.rs | 8 +- .../miri_unleashed/mutable_references.rs | 28 ++--- tests/ui/consts/offset_from_ub.rs | 22 ++-- .../interpret-in-const-called-fn.rs | 2 +- .../required-consts/interpret-in-promoted.rs | 2 +- .../required-consts/interpret-in-static.rs | 2 +- .../consts/uninhabited-const-issue-61744.rs | 4 +- .../drop-tracking-parent-expression.rs | 6 +- tests/ui/coroutine/parent-expression.rs | 6 +- tests/ui/cross/cross-borrow-trait.rs | 4 +- tests/ui/destructure-trait-ref.rs | 12 +- tests/ui/diagnostic-width/long-E0529.rs | 2 +- tests/ui/diagnostic-width/long-E0618.rs | 2 +- .../custom-on-unimplemented-diagnostic.rs | 4 +- tests/ui/dst/dst-bad-assign-3.rs | 6 +- tests/ui/dst/dst-bad-assign.rs | 6 +- tests/ui/dst/dst-bad-coerce4.rs | 6 +- tests/ui/empty/empty-never-array.rs | 2 +- .../discriminant-overflow.rs | 10 +- tests/ui/error-codes/E0080.rs | 2 +- tests/ui/error-codes/E0106.rs | 4 +- tests/ui/error-codes/E0428.rs | 2 +- .../explicit-self-lifetime-mismatch.rs | 12 +- tests/ui/expr/if/if-branch-types.rs | 2 +- tests/ui/expr/if/if-without-else-result.rs | 2 +- tests/ui/expr/if/issue-4201.rs | 2 +- tests/ui/fn/fn-item-type.rs | 24 ++-- tests/ui/fn/fn-pointer-mismatch.rs | 22 ++-- tests/ui/fn/fn-trait-formatting.rs | 12 +- .../issue-91370-foreign-fn-block-impl.rs | 4 +- .../fully-qualified-type-name2.rs | 2 +- .../fully-qualified-type-name4.rs | 6 +- .../generics/generic-type-params-name-repr.rs | 36 +++--- .../slightly-nice-generic-literal-messages.rs | 6 +- tests/ui/impl-trait/equality.rs | 2 +- tests/ui/impl-trait/equality2.rs | 16 +-- .../impl-trait/no-method-suggested-traits.rs | 4 +- tests/ui/implied-bounds/sod_service_chain.rs | 10 +- tests/ui/imports/import.rs | 4 +- tests/ui/imports/issue-19498.rs | 6 +- tests/ui/imports/issue-24081.rs | 10 +- tests/ui/imports/issue-26886.rs | 4 +- .../tutorial-suffix-inference-test.rs | 6 +- tests/ui/issues/issue-13359.rs | 4 +- tests/ui/issues/issue-13466.rs | 12 +- tests/ui/issues/issue-14541.rs | 2 +- tests/ui/issues/issue-15094.rs | 4 +- tests/ui/issues/issue-15381.rs | 2 +- tests/ui/issues/issue-15783.rs | 6 +- tests/ui/issues/issue-16401.rs | 6 +- tests/ui/issues/issue-17033.rs | 2 +- tests/ui/issues/issue-17740.rs | 12 +- tests/ui/issues/issue-19991.rs | 2 +- tests/ui/issues/issue-21332.rs | 2 +- tests/ui/issues/issue-24819.rs | 2 +- tests/ui/issues/issue-27942.rs | 4 +- tests/ui/issues/issue-2951.rs | 6 +- tests/ui/issues/issue-31011.rs | 2 +- tests/ui/issues/issue-31910.rs | 4 +- tests/ui/issues/issue-3477.rs | 2 +- tests/ui/issues/issue-3680.rs | 6 +- tests/ui/issues/issue-37884.rs | 2 +- tests/ui/issues/issue-43355.rs | 2 +- tests/ui/issues/issue-4517.rs | 2 +- tests/ui/issues/issue-4935.rs | 2 +- tests/ui/issues/issue-4968.rs | 6 +- tests/ui/issues/issue-5100.rs | 30 ++--- tests/ui/issues/issue-5358-1.rs | 6 +- tests/ui/issues/issue-7061.rs | 4 +- tests/ui/issues/issue-7092.rs | 6 +- tests/ui/issues/issue-7867.rs | 6 +- tests/ui/macros/issue-118786.rs | 2 +- tests/ui/macros/issue-29084.rs | 4 +- tests/ui/match/match-struct.rs | 2 +- ...-same-trait-object-with-separate-params.rs | 10 +- tests/ui/methods/method-self-arg-1.rs | 8 +- tests/ui/mismatched_types/issue-13033.rs | 4 +- .../moves-based-on-type-match-bindings.rs | 4 +- tests/ui/mut/mut-pattern-mismatched.rs | 12 +- tests/ui/never_type/issue-10176.rs | 6 +- tests/ui/noexporttypeexe.rs | 6 +- .../integer-literal-suffix-inference.rs | 104 +++++++++--------- ...hesized-type-arguments-ice-issue-122345.rs | 2 +- tests/ui/parser/do-catch-suggests-try.rs | 2 +- tests/ui/parser/mut-patterns.rs | 8 +- tests/ui/parser/recover/recover-pat-exprs.rs | 2 +- tests/ui/pattern/pattern-error-continue.rs | 4 +- .../experimental/borrowck-errors.rs | 4 +- .../experimental/mut-ref-mut.rs | 2 +- .../experimental/pattern-errors.rs | 104 +++++++++--------- .../ref-binding-on-inh-ref-errors.rs | 6 +- .../experimental/well-typed-edition-2024.rs | 42 +++---- tests/ui/pattern/usefulness/issue-31561.rs | 2 +- tests/ui/pattern/usefulness/issue-39362.rs | 2 +- tests/ui/pattern/usefulness/issue-72377.rs | 2 +- .../usefulness/refutable-pattern-errors.rs | 4 +- .../usefulness/refutable-pattern-in-fn-arg.rs | 2 +- tests/ui/pptypedef.rs | 4 +- tests/ui/privacy/privacy2.rs | 2 +- tests/ui/ptr-coercion.rs | 18 +-- tests/ui/recursion_limit/empty.rs | 4 +- tests/ui/recursion_limit/invalid_digit.rs | 4 +- tests/ui/recursion_limit/overflow.rs | 4 +- tests/ui/repeat-expr/repeat_count.rs | 16 +-- tests/ui/resolve/issue-23716.rs | 4 +- tests/ui/resolve/issue-5035.rs | 2 +- .../resolve-conflict-item-vs-import.rs | 4 +- .../enum_same_crate_empty_match.rs | 12 +- .../omitted-patterns.rs | 8 +- tests/ui/simd/const-err-trumps-simd-err.rs | 2 +- .../structs/default-field-values/failures.rs | 6 +- .../structure-constructor-type-mismatch.rs | 12 +- .../const-pat-non-exaustive-let-new-var.rs | 4 +- tests/ui/traits/bound/same-crate-name.rs | 6 +- tests/ui/traits/impl-method-mismatch.rs | 4 +- tests/ui/tuple/tuple-arity-mismatch.rs | 12 +- tests/ui/type/type-mismatch-multiple.rs | 4 +- tests/ui/type/type-parameter-names.rs | 6 +- .../type/type-params-in-different-spaces-1.rs | 6 +- tests/ui/typeck/issue-16338.rs | 2 +- tests/ui/typeck/suppressed-error.rs | 6 +- .../tag-that-dare-not-speak-its-name.rs | 6 +- tests/ui/typeck/terr-in-field.rs | 2 +- tests/ui/typeck/terr-sorts.rs | 4 +- .../typeck_type_placeholder_mismatch.rs | 12 +- tests/ui/typeof/type_mismatch.rs | 2 +- tests/ui/ufcs/ufcs-explicit-self-bad.rs | 14 +-- tests/ui/unsafe/unsafe-trait-impl.rs | 4 +- ...range-expr-root-of-constant-issue-40749.rs | 4 +- 192 files changed, 803 insertions(+), 764 deletions(-) diff --git a/src/tools/compiletest/src/errors.rs b/src/tools/compiletest/src/errors.rs index 64d68eb7f23e5..8702c365d4d61 100644 --- a/src/tools/compiletest/src/errors.rs +++ b/src/tools/compiletest/src/errors.rs @@ -30,24 +30,18 @@ impl ErrorKind { /// Either the canonical uppercase string, or some additional versions for compatibility. /// FIXME: consider keeping only the canonical versions here. - fn from_user_str(s: &str) -> Option { - Some(match s { - "HELP" | "help" => ErrorKind::Help, + pub fn from_user_str(s: &str) -> ErrorKind { + match s { + "HELP" | "help" | "HELP_NONVIRAL" => ErrorKind::Help, "ERROR" | "error" => ErrorKind::Error, - "NOTE" | "note" => ErrorKind::Note, + "NOTE" | "note" | "NOTE_NONVIRAL" => ErrorKind::Note, "SUGGESTION" => ErrorKind::Suggestion, "WARN" | "WARNING" | "warn" | "warning" => ErrorKind::Warning, - _ => return None, - }) - } - - pub fn expect_from_user_str(s: &str) -> ErrorKind { - ErrorKind::from_user_str(s).unwrap_or_else(|| { - panic!( + _ => panic!( "unexpected diagnostic kind `{s}`, expected \ `ERROR`, `WARN`, `NOTE`, `HELP` or `SUGGESTION`" - ) - }) + ), + } } } @@ -67,24 +61,22 @@ impl fmt::Display for ErrorKind { pub struct Error { pub line_num: Option, /// What kind of message we expect (e.g., warning, error, suggestion). - /// `None` if not specified or unknown message kind. - pub kind: Option, + pub kind: ErrorKind, pub msg: String, /// For some `Error`s, like secondary lines of multi-line diagnostics, line annotations /// are not mandatory, even if they would otherwise be mandatory for primary errors. /// Only makes sense for "actual" errors, not for "expected" errors. pub require_annotation: bool, + /// A temporary measure to avoid adding too many `NOTE` and `HELP` annotations in #NNNNNN. + /// Only makes sense for "expected" errors, not for "found" errors. + pub viral: bool, + pub parent: Option, } impl Error { pub fn render_for_expected(&self) -> String { use colored::Colorize; - format!( - "{: <10}line {: >3}: {}", - self.kind.map(|kind| kind.to_string()).unwrap_or_default(), - self.line_num_str(), - self.msg.cyan(), - ) + format!("{: <10}line {: >3}: {}", self.kind, self.line_num_str(), self.msg.cyan()) } pub fn line_num_str(&self) -> String { @@ -173,9 +165,11 @@ fn parse_expected( // Get the part of the comment after the sigil (e.g. `~^^` or ~|). let tag = captures.get(0).unwrap(); let rest = line[tag.end()..].trim_start(); - let (kind_str, _) = rest.split_once(|c: char| !c.is_ascii_alphabetic()).unwrap_or((rest, "")); + let (kind_str, _) = + rest.split_once(|c: char| c != '_' && !c.is_ascii_alphabetic()).unwrap_or((rest, "")); + let viral = kind_str != "NOTE_NONVIRAL" && kind_str != "HELP_NONVIRAL"; let kind = ErrorKind::from_user_str(kind_str); - let untrimmed_msg = if kind.is_some() { &rest[kind_str.len()..] } else { rest }; + let untrimmed_msg = &rest[kind_str.len()..]; let msg = untrimmed_msg.strip_prefix(':').unwrap_or(untrimmed_msg).trim().to_owned(); let line_num_adjust = &captures["adjust"]; @@ -197,7 +191,10 @@ fn parse_expected( kind, msg ); - Some((follow_prev, Error { line_num, kind, msg, require_annotation: true })) + Some(( + follow_prev, + Error { line_num, kind, msg, require_annotation: true, viral, parent: None }, + )) } #[cfg(test)] diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 01a6ae00825d7..324ed8008521c 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -585,8 +585,7 @@ impl TestProps { if let Some(err_kind) = config.parse_name_value_directive(ln, DONT_REQUIRE_ANNOTATIONS) { - self.require_annotations - .insert(ErrorKind::expect_from_user_str(&err_kind), false); + self.require_annotations.insert(ErrorKind::from_user_str(&err_kind), false); } }, ); diff --git a/src/tools/compiletest/src/json.rs b/src/tools/compiletest/src/json.rs index 62fe538ee32ea..8427f67e98fec 100644 --- a/src/tools/compiletest/src/json.rs +++ b/src/tools/compiletest/src/json.rs @@ -147,7 +147,9 @@ pub fn parse_output(file_name: &str, output: &str, proc_res: &ProcRes) -> Vec(line) { - Ok(diagnostic) => push_actual_errors(&mut errors, &diagnostic, &[], file_name), + Ok(diagnostic) => { + push_actual_errors(&mut errors, &diagnostic, &[], file_name, None) + } Err(error) => { // Ignore the future compat report message - this is handled // by `extract_rendered` @@ -172,6 +174,7 @@ fn push_actual_errors( diagnostic: &Diagnostic, default_spans: &[&DiagnosticSpan], file_name: &str, + prev_parent: Option, ) { // In case of macro expansions, we need to get the span of the callsite let spans_info_in_this_file: Vec<_> = diagnostic @@ -229,26 +232,37 @@ fn push_actual_errors( // Convert multi-line messages into multiple errors. // We expect to replace these with something more structured anyhow. let mut message_lines = diagnostic.message.lines(); - let kind = Some(ErrorKind::from_compiler_str(&diagnostic.level)); + let kind = ErrorKind::from_compiler_str(&diagnostic.level); let first_line = message_lines.next().unwrap_or(&diagnostic.message); + let mut parent = None; if primary_spans.is_empty() { static RE: OnceLock = OnceLock::new(); let re_init = || Regex::new(r"aborting due to \d+ previous errors?|\d+ warnings? emitted").unwrap(); + if parent.is_none() { + parent = Some(errors.len()); + } errors.push(Error { line_num: None, kind, msg: with_code(None, first_line), require_annotation: diagnostic.level != "failure-note" && !RE.get_or_init(re_init).is_match(first_line), + viral: true, + parent: prev_parent, }); } else { for span in primary_spans { + if parent.is_none() { + parent = Some(errors.len()); + } errors.push(Error { line_num: Some(span.line_start), kind, msg: with_code(Some(span), first_line), require_annotation: true, + viral: true, + parent: prev_parent, }); } } @@ -259,6 +273,8 @@ fn push_actual_errors( kind, msg: with_code(None, next_line), require_annotation: false, + viral: true, + parent: prev_parent, }); } else { for span in primary_spans { @@ -267,6 +283,8 @@ fn push_actual_errors( kind, msg: with_code(Some(span), next_line), require_annotation: false, + viral: true, + parent: prev_parent, }); } } @@ -278,9 +296,11 @@ fn push_actual_errors( for (index, line) in suggested_replacement.lines().enumerate() { errors.push(Error { line_num: Some(span.line_start + index), - kind: Some(ErrorKind::Suggestion), + kind: ErrorKind::Suggestion, msg: line.to_string(), require_annotation: true, + viral: true, + parent, }); } } @@ -289,7 +309,7 @@ fn push_actual_errors( // Add notes for the backtrace for span in primary_spans { if let Some(frame) = &span.expansion { - push_backtrace(errors, frame, file_name); + push_backtrace(errors, frame, file_name, parent); } } @@ -297,15 +317,17 @@ fn push_actual_errors( for span in spans_in_this_file.iter().filter(|span| span.label.is_some()) { errors.push(Error { line_num: Some(span.line_start), - kind: Some(ErrorKind::Note), + kind: ErrorKind::Note, msg: span.label.clone().unwrap(), require_annotation: true, + viral: true, + parent, }); } // Flatten out the children. for child in &diagnostic.children { - push_actual_errors(errors, child, primary_spans, file_name); + push_actual_errors(errors, child, primary_spans, file_name, parent); } } @@ -313,17 +335,20 @@ fn push_backtrace( errors: &mut Vec, expansion: &DiagnosticSpanMacroExpansion, file_name: &str, + parent: Option, ) { if Path::new(&expansion.span.file_name) == Path::new(&file_name) { errors.push(Error { line_num: Some(expansion.span.line_start), - kind: Some(ErrorKind::Note), + kind: ErrorKind::Note, msg: format!("in this expansion of {}", expansion.macro_decl_name), require_annotation: true, + viral: true, + parent, }); } if let Some(previous_expansion) = &expansion.span.expansion { - push_backtrace(errors, previous_expansion, file_name); + push_backtrace(errors, previous_expansion, file_name, parent); } } diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 9c03fa141bd36..41db1dc7144aa 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -679,9 +679,7 @@ impl<'test> TestCx<'test> { "check_expected_errors: expected_errors={:?} proc_res.status={:?}", expected_errors, proc_res.status ); - if proc_res.status.success() - && expected_errors.iter().any(|x| x.kind == Some(ErrorKind::Error)) - { + if proc_res.status.success() && expected_errors.iter().any(|x| x.kind == ErrorKind::Error) { self.fatal_proc_rec("process did not return an error status", proc_res); } @@ -709,22 +707,28 @@ impl<'test> TestCx<'test> { self.testpaths.file.display().to_string() }; - let expect_help = expected_errors.iter().any(|ee| ee.kind == Some(ErrorKind::Help)); - let expect_note = expected_errors.iter().any(|ee| ee.kind == Some(ErrorKind::Note)); + // If the testcase being checked contains at least one expected "help" + // message, then we'll ensure that all "help" messages are expected. + // Otherwise, all "help" messages reported by the compiler will be ignored. + // This logic also applies to "note" messages. + let expect_help = expected_errors.iter().any(|ee| ee.kind == ErrorKind::Help && ee.viral); + // let expect_note = expected_errors.iter().any(|ee| ee.kind == ErrorKind::Note && ee.viral); // Parse the JSON output from the compiler and extract out the messages. - let actual_errors = json::parse_output(&diagnostic_file_name, &proc_res.stderr, proc_res); + let mut actual_errors = + json::parse_output(&diagnostic_file_name, &proc_res.stderr, proc_res); let mut unexpected = Vec::new(); let mut found = vec![false; expected_errors.len()]; - for mut actual_error in actual_errors { + let mut unexpected_actual_indices = Vec::new(); + let mut poisoned_parents = HashSet::new(); + for (actual_index, actual_error) in actual_errors.iter_mut().enumerate() { actual_error.msg = self.normalize_output(&actual_error.msg, &[]); let opt_index = expected_errors.iter().enumerate().position(|(index, expected_error)| { !found[index] && actual_error.line_num == expected_error.line_num - && (expected_error.kind.is_none() - || actual_error.kind == expected_error.kind) + && actual_error.kind == expected_error.kind && actual_error.msg.contains(&expected_error.msg) }); @@ -733,25 +737,41 @@ impl<'test> TestCx<'test> { // found a match, everybody is happy assert!(!found[index]); found[index] = true; - } - None => { - // If the test is a known bug, don't require that the error is annotated - if self.is_unexpected_compiler_message(&actual_error, expect_help, expect_note) - { - self.error(&format!( - "{}:{}: unexpected {}: '{}'", - file_name, - actual_error.line_num_str(), - actual_error - .kind - .as_ref() - .map_or(String::from("message"), |k| k.to_string()), - actual_error.msg - )); - unexpected.push(actual_error); + if actual_error.kind == ErrorKind::Note && expected_errors[index].viral { + poisoned_parents.insert(actual_error.parent); } } + + None => unexpected_actual_indices.push(actual_index), + } + } + + for unexpected_actual_index in unexpected_actual_indices { + // If the test is a known bug, don't require that the error is annotated + let actual_error = &actual_errors[unexpected_actual_index]; + let mut expect_note = false; + let mut next_parent = actual_error.parent; + loop { + if poisoned_parents.contains(&next_parent) { + expect_note = true; + break; + } + match next_parent { + Some(next) => next_parent = actual_errors[next].parent, + None => break, + } + } + + if self.is_unexpected_compiler_message(&actual_error, expect_help, expect_note) { + self.error(&format!( + "{}:{}: unexpected {}: '{}'", + file_name, + actual_error.line_num_str(), + actual_error.kind, + actual_error.msg + )); + unexpected.push(actual_error); } } @@ -763,7 +783,7 @@ impl<'test> TestCx<'test> { "{}:{}: expected {} not found: {}", file_name, expected_error.line_num_str(), - expected_error.kind.as_ref().map_or("message".into(), |k| k.to_string()), + expected_error.kind, expected_error.msg )); not_found.push(expected_error); @@ -803,17 +823,15 @@ impl<'test> TestCx<'test> { expect_help: bool, expect_note: bool, ) -> bool { + // If the test being checked doesn't contain any "help" or "note" annotations, then + // we don't require annotating "help" or "note" (respecively) diagnostics at all. actual_error.require_annotation - && actual_error.kind.map_or(false, |err_kind| { - // If the test being checked doesn't contain any "help" or "note" annotations, then - // we don't require annotating "help" or "note" (respecively) diagnostics at all. - let default_require_annotations = self.props.require_annotations[&err_kind]; - match err_kind { - ErrorKind::Help => expect_help && default_require_annotations, - ErrorKind::Note => expect_note && default_require_annotations, - _ => default_require_annotations, - } - }) + && self.props.require_annotations[&actual_error.kind] + && match actual_error.kind { + ErrorKind::Help => expect_help, + ErrorKind::Note => expect_note, + _ => true, + } } fn should_emit_metadata(&self, pm: Option) -> Emit { diff --git a/src/tools/compiletest/src/runtest/ui.rs b/src/tools/compiletest/src/runtest/ui.rs index 974e5170465ec..afbd21babcfeb 100644 --- a/src/tools/compiletest/src/runtest/ui.rs +++ b/src/tools/compiletest/src/runtest/ui.rs @@ -6,8 +6,8 @@ use rustfix::{Filter, apply_suggestions, get_suggestions_from_json}; use tracing::debug; use super::{ - AllowUnused, Emit, ErrorKind, FailMode, LinkToAux, PassMode, TargetLocation, TestCx, - TestOutput, Truncated, UI_FIXED, WillExecute, + AllowUnused, Emit, FailMode, LinkToAux, PassMode, TargetLocation, TestCx, TestOutput, + Truncated, UI_FIXED, WillExecute, }; use crate::{errors, json}; @@ -176,7 +176,7 @@ impl TestCx<'_> { let msg = format!( "line {}: cannot combine `--error-format` with {} annotations; use `error-pattern` instead", expected_errors[0].line_num_str(), - expected_errors[0].kind.unwrap_or(ErrorKind::Error), + expected_errors[0].kind, ); self.fatal(&msg); } diff --git a/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs index 73a68777c6d89..3371a788ff753 100644 --- a/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs +++ b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs @@ -3,10 +3,10 @@ use std::ops::Index; pub fn next<'a, T>(s: &'a mut dyn SVec) { - //~^ expected 1 lifetime argument - //~| expected 1 generic argument + //~^ NOTE_NONVIRAL expected 1 lifetime argument + //~| NOTE_NONVIRAL expected 1 generic argument //~| ERROR the trait `SVec` is not dyn compatible - //~| `SVec` is not dyn compatible + //~| NOTE_NONVIRAL `SVec` is not dyn compatible //~| ERROR missing generics for associated type `SVec::Item` //~| ERROR missing generics for associated type `SVec::Item` let _ = s; @@ -14,8 +14,8 @@ pub fn next<'a, T>(s: &'a mut dyn SVec) { pub trait SVec: Index< ::Item, - //~^ expected 1 lifetime argument - //~| expected 1 generic argument + //~^ NOTE_NONVIRAL expected 1 lifetime argument + //~| NOTE_NONVIRAL expected 1 generic argument //~| ERROR missing generics for associated type `SVec::Item` //~| ERROR missing generics for associated type `SVec::Item` //~| ERROR missing generics for associated type `SVec::Item` @@ -25,8 +25,8 @@ pub trait SVec: Index< //~| ERROR missing generics for associated type `SVec::Item` //~| ERROR missing generics for associated type `SVec::Item` Output = ::Item, - //~^ expected 1 lifetime argument - //~| expected 1 generic argument + //~^ NOTE_NONVIRAL expected 1 lifetime argument + //~| NOTE_NONVIRAL expected 1 generic argument //~| ERROR missing generics for associated type `SVec::Item` //~| ERROR missing generics for associated type `SVec::Item` //~| ERROR missing generics for associated type `SVec::Item` @@ -36,16 +36,16 @@ pub trait SVec: Index< //~| ERROR missing generics for associated type `SVec::Item` //~| ERROR missing generics for associated type `SVec::Item` Output = ::Item> as SVec>::Item, - //~^ expected 1 lifetime argument - //~| expected 1 generic argument - //~| expected 1 lifetime argument + //~^ NOTE_NONVIRAL expected 1 lifetime argument + //~| NOTE_NONVIRAL expected 1 generic argument + //~| NOTE_NONVIRAL expected 1 lifetime argument //~| ERROR missing generics for associated type `SVec::Item` //~| ERROR missing generics for associated type `SVec::Item` //~| ERROR missing generics for associated type `SVec::Item` //~| ERROR missing generics for associated type `SVec::Item` //~| ERROR missing generics for associated type `SVec::Item` //~| ERROR missing generics for associated type `SVec::Item` - //~| expected 1 generic argument + //~| NOTE_NONVIRAL expected 1 generic argument //~| ERROR missing generics for associated type `SVec::Item` //~| ERROR missing generics for associated type `SVec::Item` //~| ERROR missing generics for associated type `SVec::Item` @@ -60,8 +60,8 @@ pub trait SVec: Index< type Item<'a, T>; fn len(&self) -> ::Item; - //~^ expected 1 lifetime argument + //~^ NOTE_NONVIRAL expected 1 lifetime argument //~| ERROR missing generics for associated type `SVec::Item` - //~| expected 1 generic argument + //~| NOTE_NONVIRAL expected 1 generic argument //~| ERROR missing generics for associated type `SVec::Item` } diff --git a/tests/ui/array-slice-vec/array-not-vector.rs b/tests/ui/array-slice-vec/array-not-vector.rs index d8b5b10d59148..cbd021d3ecd64 100644 --- a/tests/ui/array-slice-vec/array-not-vector.rs +++ b/tests/ui/array-slice-vec/array-not-vector.rs @@ -1,12 +1,12 @@ fn main() { let _x: i32 = [1, 2, 3]; //~^ ERROR mismatched types - //~| expected `i32`, found `[{integer}; 3]` + //~| NOTE_NONVIRAL expected `i32`, found `[{integer}; 3]` let x: &[i32] = &[1, 2, 3]; let _y: &i32 = x; //~^ ERROR mismatched types - //~| expected reference `&i32` - //~| found reference `&[i32]` - //~| expected `&i32`, found `&[i32]` + //~| NOTE_NONVIRAL expected reference `&i32` + //~| NOTE_NONVIRAL found reference `&[i32]` + //~| NOTE_NONVIRAL expected `&i32`, found `&[i32]` } diff --git a/tests/ui/array-slice-vec/slice-mut.rs b/tests/ui/array-slice-vec/slice-mut.rs index e9989f0f48131..7f796be239201 100644 --- a/tests/ui/array-slice-vec/slice-mut.rs +++ b/tests/ui/array-slice-vec/slice-mut.rs @@ -6,7 +6,7 @@ fn main() { let y: &mut[_] = &x[2..4]; //~^ ERROR mismatched types - //~| expected mutable reference `&mut [_]` - //~| found reference `&[isize]` - //~| types differ in mutability + //~| NOTE_NONVIRAL expected mutable reference `&mut [_]` + //~| NOTE_NONVIRAL found reference `&[isize]` + //~| NOTE_NONVIRAL types differ in mutability } diff --git a/tests/ui/associated-consts/defaults-not-assumed-fail.rs b/tests/ui/associated-consts/defaults-not-assumed-fail.rs index 3dc709cf633a7..e13c1857df639 100644 --- a/tests/ui/associated-consts/defaults-not-assumed-fail.rs +++ b/tests/ui/associated-consts/defaults-not-assumed-fail.rs @@ -31,7 +31,7 @@ impl Tr for u32 { fn main() { assert_eq!(<() as Tr>::A, 255); assert_eq!(<() as Tr>::B, 0); // causes the error above - //~^ constant + //~^ NOTE_NONVIRAL constant assert_eq!(::A, 254); assert_eq!(::B, 255); diff --git a/tests/ui/associated-types/associated-types-eq-3.rs b/tests/ui/associated-types/associated-types-eq-3.rs index 380d0e95c13f3..63caf444e91ad 100644 --- a/tests/ui/associated-types/associated-types-eq-3.rs +++ b/tests/ui/associated-types/associated-types-eq-3.rs @@ -22,9 +22,9 @@ fn foo1>(x: I) { fn foo2(x: I) { let _: Bar = x.boo(); //~^ ERROR mismatched types - //~| found associated type `::A` - //~| expected `Bar`, found - //~| expected struct `Bar` + //~| NOTE_NONVIRAL found associated type `::A` + //~| NOTE_NONVIRAL expected `Bar`, found + //~| NOTE_NONVIRAL expected struct `Bar` } diff --git a/tests/ui/associated-types/associated-types-path-2.rs b/tests/ui/associated-types/associated-types-path-2.rs index c993e1d27202d..0de48db0bc3dc 100644 --- a/tests/ui/associated-types/associated-types-path-2.rs +++ b/tests/ui/associated-types/associated-types-path-2.rs @@ -18,7 +18,7 @@ pub fn f2(a: T) -> T::A { pub fn f1_int_int() { f1(2i32, 4i32); //~^ ERROR mismatched types - //~| expected `u32`, found `i32` + //~| NOTE_NONVIRAL expected `u32`, found `i32` } pub fn f1_int_uint() { @@ -40,7 +40,7 @@ pub fn f1_uint_int() { pub fn f2_int() { let _: i32 = f2(2i32); //~^ ERROR mismatched types - //~| expected `i32`, found `u32` + //~| NOTE_NONVIRAL expected `i32`, found `u32` } pub fn main() { } diff --git a/tests/ui/associated-types/substs-ppaux.rs b/tests/ui/associated-types/substs-ppaux.rs index 302a6b345e49b..696f567d64d10 100644 --- a/tests/ui/associated-types/substs-ppaux.rs +++ b/tests/ui/associated-types/substs-ppaux.rs @@ -22,35 +22,35 @@ where { let x: () = >::bar::<'static, char>; //[verbose]~^ ERROR mismatched types - //[verbose]~| expected unit type `()` - //[verbose]~| found fn item `fn() {>::bar::<'static, char>}` + //[verbose]~| NOTE_NONVIRAL expected unit type `()` + //[verbose]~| NOTE_NONVIRAL found fn item `fn() {>::bar::<'static, char>}` //[normal]~^^^^ ERROR mismatched types - //[normal]~| expected unit type `()` - //[normal]~| found fn item `fn() {>::bar::<'static, char>}` + //[normal]~| NOTE_NONVIRAL expected unit type `()` + //[normal]~| NOTE_NONVIRAL found fn item `fn() {>::bar::<'static, char>}` let x: () = >::bar::<'static, char>; //[verbose]~^ ERROR mismatched types - //[verbose]~| expected unit type `()` - //[verbose]~| found fn item `fn() {>::bar::<'static, char>}` + //[verbose]~| NOTE_NONVIRAL expected unit type `()` + //[verbose]~| NOTE_NONVIRAL found fn item `fn() {>::bar::<'static, char>}` //[normal]~^^^^ ERROR mismatched types - //[normal]~| expected unit type `()` - //[normal]~| found fn item `fn() {>::bar::<'static, char>}` + //[normal]~| NOTE_NONVIRAL expected unit type `()` + //[normal]~| NOTE_NONVIRAL found fn item `fn() {>::bar::<'static, char>}` let x: () = >::baz; //[verbose]~^ ERROR mismatched types - //[verbose]~| expected unit type `()` - //[verbose]~| found fn item `fn() {>::baz}` + //[verbose]~| NOTE_NONVIRAL expected unit type `()` + //[verbose]~| NOTE_NONVIRAL found fn item `fn() {>::baz}` //[normal]~^^^^ ERROR mismatched types - //[normal]~| expected unit type `()` - //[normal]~| found fn item `fn() {>::baz}` + //[normal]~| NOTE_NONVIRAL expected unit type `()` + //[normal]~| NOTE_NONVIRAL found fn item `fn() {>::baz}` let x: () = foo::<'static>; //[verbose]~^ ERROR mismatched types - //[verbose]~| expected unit type `()` - //[verbose]~| found fn item `fn() {foo::<'static>}` + //[verbose]~| NOTE_NONVIRAL expected unit type `()` + //[verbose]~| NOTE_NONVIRAL found fn item `fn() {foo::<'static>}` //[normal]~^^^^ ERROR mismatched types - //[normal]~| expected unit type `()` - //[normal]~| found fn item `fn() {foo::<'static>}` + //[normal]~| NOTE_NONVIRAL expected unit type `()` + //[normal]~| NOTE_NONVIRAL found fn item `fn() {foo::<'static>}` >::bar; //[verbose]~^ ERROR the trait bound `str: Foo<'?0, '?1, u8>` is not satisfied diff --git a/tests/ui/binop/shift-various-bad-types.rs b/tests/ui/binop/shift-various-bad-types.rs index 31224bbca1efc..712b13575e81a 100644 --- a/tests/ui/binop/shift-various-bad-types.rs +++ b/tests/ui/binop/shift-various-bad-types.rs @@ -24,7 +24,7 @@ fn foo(p: &Panolpy) { // Type of the result follows the LHS, not the RHS: let _: i32 = 22_i64 >> 1_i32; //~^ ERROR mismatched types - //~| expected `i32`, found `i64` + //~| NOTE_NONVIRAL expected `i32`, found `i64` } fn main() { diff --git a/tests/ui/blind/blind-item-item-shadow.rs b/tests/ui/blind/blind-item-item-shadow.rs index 82d07ea70919b..a6fa3ade13830 100644 --- a/tests/ui/blind/blind-item-item-shadow.rs +++ b/tests/ui/blind/blind-item-item-shadow.rs @@ -2,6 +2,6 @@ mod foo { pub mod foo { } } use foo::foo; //~^ ERROR the name `foo` is defined multiple times -//~| `foo` reimported here +//~| NOTE_NONVIRAL `foo` reimported here fn main() {} diff --git a/tests/ui/block-result/block-must-not-have-result-while.rs b/tests/ui/block-result/block-must-not-have-result-while.rs index 418059bf280ea..4226526942f6f 100644 --- a/tests/ui/block-result/block-must-not-have-result-while.rs +++ b/tests/ui/block-result/block-must-not-have-result-while.rs @@ -1,6 +1,6 @@ fn main() { while true { //~ WARN denote infinite loops with true //~ ERROR mismatched types - //~| expected `()`, found `bool` + //~| NOTE_NONVIRAL expected `()`, found `bool` } } diff --git a/tests/ui/block-result/issue-13624.rs b/tests/ui/block-result/issue-13624.rs index 8f93e5a356fa6..ab3aed1e649f3 100644 --- a/tests/ui/block-result/issue-13624.rs +++ b/tests/ui/block-result/issue-13624.rs @@ -6,7 +6,7 @@ mod a { pub fn get_enum_struct_variant() -> () { Enum::EnumStructVariant { x: 1, y: 2, z: 3 } //~^ ERROR mismatched types - //~| expected `()`, found `Enum` + //~| NOTE_NONVIRAL expected `()`, found `Enum` } } @@ -19,7 +19,7 @@ mod b { match enum_struct_variant { a::Enum::EnumStructVariant { x, y, z } => { //~^ ERROR mismatched types - //~| expected `()`, found `Enum` + //~| NOTE_NONVIRAL expected `()`, found `Enum` } } } diff --git a/tests/ui/block-result/issue-5500.rs b/tests/ui/block-result/issue-5500.rs index de7fd39a20caa..f383986746026 100644 --- a/tests/ui/block-result/issue-5500.rs +++ b/tests/ui/block-result/issue-5500.rs @@ -1,7 +1,7 @@ fn main() { &panic!() //~^ ERROR mismatched types - //~| expected unit type `()` - //~| found reference `&_` - //~| expected `()`, found `&_` + //~| NOTE_NONVIRAL expected unit type `()` + //~| NOTE_NONVIRAL found reference `&_` + //~| NOTE_NONVIRAL expected `()`, found `&_` } diff --git a/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.rs b/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.rs index 9d323bf0324ee..26b4654ac5181 100644 --- a/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.rs +++ b/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.rs @@ -3,9 +3,9 @@ fn main() { // Original borrow ends at end of function let mut x = 1; let y = &mut x; - //~^ mutable borrow occurs here + //~^ NOTE_NONVIRAL mutable borrow occurs here let z = &x; //~ ERROR cannot borrow - //~^ immutable borrow occurs here + //~^ NOTE_NONVIRAL immutable borrow occurs here z.use_ref(); y.use_mut(); } @@ -16,9 +16,9 @@ fn foo() { // Original borrow ends at end of match arm let mut x = 1; let y = &x; - //~^ immutable borrow occurs here + //~^ NOTE_NONVIRAL immutable borrow occurs here let z = &mut x; //~ ERROR cannot borrow - //~^ mutable borrow occurs here + //~^ NOTE_NONVIRAL mutable borrow occurs here z.use_mut(); y.use_ref(); } @@ -31,9 +31,9 @@ fn bar() { || { let mut x = 1; let y = &mut x; - //~^ first mutable borrow occurs here + //~^ NOTE_NONVIRAL first mutable borrow occurs here let z = &mut x; //~ ERROR cannot borrow - //~^ second mutable borrow occurs here + //~^ NOTE_NONVIRAL second mutable borrow occurs here z.use_mut(); y.use_mut(); }; diff --git a/tests/ui/borrowck/issue-81899.rs b/tests/ui/borrowck/issue-81899.rs index 380c03751f504..ab0218598c908 100644 --- a/tests/ui/borrowck/issue-81899.rs +++ b/tests/ui/borrowck/issue-81899.rs @@ -2,13 +2,13 @@ // The `panic!()` below is important to trigger the fixed ICE. const _CONST: &[u8] = &f(&[], |_| {}); //~ ERROR evaluation of constant value failed -//~^ constant +//~^ NOTE_NONVIRAL constant const fn f(_: &[u8], _: F) -> &[u8] where F: FnMut(&u8), { - panic!() //~ inside `f + panic!() //~ NOTE_NONVIRAL inside `f } fn main() {} diff --git a/tests/ui/borrowck/issue-88434-minimal-example.rs b/tests/ui/borrowck/issue-88434-minimal-example.rs index ebaa9a92273b7..0fb983f8bc69a 100644 --- a/tests/ui/borrowck/issue-88434-minimal-example.rs +++ b/tests/ui/borrowck/issue-88434-minimal-example.rs @@ -1,13 +1,13 @@ // Regression test related to issue 88434 const _CONST: &() = &f(&|_| {}); //~ ERROR evaluation of constant value failed -//~^ constant +//~^ NOTE_NONVIRAL constant const fn f(_: &F) where F: FnMut(&u8), { - panic!() //~ inside `f + panic!() //~ NOTE_NONVIRAL inside `f } fn main() { } diff --git a/tests/ui/borrowck/issue-88434-removal-index-should-be-less.rs b/tests/ui/borrowck/issue-88434-removal-index-should-be-less.rs index 8d042630424b8..a102deb95a1b6 100644 --- a/tests/ui/borrowck/issue-88434-removal-index-should-be-less.rs +++ b/tests/ui/borrowck/issue-88434-removal-index-should-be-less.rs @@ -1,13 +1,13 @@ // Regression test for issue 88434 const _CONST: &[u8] = &f(&[], |_| {}); //~ ERROR evaluation of constant value failed -//~^ constant +//~^ NOTE_NONVIRAL constant const fn f(_: &[u8], _: F) -> &[u8] where F: FnMut(&u8), { - panic!() //~ inside `f + panic!() //~ NOTE_NONVIRAL inside `f } fn main() { } diff --git a/tests/ui/cast/ptr-to-trait-obj-different-regions-misc.rs b/tests/ui/cast/ptr-to-trait-obj-different-regions-misc.rs index f8910c944c61e..d237e4bf04339 100644 --- a/tests/ui/cast/ptr-to-trait-obj-different-regions-misc.rs +++ b/tests/ui/cast/ptr-to-trait-obj-different-regions-misc.rs @@ -18,7 +18,7 @@ fn change_lt_ba<'a, 'b: 'a>(x: *mut dyn Trait<'a>) -> *mut dyn Trait<'b> { fn change_lt_hr<'a>(x: *mut dyn Trait<'a>) -> *mut dyn for<'b> Trait<'b> { x as _ //~ error: lifetime may not live long enough //~^ error: mismatched types - //~| one type is more general than the other + //~| NOTE_NONVIRAL one type is more general than the other } trait Assocked { diff --git a/tests/ui/coercion/coerce-mut.rs b/tests/ui/coercion/coerce-mut.rs index 43f0b55856d3c..b0784a610a207 100644 --- a/tests/ui/coercion/coerce-mut.rs +++ b/tests/ui/coercion/coerce-mut.rs @@ -4,7 +4,7 @@ fn main() { let x = 0; f(&x); //~^ ERROR mismatched types - //~| expected mutable reference `&mut i32` - //~| found reference `&{integer}` - //~| types differ in mutability + //~| NOTE_NONVIRAL expected mutable reference `&mut i32` + //~| NOTE_NONVIRAL found reference `&{integer}` + //~| NOTE_NONVIRAL types differ in mutability } diff --git a/tests/ui/coercion/coercion-slice.rs b/tests/ui/coercion/coercion-slice.rs index b99235dd37f89..8df4378cde60e 100644 --- a/tests/ui/coercion/coercion-slice.rs +++ b/tests/ui/coercion/coercion-slice.rs @@ -3,5 +3,5 @@ fn main() { let _: &[i32] = [0]; //~^ ERROR mismatched types - //~| expected `&[i32]`, found `[{integer}; 1]` + //~| NOTE_NONVIRAL expected `&[i32]`, found `[{integer}; 1]` } diff --git a/tests/ui/coercion/mut-mut-wont-coerce.rs b/tests/ui/coercion/mut-mut-wont-coerce.rs index 33016e1e48a8d..27f512c061cc7 100644 --- a/tests/ui/coercion/mut-mut-wont-coerce.rs +++ b/tests/ui/coercion/mut-mut-wont-coerce.rs @@ -34,7 +34,7 @@ fn make_foo(_: *mut *mut Foo) { fn main() { let mut result: SmartPtr = SmartPtr(std::ptr::null_mut()); make_foo(&mut &mut *result); //~ ERROR mismatched types - //~^ expected `*mut *mut Foo`, found `&mut &mut Foo` + //~^ NOTE_NONVIRAL expected `*mut *mut Foo`, found `&mut &mut Foo` make_foo(out(&mut result)); // works, but makes one wonder why above coercion cannot happen } diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs index 761a6387a24e9..e743b78fd134b 100644 --- a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs @@ -9,11 +9,11 @@ struct CantParam(ImplementsConstParamTy); impl std::marker::UnsizedConstParamTy for CantParam {} //~^ error: the type `CantParam` does not `#[derive(PartialEq)]` -//~| the trait bound `CantParam: Eq` is not satisfied +//~| ERROR the trait bound `CantParam: Eq` is not satisfied #[derive(std::marker::UnsizedConstParamTy)] //~^ error: the type `CantParamDerive` does not `#[derive(PartialEq)]` -//~| the trait bound `CantParamDerive: Eq` is not satisfied +//~| ERROR the trait bound `CantParamDerive: Eq` is not satisfied struct CantParamDerive(ImplementsConstParamTy); fn check() {} diff --git a/tests/ui/const-generics/defaults/mismatch.rs b/tests/ui/const-generics/defaults/mismatch.rs index 3e35c2060b1e0..2692b0dc6f034 100644 --- a/tests/ui/const-generics/defaults/mismatch.rs +++ b/tests/ui/const-generics/defaults/mismatch.rs @@ -6,17 +6,17 @@ pub struct Example4; fn main() { let e: Example<13> = (); //~^ ERROR mismatched types - //~| expected struct `Example` + //~| NOTE_NONVIRAL expected struct `Example` let e: Example2 = (); //~^ ERROR mismatched types - //~| expected struct `Example2` + //~| NOTE_NONVIRAL expected struct `Example2` let e: Example3<13, u32> = (); //~^ ERROR mismatched types - //~| expected struct `Example3` + //~| NOTE_NONVIRAL expected struct `Example3` let e: Example3<7> = (); //~^ ERROR mismatched types - //~| expected struct `Example3<7>` + //~| NOTE_NONVIRAL expected struct `Example3<7>` let e: Example4<7> = (); //~^ ERROR mismatched types - //~| expected struct `Example4<7>` + //~| NOTE_NONVIRAL expected struct `Example4<7>` } diff --git a/tests/ui/const-generics/issues/issue-100313.rs b/tests/ui/const-generics/issues/issue-100313.rs index 7ce2a3b908c59..5e42878dcc83e 100644 --- a/tests/ui/const-generics/issues/issue-100313.rs +++ b/tests/ui/const-generics/issues/issue-100313.rs @@ -6,7 +6,7 @@ struct T; impl T { const fn set_false(&self) { unsafe { - *(B as *const bool as *mut bool) = false; //~ inside `T + *(B as *const bool as *mut bool) = false; //~ NOTE_NONVIRAL inside `T } } } diff --git a/tests/ui/const-generics/min_const_generics/invalid-patterns.rs b/tests/ui/const-generics/min_const_generics/invalid-patterns.rs index a9d2a8a5dd7a4..d99ddaef44367 100644 --- a/tests/ui/const-generics/min_const_generics/invalid-patterns.rs +++ b/tests/ui/const-generics/min_const_generics/invalid-patterns.rs @@ -37,11 +37,11 @@ fn main() { get_flag::(); //~^ ERROR evaluation of constant value failed - //~| uninitialized + //~| NOTE_NONVIRAL uninitialized get_flag::<{ unsafe { bool_raw.boolean } }, 'z'>(); //~^ ERROR it is undefined behavior get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>(); //~^ ERROR evaluation of constant value failed - //~| uninitialized + //~| NOTE_NONVIRAL uninitialized //~| ERROR it is undefined behavior } diff --git a/tests/ui/consts/const-array-oob.rs b/tests/ui/consts/const-array-oob.rs index cf3db077e36ee..3639206fc7521 100644 --- a/tests/ui/consts/const-array-oob.rs +++ b/tests/ui/consts/const-array-oob.rs @@ -4,7 +4,7 @@ const BAR: usize = FOO[5]; const BLUB: [u32; FOO[4]] = [5, 6]; //~^ ERROR evaluation of constant value failed [E0080] -//~| index out of bounds: the length is 3 but the index is 4 +//~| NOTE_NONVIRAL index out of bounds: the length is 3 but the index is 4 fn main() { let _ = BAR; diff --git a/tests/ui/consts/const-err-late.rs b/tests/ui/consts/const-err-late.rs index 6dff2c101a089..f10feddd849d2 100644 --- a/tests/ui/consts/const-err-late.rs +++ b/tests/ui/consts/const-err-late.rs @@ -16,5 +16,5 @@ impl S { } fn main() { - black_box((S::::FOO, S::::FOO)); //~ constant + black_box((S::::FOO, S::::FOO)); //~ NOTE_NONVIRAL constant } diff --git a/tests/ui/consts/const-err-multi.rs b/tests/ui/consts/const-err-multi.rs index b265bc4c4d84f..bda4a6a1b2d33 100644 --- a/tests/ui/consts/const-err-multi.rs +++ b/tests/ui/consts/const-err-multi.rs @@ -1,11 +1,11 @@ pub const A: i8 = -i8::MIN; //~^ ERROR constant pub const B: i8 = A; -//~^ constant +//~^ NOTE_NONVIRAL constant pub const C: u8 = A as u8; -//~^ constant +//~^ NOTE_NONVIRAL constant pub const D: i8 = 50 - A; -//~^ constant +//~^ NOTE_NONVIRAL constant fn main() { let _ = (A, B, C, D); diff --git a/tests/ui/consts/const-eval/const-eval-overflow-4b.rs b/tests/ui/consts/const-eval/const-eval-overflow-4b.rs index ce9c980de0dd2..efbbd543c3150 100644 --- a/tests/ui/consts/const-eval/const-eval-overflow-4b.rs +++ b/tests/ui/consts/const-eval/const-eval-overflow-4b.rs @@ -8,7 +8,7 @@ const A_I8_T : [u32; (i8::MAX as i8 + 1u8) as usize] //~^ ERROR mismatched types - //~| expected `i8`, found `u8` + //~| NOTE_NONVIRAL expected `i8`, found `u8` //~| ERROR cannot add `u8` to `i8` = [0; (i8::MAX as usize) + 1]; diff --git a/tests/ui/consts/const-eval/const-pointer-values-in-various-types.rs b/tests/ui/consts/const-eval/const-pointer-values-in-various-types.rs index d6b6d42780743..cbbc28e298c32 100644 --- a/tests/ui/consts/const-eval/const-pointer-values-in-various-types.rs +++ b/tests/ui/consts/const-eval/const-pointer-values-in-various-types.rs @@ -40,7 +40,7 @@ fn main() { const I32_REF_U128_UNION: u128 = unsafe { Nonsense { int_32_ref: &3 }.uint_128 }; //~^ ERROR evaluation of constant value failed - //~| uninitialized + //~| NOTE_NONVIRAL uninitialized const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 }; //~^ ERROR evaluation of constant value failed @@ -56,7 +56,7 @@ fn main() { const I32_REF_I128_UNION: i128 = unsafe { Nonsense { int_32_ref: &3 }.int_128 }; //~^ ERROR evaluation of constant value failed - //~| uninitialized + //~| NOTE_NONVIRAL uninitialized const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.float_32 }; //~^ ERROR evaluation of constant value failed diff --git a/tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.rs b/tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.rs index c1a544031c2a5..6cd0c95fbf1ef 100644 --- a/tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.rs +++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.rs @@ -2,10 +2,10 @@ #![feature(const_heap)] use std::intrinsics; -const FOO: i32 = foo(); //~ error: evaluation of constant value failed +const FOO: i32 = foo(); //~ ERROR evaluation of constant value failed const fn foo() -> i32 { unsafe { - let _ = intrinsics::const_allocate(4, 3) as *mut i32; //~ inside `foo` + let _ = intrinsics::const_allocate(4, 3) as *mut i32; //~ NOTE_NONVIRAL inside `foo` } 1 } diff --git a/tests/ui/consts/const-eval/issue-44578.rs b/tests/ui/consts/const-eval/issue-44578.rs index 945bf93f8faad..e1f5ec1352833 100644 --- a/tests/ui/consts/const-eval/issue-44578.rs +++ b/tests/ui/consts/const-eval/issue-44578.rs @@ -23,5 +23,5 @@ impl Foo for u16 { fn main() { println!("{}", as Foo>::AMT); - //~^ constant + //~^ NOTE_NONVIRAL constant } diff --git a/tests/ui/consts/const-eval/issue-50814-2.rs b/tests/ui/consts/const-eval/issue-50814-2.rs index c2e2de67a6517..78e32caccddd5 100644 --- a/tests/ui/consts/const-eval/issue-50814-2.rs +++ b/tests/ui/consts/const-eval/issue-50814-2.rs @@ -17,7 +17,7 @@ impl Foo for A { } fn foo() -> &'static usize { - & as Foo>::BAR //~ constant + & as Foo>::BAR //~ NOTE_NONVIRAL constant } impl C for () { diff --git a/tests/ui/consts/const-eval/issue-50814.rs b/tests/ui/consts/const-eval/issue-50814.rs index 27b5b39ad7371..422e550aa2e3c 100644 --- a/tests/ui/consts/const-eval/issue-50814.rs +++ b/tests/ui/consts/const-eval/issue-50814.rs @@ -19,7 +19,7 @@ impl Unsigned for Sum { fn foo(_: T) -> &'static u8 { &Sum::::MAX - //~^ constant + //~^ NOTE_NONVIRAL constant } fn main() { diff --git a/tests/ui/consts/const-eval/panic-assoc-never-type.rs b/tests/ui/consts/const-eval/panic-assoc-never-type.rs index bdaa51494b981..34de668a665d7 100644 --- a/tests/ui/consts/const-eval/panic-assoc-never-type.rs +++ b/tests/ui/consts/const-eval/panic-assoc-never-type.rs @@ -11,5 +11,5 @@ impl PrintName { } fn main() { - let _ = PrintName::VOID; //~ erroneous constant encountered + let _ = PrintName::VOID; //~ NOTE_NONVIRAL erroneous constant encountered } diff --git a/tests/ui/consts/const-eval/raw-bytes.rs b/tests/ui/consts/const-eval/raw-bytes.rs index 9187de5636202..57eed10a507a7 100644 --- a/tests/ui/consts/const-eval/raw-bytes.rs +++ b/tests/ui/consts/const-eval/raw-bytes.rs @@ -83,11 +83,11 @@ const NULL_FAT_PTR: NonNull = unsafe { const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) }; //~^ ERROR it is undefined behavior to use this value -//~| constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1) +//~| NOTE_NONVIRAL constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1) const UNALIGNED_BOX: Box = unsafe { mem::transmute(&[0u8; 4]) }; //~^ ERROR it is undefined behavior to use this value -//~| constructing invalid value: encountered an unaligned box (required 2 byte alignment but found 1) +//~| NOTE_NONVIRAL constructing invalid value: encountered an unaligned box (required 2 byte alignment but found 1) const NULL: &u16 = unsafe { mem::transmute(0usize) }; //~^ ERROR it is undefined behavior to use this value @@ -161,44 +161,44 @@ const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999usize)) // bad data *inside* the slice const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; //~^ ERROR it is undefined behavior to use this value -//~| constant +//~| NOTE_NONVIRAL constant // bad: sized field is not okay const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); //~^ ERROR it is undefined behavior to use this value -//~| constant +//~| NOTE_NONVIRAL constant // bad: unsized part is not okay const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); //~^ ERROR it is undefined behavior to use this value -//~| constant +//~| NOTE_NONVIRAL constant // bad trait object const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) }; //~^ ERROR it is undefined behavior to use this value -//~| expected a vtable +//~| NOTE_NONVIRAL expected a vtable // bad trait object const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) }; //~^ ERROR it is undefined behavior to use this value -//~| expected a vtable +//~| NOTE_NONVIRAL expected a vtable // bad trait object const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, 4usize))) }; //~^ ERROR it is undefined behavior to use this value -//~| expected a vtable +//~| NOTE_NONVIRAL expected a vtable const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) }; //~^ ERROR it is undefined behavior to use this value -//~| expected a vtable +//~| NOTE_NONVIRAL expected a vtable // bad data *inside* the trait object const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, &bool>(&3u8) }; //~^ ERROR it is undefined behavior to use this value -//~| expected a boolean +//~| NOTE_NONVIRAL expected a boolean const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) }; //~^ ERROR it is undefined behavior to use this value -//~| null pointer +//~| NOTE_NONVIRAL null pointer const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) }; //~^ ERROR it is undefined behavior to use this value -//~| vtable +//~| NOTE_NONVIRAL vtable // Uninhabited types const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; //~ ERROR undefined behavior diff --git a/tests/ui/consts/const-eval/ub-enum.rs b/tests/ui/consts/const-eval/ub-enum.rs index 5be444e667a1f..09cd2b85784b4 100644 --- a/tests/ui/consts/const-eval/ub-enum.rs +++ b/tests/ui/consts/const-eval/ub-enum.rs @@ -58,7 +58,7 @@ union MaybeUninit { } const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init }; //~^ ERROR evaluation of constant value failed -//~| uninitialized +//~| NOTE_NONVIRAL uninitialized // Pointer value in an enum with a niche that is not just 0. const BAD_ENUM2_OPTION_PTR: Option = unsafe { mem::transmute(&0) }; diff --git a/tests/ui/consts/const-eval/ub-incorrect-vtable.rs b/tests/ui/consts/const-eval/ub-incorrect-vtable.rs index 8058f7693a71c..1d3ef7bd9cc59 100644 --- a/tests/ui/consts/const-eval/ub-incorrect-vtable.rs +++ b/tests/ui/consts/const-eval/ub-incorrect-vtable.rs @@ -18,12 +18,12 @@ trait Trait {} const INVALID_VTABLE_ALIGNMENT: &dyn Trait = unsafe { std::mem::transmute((&92u8, &[0usize, 1usize, 1000usize])) }; //~^^ ERROR it is undefined behavior to use this value -//~| vtable +//~| NOTE_NONVIRAL vtable const INVALID_VTABLE_SIZE: &dyn Trait = unsafe { std::mem::transmute((&92u8, &[1usize, usize::MAX, 1usize])) }; //~^^ ERROR it is undefined behavior to use this value -//~| vtable +//~| NOTE_NONVIRAL vtable #[repr(transparent)] struct W(T); @@ -33,18 +33,18 @@ fn drop_me(_: *mut usize) {} const INVALID_VTABLE_ALIGNMENT_UB: W<&dyn Trait> = unsafe { std::mem::transmute((&92u8, &(drop_me as fn(*mut usize), 1usize, 1000usize))) }; //~^^ ERROR it is undefined behavior to use this value -//~| expected a vtable pointer +//~| NOTE_NONVIRAL expected a vtable pointer const INVALID_VTABLE_SIZE_UB: W<&dyn Trait> = unsafe { std::mem::transmute((&92u8, &(drop_me as fn(*mut usize), usize::MAX, 1usize))) }; //~^^ ERROR it is undefined behavior to use this value -//~| expected a vtable pointer +//~| NOTE_NONVIRAL expected a vtable pointer // Even if the vtable has a fn ptr and a reasonable size+align, it still does not work. const INVALID_VTABLE_UB: W<&dyn Trait> = unsafe { std::mem::transmute((&92u8, &(drop_me as fn(*mut usize), 1usize, 1usize))) }; //~^^ ERROR it is undefined behavior to use this value -//~| expected a vtable pointer +//~| NOTE_NONVIRAL expected a vtable pointer // Trying to access the data in a vtable does not work, either. @@ -90,7 +90,7 @@ union Transmute { const FOO: &dyn Bar = &Foo { foo: 128, bar: false }; const G: Wide = unsafe { Transmute { t: FOO }.u }; //~^ ERROR it is undefined behavior to use this value -//~| encountered a dangling reference +//~| NOTE_NONVIRAL encountered a dangling reference // (it is dangling because vtables do not contain memory that can be dereferenced) fn main() {} diff --git a/tests/ui/consts/const-eval/ub-int-array.rs b/tests/ui/consts/const-eval/ub-int-array.rs index cde0749dc5fb5..afd6c87e16e27 100644 --- a/tests/ui/consts/const-eval/ub-int-array.rs +++ b/tests/ui/consts/const-eval/ub-int-array.rs @@ -17,7 +17,7 @@ impl MaybeUninit { const UNINIT_INT_0: [u32; 3] = unsafe { //~^ ERROR it is undefined behavior to use this value - //~| invalid value at [0] + //~| NOTE_NONVIRAL invalid value at [0] mem::transmute([ MaybeUninit { uninit: () }, // Constants chosen to achieve endianness-independent hex dump. @@ -27,7 +27,7 @@ const UNINIT_INT_0: [u32; 3] = unsafe { }; const UNINIT_INT_1: [u32; 3] = unsafe { //~^ ERROR it is undefined behavior to use this value - //~| invalid value at [1] + //~| NOTE_NONVIRAL invalid value at [1] mem::transmute([ MaybeUninit::new(0u8), MaybeUninit::new(0u8), @@ -45,7 +45,7 @@ const UNINIT_INT_1: [u32; 3] = unsafe { }; const UNINIT_INT_2: [u32; 3] = unsafe { //~^ ERROR it is undefined behavior to use this value - //~| invalid value at [2] + //~| NOTE_NONVIRAL invalid value at [2] mem::transmute([ MaybeUninit::new(0u8), MaybeUninit::new(0u8), diff --git a/tests/ui/consts/const-eval/ub-nonnull.rs b/tests/ui/consts/const-eval/ub-nonnull.rs index b8e312759b4c3..00637473839c4 100644 --- a/tests/ui/consts/const-eval/ub-nonnull.rs +++ b/tests/ui/consts/const-eval/ub-nonnull.rs @@ -33,7 +33,7 @@ union MaybeUninit { } const UNINIT: NonZero = unsafe { MaybeUninit { uninit: () }.init }; //~^ ERROR evaluation of constant value failed -//~| uninitialized +//~| NOTE_NONVIRAL uninitialized // Also test other uses of rustc_layout_scalar_valid_range_start diff --git a/tests/ui/consts/const-eval/ub-ref-ptr.rs b/tests/ui/consts/const-eval/ub-ref-ptr.rs index 50e510a3d5467..b34072e29dfde 100644 --- a/tests/ui/consts/const-eval/ub-ref-ptr.rs +++ b/tests/ui/consts/const-eval/ub-ref-ptr.rs @@ -14,11 +14,11 @@ union MaybeUninit { const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) }; //~^ ERROR it is undefined behavior to use this value -//~| constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1) +//~| NOTE_NONVIRAL constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1) const UNALIGNED_BOX: Box = unsafe { mem::transmute(&[0u8; 4]) }; //~^ ERROR it is undefined behavior to use this value -//~| constructing invalid value: encountered an unaligned box (required 2 byte alignment but found 1) +//~| NOTE_NONVIRAL constructing invalid value: encountered an unaligned box (required 2 byte alignment but found 1) const NULL: &u16 = unsafe { mem::transmute(0usize) }; //~^ ERROR it is undefined behavior to use this value @@ -47,13 +47,13 @@ const USIZE_AS_BOX: Box = unsafe { mem::transmute(1337usize) }; const UNINIT_PTR: *const i32 = unsafe { MaybeUninit { uninit: () }.init }; //~^ ERROR evaluation of constant value failed -//~| uninitialized +//~| NOTE_NONVIRAL uninitialized const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) }; //~^ ERROR it is undefined behavior to use this value const UNINIT_FN_PTR: fn() = unsafe { MaybeUninit { uninit: () }.init }; //~^ ERROR evaluation of constant value failed -//~| uninitialized +//~| NOTE_NONVIRAL ninitialized const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) }; //~^ ERROR it is undefined behavior to use this value const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) }; diff --git a/tests/ui/consts/const-eval/ub-uninhabit.rs b/tests/ui/consts/const-eval/ub-uninhabit.rs index d0515a4e6f067..4f3409214d1d9 100644 --- a/tests/ui/consts/const-eval/ub-uninhabit.rs +++ b/tests/ui/consts/const-eval/ub-uninhabit.rs @@ -18,15 +18,15 @@ union MaybeUninit { const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init }; //~^ ERROR evaluation of constant value failed -//~| constructing invalid value +//~| NOTE_NONVIRAL constructing invalid value const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) }; //~^ ERROR it is undefined behavior to use this value -//~| constructing invalid value +//~| NOTE_NONVIRAL constructing invalid value const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init }; //~^ ERROR evaluation of constant value failed -//~| constructing invalid value +//~| NOTE_NONVIRAL constructing invalid value const READ_NEVER: () = unsafe { @@ -34,7 +34,7 @@ const READ_NEVER: () = unsafe { let ptr = mem.as_ptr().cast::(); let _val = intrinsics::read_via_copy(ptr); //~^ ERROR evaluation of constant value failed - //~| constructing invalid value + //~| NOTE_NONVIRAL constructing invalid value }; diff --git a/tests/ui/consts/const-eval/ub-wide-ptr.rs b/tests/ui/consts/const-eval/ub-wide-ptr.rs index a071a44272b4d..04e3705eae870 100644 --- a/tests/ui/consts/const-eval/ub-wide-ptr.rs +++ b/tests/ui/consts/const-eval/ub-wide-ptr.rs @@ -62,7 +62,7 @@ const SLICE_VALID: &[u8] = unsafe { mem::transmute((&42u8, 1usize)) }; // bad slice: length uninit const SLICE_LENGTH_UNINIT: &[u8] = unsafe { //~^ ERROR evaluation of constant value failed -//~| uninitialized +//~| NOTE_NONVIRAL uninitialized let uninit_len = MaybeUninit:: { uninit: () }; mem::transmute((42, uninit_len)) }; @@ -85,18 +85,18 @@ const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3)) }; // bad data *inside* the slice const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; //~^ ERROR it is undefined behavior to use this value -//~| constant +//~| NOTE_NONVIRAL constant // good MySliceBool const MYSLICE_GOOD: &MySliceBool = &MySlice(true, [false]); // bad: sized field is not okay const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); //~^ ERROR it is undefined behavior to use this value -//~| constant +//~| NOTE_NONVIRAL constant // bad: unsized part is not okay const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); //~^ ERROR it is undefined behavior to use this value -//~| constant +//~| NOTE_NONVIRAL constant // # raw slice const RAW_SLICE_VALID: *const [u8] = unsafe { mem::transmute((&42u8, 1usize)) }; // ok @@ -104,7 +104,7 @@ const RAW_SLICE_TOO_LONG: *const [u8] = unsafe { mem::transmute((&42u8, 999usize const RAW_SLICE_MUCH_TOO_LONG: *const [u8] = unsafe { mem::transmute((&42u8, usize::MAX)) }; // ok because raw const RAW_SLICE_LENGTH_UNINIT: *const [u8] = unsafe { //~^ ERROR evaluation of constant value failed -//~| uninitialized +//~| NOTE_NONVIRAL uninitialized let uninit_len = MaybeUninit:: { uninit: () }; mem::transmute((42, uninit_len)) }; @@ -113,40 +113,40 @@ const RAW_SLICE_LENGTH_UNINIT: *const [u8] = unsafe { // bad trait object const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) }; //~^ ERROR it is undefined behavior to use this value -//~| vtable +//~| NOTE_NONVIRAL vtable // bad trait object const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) }; //~^ ERROR it is undefined behavior to use this value -//~| vtable +//~| NOTE_NONVIRAL vtable // bad trait object const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, 4usize))) }; //~^ ERROR it is undefined behavior to use this value -//~| vtable +//~| NOTE_NONVIRAL vtable const TRAIT_OBJ_UNALIGNED_VTABLE: &dyn Trait = unsafe { mem::transmute((&92u8, &[0u8; 128])) }; //~^ ERROR it is undefined behavior to use this value -//~| vtable +//~| NOTE_NONVIRAL vtable const TRAIT_OBJ_BAD_DROP_FN_NULL: &dyn Trait = unsafe { mem::transmute((&92u8, &[0usize; 8])) }; //~^ ERROR it is undefined behavior to use this value -//~| vtable +//~| NOTE_NONVIRAL vtable const TRAIT_OBJ_BAD_DROP_FN_INT: &dyn Trait = unsafe { mem::transmute((&92u8, &[1usize; 8])) }; //~^ ERROR it is undefined behavior to use this value -//~| vtable +//~| NOTE_NONVIRAL vtable const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) }; //~^ ERROR it is undefined behavior to use this value -//~| vtable +//~| NOTE_NONVIRAL vtable // bad data *inside* the trait object const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, &bool>(&3u8) }; //~^ ERROR it is undefined behavior to use this value -//~| expected a boolean +//~| NOTE_NONVIRAL expected a boolean // # raw trait object const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) }; //~^ ERROR it is undefined behavior to use this value -//~| null pointer +//~| NOTE_NONVIRAL null pointer const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) }; //~^ ERROR it is undefined behavior to use this value -//~| vtable +//~| NOTE_NONVIRAL vtable const RAW_TRAIT_OBJ_CONTENT_INVALID: *const dyn Trait = unsafe { mem::transmute::<_, &bool>(&3u8) } as *const dyn Trait; // ok because raw // Officially blessed way to get the vtable const DYN_METADATA: ptr::DynMetadata = ptr::metadata::(ptr::null::()); @@ -155,12 +155,12 @@ const DYN_METADATA: ptr::DynMetadata = ptr::metadata::(ptr:: static mut RAW_TRAIT_OBJ_VTABLE_NULL_THROUGH_REF: *const dyn Trait = unsafe { mem::transmute::<_, &dyn Trait>((&92u8, 0usize)) //~^^ ERROR it is undefined behavior to use this value - //~| null pointer + //~| NOTE_NONVIRAL null pointer }; static mut RAW_TRAIT_OBJ_VTABLE_INVALID_THROUGH_REF: *const dyn Trait = unsafe { mem::transmute::<_, &dyn Trait>((&92u8, &3u64)) //~^^ ERROR it is undefined behavior to use this value - //~| vtable + //~| NOTE_NONVIRAL vtable }; fn main() {} diff --git a/tests/ui/consts/const-eval/union-const-eval-field.rs b/tests/ui/consts/const-eval/union-const-eval-field.rs index c9799989ea835..b27fea96a2c70 100644 --- a/tests/ui/consts/const-eval/union-const-eval-field.rs +++ b/tests/ui/consts/const-eval/union-const-eval-field.rs @@ -25,7 +25,7 @@ const fn read_field2() -> Field2 { const fn read_field3() -> Field3 { const FIELD3: Field3 = unsafe { UNION.field3 }; //~^ ERROR evaluation of constant value failed - //~| uninitialized + //~| NOTE_NONVIRAL uninitialized FIELD3 } diff --git a/tests/ui/consts/const-eval/union-ub.rs b/tests/ui/consts/const-eval/union-ub.rs index 5eb4ad4b47f2c..74e1819391ee4 100644 --- a/tests/ui/consts/const-eval/union-ub.rs +++ b/tests/ui/consts/const-eval/union-ub.rs @@ -33,7 +33,7 @@ const BAD_BOOL: bool = unsafe { DummyUnion { u8: 42 }.bool}; //~^ ERROR it is undefined behavior to use this value const UNINIT_BOOL: bool = unsafe { DummyUnion { unit: () }.bool}; //~^ ERROR evaluation of constant value failed -//~| uninitialized +//~| NOTE_NONVIRAL uninitialized // The value is not valid for any union variant, but that's fine // unions are just a convenient way to transmute bits around diff --git a/tests/ui/consts/const-eval/unwind-abort.rs b/tests/ui/consts/const-eval/unwind-abort.rs index fee53f8528d60..deda3ca1d8f35 100644 --- a/tests/ui/consts/const-eval/unwind-abort.rs +++ b/tests/ui/consts/const-eval/unwind-abort.rs @@ -1,5 +1,5 @@ const extern "C" fn foo() { - panic!() //~ inside `foo` + panic!() //~ NOTE_NONVIRAL inside `foo` } const _: () = foo(); //~ ERROR evaluation of constant value failed diff --git a/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs b/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs index c4df93b6239ab..f696b779963a7 100644 --- a/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs +++ b/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs @@ -1,5 +1,5 @@ const fn foo() -> ! { - unsafe { std::mem::transmute(()) } //~ inside `foo` + unsafe { std::mem::transmute(()) } //~ NOTE_NONVIRAL inside `foo` } // Type defined in a submodule, so that it is not "visibly" diff --git a/tests/ui/consts/const-len-underflow-separate-spans.rs b/tests/ui/consts/const-len-underflow-separate-spans.rs index 42314eed7aad6..e398145860ecc 100644 --- a/tests/ui/consts/const-len-underflow-separate-spans.rs +++ b/tests/ui/consts/const-len-underflow-separate-spans.rs @@ -12,5 +12,5 @@ const LEN: usize = ONE - TWO; fn main() { let a: [i8; LEN] = unimplemented!(); -//~^ constant +//~^ NOTE_NONVIRAL constant } diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final.rs b/tests/ui/consts/const-mut-refs/mut_ref_in_final.rs index 283c1224e013d..74fc23574ee5f 100644 --- a/tests/ui/consts/const-mut-refs/mut_ref_in_final.rs +++ b/tests/ui/consts/const-mut-refs/mut_ref_in_final.rs @@ -25,7 +25,7 @@ const B4: Option<&mut i32> = helper(&mut 42); //~ ERROR temporary value dropped // Not ok, since it points to read-only memory. const IMMUT_MUT_REF: &mut u16 = unsafe { mem::transmute(&13) }; //~^ ERROR undefined behavior to use this value -//~| pointing to read-only memory +//~| NOTE_NONVIRAL pointing to read-only memory // Ok, because no references to mutable data exist here, since the `{}` moves // its value and then takes a reference to that. diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs index ac903fca20aed..f48488c954edd 100644 --- a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs +++ b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs @@ -16,16 +16,16 @@ const fn helper() -> Option<&'static mut i32> { unsafe { Some(&mut *std::ptr::addr_of_mut!(BUFFER)) } } const MUT: Option<&mut i32> = helper(); //~ ERROR it is undefined behavior to use this value -//~^ encountered reference to mutable +//~^ NOTE_NONVIRAL encountered reference to mutable const fn helper_int2ptr() -> Option<&'static mut i32> { unsafe { // Undefined behaviour (integer as pointer), who doesn't love tests like this. Some(&mut *(42 as *mut i32)) } } const INT2PTR: Option<&mut i32> = helper_int2ptr(); //~ ERROR it is undefined behavior to use this value -//~^ encountered a dangling reference +//~^ NOTE_NONVIRAL encountered a dangling reference static INT2PTR_STATIC: Option<&mut i32> = helper_int2ptr(); //~ ERROR it is undefined behavior to use this value -//~^ encountered a dangling reference +//~^ NOTE_NONVIRAL encountered a dangling reference const fn helper_dangling() -> Option<&'static mut i32> { unsafe { // Undefined behaviour (dangling pointer), who doesn't love tests like this. diff --git a/tests/ui/consts/const-pattern-irrefutable.rs b/tests/ui/consts/const-pattern-irrefutable.rs index 759d2e8b2edeb..6178117145c19 100644 --- a/tests/ui/consts/const-pattern-irrefutable.rs +++ b/tests/ui/consts/const-pattern-irrefutable.rs @@ -1,15 +1,15 @@ mod foo { pub const b: u8 = 2; - //~^ missing patterns are not covered because `b` is interpreted as a constant pattern, not a new variable + //~^ NOTE_NONVIRAL missing patterns are not covered because `b` is interpreted as a constant pattern, not a new variable pub const d: (u8, u8) = (2, 1); - //~^ missing patterns are not covered because `d` is interpreted as a constant pattern, not a new variable + //~^ NOTE_NONVIRAL missing patterns are not covered because `d` is interpreted as a constant pattern, not a new variable } use foo::b as c; use foo::d; const a: u8 = 2; -//~^ missing patterns are not covered because `a` is interpreted as a constant pattern, not a new variable +//~^ NOTE_NONVIRAL missing patterns are not covered because `a` is interpreted as a constant pattern, not a new variable #[derive(PartialEq)] struct S { @@ -23,21 +23,21 @@ const e: S = S { fn main() { let a = 4; //~^ ERROR refutable pattern in local binding - //~| patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered + //~| NOTE_NONVIRAL patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered //~| HELP introduce a variable instead let c = 4; //~^ ERROR refutable pattern in local binding - //~| patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered + //~| NOTE_NONVIRAL patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered //~| HELP introduce a variable instead let d = (4, 4); //~^ ERROR refutable pattern in local binding - //~| patterns `(0_u8..=1_u8, _)` and `(3_u8..=u8::MAX, _)` not covered + //~| NOTE_NONVIRAL patterns `(0_u8..=1_u8, _)` and `(3_u8..=u8::MAX, _)` not covered //~| HELP introduce a variable instead let e = S { //~^ ERROR refutable pattern in local binding - //~| pattern `S { foo: 1_u8..=u8::MAX }` not covered + //~| NOTE_NONVIRAL pattern `S { foo: 1_u8..=u8::MAX }` not covered //~| HELP introduce a variable instead foo: 1, }; - fn f() {} // Check that the `NOTE`s still work with an item here (cf. issue #35115). + fn f() {} // Check that the `NOTE_NONVIRAL`s still work with an item here (cf. issue #35115). } diff --git a/tests/ui/consts/const-tup-index-span.rs b/tests/ui/consts/const-tup-index-span.rs index e77d392e69402..e430a6c6f9f46 100644 --- a/tests/ui/consts/const-tup-index-span.rs +++ b/tests/ui/consts/const-tup-index-span.rs @@ -2,7 +2,7 @@ const TUP: (usize,) = 5usize << 64; //~^ ERROR mismatched types -//~| expected `(usize,)`, found `usize` +//~| NOTE_NONVIRAL expected `(usize,)`, found `usize` const ARR: [i32; TUP.0] = []; fn main() { diff --git a/tests/ui/consts/const-unstable-intrinsic.rs b/tests/ui/consts/const-unstable-intrinsic.rs index 890a30c73c8aa..46c70848126ca 100644 --- a/tests/ui/consts/const-unstable-intrinsic.rs +++ b/tests/ui/consts/const-unstable-intrinsic.rs @@ -15,16 +15,16 @@ const fn const_main() { let x = 42; unsafe { unstable_intrinsic::size_of_val(&x); - //~^ERROR: unstable library feature `unstable` - //~|ERROR: not yet stable as a const intrinsic + //~^ ERROR unstable library feature `unstable` + //~| ERROR not yet stable as a const intrinsic unstable_intrinsic::min_align_of_val(&x); - //~^ERROR: unstable library feature `unstable` - //~|ERROR: not yet stable as a const intrinsic + //~^ ERROR unstable library feature `unstable` + //~| ERROR not yet stable as a const intrinsic size_of_val(&x); - //~^ERROR: cannot use `#[feature(local)]` + //~^ ERROR cannot use `#[feature(local)]` min_align_of_val(&x); - //~^ERROR: cannot use `#[feature(local)]` + //~^ ERROR cannot use `#[feature(local)]` } } diff --git a/tests/ui/consts/const_refs_to_static_fail.rs b/tests/ui/consts/const_refs_to_static_fail.rs index 596ed50af3852..1859523dc65e6 100644 --- a/tests/ui/consts/const_refs_to_static_fail.rs +++ b/tests/ui/consts/const_refs_to_static_fail.rs @@ -9,14 +9,14 @@ static S: SyncUnsafeCell = SyncUnsafeCell::new(0); static mut S_MUT: i32 = 0; const C1: &SyncUnsafeCell = &S; //~ERROR undefined behavior -//~| encountered reference to mutable memory +//~| NOTE_NONVIRAL encountered reference to mutable memory const C1_READ: () = unsafe { assert!(*C1.get() == 0); }; const C2: *const i32 = unsafe { std::ptr::addr_of!(S_MUT) }; const C2_READ: () = unsafe { assert!(*C2 == 0); //~ERROR evaluation of constant value failed - //~^ constant accesses mutable global memory + //~^ NOTE_NONVIRAL constant accesses mutable global memory }; fn main() { diff --git a/tests/ui/consts/const_refs_to_static_fail_invalid.rs b/tests/ui/consts/const_refs_to_static_fail_invalid.rs index 3383a208345da..2c445a25bdc2f 100644 --- a/tests/ui/consts/const_refs_to_static_fail_invalid.rs +++ b/tests/ui/consts/const_refs_to_static_fail_invalid.rs @@ -6,8 +6,8 @@ fn invalid() { static S: i8 = 10; const C: &bool = unsafe { std::mem::transmute(&S) }; - //~^ERROR: undefined behavior - //~| expected a boolean + //~^ ERROR undefined behavior + //~| NOTE_NONVIRAL expected a boolean // This must be rejected here (or earlier), since it's not a valid `&bool`. match &true { @@ -22,8 +22,8 @@ fn extern_() { } const C: &i8 = unsafe { &S }; - //~^ERROR: undefined behavior - //~| `extern` static + //~^ ERROR undefined behavior + //~| NOTE_NONVIRAL `extern` static // This must be rejected here (or earlier), since the pattern cannot be read. match &0 { @@ -36,8 +36,8 @@ fn mutable() { static mut S_MUT: i32 = 0; const C: &i32 = unsafe { &S_MUT }; - //~^ERROR: undefined behavior - //~| encountered reference to mutable memory + //~^ ERROR undefined behavior + //~| NOTE_NONVIRAL encountered reference to mutable memory // This *must not build*, the constant we are matching against // could change its value! diff --git a/tests/ui/consts/issue-17718-const-bad-values.rs b/tests/ui/consts/issue-17718-const-bad-values.rs index c4de7b61f07d7..840d050b7c104 100644 --- a/tests/ui/consts/issue-17718-const-bad-values.rs +++ b/tests/ui/consts/issue-17718-const-bad-values.rs @@ -9,6 +9,6 @@ const C1: &'static mut [usize] = &mut []; static mut S: i32 = 3; const C2: &'static mut i32 = unsafe { &mut S }; //~^ ERROR: it is undefined behavior to use this value -//~| reference to mutable memory +//~| NOTE_NONVIRAL reference to mutable memory fn main() {} diff --git a/tests/ui/consts/issue-39974.rs b/tests/ui/consts/issue-39974.rs index 9cb180014b86b..b80e2597ee9dd 100644 --- a/tests/ui/consts/issue-39974.rs +++ b/tests/ui/consts/issue-39974.rs @@ -4,7 +4,7 @@ const LENGTH: f64 = 2; struct Thing { f: [[f64; 2]; LENGTH], //~^ ERROR mismatched types - //~| expected `usize`, found `f64` + //~| NOTE_NONVIRAL expected `usize`, found `f64` } fn main() { diff --git a/tests/ui/consts/miri_unleashed/assoc_const_2.rs b/tests/ui/consts/miri_unleashed/assoc_const_2.rs index 5490c0963915b..e5aea4fe4bbf5 100644 --- a/tests/ui/consts/miri_unleashed/assoc_const_2.rs +++ b/tests/ui/consts/miri_unleashed/assoc_const_2.rs @@ -24,5 +24,5 @@ impl Bar for String {} fn main() { let x = <() as Bar<()>>::F; // this test only causes errors due to the line below, so post-monomorphization - let y = >::F; //~ constant + let y = >::F; //~ NOTE_NONVIRAL constant } diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static.rs b/tests/ui/consts/miri_unleashed/const_refers_to_static.rs index fdccc17ab49a8..18f417a775b72 100644 --- a/tests/ui/consts/miri_unleashed/const_refers_to_static.rs +++ b/tests/ui/consts/miri_unleashed/const_refers_to_static.rs @@ -20,7 +20,7 @@ const READ_MUT: u32 = unsafe { MUTABLE }; //~ERROR evaluation of constant value // Evaluating this does not read anything mutable, but validation does, so this should error. const REF_INTERIOR_MUT: &usize = { //~ ERROR undefined behavior - //~| encountered reference to mutable memory + //~| NOTE_NONVIRAL encountered reference to mutable memory static FOO: AtomicUsize = AtomicUsize::new(0); unsafe { &*(&FOO as *const _ as *const usize) } }; diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs index b33ebfb06be9a..e9e477ccba385 100644 --- a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs +++ b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs @@ -10,25 +10,25 @@ extern crate static_cross_crate; // Sneaky: reference to a mutable static. // Allowing this would be a disaster for pattern matching, we could violate exhaustiveness checking! const SLICE_MUT: &[u8; 1] = { //~ ERROR undefined behavior - //~| encountered reference to mutable memory + //~| NOTE_NONVIRAL encountered reference to mutable memory unsafe { &static_cross_crate::ZERO } }; const U8_MUT: &u8 = { //~ ERROR undefined behavior - //~| encountered reference to mutable memory + //~| NOTE_NONVIRAL encountered reference to mutable memory unsafe { &static_cross_crate::ZERO[0] } }; // Also test indirection that reads from other static. const U8_MUT2: &u8 = { //~ ERROR undefined behavior - //~| encountered reference to mutable memory + //~| NOTE_NONVIRAL encountered reference to mutable memory unsafe { &(*static_cross_crate::ZERO_REF)[0] } }; const U8_MUT3: &u8 = { unsafe { match static_cross_crate::OPT_ZERO { //~^ ERROR evaluation of constant value failed - //~| constant accesses mutable global memory + //~| NOTE_NONVIRAL constant accesses mutable global memory Some(ref u) => u, None => panic!(), } diff --git a/tests/ui/consts/miri_unleashed/mutable_references.rs b/tests/ui/consts/miri_unleashed/mutable_references.rs index e7fc5699236ee..de46b24882612 100644 --- a/tests/ui/consts/miri_unleashed/mutable_references.rs +++ b/tests/ui/consts/miri_unleashed/mutable_references.rs @@ -11,10 +11,10 @@ use std::sync::atomic::*; // This requires walking nested statics. static FOO: &&mut u32 = &&mut 42; //~^ ERROR it is undefined behavior to use this value -//~| pointing to read-only memory +//~| NOTE_NONVIRAL pointing to read-only memory static OH_YES: &mut i32 = &mut 42; //~^ ERROR it is undefined behavior to use this value -//~| pointing to read-only memory +//~| NOTE_NONVIRAL pointing to read-only memory static BAR: &mut () = &mut (); //~^ ERROR encountered mutable pointer in final value of static @@ -25,11 +25,11 @@ static BOO: &mut Foo<()> = &mut Foo(()); const BLUNT: &mut i32 = &mut 42; //~^ ERROR: it is undefined behavior to use this value -//~| pointing to read-only memory +//~| NOTE_NONVIRAL pointing to read-only memory const SUBTLE: &mut i32 = unsafe { //~^ ERROR: it is undefined behavior to use this value - //~| constructing invalid value: encountered reference to mutable memory in `const` + //~| NOTE_NONVIRAL constructing invalid value: encountered reference to mutable memory in `const` static mut STATIC: i32 = 0; &mut STATIC }; @@ -42,13 +42,13 @@ struct Meh { unsafe impl Sync for Meh {} static MEH: Meh = Meh { x: &UnsafeCell::new(42) }; //~^ ERROR it is undefined behavior to use this value -//~| `UnsafeCell` in read-only memory +//~| NOTE_NONVIRAL `UnsafeCell` in read-only memory // Same with a const: // the following will never be ok! no interior mut behind consts, because // all allocs interned here will be marked immutable. const MUH: Meh = Meh { //~^ ERROR it is undefined behavior to use this value - //~| `UnsafeCell` in read-only memory + //~| NOTE_NONVIRAL `UnsafeCell` in read-only memory x: &UnsafeCell::new(42), }; @@ -60,30 +60,30 @@ unsafe impl Sync for Synced {} // Make sure we also catch this behind a type-erased `dyn Trait` reference. const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) }; //~^ ERROR: it is undefined behavior to use this value -//~| `UnsafeCell` in read-only memory +//~| NOTE_NONVIRAL `UnsafeCell` in read-only memory // # Check for mutable references to read-only memory static READONLY: i32 = 0; static mut MUT_TO_READONLY: &mut i32 = unsafe { &mut *(&READONLY as *const _ as *mut _) }; //~^ ERROR: it is undefined behavior to use this value -//~| pointing to read-only memory +//~| NOTE_NONVIRAL pointing to read-only memory // # Check for consts pointing to mutable memory static mut MUTABLE: i32 = 42; -const POINTS_TO_MUTABLE: &i32 = unsafe { &MUTABLE }; //~ERROR: undefined behavior -//~| encountered reference to mutable memory +const POINTS_TO_MUTABLE: &i32 = unsafe { &MUTABLE }; //~ ERROR undefined behavior +//~| NOTE_NONVIRAL encountered reference to mutable memory static mut MUTABLE_REF: &mut i32 = &mut 42; const POINTS_TO_MUTABLE2: &i32 = unsafe { &*MUTABLE_REF }; -//~^ ERROR: evaluation of constant value failed -//~| accesses mutable global memory +//~^ ERROR evaluation of constant value failed +//~| NOTE_NONVIRAL accesses mutable global memory const POINTS_TO_MUTABLE_INNER: *const i32 = &mut 42 as *mut _ as *const _; -//~^ ERROR: mutable pointer in final value +//~^ ERROR mutable pointer in final value const POINTS_TO_MUTABLE_INNER2: *const i32 = &mut 42 as *const _; -//~^ ERROR: mutable pointer in final value +//~^ ERROR mutable pointer in final value // This does *not* error since it uses a shared reference, and we have to ignore // those. See . diff --git a/tests/ui/consts/offset_from_ub.rs b/tests/ui/consts/offset_from_ub.rs index 53d9c7a39da8a..42aa37eb6f0f4 100644 --- a/tests/ui/consts/offset_from_ub.rs +++ b/tests/ui/consts/offset_from_ub.rs @@ -16,7 +16,7 @@ pub const DIFFERENT_ALLOC: usize = { let uninit2 = std::mem::MaybeUninit::::uninit(); let field_ptr: *const Struct = &uninit2 as *const _ as *const Struct; let offset = unsafe { ptr_offset_from(field_ptr, base_ptr) }; //~ERROR evaluation of constant value failed - //~| not both derived from the same allocation + //~| NOTE_NONVIRAL not both derived from the same allocation offset as usize }; @@ -29,14 +29,14 @@ pub const NOT_MULTIPLE_OF_SIZE: isize = { let base_ptr = data.as_ptr(); let field_ptr = &data[1] as *const u8 as *const u16; unsafe { ptr_offset_from(field_ptr, base_ptr as *const u16) } //~ERROR evaluation of constant value failed - //~| 1_isize cannot be divided by 2_isize without remainder + //~| NOTE_NONVIRAL 1_isize cannot be divided by 2_isize without remainder }; pub const DIFFERENT_INT: isize = { // offset_from with two different integers: like DIFFERENT_ALLOC let ptr1 = 8 as *const u8; let ptr2 = 16 as *const u8; unsafe { ptr_offset_from(ptr2, ptr1) } //~ERROR evaluation of constant value failed - //~| not both derived from the same allocation + //~| NOTE_NONVIRAL not both derived from the same allocation }; const OUT_OF_BOUNDS_1: isize = { @@ -45,7 +45,7 @@ const OUT_OF_BOUNDS_1: isize = { let end_ptr = (start_ptr).wrapping_add(length); // First ptr is out of bounds unsafe { ptr_offset_from(end_ptr, start_ptr) } //~ERROR evaluation of constant value failed - //~| the memory range between them is not in-bounds of an allocation + //~| NOTE_NONVIRAL the memory range between them is not in-bounds of an allocation }; const OUT_OF_BOUNDS_2: isize = { @@ -54,7 +54,7 @@ const OUT_OF_BOUNDS_2: isize = { let end_ptr = (start_ptr).wrapping_add(length); // Second ptr is out of bounds unsafe { ptr_offset_from(start_ptr, end_ptr) } //~ERROR evaluation of constant value failed - //~| the memory range between them is not in-bounds of an allocation + //~| NOTE_NONVIRAL the memory range between them is not in-bounds of an allocation }; pub const DIFFERENT_ALLOC_UNSIGNED: usize = { @@ -63,20 +63,20 @@ pub const DIFFERENT_ALLOC_UNSIGNED: usize = { let uninit2 = std::mem::MaybeUninit::::uninit(); let field_ptr: *const Struct = &uninit2 as *const _ as *const Struct; unsafe { ptr_offset_from_unsigned(field_ptr, base_ptr) } //~ERROR evaluation of constant value failed - //~| not both derived from the same allocation + //~| NOTE_NONVIRAL not both derived from the same allocation }; pub const TOO_FAR_APART1: isize = { let ptr1 = &0u8 as *const u8; let ptr2 = ptr1.wrapping_add(isize::MAX as usize + 42); unsafe { ptr_offset_from(ptr2, ptr1) } //~ERROR evaluation of constant value failed - //~| too far ahead + //~| NOTE_NONVIRAL too far ahead }; pub const TOO_FAR_APART2: isize = { let ptr1 = &0u8 as *const u8; let ptr2 = ptr1.wrapping_add(isize::MAX as usize + 42); unsafe { ptr_offset_from(ptr1, ptr2) } //~ERROR evaluation of constant value failed - //~| too far before + //~| NOTE_NONVIRAL too far before }; pub const TOO_FAR_APART3: isize = { let ptr1 = &0u8 as *const u8; @@ -84,21 +84,21 @@ pub const TOO_FAR_APART3: isize = { // The result of this would be `isize::MIN`, which *does* fit in an `isize`, but its // absolute value does not. (Also anyway there cannot be an allocation of that size.) unsafe { ptr_offset_from(ptr1, ptr2) } //~ERROR evaluation of constant value failed - //~| too far before + //~| NOTE_NONVIRAL too far before }; const WRONG_ORDER_UNSIGNED: usize = { let a = ['a', 'b', 'c']; let p = a.as_ptr(); unsafe { ptr_offset_from_unsigned(p, p.add(2) ) } //~ERROR evaluation of constant value failed - //~| first pointer has smaller offset than second: 0 < 8 + //~| NOTE_NONVIRAL first pointer has smaller offset than second: 0 < 8 }; pub const TOO_FAR_APART_UNSIGNED: usize = { let ptr1 = &0u8 as *const u8; let ptr2 = ptr1.wrapping_add(isize::MAX as usize + 42); // This would fit into a `usize` but we still don't allow it. unsafe { ptr_offset_from_unsigned(ptr2, ptr1) } //~ERROR evaluation of constant value failed - //~| too far ahead + //~| NOTE_NONVIRAL too far ahead }; // These do NOT complain that pointers are too far apart; they pass that check (to then fail the diff --git a/tests/ui/consts/required-consts/interpret-in-const-called-fn.rs b/tests/ui/consts/required-consts/interpret-in-const-called-fn.rs index f2e83f56f3707..a31b17929dd84 100644 --- a/tests/ui/consts/required-consts/interpret-in-const-called-fn.rs +++ b/tests/ui/consts/required-consts/interpret-in-const-called-fn.rs @@ -14,7 +14,7 @@ const fn no_codegen() { // This bad constant is only used in dead code in a no-codegen function... and yet we still // must make sure that the build fails. // This relies on const-eval evaluating all `required_consts` of `const fn`. - Fail::::C; //~ constant + Fail::::C; //~ NOTE_NONVIRAL constant } } diff --git a/tests/ui/consts/required-consts/interpret-in-promoted.rs b/tests/ui/consts/required-consts/interpret-in-promoted.rs index 2c7b3375054d2..1b6770c1a76d3 100644 --- a/tests/ui/consts/required-consts/interpret-in-promoted.rs +++ b/tests/ui/consts/required-consts/interpret-in-promoted.rs @@ -4,7 +4,7 @@ //! Make sure we evaluate const fn calls even if they get promoted and their result ignored. const unsafe fn ub() { - std::hint::unreachable_unchecked(); //~ inside `ub` + std::hint::unreachable_unchecked(); //~ NOTE_NONVIRAL inside `ub` } pub const FOO: () = unsafe { diff --git a/tests/ui/consts/required-consts/interpret-in-static.rs b/tests/ui/consts/required-consts/interpret-in-static.rs index 8bacd03044002..d20b7396fbada 100644 --- a/tests/ui/consts/required-consts/interpret-in-static.rs +++ b/tests/ui/consts/required-consts/interpret-in-static.rs @@ -13,7 +13,7 @@ pub static FOO: () = { // This bad constant is only used in dead code in a static initializer... and yet we still // must make sure that the build fails. // This relies on const-eval evaluating all `required_consts` of the `static` MIR body. - Fail::::C; //~ constant + Fail::::C; //~ NOTE_NONVIRAL constant } }; diff --git a/tests/ui/consts/uninhabited-const-issue-61744.rs b/tests/ui/consts/uninhabited-const-issue-61744.rs index 743aaf58ef5a1..e3dc5313bc4b5 100644 --- a/tests/ui/consts/uninhabited-const-issue-61744.rs +++ b/tests/ui/consts/uninhabited-const-issue-61744.rs @@ -1,11 +1,11 @@ //@ build-fail pub const unsafe fn fake_type() -> T { - hint_unreachable() //~ inside + hint_unreachable() //~ NOTE_NONVIRAL inside } pub const unsafe fn hint_unreachable() -> ! { - fake_type() //~ inside + fake_type() //~ NOTE_NONVIRAL inside } trait Const { diff --git a/tests/ui/coroutine/drop-tracking-parent-expression.rs b/tests/ui/coroutine/drop-tracking-parent-expression.rs index 0f4d99c893648..4c606f7eeb584 100644 --- a/tests/ui/coroutine/drop-tracking-parent-expression.rs +++ b/tests/ui/coroutine/drop-tracking-parent-expression.rs @@ -15,9 +15,9 @@ macro_rules! type_combinations { // dropped *after* the yield. { let g = #[coroutine] move || match drop($name::Client { ..$name::Client::default() }) { - //~^ `significant_drop::Client` which is not `Send` - //~| `insignificant_dtor::Client` which is not `Send` - //~| `derived_drop::Client` which is not `Send` + //~^ NOTE_NONVIRAL `significant_drop::Client` which is not `Send` + //~| NOTE_NONVIRAL `insignificant_dtor::Client` which is not `Send` + //~| NOTE_NONVIRAL `derived_drop::Client` which is not `Send` _ => yield, }; assert_send(g); diff --git a/tests/ui/coroutine/parent-expression.rs b/tests/ui/coroutine/parent-expression.rs index 0f4d99c893648..4c606f7eeb584 100644 --- a/tests/ui/coroutine/parent-expression.rs +++ b/tests/ui/coroutine/parent-expression.rs @@ -15,9 +15,9 @@ macro_rules! type_combinations { // dropped *after* the yield. { let g = #[coroutine] move || match drop($name::Client { ..$name::Client::default() }) { - //~^ `significant_drop::Client` which is not `Send` - //~| `insignificant_dtor::Client` which is not `Send` - //~| `derived_drop::Client` which is not `Send` + //~^ NOTE_NONVIRAL `significant_drop::Client` which is not `Send` + //~| NOTE_NONVIRAL `insignificant_dtor::Client` which is not `Send` + //~| NOTE_NONVIRAL `derived_drop::Client` which is not `Send` _ => yield, }; assert_send(g); diff --git a/tests/ui/cross/cross-borrow-trait.rs b/tests/ui/cross/cross-borrow-trait.rs index 180a75e3dfc54..fe0a37a3c6ca7 100644 --- a/tests/ui/cross/cross-borrow-trait.rs +++ b/tests/ui/cross/cross-borrow-trait.rs @@ -8,6 +8,6 @@ impl Trait for Foo {} pub fn main() { let x: Box = Box::new(Foo); let _y: &dyn Trait = x; //~ ERROR E0308 - //~| expected reference `&dyn Trait` - //~| found struct `Box` + //~| NOTE_NONVIRAL expected reference `&dyn Trait` + //~| NOTE_NONVIRAL found struct `Box` } diff --git a/tests/ui/destructure-trait-ref.rs b/tests/ui/destructure-trait-ref.rs index 50b64aeebf0ef..3c6c56d6ce2ca 100644 --- a/tests/ui/destructure-trait-ref.rs +++ b/tests/ui/destructure-trait-ref.rs @@ -31,14 +31,14 @@ fn main() { // n > m let &&x = &1isize as &dyn T; //~^ ERROR mismatched types - //~| expected trait object `dyn T` - //~| found reference `&_` + //~| NOTE_NONVIRAL expected trait object `dyn T` + //~| NOTE_NONVIRAL found reference `&_` let &&&x = &(&1isize as &dyn T); //~^ ERROR mismatched types - //~| expected trait object `dyn T` - //~| found reference `&_` + //~| NOTE_NONVIRAL expected trait object `dyn T` + //~| NOTE_NONVIRAL found reference `&_` let box box x = Box::new(1isize) as Box; //~^ ERROR mismatched types - //~| expected trait object `dyn T` - //~| found struct `Box<_>` + //~| NOTE_NONVIRAL expected trait object `dyn T` + //~| NOTE_NONVIRAL found struct `Box<_>` } diff --git a/tests/ui/diagnostic-width/long-E0529.rs b/tests/ui/diagnostic-width/long-E0529.rs index 759a902da7e63..e8d4666d16500 100644 --- a/tests/ui/diagnostic-width/long-E0529.rs +++ b/tests/ui/diagnostic-width/long-E0529.rs @@ -7,7 +7,7 @@ type D = (C, C, C, C); fn foo(x: D) { let [] = x; //~ ERROR expected an array or slice, found `(... - //~^ pattern cannot match with input type `(... + //~^ NOTE_NONVIRAL pattern cannot match with input type `(... } fn main() {} diff --git a/tests/ui/diagnostic-width/long-E0618.rs b/tests/ui/diagnostic-width/long-E0618.rs index b499bedc394a5..86cc4214e9c89 100644 --- a/tests/ui/diagnostic-width/long-E0618.rs +++ b/tests/ui/diagnostic-width/long-E0618.rs @@ -5,7 +5,7 @@ type B = (A, A, A, A); type C = (B, B, B, B); type D = (C, C, C, C); -fn foo(x: D) { //~ `x` has type `(... +fn foo(x: D) { //~ NOTE_NONVIRAL `x` has type `(... x(); //~ ERROR expected function, found `(... } diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/custom-on-unimplemented-diagnostic.rs b/tests/ui/diagnostic_namespace/on_unimplemented/custom-on-unimplemented-diagnostic.rs index 3bb0939b5f91d..4e0127308dc5b 100644 --- a/tests/ui/diagnostic_namespace/on_unimplemented/custom-on-unimplemented-diagnostic.rs +++ b/tests/ui/diagnostic_namespace/on_unimplemented/custom-on-unimplemented-diagnostic.rs @@ -16,6 +16,6 @@ struct B; fn main() { B.request(); //~^ ERROR my message [E0599] - //~| my label - //~| my note + //~| NOTE_NONVIRAL my label + //~| NOTE_NONVIRAL my note } diff --git a/tests/ui/dst/dst-bad-assign-3.rs b/tests/ui/dst/dst-bad-assign-3.rs index f96ecf7762c08..2dd2ed2f1d431 100644 --- a/tests/ui/dst/dst-bad-assign-3.rs +++ b/tests/ui/dst/dst-bad-assign-3.rs @@ -30,8 +30,8 @@ pub fn main() { let z: Box = Box::new(Bar1 {f: 36}); f5.2 = Bar1 {f: 36}; //~^ ERROR mismatched types - //~| expected `dyn ToBar`, found `Bar1` - //~| expected trait object `dyn ToBar` - //~| found struct `Bar1` + //~| NOTE_NONVIRAL expected `dyn ToBar`, found `Bar1` + //~| NOTE_NONVIRAL expected trait object `dyn ToBar` + //~| NOTE_NONVIRAL found struct `Bar1` //~| ERROR the size for values of type } diff --git a/tests/ui/dst/dst-bad-assign.rs b/tests/ui/dst/dst-bad-assign.rs index c55fb2c3e5709..ce3946dc3ec86 100644 --- a/tests/ui/dst/dst-bad-assign.rs +++ b/tests/ui/dst/dst-bad-assign.rs @@ -34,8 +34,8 @@ pub fn main() { let z: Box = Box::new(Bar1 {f: 36}); f5.ptr = Bar1 {f: 36}; //~^ ERROR mismatched types - //~| expected `dyn ToBar`, found `Bar1` - //~| expected trait object `dyn ToBar` - //~| found struct `Bar1` + //~| NOTE_NONVIRAL expected `dyn ToBar`, found `Bar1` + //~| NOTE_NONVIRAL expected trait object `dyn ToBar` + //~| NOTE_NONVIRAL found struct `Bar1` //~| ERROR the size for values of type } diff --git a/tests/ui/dst/dst-bad-coerce4.rs b/tests/ui/dst/dst-bad-coerce4.rs index 25410aa4fac75..ff47deee0e2dd 100644 --- a/tests/ui/dst/dst-bad-coerce4.rs +++ b/tests/ui/dst/dst-bad-coerce4.rs @@ -9,7 +9,7 @@ pub fn main() { let f1: &Fat<[isize]> = &Fat { ptr: [1, 2, 3] }; let f2: &Fat<[isize; 3]> = f1; //~^ ERROR mismatched types - //~| expected `&Fat<[isize; 3]>`, found `&Fat<[isize]>` - //~| expected reference `&Fat<[isize; 3]>` - //~| found reference `&Fat<[isize]>` + //~| NOTE_NONVIRAL expected `&Fat<[isize; 3]>`, found `&Fat<[isize]>` + //~| NOTE_NONVIRAL expected reference `&Fat<[isize; 3]>` + //~| NOTE_NONVIRAL found reference `&Fat<[isize]>` } diff --git a/tests/ui/empty/empty-never-array.rs b/tests/ui/empty/empty-never-array.rs index fd93346101d84..d278a45a4560e 100644 --- a/tests/ui/empty/empty-never-array.rs +++ b/tests/ui/empty/empty-never-array.rs @@ -9,7 +9,7 @@ enum Helper { fn transmute(t: T) -> U { let Helper::U(u) = Helper::T(t, []); //~^ ERROR refutable pattern in local binding - //~| `Helper::T(_, _)` not covered + //~| NOTE_NONVIRAL `Helper::T(_, _)` not covered u } diff --git a/tests/ui/enum-discriminant/discriminant-overflow.rs b/tests/ui/enum-discriminant/discriminant-overflow.rs index 774ced93c1723..51de8d71b6e45 100644 --- a/tests/ui/enum-discriminant/discriminant-overflow.rs +++ b/tests/ui/enum-discriminant/discriminant-overflow.rs @@ -42,7 +42,7 @@ fn f_u16() { Ok = u16::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| overflowed on value after 65535 + //~| NOTE_NONVIRAL overflowed on value after 65535 } let x = A::Ok; @@ -54,7 +54,7 @@ fn f_i32() { Ok = i32::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| overflowed on value after 2147483647 + //~| NOTE_NONVIRAL overflowed on value after 2147483647 } let x = A::Ok; @@ -66,7 +66,7 @@ fn f_u32() { Ok = u32::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| overflowed on value after 4294967295 + //~| NOTE_NONVIRAL overflowed on value after 4294967295 } let x = A::Ok; @@ -78,7 +78,7 @@ fn f_i64() { Ok = i64::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| overflowed on value after 9223372036854775807 + //~| NOTE_NONVIRAL overflowed on value after 9223372036854775807 } let x = A::Ok; @@ -90,7 +90,7 @@ fn f_u64() { Ok = u64::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| overflowed on value after 18446744073709551615 + //~| NOTE_NONVIRAL overflowed on value after 18446744073709551615 } let x = A::Ok; diff --git a/tests/ui/error-codes/E0080.rs b/tests/ui/error-codes/E0080.rs index ea3264b61b356..396442feb67c6 100644 --- a/tests/ui/error-codes/E0080.rs +++ b/tests/ui/error-codes/E0080.rs @@ -1,6 +1,6 @@ enum Enum { X = (1 << 500), //~ ERROR E0080 - //~| attempt to shift left by `500_i32`, which would overflow + //~| NOTE_NONVIRAL attempt to shift left by `500_i32`, which would overflow Y = (1 / 0) //~ ERROR E0080 } diff --git a/tests/ui/error-codes/E0106.rs b/tests/ui/error-codes/E0106.rs index cc3438727a817..e9c607d90e27d 100644 --- a/tests/ui/error-codes/E0106.rs +++ b/tests/ui/error-codes/E0106.rs @@ -16,10 +16,10 @@ struct Buzz<'a, 'b>(&'a str, &'b str); struct Quux { baz: Baz, //~^ ERROR E0106 - //~| expected named lifetime parameter + //~| NOTE_NONVIRAL expected named lifetime parameter buzz: Buzz, //~^ ERROR E0106 - //~| expected 2 lifetime parameters + //~| NOTE_NONVIRAL expected 2 lifetime parameters } fn main() { diff --git a/tests/ui/error-codes/E0428.rs b/tests/ui/error-codes/E0428.rs index eb9594fb8b6e3..48fbc9c87552a 100644 --- a/tests/ui/error-codes/E0428.rs +++ b/tests/ui/error-codes/E0428.rs @@ -1,4 +1,4 @@ -struct Bar; //~ previous definition of the type `Bar` here +struct Bar; //~ NOTE_NONVIRAL previous definition of the type `Bar` here struct Bar; //~ ERROR E0428 fn main () { diff --git a/tests/ui/explicit/explicit-self-lifetime-mismatch.rs b/tests/ui/explicit/explicit-self-lifetime-mismatch.rs index a9a6f50fb8ea5..cb601b792efaa 100644 --- a/tests/ui/explicit/explicit-self-lifetime-mismatch.rs +++ b/tests/ui/explicit/explicit-self-lifetime-mismatch.rs @@ -7,13 +7,13 @@ impl<'a,'b> Foo<'a,'b> { fn bar(self: Foo<'b,'a> //~^ ERROR mismatched `self` parameter type - //~| expected struct `Foo<'a, 'b>` - //~| found struct `Foo<'b, 'a>` - //~| lifetime mismatch + //~| NOTE_NONVIRAL expected struct `Foo<'a, 'b>` + //~| NOTE_NONVIRAL found struct `Foo<'b, 'a>` + //~| NOTE_NONVIRAL lifetime mismatch //~| ERROR mismatched `self` parameter type - //~| expected struct `Foo<'a, 'b>` - //~| found struct `Foo<'b, 'a>` - //~| lifetime mismatch + //~| NOTE_NONVIRAL expected struct `Foo<'a, 'b>` + //~| NOTE_NONVIRAL found struct `Foo<'b, 'a>` + //~| NOTE_NONVIRAL lifetime mismatch ) {} } diff --git a/tests/ui/expr/if/if-branch-types.rs b/tests/ui/expr/if/if-branch-types.rs index c125ba30606c5..88e3909bbd8d5 100644 --- a/tests/ui/expr/if/if-branch-types.rs +++ b/tests/ui/expr/if/if-branch-types.rs @@ -1,5 +1,5 @@ fn main() { let x = if true { 10i32 } else { 10u32 }; //~^ ERROR `if` and `else` have incompatible types - //~| expected `i32`, found `u32` + //~| NOTE_NONVIRAL expected `i32`, found `u32` } diff --git a/tests/ui/expr/if/if-without-else-result.rs b/tests/ui/expr/if/if-without-else-result.rs index 95604758a6b3e..6150fa80a7ccf 100644 --- a/tests/ui/expr/if/if-without-else-result.rs +++ b/tests/ui/expr/if/if-without-else-result.rs @@ -1,6 +1,6 @@ fn main() { let a = if true { true }; //~^ ERROR `if` may be missing an `else` clause [E0317] - //~| expected `bool`, found `()` + //~| NOTE_NONVIRAL expected `bool`, found `()` println!("{}", a); } diff --git a/tests/ui/expr/if/issue-4201.rs b/tests/ui/expr/if/issue-4201.rs index 59c465b9e1492..5ccaf42facb35 100644 --- a/tests/ui/expr/if/issue-4201.rs +++ b/tests/ui/expr/if/issue-4201.rs @@ -3,7 +3,7 @@ fn main() { 0 } else if false { //~^ ERROR `if` may be missing an `else` clause -//~| expected integer, found `()` +//~| NOTE_NONVIRAL expected integer, found `()` 1 }; } diff --git a/tests/ui/fn/fn-item-type.rs b/tests/ui/fn/fn-item-type.rs index c094a34b207d9..358f7a5cb2343 100644 --- a/tests/ui/fn/fn-item-type.rs +++ b/tests/ui/fn/fn-item-type.rs @@ -21,31 +21,31 @@ impl Foo for T { fn main() { eq(foo::, bar::); //~^ ERROR mismatched types - //~| expected fn item `fn(_) -> _ {foo::}` - //~| found fn item `fn(_) -> _ {bar::}` - //~| expected fn item, found a different fn item - //~| different fn items have unique types, even if their signatures are the same + //~| NOTE_NONVIRAL expected fn item `fn(_) -> _ {foo::}` + //~| NOTE_NONVIRAL found fn item `fn(_) -> _ {bar::}` + //~| NOTE_NONVIRAL expected fn item, found a different fn item + //~| NOTE_NONVIRAL different fn items have unique types, even if their signatures are the same eq(foo::, foo::); //~^ ERROR mismatched types - //~| expected `u8`, found `i8` - //~| different fn items have unique types, even if their signatures are the same + //~| NOTE_NONVIRAL expected `u8`, found `i8` + //~| NOTE_NONVIRAL different fn items have unique types, even if their signatures are the same eq(bar::, bar::>); //~^ ERROR mismatched types - //~| found fn item `fn(_) -> _ {bar::>}` - //~| expected `String`, found `Vec` + //~| NOTE_NONVIRAL found fn item `fn(_) -> _ {bar::>}` + //~| NOTE_NONVIRAL expected `String`, found `Vec` // Make sure we distinguish between trait methods correctly. eq(::foo, ::foo); //~^ ERROR mismatched types - //~| expected `u8`, found `u16` - //~| different fn items have unique types, even if their signatures are the same + //~| NOTE_NONVIRAL expected `u8`, found `u16` + //~| NOTE_NONVIRAL different fn items have unique types, even if their signatures are the same eq(foo::, bar:: as fn(isize) -> isize); //~^ ERROR mismatched types - //~| found fn pointer `fn(_) -> _` - //~| expected fn item, found fn pointer + //~| NOTE_NONVIRAL found fn pointer `fn(_) -> _` + //~| NOTE_NONVIRAL expected fn item, found fn pointer eq(foo:: as fn(isize) -> isize, bar::); // ok! } diff --git a/tests/ui/fn/fn-pointer-mismatch.rs b/tests/ui/fn/fn-pointer-mismatch.rs index 1c50d8b0f8b2d..2b420e2f58a38 100644 --- a/tests/ui/fn/fn-pointer-mismatch.rs +++ b/tests/ui/fn/fn-pointer-mismatch.rs @@ -10,7 +10,7 @@ fn bar(x: u32) -> u32 { fn foobar(n: u32) -> u32 { let g = if n % 2 == 0 { &foo } else { &bar }; //~^ ERROR `if` and `else` have incompatible types - //~| different fn items have unique types, even if their signatures are the same + //~| NOTE_NONVIRAL different fn items have unique types, even if their signatures are the same g(n) } @@ -22,33 +22,33 @@ fn main() { let mut a = foo; a = bar; //~^ ERROR mismatched types - //~| expected fn item `fn(_) -> _ {foo}` - //~| found fn item `fn(_) -> _ {bar}` - //~| different fn items have unique types, even if their signatures are the same + //~| NOTE_NONVIRAL expected fn item `fn(_) -> _ {foo}` + //~| NOTE_NONVIRAL found fn item `fn(_) -> _ {bar}` + //~| NOTE_NONVIRAL different fn items have unique types, even if their signatures are the same // display note even when boxed let mut b = Box::new(foo); b = Box::new(bar); //~^ ERROR mismatched types - //~| different fn items have unique types, even if their signatures are the same + //~| NOTE_NONVIRAL different fn items have unique types, even if their signatures are the same // suggest removing reference let c: fn(u32) -> u32 = &foo; //~^ ERROR mismatched types - //~| expected fn pointer `fn(_) -> _` - //~| found reference `&fn(_) -> _ {foo}` + //~| NOTE_NONVIRAL expected fn pointer `fn(_) -> _` + //~| NOTE_NONVIRAL found reference `&fn(_) -> _ {foo}` // suggest using reference let d: &fn(u32) -> u32 = foo; //~^ ERROR mismatched types - //~| expected reference `&fn(_) -> _` - //~| found fn item `fn(_) -> _ {foo}` + //~| NOTE_NONVIRAL expected reference `&fn(_) -> _` + //~| NOTE_NONVIRAL found fn item `fn(_) -> _ {foo}` // suggest casting with reference let e: &fn(u32) -> u32 = &foo; //~^ ERROR mismatched types - //~| expected reference `&fn(_) -> _` - //~| found reference `&fn(_) -> _ {foo}` + //~| NOTE_NONVIRAL expected reference `&fn(_) -> _` + //~| NOTE_NONVIRAL found reference `&fn(_) -> _ {foo}` // OK let mut z: fn(u32) -> u32 = foo as fn(u32) -> u32; diff --git a/tests/ui/fn/fn-trait-formatting.rs b/tests/ui/fn/fn-trait-formatting.rs index 61a8791ab1f3e..570348b5615cf 100644 --- a/tests/ui/fn/fn-trait-formatting.rs +++ b/tests/ui/fn/fn-trait-formatting.rs @@ -5,16 +5,16 @@ fn needs_fn(x: F) where F: Fn(isize) -> isize {} fn main() { let _: () = Box::new(|_: isize| {}) as Box; //~^ ERROR mismatched types - //~| expected unit type `()` - //~| found struct `Box` + //~| NOTE_NONVIRAL expected unit type `()` + //~| NOTE_NONVIRAL found struct `Box` let _: () = Box::new(|_: isize, isize| {}) as Box; //~^ ERROR mismatched types - //~| expected unit type `()` - //~| found struct `Box` + //~| NOTE_NONVIRAL expected unit type `()` + //~| NOTE_NONVIRAL found struct `Box` let _: () = Box::new(|| -> isize { unimplemented!() }) as Box isize>; //~^ ERROR mismatched types - //~| expected unit type `()` - //~| found struct `Box isize>` + //~| NOTE_NONVIRAL expected unit type `()` + //~| NOTE_NONVIRAL found struct `Box isize>` needs_fn(1); //~^ ERROR expected a `Fn(isize)` closure, found `{integer}` diff --git a/tests/ui/foreign/issue-91370-foreign-fn-block-impl.rs b/tests/ui/foreign/issue-91370-foreign-fn-block-impl.rs index 23e08e01e6a62..6c089ceb4e5ad 100644 --- a/tests/ui/foreign/issue-91370-foreign-fn-block-impl.rs +++ b/tests/ui/foreign/issue-91370-foreign-fn-block-impl.rs @@ -1,10 +1,10 @@ // Regression test for issue #91370. extern "C" { - //~^ `extern` blocks define existing foreign functions + //~^ NOTE_NONVIRAL `extern` blocks define existing foreign functions fn f() { //~^ ERROR incorrect function inside `extern` block - //~| cannot have a body + //~| NOTE_NONVIRAL cannot have a body impl Copy for u8 {} } } diff --git a/tests/ui/fully-qualified-type/fully-qualified-type-name2.rs b/tests/ui/fully-qualified-type/fully-qualified-type-name2.rs index f26d3be66303d..c491bca05a7f1 100644 --- a/tests/ui/fully-qualified-type/fully-qualified-type-name2.rs +++ b/tests/ui/fully-qualified-type/fully-qualified-type-name2.rs @@ -11,7 +11,7 @@ mod y { fn bar(x: x::Foo) -> y::Foo { return x; //~^ ERROR mismatched types - //~| expected `y::Foo`, found `x::Foo` + //~| NOTE_NONVIRAL expected `y::Foo`, found `x::Foo` } fn main() { diff --git a/tests/ui/fully-qualified-type/fully-qualified-type-name4.rs b/tests/ui/fully-qualified-type/fully-qualified-type-name4.rs index 41f07bab80966..5733c76c54011 100644 --- a/tests/ui/fully-qualified-type/fully-qualified-type-name4.rs +++ b/tests/ui/fully-qualified-type/fully-qualified-type-name4.rs @@ -5,9 +5,9 @@ use std::option::Option; fn bar(x: usize) -> Option { return x; //~^ ERROR mismatched types - //~| expected enum `Option` - //~| found type `usize` - //~| expected `Option`, found `usize` + //~| NOTE_NONVIRAL expected enum `Option` + //~| NOTE_NONVIRAL found type `usize` + //~| NOTE_NONVIRAL expected `Option`, found `usize` } fn main() { diff --git a/tests/ui/generics/generic-type-params-name-repr.rs b/tests/ui/generics/generic-type-params-name-repr.rs index d60856b8904bb..c5d4abd5f225b 100644 --- a/tests/ui/generics/generic-type-params-name-repr.rs +++ b/tests/ui/generics/generic-type-params-name-repr.rs @@ -12,40 +12,40 @@ fn main() { // Ensure that the printed type doesn't include the default type params... let _: Foo = (); //~^ ERROR mismatched types - //~| expected `Foo`, found `()` - //~| expected struct `Foo` - //~| found unit type `()` + //~| NOTE_NONVIRAL expected `Foo`, found `()` + //~| NOTE_NONVIRAL expected struct `Foo` + //~| NOTE_NONVIRAL found unit type `()` // ...even when they're present, but the same types as the defaults. let _: Foo = (); //~^ ERROR mismatched types - //~| expected `Foo`, found `()` - //~| expected struct `Foo` - //~| found unit type `()` + //~| NOTE_NONVIRAL expected `Foo`, found `()` + //~| NOTE_NONVIRAL expected struct `Foo` + //~| NOTE_NONVIRAL found unit type `()` // Including cases where the default is using previous type params. let _: HashMap = (); //~^ ERROR mismatched types - //~| expected `HashMap`, found `()` - //~| expected struct `HashMap` - //~| found unit type `()` + //~| NOTE_NONVIRAL expected `HashMap`, found `()` + //~| NOTE_NONVIRAL expected struct `HashMap` + //~| NOTE_NONVIRAL found unit type `()` let _: HashMap> = (); //~^ ERROR mismatched types - //~| expected `HashMap`, found `()` - //~| expected struct `HashMap` - //~| found unit type `()` + //~| NOTE_NONVIRAL expected `HashMap`, found `()` + //~| NOTE_NONVIRAL expected struct `HashMap` + //~| NOTE_NONVIRAL found unit type `()` // But not when there's a different type in between. let _: Foo = (); //~^ ERROR mismatched types - //~| expected `Foo`, found `()` - //~| expected struct `Foo` - //~| found unit type `()` + //~| NOTE_NONVIRAL expected `Foo`, found `()` + //~| NOTE_NONVIRAL expected struct `Foo` + //~| NOTE_NONVIRAL found unit type `()` // And don't print <> at all when there's just defaults. let _: Foo = (); //~^ ERROR mismatched types - //~| expected `Foo`, found `()` - //~| expected struct `Foo` - //~| found unit type `()` + //~| NOTE_NONVIRAL expected `Foo`, found `()` + //~| NOTE_NONVIRAL expected struct `Foo` + //~| NOTE_NONVIRAL found unit type `()` } diff --git a/tests/ui/generics/slightly-nice-generic-literal-messages.rs b/tests/ui/generics/slightly-nice-generic-literal-messages.rs index 268009f65a5c1..57bbfb4c1d004 100644 --- a/tests/ui/generics/slightly-nice-generic-literal-messages.rs +++ b/tests/ui/generics/slightly-nice-generic-literal-messages.rs @@ -6,9 +6,9 @@ fn main() { match Foo(1.1, marker::PhantomData) { 1 => {} //~^ ERROR mismatched types - //~| expected struct `Foo<{float}, _>` - //~| found type `{integer}` - //~| expected `Foo<{float}, _>`, found integer + //~| NOTE_NONVIRAL expected struct `Foo<{float}, _>` + //~| NOTE_NONVIRAL found type `{integer}` + //~| NOTE_NONVIRAL expected `Foo<{float}, _>`, found integer } } diff --git a/tests/ui/impl-trait/equality.rs b/tests/ui/impl-trait/equality.rs index 828b5aac896be..2f5fa99e73c8e 100644 --- a/tests/ui/impl-trait/equality.rs +++ b/tests/ui/impl-trait/equality.rs @@ -14,7 +14,7 @@ fn two(x: bool) -> impl Foo { } 0_u32 //~^ ERROR mismatched types - //~| expected `i32`, found `u32` + //~| NOTE_NONVIRAL expected `i32`, found `u32` } fn sum_to(n: u32) -> impl Foo { diff --git a/tests/ui/impl-trait/equality2.rs b/tests/ui/impl-trait/equality2.rs index 2e325867da86e..a7927150a141f 100644 --- a/tests/ui/impl-trait/equality2.rs +++ b/tests/ui/impl-trait/equality2.rs @@ -24,21 +24,21 @@ impl Leak for i32 { fn main() { let _: u32 = hide(0_u32); //~^ ERROR mismatched types - //~| expected type `u32` - //~| found opaque type `impl Foo` - //~| expected `u32`, found opaque type + //~| NOTE_NONVIRAL expected type `u32` + //~| NOTE_NONVIRAL found opaque type `impl Foo` + //~| NOTE_NONVIRAL expected `u32`, found opaque type let _: i32 = Leak::leak(hide(0_i32)); //~^ ERROR mismatched types - //~| expected type `i32` - //~| found associated type `::T` - //~| expected `i32`, found associated type + //~| NOTE_NONVIRAL expected type `i32` + //~| NOTE_NONVIRAL found associated type `::T` + //~| NOTE_NONVIRAL expected `i32`, found associated type let mut x = (hide(0_u32), hide(0_i32)); x = (x.1, //~^ ERROR mismatched types - //~| expected `u32`, found `i32` + //~| NOTE_NONVIRAL expected `u32`, found `i32` x.0); //~^ ERROR mismatched types - //~| expected `i32`, found `u32` + //~| NOTE_NONVIRAL expected `i32`, found `u32` } diff --git a/tests/ui/impl-trait/no-method-suggested-traits.rs b/tests/ui/impl-trait/no-method-suggested-traits.rs index 6fc96f27a671e..02f728301f92b 100644 --- a/tests/ui/impl-trait/no-method-suggested-traits.rs +++ b/tests/ui/impl-trait/no-method-suggested-traits.rs @@ -22,9 +22,9 @@ fn main() { 1u32.method(); //~^ ERROR no method named - //~|items from traits can only be used if the trait is in scope + //~| HELP_NONVIRAL items from traits can only be used if the trait is in scope std::rc::Rc::new(&mut Box::new(&1u32)).method(); - //~^items from traits can only be used if the trait is in scope + //~^ HELP_NONVIRAL items from traits can only be used if the trait is in scope //~| ERROR no method named `method` found for struct 'a'.method(); diff --git a/tests/ui/implied-bounds/sod_service_chain.rs b/tests/ui/implied-bounds/sod_service_chain.rs index 73dce2fce2494..501cc08f529e1 100644 --- a/tests/ui/implied-bounds/sod_service_chain.rs +++ b/tests/ui/implied-bounds/sod_service_chain.rs @@ -30,16 +30,16 @@ impl> ServiceChainBuilder { //~^ ERROR the associated type //~| ERROR the associated type //~| ERROR the associated type - //~| the associated type - //~| the associated type - //~| the associated type + //~| NOTE_NONVIRAL the associated type + //~| NOTE_NONVIRAL the associated type + //~| NOTE_NONVIRAL the associated type //~| ERROR may not live long enough self, ) -> ServiceChainBuilder, NS> { //~^ ERROR the associated type //~| ERROR the associated type - //~| the associated type - //~| the associated type + //~| NOTE_NONVIRAL the associated type + //~| NOTE_NONVIRAL the associated type panic!(); } } diff --git a/tests/ui/imports/import.rs b/tests/ui/imports/import.rs index 3170dd2fae108..d244b770f621a 100644 --- a/tests/ui/imports/import.rs +++ b/tests/ui/imports/import.rs @@ -1,6 +1,6 @@ use zed::bar; use zed::baz; //~ ERROR unresolved import `zed::baz` [E0432] - //~| no `baz` in `zed` + //~| NOTE_NONVIRAL no `baz` in `zed` //~| HELP a similar name exists in the module //~| SUGGESTION bar @@ -8,7 +8,7 @@ use zed::baz; //~ ERROR unresolved import `zed::baz` [E0432] mod zed { pub fn bar() { println!("bar"); } use foo; //~ ERROR unresolved import `foo` [E0432] - //~^ no `foo` in the root + //~^ NOTE_NONVIRAL no `foo` in the root } fn main() { diff --git a/tests/ui/imports/issue-19498.rs b/tests/ui/imports/issue-19498.rs index 5fe6742f55e03..592227730c5ac 100644 --- a/tests/ui/imports/issue-19498.rs +++ b/tests/ui/imports/issue-19498.rs @@ -1,13 +1,13 @@ use self::A; use self::B; mod A {} //~ ERROR the name `A` is defined multiple times -//~| `A` redefined here +//~| NOTE_NONVIRAL `A` redefined here pub mod B {} //~ ERROR the name `B` is defined multiple times -//~| `B` redefined here +//~| NOTE_NONVIRAL `B` redefined here mod C { use C::D; mod D {} //~ ERROR the name `D` is defined multiple times - //~| `D` redefined here + //~| NOTE_NONVIRAL `D` redefined here } fn main() {} diff --git a/tests/ui/imports/issue-24081.rs b/tests/ui/imports/issue-24081.rs index 10983ce11b501..39b09b515beb6 100644 --- a/tests/ui/imports/issue-24081.rs +++ b/tests/ui/imports/issue-24081.rs @@ -5,14 +5,14 @@ use std::ops::Div; use std::ops::Rem; type Add = bool; //~ ERROR the name `Add` is defined multiple times -//~| `Add` redefined here +//~| NOTE_NONVIRAL `Add` redefined here struct Sub { x: f32 } //~ ERROR the name `Sub` is defined multiple times -//~| `Sub` redefined here +//~| NOTE_NONVIRAL `Sub` redefined here enum Mul { A, B } //~ ERROR the name `Mul` is defined multiple times -//~| `Mul` redefined here +//~| NOTE_NONVIRAL `Mul` redefined here mod Div { } //~ ERROR the name `Div` is defined multiple times -//~| `Div` redefined here +//~| NOTE_NONVIRAL `Div` redefined here trait Rem { } //~ ERROR the name `Rem` is defined multiple times -//~| `Rem` redefined here +//~| NOTE_NONVIRAL `Rem` redefined here fn main() {} diff --git a/tests/ui/imports/issue-26886.rs b/tests/ui/imports/issue-26886.rs index 6e6d406c656d6..82dd5bf39ec38 100644 --- a/tests/ui/imports/issue-26886.rs +++ b/tests/ui/imports/issue-26886.rs @@ -1,8 +1,8 @@ use std::sync::{self, Arc}; use std::sync::Arc; //~ ERROR the name `Arc` is defined multiple times - //~| `Arc` must be defined only once in the type namespace of this module + //~| NOTE_NONVIRAL `Arc` must be defined only once in the type namespace of this module use std::sync; //~ ERROR the name `sync` is defined multiple times - //~| `sync` must be defined only once in the type namespace of this module + //~| NOTE_NONVIRAL `sync` must be defined only once in the type namespace of this module fn main() { } diff --git a/tests/ui/inference/tutorial-suffix-inference-test.rs b/tests/ui/inference/tutorial-suffix-inference-test.rs index 849adfd53686b..b5f9b40357e89 100644 --- a/tests/ui/inference/tutorial-suffix-inference-test.rs +++ b/tests/ui/inference/tutorial-suffix-inference-test.rs @@ -8,10 +8,10 @@ fn main() { identity_u8(x); // after this, `x` is assumed to have type `u8` identity_u16(x); //~^ ERROR mismatched types - //~| expected `u16`, found `u8` + //~| NOTE_NONVIRAL expected `u16`, found `u8` identity_u16(y); //~^ ERROR mismatched types - //~| expected `u16`, found `i32` + //~| NOTE_NONVIRAL expected `u16`, found `i32` let a = 3; @@ -20,5 +20,5 @@ fn main() { identity_i(a); // ok identity_u16(a); //~^ ERROR mismatched types - //~| expected `u16`, found `isize` + //~| NOTE_NONVIRAL expected `u16`, found `isize` } diff --git a/tests/ui/issues/issue-13359.rs b/tests/ui/issues/issue-13359.rs index 9129790c501e3..7e8b9ea985a6d 100644 --- a/tests/ui/issues/issue-13359.rs +++ b/tests/ui/issues/issue-13359.rs @@ -5,9 +5,9 @@ fn bar(_s: u32) { } fn main() { foo(1*(1 as isize)); //~^ ERROR mismatched types - //~| expected `i16`, found `isize` + //~| NOTE_NONVIRAL expected `i16`, found `isize` bar(1*(1 as usize)); //~^ ERROR mismatched types - //~| expected `u32`, found `usize` + //~| NOTE_NONVIRAL expected `u32`, found `usize` } diff --git a/tests/ui/issues/issue-13466.rs b/tests/ui/issues/issue-13466.rs index 52d4d75d29da2..11118620cd84e 100644 --- a/tests/ui/issues/issue-13466.rs +++ b/tests/ui/issues/issue-13466.rs @@ -7,14 +7,14 @@ pub fn main() { let _x: usize = match Some(1) { Ok(u) => u, //~^ ERROR mismatched types - //~| expected enum `Option<{integer}>` - //~| found enum `Result<_, _>` - //~| expected `Option<{integer}>`, found `Result<_, _>` + //~| NOTE_NONVIRAL expected enum `Option<{integer}>` + //~| NOTE_NONVIRAL found enum `Result<_, _>` + //~| NOTE_NONVIRAL expected `Option<{integer}>`, found `Result<_, _>` Err(e) => panic!(e) //~^ ERROR mismatched types - //~| expected enum `Option<{integer}>` - //~| found enum `Result<_, _>` - //~| expected `Option<{integer}>`, found `Result<_, _>` + //~| NOTE_NONVIRAL expected enum `Option<{integer}>` + //~| NOTE_NONVIRAL found enum `Result<_, _>` + //~| NOTE_NONVIRAL expected `Option<{integer}>`, found `Result<_, _>` }; } diff --git a/tests/ui/issues/issue-14541.rs b/tests/ui/issues/issue-14541.rs index 2ff1c1f8876cd..90ea51347c492 100644 --- a/tests/ui/issues/issue-14541.rs +++ b/tests/ui/issues/issue-14541.rs @@ -4,7 +4,7 @@ struct Vec3 { y: f32, z: f32 } fn make(v: Vec2) { let Vec3 { y: _, z: _ } = v; //~^ ERROR mismatched types - //~| expected `Vec2`, found `Vec3` + //~| NOTE_NONVIRAL expected `Vec2`, found `Vec3` } fn main() { } diff --git a/tests/ui/issues/issue-15094.rs b/tests/ui/issues/issue-15094.rs index cb27e2bcfb6c0..69f1375921339 100644 --- a/tests/ui/issues/issue-15094.rs +++ b/tests/ui/issues/issue-15094.rs @@ -10,8 +10,8 @@ impl ops::FnOnce<(),> for Debuger { type Output = (); fn call_once(self, _args: ()) { //~^ ERROR `call_once` has an incompatible type for trait - //~| expected signature `extern "rust-call" fn - //~| found signature `fn + //~| NOTE_NONVIRAL expected signature `extern "rust-call" fn + //~| NOTE_NONVIRAL found signature `fn println!("{:?}", self.x); } } diff --git a/tests/ui/issues/issue-15381.rs b/tests/ui/issues/issue-15381.rs index 23b266bef1d91..c5aca14891b47 100644 --- a/tests/ui/issues/issue-15381.rs +++ b/tests/ui/issues/issue-15381.rs @@ -3,7 +3,7 @@ fn main() { for &[x,y,z] in values.chunks(3).filter(|&xs| xs.len() == 3) { //~^ ERROR refutable pattern in `for` loop binding - //~| patterns `&[]`, `&[_]`, `&[_, _]` and 1 more not covered + //~| NOTE_NONVIRAL patterns `&[]`, `&[_]`, `&[_, _]` and 1 more not covered println!("y={}", y); } } diff --git a/tests/ui/issues/issue-15783.rs b/tests/ui/issues/issue-15783.rs index ceb37a20e3f30..d712a7de98860 100644 --- a/tests/ui/issues/issue-15783.rs +++ b/tests/ui/issues/issue-15783.rs @@ -7,8 +7,8 @@ fn main() { let x = Some(&[name]); let msg = foo(x); //~^ ERROR mismatched types - //~| expected enum `Option<&[&str]>` - //~| found enum `Option<&[&str; 1]>` - //~| expected `Option<&[&str]>`, found `Option<&[&str; 1]>` + //~| NOTE_NONVIRAL expected enum `Option<&[&str]>` + //~| NOTE_NONVIRAL found enum `Option<&[&str; 1]>` + //~| NOTE_NONVIRAL expected `Option<&[&str]>`, found `Option<&[&str; 1]>` assert_eq!(msg, 3); } diff --git a/tests/ui/issues/issue-16401.rs b/tests/ui/issues/issue-16401.rs index 19ae7da107ca2..f0fad6d2cd1b4 100644 --- a/tests/ui/issues/issue-16401.rs +++ b/tests/ui/issues/issue-16401.rs @@ -7,9 +7,9 @@ fn main() { match () { Slice { data: data, len: len } => (), //~^ ERROR mismatched types - //~| expected unit type `()` - //~| found struct `Slice<_>` - //~| expected `()`, found `Slice<_>` + //~| NOTE_NONVIRAL expected unit type `()` + //~| NOTE_NONVIRAL found struct `Slice<_>` + //~| NOTE_NONVIRAL expected `()`, found `Slice<_>` _ => unreachable!() } } diff --git a/tests/ui/issues/issue-17033.rs b/tests/ui/issues/issue-17033.rs index 72a8cd9823a4b..2439f9f15df08 100644 --- a/tests/ui/issues/issue-17033.rs +++ b/tests/ui/issues/issue-17033.rs @@ -1,6 +1,6 @@ fn f<'r>(p: &'r mut fn(p: &mut ())) { (*p)(()) //~ ERROR mismatched types - //~| expected `&mut ()`, found `()` + //~| NOTE_NONVIRAL expected `&mut ()`, found `()` } fn main() {} diff --git a/tests/ui/issues/issue-17740.rs b/tests/ui/issues/issue-17740.rs index 574d3662b4fb0..2e2c322a7cca4 100644 --- a/tests/ui/issues/issue-17740.rs +++ b/tests/ui/issues/issue-17740.rs @@ -5,13 +5,13 @@ struct Foo<'a> { impl <'a> Foo<'a>{ fn bar(self: &mut Foo) { //~^ ERROR mismatched `self` parameter type - //~| expected struct `Foo<'a>` - //~| found struct `Foo<'_>` - //~| lifetime mismatch + //~| NOTE_NONVIRAL expected struct `Foo<'a>` + //~| NOTE_NONVIRAL found struct `Foo<'_>` + //~| NOTE_NONVIRAL lifetime mismatch //~| ERROR mismatched `self` parameter type - //~| expected struct `Foo<'a>` - //~| found struct `Foo<'_>` - //~| lifetime mismatch + //~| NOTE_NONVIRAL expected struct `Foo<'a>` + //~| NOTE_NONVIRAL found struct `Foo<'_>` + //~| NOTE_NONVIRAL lifetime mismatch } } diff --git a/tests/ui/issues/issue-19991.rs b/tests/ui/issues/issue-19991.rs index dd0efa972ba3e..6e8b0997a1952 100644 --- a/tests/ui/issues/issue-19991.rs +++ b/tests/ui/issues/issue-19991.rs @@ -3,7 +3,7 @@ fn main() { if let Some(homura) = Some("madoka") { //~ ERROR missing an `else` clause - //~| expected integer, found `()` + //~| NOTE_NONVIRAL expected integer, found `()` 765 }; } diff --git a/tests/ui/issues/issue-21332.rs b/tests/ui/issues/issue-21332.rs index 4473d00fd5da2..eb47987a53f98 100644 --- a/tests/ui/issues/issue-21332.rs +++ b/tests/ui/issues/issue-21332.rs @@ -4,7 +4,7 @@ impl Iterator for S { type Item = i32; fn next(&mut self) -> Result { Ok(7) } //~^ ERROR method `next` has an incompatible type for trait - //~| expected `Option`, found `Result` + //~| NOTE_NONVIRAL expected `Option`, found `Result` } fn main() {} diff --git a/tests/ui/issues/issue-24819.rs b/tests/ui/issues/issue-24819.rs index fb4cfb7b29e8b..4ba5e7310cb7a 100644 --- a/tests/ui/issues/issue-24819.rs +++ b/tests/ui/issues/issue-24819.rs @@ -4,7 +4,7 @@ fn main() { let mut v = Vec::new(); foo(&mut v); //~^ ERROR mismatched types - //~| expected `&mut HashSet`, found `&mut Vec<_>` + //~| NOTE_NONVIRAL expected `&mut HashSet`, found `&mut Vec<_>` } fn foo(h: &mut HashSet) { diff --git a/tests/ui/issues/issue-27942.rs b/tests/ui/issues/issue-27942.rs index 34b34de387976..d98966880472d 100644 --- a/tests/ui/issues/issue-27942.rs +++ b/tests/ui/issues/issue-27942.rs @@ -4,9 +4,9 @@ pub trait Buffer<'a, R: Resources<'a>> { fn select(&self) -> BufferViewHandle; //~^ ERROR mismatched types - //~| lifetime mismatch + //~| NOTE_NONVIRAL lifetime mismatch //~| ERROR mismatched types - //~| lifetime mismatch + //~| NOTE_NONVIRAL lifetime mismatch } pub struct BufferViewHandle<'a, R: 'a+Resources<'a>>(&'a R); diff --git a/tests/ui/issues/issue-2951.rs b/tests/ui/issues/issue-2951.rs index 1798e3e751923..50039d5f7266a 100644 --- a/tests/ui/issues/issue-2951.rs +++ b/tests/ui/issues/issue-2951.rs @@ -2,9 +2,9 @@ fn foo(x: T, y: U) { let mut xx = x; xx = y; //~^ ERROR mismatched types - //~| expected type parameter `T`, found type parameter `U` - //~| expected type parameter `T` - //~| found type parameter `U` + //~| NOTE_NONVIRAL expected type parameter `T`, found type parameter `U` + //~| NOTE_NONVIRAL expected type parameter `T` + //~| NOTE_NONVIRAL found type parameter `U` } fn main() { diff --git a/tests/ui/issues/issue-31011.rs b/tests/ui/issues/issue-31011.rs index 86fe16f48e224..c7848e0a6a8f7 100644 --- a/tests/ui/issues/issue-31011.rs +++ b/tests/ui/issues/issue-31011.rs @@ -16,7 +16,7 @@ struct Foo { fn wrap(context: &T) -> () { log!(context, "entered wrapper"); - //~^ in this expansion of log! + //~^ NOTE_NONVIRAL in this expansion of log! } fn main() { diff --git a/tests/ui/issues/issue-31910.rs b/tests/ui/issues/issue-31910.rs index 19cfc4627c756..5aa68b34f3f9e 100644 --- a/tests/ui/issues/issue-31910.rs +++ b/tests/ui/issues/issue-31910.rs @@ -1,8 +1,8 @@ enum Enum { - //~^ ERROR: `T` is never used + //~^ ERROR `T` is never used X = Trait::Number, //~^ ERROR mismatched types - //~| expected `isize`, found `i32` + //~| NOTE_NONVIRAL expected `isize`, found `i32` } trait Trait { diff --git a/tests/ui/issues/issue-3477.rs b/tests/ui/issues/issue-3477.rs index 3817d0e6a3ee9..7bcb0475e6d8c 100644 --- a/tests/ui/issues/issue-3477.rs +++ b/tests/ui/issues/issue-3477.rs @@ -1,5 +1,5 @@ fn main() { let _p: char = 100; //~^ ERROR mismatched types - //~| expected `char`, found `u8` + //~| NOTE_NONVIRAL expected `char`, found `u8` } diff --git a/tests/ui/issues/issue-3680.rs b/tests/ui/issues/issue-3680.rs index a0e5279812297..e1469e5a01a63 100644 --- a/tests/ui/issues/issue-3680.rs +++ b/tests/ui/issues/issue-3680.rs @@ -2,8 +2,8 @@ fn main() { match None { Err(_) => () //~^ ERROR mismatched types - //~| expected enum `Option<_>` - //~| found enum `Result<_, _>` - //~| expected `Option<_>`, found `Result<_, _>` + //~| NOTE_NONVIRAL expected enum `Option<_>` + //~| NOTE_NONVIRAL found enum `Result<_, _>` + //~| NOTE_NONVIRAL expected `Option<_>`, found `Result<_, _>` } } diff --git a/tests/ui/issues/issue-37884.rs b/tests/ui/issues/issue-37884.rs index ee37481b23f72..cf8d184cae1c8 100644 --- a/tests/ui/issues/issue-37884.rs +++ b/tests/ui/issues/issue-37884.rs @@ -5,7 +5,7 @@ impl<'a, T: 'a> Iterator for RepeatMut<'a, T> { type Item = &'a mut T; fn next(&'a mut self) -> Option //~^ ERROR method not compatible with trait - //~| lifetime mismatch + //~| NOTE_NONVIRAL lifetime mismatch { Some(&mut self.0) } diff --git a/tests/ui/issues/issue-43355.rs b/tests/ui/issues/issue-43355.rs index bf819af79625f..1b99899f7515e 100644 --- a/tests/ui/issues/issue-43355.rs +++ b/tests/ui/issues/issue-43355.rs @@ -12,7 +12,7 @@ impl Trait1 for T where T: Trait2 { impl Trait1> for A { //~^ ERROR conflicting implementations of trait -//~| downstream crates may implement trait `Trait2>` for type `A` +//~| NOTE_NONVIRAL downstream crates may implement trait `Trait2>` for type `A` type Output = i32; } diff --git a/tests/ui/issues/issue-4517.rs b/tests/ui/issues/issue-4517.rs index 469304e2cf70f..b11c200d9dff4 100644 --- a/tests/ui/issues/issue-4517.rs +++ b/tests/ui/issues/issue-4517.rs @@ -4,5 +4,5 @@ fn main() { let foo: [u8; 4] = [1; 4]; bar(foo); //~^ ERROR mismatched types - //~| expected `usize`, found `[u8; 4]` + //~| NOTE_NONVIRAL expected `usize`, found `[u8; 4]` } diff --git a/tests/ui/issues/issue-4935.rs b/tests/ui/issues/issue-4935.rs index c95020a0c006c..cb1bea007ae29 100644 --- a/tests/ui/issues/issue-4935.rs +++ b/tests/ui/issues/issue-4935.rs @@ -1,6 +1,6 @@ // Regression test for issue #4935 fn foo(a: usize) {} -//~^ defined here +//~^ NOTE_NONVIRAL defined here fn main() { foo(5, 6) } //~^ ERROR function takes 1 argument but 2 arguments were supplied diff --git a/tests/ui/issues/issue-4968.rs b/tests/ui/issues/issue-4968.rs index c8df46dc26740..2f263c6cb6f1d 100644 --- a/tests/ui/issues/issue-4968.rs +++ b/tests/ui/issues/issue-4968.rs @@ -4,7 +4,7 @@ const A: (isize,isize) = (4,2); fn main() { match 42 { A => () } //~^ ERROR mismatched types - //~| expected type `{integer}` - //~| found tuple `(isize, isize)` - //~| expected integer, found `(isize, isize)` + //~| NOTE_NONVIRAL expected type `{integer}` + //~| NOTE_NONVIRAL found tuple `(isize, isize)` + //~| NOTE_NONVIRAL expected integer, found `(isize, isize)` } diff --git a/tests/ui/issues/issue-5100.rs b/tests/ui/issues/issue-5100.rs index 53ebdec816493..66fd27e5ada25 100644 --- a/tests/ui/issues/issue-5100.rs +++ b/tests/ui/issues/issue-5100.rs @@ -7,41 +7,41 @@ fn main() { match (true, false) { A::B => (), //~^ ERROR mismatched types -//~| expected `(bool, bool)`, found `A` -//~| expected tuple `(bool, bool)` -//~| found enum `A` +//~| NOTE_NONVIRAL expected `(bool, bool)`, found `A` +//~| NOTE_NONVIRAL expected tuple `(bool, bool)` +//~| NOTE_NONVIRAL found enum `A` _ => () } match (true, false) { (true, false, false) => () //~^ ERROR mismatched types -//~| expected a tuple with 2 elements, found one with 3 elements -//~| expected tuple `(bool, bool)` -//~| found tuple `(_, _, _)` +//~| NOTE_NONVIRAL expected a tuple with 2 elements, found one with 3 elements +//~| NOTE_NONVIRAL expected tuple `(bool, bool)` +//~| NOTE_NONVIRAL found tuple `(_, _, _)` } match (true, false) { (true, false, false) => () //~^ ERROR mismatched types -//~| expected a tuple with 2 elements, found one with 3 elements -//~| expected tuple `(bool, bool)` -//~| found tuple `(_, _, _)` +//~| NOTE_NONVIRAL expected a tuple with 2 elements, found one with 3 elements +//~| NOTE_NONVIRAL expected tuple `(bool, bool)` +//~| NOTE_NONVIRAL found tuple `(_, _, _)` } match (true, false) { box (true, false) => () //~^ ERROR mismatched types -//~| expected tuple `(bool, bool)` -//~| found struct `Box<_>` +//~| NOTE_NONVIRAL expected tuple `(bool, bool)` +//~| NOTE_NONVIRAL found struct `Box<_>` } match (true, false) { &(true, false) => () //~^ ERROR mismatched types -//~| expected `(bool, bool)`, found `&_` -//~| expected tuple `(bool, bool)` -//~| found reference `&_` +//~| NOTE_NONVIRAL expected `(bool, bool)`, found `&_` +//~| NOTE_NONVIRAL expected tuple `(bool, bool)` +//~| NOTE_NONVIRAL found reference `&_` } @@ -53,5 +53,5 @@ fn main() { // Make sure none of the errors above were fatal let x: char = true; //~ ERROR mismatched types - //~| expected `char`, found `bool` + //~| NOTE_NONVIRAL expected `char`, found `bool` } diff --git a/tests/ui/issues/issue-5358-1.rs b/tests/ui/issues/issue-5358-1.rs index 14ee962b722e8..831de020febc0 100644 --- a/tests/ui/issues/issue-5358-1.rs +++ b/tests/ui/issues/issue-5358-1.rs @@ -5,9 +5,9 @@ fn main() { match S(Either::Left(5)) { Either::Right(_) => {} //~^ ERROR mismatched types - //~| expected `S`, found `Either<_, _>` - //~| expected struct `S` - //~| found enum `Either<_, _>` + //~| NOTE_NONVIRAL expected `S`, found `Either<_, _>` + //~| NOTE_NONVIRAL expected struct `S` + //~| NOTE_NONVIRAL found enum `Either<_, _>` _ => {} } } diff --git a/tests/ui/issues/issue-7061.rs b/tests/ui/issues/issue-7061.rs index 8a6ee920a3a8b..cf32a2bda3cd2 100644 --- a/tests/ui/issues/issue-7061.rs +++ b/tests/ui/issues/issue-7061.rs @@ -3,8 +3,8 @@ struct BarStruct; impl<'a> BarStruct { fn foo(&'a mut self) -> Box { self } //~^ ERROR mismatched types - //~| expected struct `Box` - //~| found mutable reference `&'a mut BarStruct` + //~| NOTE_NONVIRAL expected struct `Box` + //~| NOTE_NONVIRAL found mutable reference `&'a mut BarStruct` } fn main() {} diff --git a/tests/ui/issues/issue-7092.rs b/tests/ui/issues/issue-7092.rs index c3c96c7d3f61d..a674e693bddc0 100644 --- a/tests/ui/issues/issue-7092.rs +++ b/tests/ui/issues/issue-7092.rs @@ -5,9 +5,9 @@ fn foo(x: Whatever) { match x { Some(field) => //~^ ERROR mismatched types -//~| expected `Whatever`, found `Option<_>` -//~| expected enum `Whatever` -//~| found enum `Option<_>` +//~| NOTE_NONVIRAL expected `Whatever`, found `Option<_>` +//~| NOTE_NONVIRAL expected enum `Whatever` +//~| NOTE_NONVIRAL found enum `Option<_>` field.access(), } } diff --git a/tests/ui/issues/issue-7867.rs b/tests/ui/issues/issue-7867.rs index e9fd10c6613d4..dba792c5cbe98 100644 --- a/tests/ui/issues/issue-7867.rs +++ b/tests/ui/issues/issue-7867.rs @@ -6,9 +6,9 @@ fn main() { match (true, false) { A::B => (), //~^ ERROR mismatched types - //~| expected `(bool, bool)`, found `A` - //~| expected tuple `(bool, bool)` - //~| found enum `A` + //~| NOTE_NONVIRAL expected `(bool, bool)`, found `A` + //~| NOTE_NONVIRAL expected tuple `(bool, bool)` + //~| NOTE_NONVIRAL found enum `A` _ => () } } diff --git a/tests/ui/macros/issue-118786.rs b/tests/ui/macros/issue-118786.rs index a73b737fe07e4..879e981ce5591 100644 --- a/tests/ui/macros/issue-118786.rs +++ b/tests/ui/macros/issue-118786.rs @@ -7,7 +7,7 @@ macro_rules! make_macro { macro_rules! $macro_name { //~^ ERROR macro expansion ignores `{` and any tokens following //~| ERROR cannot find macro `macro_rules` in this scope - //~| put a macro name here + //~| NOTE_NONVIRAL put a macro name here () => {} } } diff --git a/tests/ui/macros/issue-29084.rs b/tests/ui/macros/issue-29084.rs index d16252686698d..2ece41b2927d5 100644 --- a/tests/ui/macros/issue-29084.rs +++ b/tests/ui/macros/issue-29084.rs @@ -3,11 +3,11 @@ macro_rules! foo { fn bar(d: u8) { } bar(&mut $d); //~^ ERROR mismatched types - //~| expected `u8`, found `&mut u8` + //~| NOTE_NONVIRAL expected `u8`, found `&mut u8` }} } fn main() { foo!(0u8); - //~^ in this expansion of foo! + //~^ NOTE_NONVIRAL in this expansion of foo! } diff --git a/tests/ui/match/match-struct.rs b/tests/ui/match/match-struct.rs index 4da7b436ba8a8..0dcaaea4b738a 100644 --- a/tests/ui/match/match-struct.rs +++ b/tests/ui/match/match-struct.rs @@ -5,7 +5,7 @@ fn main() { match (S { a: 1 }) { E::C(_) => (), //~^ ERROR mismatched types - //~| expected `S`, found `E` + //~| NOTE_NONVIRAL expected `S`, found `E` _ => () } } diff --git a/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.rs b/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.rs index 9e53ff0791728..c26d29dba2ff2 100644 --- a/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.rs +++ b/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.rs @@ -85,7 +85,7 @@ fn objectcandidate_impl() { // Observe the type of `z` is `u32` let _seetype: () = z; //~ ERROR mismatched types - //~| expected `()`, found `u32` + //~| NOTE_NONVIRAL expected `()`, found `u32` } fn traitcandidate_impl() { @@ -102,7 +102,7 @@ fn traitcandidate_impl() { // Observe the type of `z` is `u64` let _seetype: () = z; //~ ERROR mismatched types - //~| expected `()`, found `u64` + //~| NOTE_NONVIRAL expected `()`, found `u64` } fn traitcandidate_impl_with_nuisance() { @@ -137,7 +137,7 @@ fn neither_impl() { // Observe the type of `z` is `u8` let _seetype: () = z; //~ ERROR mismatched types - //~| expected `()`, found `u8` + //~| NOTE_NONVIRAL expected `()`, found `u8` } fn both_impls() { @@ -155,7 +155,7 @@ fn both_impls() { // Observe the type of `z` is `u32` let _seetype: () = z; //~ ERROR mismatched types - //~| expected `()`, found `u32` + //~| NOTE_NONVIRAL expected `()`, found `u32` } @@ -172,7 +172,7 @@ fn both_impls_with_nuisance() { // Observe the type of `z` is `u32` let _seetype: () = z; //~ ERROR mismatched types - //~| expected `()`, found `u32` + //~| NOTE_NONVIRAL expected `()`, found `u32` } fn main() { diff --git a/tests/ui/methods/method-self-arg-1.rs b/tests/ui/methods/method-self-arg-1.rs index 5912b4ec2c3cb..5e7bf689b7464 100644 --- a/tests/ui/methods/method-self-arg-1.rs +++ b/tests/ui/methods/method-self-arg-1.rs @@ -9,9 +9,9 @@ impl Foo { fn main() { let x = Foo; Foo::bar(x); //~ ERROR mismatched types - //~| expected `&Foo`, found `Foo` + //~| NOTE_NONVIRAL expected `&Foo`, found `Foo` Foo::bar(&42); //~ ERROR mismatched types - //~| expected `&Foo`, found `&{integer}` - //~| expected reference `&Foo` - //~| found reference `&{integer}` + //~| NOTE_NONVIRAL expected `&Foo`, found `&{integer}` + //~| NOTE_NONVIRAL expected reference `&Foo` + //~| NOTE_NONVIRAL found reference `&{integer}` } diff --git a/tests/ui/mismatched_types/issue-13033.rs b/tests/ui/mismatched_types/issue-13033.rs index fdb356e70c5f0..ab41e5003f196 100644 --- a/tests/ui/mismatched_types/issue-13033.rs +++ b/tests/ui/mismatched_types/issue-13033.rs @@ -7,8 +7,8 @@ struct Baz; impl Foo for Baz { fn bar(&mut self, other: &dyn Foo) {} //~^ ERROR method `bar` has an incompatible type for trait - //~| expected signature `fn(&mut Baz, &mut dyn Foo)` - //~| found signature `fn(&mut Baz, &dyn Foo)` + //~| NOTE_NONVIRAL expected signature `fn(&mut Baz, &mut dyn Foo)` + //~| NOTE_NONVIRAL found signature `fn(&mut Baz, &dyn Foo)` } fn main() {} diff --git a/tests/ui/moves/moves-based-on-type-match-bindings.rs b/tests/ui/moves/moves-based-on-type-match-bindings.rs index 4fb9b40e87526..dd204197b0bdf 100644 --- a/tests/ui/moves/moves-based-on-type-match-bindings.rs +++ b/tests/ui/moves/moves-based-on-type-match-bindings.rs @@ -14,8 +14,8 @@ fn f10() { }; touch(&x); //~ ERROR borrow of partially moved value: `x` - //~^ value borrowed here after partial move - //~| partial move occurs because `x.f` has type `String` + //~^ NOTE_NONVIRAL value borrowed here after partial move + //~| NOTE_NONVIRAL partial move occurs because `x.f` has type `String` } fn main() {} diff --git a/tests/ui/mut/mut-pattern-mismatched.rs b/tests/ui/mut/mut-pattern-mismatched.rs index 700261fe40b65..301857b9c7369 100644 --- a/tests/ui/mut/mut-pattern-mismatched.rs +++ b/tests/ui/mut/mut-pattern-mismatched.rs @@ -4,17 +4,17 @@ fn main() { // (separate lines to ensure the spans are accurate) let &_ //~ ERROR mismatched types - //~| expected mutable reference `&mut {integer}` - //~| found reference `&_` - //~| types differ in mutability + //~| NOTE_NONVIRAL expected mutable reference `&mut {integer}` + //~| NOTE_NONVIRAL found reference `&_` + //~| NOTE_NONVIRAL types differ in mutability = foo; let &mut _ = foo; let bar = &1; let &_ = bar; let &mut _ //~ ERROR mismatched types - //~| expected reference `&{integer}` - //~| found mutable reference `&mut _` - //~| types differ in mutability + //~| NOTE_NONVIRAL expected reference `&{integer}` + //~| NOTE_NONVIRAL found mutable reference `&mut _` + //~| NOTE_NONVIRAL types differ in mutability = bar; } diff --git a/tests/ui/never_type/issue-10176.rs b/tests/ui/never_type/issue-10176.rs index 5ac4359c5016f..1eafce7484564 100644 --- a/tests/ui/never_type/issue-10176.rs +++ b/tests/ui/never_type/issue-10176.rs @@ -1,9 +1,9 @@ fn f() -> isize { (return 1, return 2) //~^ ERROR mismatched types -//~| expected type `isize` -//~| found tuple `(!, !)` -//~| expected `isize`, found `(!, !)` +//~| NOTE_NONVIRAL expected type `isize` +//~| NOTE_NONVIRAL found tuple `(!, !)` +//~| NOTE_NONVIRAL expected `isize`, found `(!, !)` } fn main() {} diff --git a/tests/ui/noexporttypeexe.rs b/tests/ui/noexporttypeexe.rs index 6b4402a81f00d..7743e1f3005f0 100644 --- a/tests/ui/noexporttypeexe.rs +++ b/tests/ui/noexporttypeexe.rs @@ -9,7 +9,7 @@ fn main() { // not convertible to a path. let x: isize = noexporttypelib::foo(); //~^ ERROR mismatched types - //~| expected type `isize` - //~| found enum `Option` - //~| expected `isize`, found `Option` + //~| NOTE_NONVIRAL expected type `isize` + //~| NOTE_NONVIRAL found enum `Option` + //~| NOTE_NONVIRAL expected `isize`, found `Option` } diff --git a/tests/ui/numeric/integer-literal-suffix-inference.rs b/tests/ui/numeric/integer-literal-suffix-inference.rs index c320f2bb7b446..863ebbb202386 100644 --- a/tests/ui/numeric/integer-literal-suffix-inference.rs +++ b/tests/ui/numeric/integer-literal-suffix-inference.rs @@ -37,184 +37,184 @@ fn main() { id_i8(a8); // ok id_i8(a16); //~^ ERROR mismatched types - //~| expected `i8`, found `i16` + //~| NOTE_NONVIRAL expected `i8`, found `i16` id_i8(a32); //~^ ERROR mismatched types - //~| expected `i8`, found `i32` + //~| NOTE_NONVIRAL expected `i8`, found `i32` id_i8(a64); //~^ ERROR mismatched types - //~| expected `i8`, found `i64` + //~| NOTE_NONVIRAL expected `i8`, found `i64` id_i8(asize); //~^ ERROR mismatched types - //~| expected `i8`, found `isize` + //~| NOTE_NONVIRAL expected `i8`, found `isize` id_i16(a8); //~^ ERROR mismatched types - //~| expected `i16`, found `i8` + //~| NOTE_NONVIRAL expected `i16`, found `i8` id_i16(a16); // ok id_i16(a32); //~^ ERROR mismatched types - //~| expected `i16`, found `i32` + //~| NOTE_NONVIRAL expected `i16`, found `i32` id_i16(a64); //~^ ERROR mismatched types - //~| expected `i16`, found `i64` + //~| NOTE_NONVIRAL expected `i16`, found `i64` id_i16(asize); //~^ ERROR mismatched types - //~| expected `i16`, found `isize` + //~| NOTE_NONVIRAL expected `i16`, found `isize` id_i32(a8); //~^ ERROR mismatched types - //~| expected `i32`, found `i8` + //~| NOTE_NONVIRAL expected `i32`, found `i8` id_i32(a16); //~^ ERROR mismatched types - //~| expected `i32`, found `i16` + //~| NOTE_NONVIRAL expected `i32`, found `i16` id_i32(a32); // ok id_i32(a64); //~^ ERROR mismatched types - //~| expected `i32`, found `i64` + //~| NOTE_NONVIRAL expected `i32`, found `i64` id_i32(asize); //~^ ERROR mismatched types - //~| expected `i32`, found `isize` + //~| NOTE_NONVIRAL expected `i32`, found `isize` id_i64(a8); //~^ ERROR mismatched types - //~| expected `i64`, found `i8` + //~| NOTE_NONVIRAL expected `i64`, found `i8` id_i64(a16); //~^ ERROR mismatched types - //~| expected `i64`, found `i16` + //~| NOTE_NONVIRAL expected `i64`, found `i16` id_i64(a32); //~^ ERROR mismatched types - //~| expected `i64`, found `i32` + //~| NOTE_NONVIRAL expected `i64`, found `i32` id_i64(a64); // ok id_i64(asize); //~^ ERROR mismatched types - //~| expected `i64`, found `isize` + //~| NOTE_NONVIRAL expected `i64`, found `isize` id_isize(a8); //~^ ERROR mismatched types - //~| expected `isize`, found `i8` + //~| NOTE_NONVIRAL expected `isize`, found `i8` id_isize(a16); //~^ ERROR mismatched types - //~| expected `isize`, found `i16` + //~| NOTE_NONVIRAL expected `isize`, found `i16` id_isize(a32); //~^ ERROR mismatched types - //~| expected `isize`, found `i32` + //~| NOTE_NONVIRAL expected `isize`, found `i32` id_isize(a64); //~^ ERROR mismatched types - //~| expected `isize`, found `i64` + //~| NOTE_NONVIRAL expected `isize`, found `i64` id_isize(asize); //ok id_i8(c8); // ok id_i8(c16); //~^ ERROR mismatched types - //~| expected `i8`, found `i16` + //~| NOTE_NONVIRAL expected `i8`, found `i16` id_i8(c32); //~^ ERROR mismatched types - //~| expected `i8`, found `i32` + //~| NOTE_NONVIRAL expected `i8`, found `i32` id_i8(c64); //~^ ERROR mismatched types - //~| expected `i8`, found `i64` + //~| NOTE_NONVIRAL expected `i8`, found `i64` id_i16(c8); //~^ ERROR mismatched types - //~| expected `i16`, found `i8` + //~| NOTE_NONVIRAL expected `i16`, found `i8` id_i16(c16); // ok id_i16(c32); //~^ ERROR mismatched types - //~| expected `i16`, found `i32` + //~| NOTE_NONVIRAL expected `i16`, found `i32` id_i16(c64); //~^ ERROR mismatched types - //~| expected `i16`, found `i64` + //~| NOTE_NONVIRAL expected `i16`, found `i64` id_i32(c8); //~^ ERROR mismatched types - //~| expected `i32`, found `i8` + //~| NOTE_NONVIRAL expected `i32`, found `i8` id_i32(c16); //~^ ERROR mismatched types - //~| expected `i32`, found `i16` + //~| NOTE_NONVIRAL expected `i32`, found `i16` id_i32(c32); // ok id_i32(c64); //~^ ERROR mismatched types - //~| expected `i32`, found `i64` + //~| NOTE_NONVIRAL expected `i32`, found `i64` id_i64(a8); //~^ ERROR mismatched types - //~| expected `i64`, found `i8` + //~| NOTE_NONVIRAL expected `i64`, found `i8` id_i64(a16); //~^ ERROR mismatched types - //~| expected `i64`, found `i16` + //~| NOTE_NONVIRAL expected `i64`, found `i16` id_i64(a32); //~^ ERROR mismatched types - //~| expected `i64`, found `i32` + //~| NOTE_NONVIRAL expected `i64`, found `i32` id_i64(a64); // ok id_u8(b8); // ok id_u8(b16); //~^ ERROR mismatched types - //~| expected `u8`, found `u16` + //~| NOTE_NONVIRAL expected `u8`, found `u16` id_u8(b32); //~^ ERROR mismatched types - //~| expected `u8`, found `u32` + //~| NOTE_NONVIRAL expected `u8`, found `u32` id_u8(b64); //~^ ERROR mismatched types - //~| expected `u8`, found `u64` + //~| NOTE_NONVIRAL expected `u8`, found `u64` id_u8(bsize); //~^ ERROR mismatched types - //~| expected `u8`, found `usize` + //~| NOTE_NONVIRAL expected `u8`, found `usize` id_u16(b8); //~^ ERROR mismatched types - //~| expected `u16`, found `u8` + //~| NOTE_NONVIRAL expected `u16`, found `u8` id_u16(b16); // ok id_u16(b32); //~^ ERROR mismatched types - //~| expected `u16`, found `u32` + //~| NOTE_NONVIRAL expected `u16`, found `u32` id_u16(b64); //~^ ERROR mismatched types - //~| expected `u16`, found `u64` + //~| NOTE_NONVIRAL expected `u16`, found `u64` id_u16(bsize); //~^ ERROR mismatched types - //~| expected `u16`, found `usize` + //~| NOTE_NONVIRAL expected `u16`, found `usize` id_u32(b8); //~^ ERROR mismatched types - //~| expected `u32`, found `u8` + //~| NOTE_NONVIRAL expected `u32`, found `u8` id_u32(b16); //~^ ERROR mismatched types - //~| expected `u32`, found `u16` + //~| NOTE_NONVIRAL expected `u32`, found `u16` id_u32(b32); // ok id_u32(b64); //~^ ERROR mismatched types - //~| expected `u32`, found `u64` + //~| NOTE_NONVIRAL expected `u32`, found `u64` id_u32(bsize); //~^ ERROR mismatched types - //~| expected `u32`, found `usize` + //~| NOTE_NONVIRAL expected `u32`, found `usize` id_u64(b8); //~^ ERROR mismatched types - //~| expected `u64`, found `u8` + //~| NOTE_NONVIRAL expected `u64`, found `u8` id_u64(b16); //~^ ERROR mismatched types - //~| expected `u64`, found `u16` + //~| NOTE_NONVIRAL expected `u64`, found `u16` id_u64(b32); //~^ ERROR mismatched types - //~| expected `u64`, found `u32` + //~| NOTE_NONVIRAL expected `u64`, found `u32` id_u64(b64); // ok id_u64(bsize); //~^ ERROR mismatched types - //~| expected `u64`, found `usize` + //~| NOTE_NONVIRAL expected `u64`, found `usize` id_usize(b8); //~^ ERROR mismatched types - //~| expected `usize`, found `u8` + //~| NOTE_NONVIRAL expected `usize`, found `u8` id_usize(b16); //~^ ERROR mismatched types - //~| expected `usize`, found `u16` + //~| NOTE_NONVIRAL expected `usize`, found `u16` id_usize(b32); //~^ ERROR mismatched types - //~| expected `usize`, found `u32` + //~| NOTE_NONVIRAL expected `usize`, found `u32` id_usize(b64); //~^ ERROR mismatched types - //~| expected `usize`, found `u64` + //~| NOTE_NONVIRAL expected `usize`, found `u64` id_usize(bsize); //ok } diff --git a/tests/ui/parser/diagnostics-parenthesized-type-arguments-ice-issue-122345.rs b/tests/ui/parser/diagnostics-parenthesized-type-arguments-ice-issue-122345.rs index 47df107a26123..993c506f82aa2 100644 --- a/tests/ui/parser/diagnostics-parenthesized-type-arguments-ice-issue-122345.rs +++ b/tests/ui/parser/diagnostics-parenthesized-type-arguments-ice-issue-122345.rs @@ -2,6 +2,6 @@ fn main() { unsafe { dealloc(ptr2, Layout::(x: !)(1, 1)); //~ ERROR: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `:` //~^ ERROR: expected one of `.`, `;`, `?`, `}`, or an operator, found `)` - //~| while parsing this parenthesized list of type arguments starting here + //~| NOTE_NONVIRAL while parsing this parenthesized list of type arguments starting here } } diff --git a/tests/ui/parser/do-catch-suggests-try.rs b/tests/ui/parser/do-catch-suggests-try.rs index fcd55ce4059f2..b813cf2762fc3 100644 --- a/tests/ui/parser/do-catch-suggests-try.rs +++ b/tests/ui/parser/do-catch-suggests-try.rs @@ -4,7 +4,7 @@ fn main() { let _: Option<()> = do catch {}; //~^ ERROR found removed `do catch` syntax //~| HELP replace with the new syntax - //~| following RFC #2388, the new non-placeholder syntax is `try` + //~| NOTE_NONVIRAL following RFC #2388, the new non-placeholder syntax is `try` let _recovery_witness: () = 1; //~ ERROR mismatched types } diff --git a/tests/ui/parser/mut-patterns.rs b/tests/ui/parser/mut-patterns.rs index ed33968c627e8..ff91f2f365446 100644 --- a/tests/ui/parser/mut-patterns.rs +++ b/tests/ui/parser/mut-patterns.rs @@ -13,20 +13,20 @@ pub fn main() { let mut mut x = 0; //~^ ERROR `mut` on a binding may not be repeated - //~| remove the additional `mut`s + //~| HELP_NONVIRAL remove the additional `mut`s let mut mut mut mut mut x = 0; //~^ ERROR `mut` on a binding may not be repeated - //~| remove the additional `mut`s + //~| HELP_NONVIRAL remove the additional `mut`s struct Foo { x: isize } let mut Foo { x: x } = Foo { x: 3 }; //~^ ERROR `mut` must be attached to each individual binding - //~| add `mut` to each binding + //~| HELP_NONVIRAL add `mut` to each binding let mut Foo { x } = Foo { x: 3 }; //~^ ERROR `mut` must be attached to each individual binding - //~| add `mut` to each binding + //~| HELP_NONVIRAL add `mut` to each binding struct r#yield(u8, u8); let mut mut yield(become, await) = r#yield(0, 0); diff --git a/tests/ui/parser/recover/recover-pat-exprs.rs b/tests/ui/parser/recover/recover-pat-exprs.rs index a78bb82828d3a..2507192ad9bad 100644 --- a/tests/ui/parser/recover/recover-pat-exprs.rs +++ b/tests/ui/parser/recover/recover-pat-exprs.rs @@ -28,7 +28,7 @@ fn array_indexing() { { let x[0; 20]; } //~ error: expected one of `:`, `;`, `=`, `@`, or `|`, found `[` { let x[]; } //~ error: expected one of `:`, `;`, `=`, `@`, or `|`, found `[` { let (x[]); } //~ error: expected one of `)`, `,`, `@`, `if`, or `|`, found `[` - //~^ missing `,` + //~^ HELP_NONVIRAL missing `,` } // MethodCallExpression, CallExpression, ErrorPropagationExpression diff --git a/tests/ui/pattern/pattern-error-continue.rs b/tests/ui/pattern/pattern-error-continue.rs index bed949439237a..e617c4d985282 100644 --- a/tests/ui/pattern/pattern-error-continue.rs +++ b/tests/ui/pattern/pattern-error-continue.rs @@ -21,13 +21,13 @@ fn main() { match 'c' { S { .. } => (), //~^ ERROR mismatched types - //~| expected `char`, found `S` + //~| NOTE_NONVIRAL expected `char`, found `S` _ => () } f(true); //~^ ERROR mismatched types - //~| expected `char`, found `bool` + //~| NOTE_NONVIRAL expected `char`, found `bool` match () { E::V => {} //~ ERROR failed to resolve: use of undeclared type `E` diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.rs b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.rs index c171dcf0ca660..4297ef50a2a17 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.rs +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.rs @@ -14,14 +14,14 @@ fn errors_caught_in_hir_typeck_on_stable() { let [&x] = &[&mut 0]; //[stable2021]~^ ERROR mismatched types - //[stable2021]~| types differ in mutability + //[stable2021]~| NOTE_NONVIRAL types differ in mutability //[classic2024]~^^^ ERROR: cannot move out of type #[cfg(any(classic2021, structural2021))] let _: u32 = x; #[cfg(structural2024)] let _: &u32 = x; let [&x] = &mut [&mut 0]; //[stable2021]~^ ERROR mismatched types - //[stable2021]~| types differ in mutability + //[stable2021]~| NOTE_NONVIRAL types differ in mutability //[classic2024]~^^^ ERROR: cannot move out of type #[cfg(any(classic2021, structural2021))] let _: u32 = x; #[cfg(structural2024)] let _: &u32 = x; diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.rs b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.rs index 94691e77bd8da..dbc34b73ae78e 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.rs +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.rs @@ -27,7 +27,7 @@ pub fn main() { let [&mut mut x] = &[&mut 0]; //[classic2024]~^ ERROR: mismatched types - //[classic2024]~| cannot match inherited `&` with `&mut` pattern + //[classic2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern //[structural2024]~^^^ ERROR binding cannot be both mutable and by-reference #[cfg(any(stable2021, classic2021, structural2021))] { x = 0 } } diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.rs b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.rs index 5e677445644a6..45f6ae4660d1f 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.rs +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.rs @@ -13,88 +13,88 @@ pub fn main() { if let Some(&mut x) = &Some(&mut 0) { //[classic2024]~^ ERROR: mismatched types - //[classic2024]~| cannot match inherited `&` with `&mut` pattern + //[classic2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern #[cfg(any(stable2021, classic2021, structural2021))] let _: u32 = x; #[cfg(structural2024)] let _: &u32 = x; } if let Some(&mut Some(&x)) = &Some(&mut Some(0)) { //[stable2021,classic2021,structural2021,classic2024]~^ ERROR: mismatched types - //[stable2021,classic2021,structural2021]~| expected integer, found `&_` - //[classic2024]~| cannot match inherited `&` with `&mut` pattern + //[stable2021,classic2021,structural2021]~| NOTE_NONVIRAL expected integer, found `&_` + //[classic2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern #[cfg(structural2024)] let _: u32 = x; } if let Some(Some(&mut x)) = &Some(Some(&mut 0)) { //[classic2024]~^ ERROR: mismatched types - //[classic2024]~| cannot match inherited `&` with `&mut` pattern + //[classic2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern #[cfg(any(stable2021, classic2021, structural2021))] let _: u32 = x; #[cfg(structural2024)] let _: &u32 = x; } if let Some(&mut Some(&_)) = &Some(&Some(0)) { //~^ ERROR: mismatched types - //[stable2021,classic2021,structural2021]~| types differ in mutability - //[classic2024,structural2024]~| cannot match inherited `&` with `&mut` pattern + //[stable2021,classic2021,structural2021]~| NOTE_NONVIRAL types differ in mutability + //[classic2024,structural2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern } if let Some(&Some(&mut x)) = &Some(&mut Some(0)) { //[stable2021,classic2021,structural2021,structural2024]~^ ERROR: mismatched types - //[stable2021]~| types differ in mutability - //[classic2021,structural2021]~| expected integer, found `&mut _` - //[structural2024]~| cannot match inherited `&` with `&mut` pattern + //[stable2021]~| NOTE_NONVIRAL types differ in mutability + //[classic2021,structural2021]~| NOTE_NONVIRAL expected integer, found `&mut _` + //[structural2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern #[cfg(classic2024)] let _: u32 = x; } if let Some(&Some(&mut _)) = &mut Some(&Some(0)) { //~^ ERROR: mismatched types - //[stable2021,classic2021,structural2021]~| expected integer, found `&mut _` - //[classic2024,structural2024]~| cannot match inherited `&` with `&mut` pattern + //[stable2021,classic2021,structural2021]~| NOTE_NONVIRAL expected integer, found `&mut _` + //[classic2024,structural2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern } if let Some(&Some(Some(&mut x))) = &Some(Some(&mut Some(0))) { //[stable2021,structural2021,structural2024]~^ ERROR: mismatched types - //[stable2021]~| expected `Option<&mut Option<{integer}>>`, found `&_` - //[structural2021,structural2024]~| cannot match inherited `&` with `&mut` pattern + //[stable2021]~| NOTE_NONVIRAL expected `Option<&mut Option<{integer}>>`, found `&_` + //[structural2021,structural2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern #[cfg(any(classic2021, classic2024))] let _: u32 = x; } if let Some(&mut Some(x)) = &Some(Some(0)) { //~^ ERROR: mismatched types - //[stable2021]~| expected `Option<{integer}>`, found `&mut _` - //[classic2021,structural2021,classic2024,structural2024]~| cannot match inherited `&` with `&mut` pattern + //[stable2021]~| NOTE_NONVIRAL expected `Option<{integer}>`, found `&mut _` + //[classic2021,structural2021,classic2024,structural2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern } } fn structural_errors_0() { let &[&mut x] = &&mut [0]; //[stable2021,structural2021,structural2024]~^ ERROR: mismatched types - //[stable2021]~| expected integer, found `&mut _` - //[structural2021,structural2024]~| cannot match inherited `&` with `&mut` pattern + //[stable2021]~| NOTE_NONVIRAL expected integer, found `&mut _` + //[structural2021,structural2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern #[cfg(any(classic2021, classic2024))] let _: u32 = x; let &[&mut x] = &mut &mut [0]; //[stable2021,structural2021,structural2024]~^ ERROR: mismatched types - //[stable2021]~| types differ in mutability - //[structural2021,structural2024]~| cannot match inherited `&` with `&mut` pattern + //[stable2021]~| NOTE_NONVIRAL types differ in mutability + //[structural2021,structural2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern #[cfg(any(classic2021, classic2024))] let _: u32 = x; let &[&mut ref x] = &&mut [0]; //[stable2021,structural2021,structural2024]~^ ERROR: mismatched types - //[stable2021]~| expected integer, found `&mut _` - //[structural2021,structural2024]~| cannot match inherited `&` with `&mut` pattern + //[stable2021]~| NOTE_NONVIRAL expected integer, found `&mut _` + //[structural2021,structural2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern #[cfg(any(classic2021, classic2024))] let _: &u32 = x; let &[&mut ref x] = &mut &mut [0]; //[stable2021,structural2021,structural2024]~^ ERROR: mismatched types - //[stable2021]~| types differ in mutability - //[structural2021,structural2024]~| cannot match inherited `&` with `&mut` pattern + //[stable2021]~| NOTE_NONVIRAL types differ in mutability + //[structural2021,structural2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern #[cfg(any(classic2021, classic2024))] let _: &u32 = x; let &[&mut mut x] = &&mut [0]; //[stable2021,structural2021,structural2024]~^ ERROR: mismatched types - //[stable2021]~| expected integer, found `&mut _` - //[structural2021,structural2024]~| cannot match inherited `&` with `&mut` pattern + //[stable2021]~| NOTE_NONVIRAL expected integer, found `&mut _` + //[structural2021,structural2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern #[cfg(any(classic2021, classic2024))] let _: u32 = x; let &[&mut mut x] = &mut &mut [0]; //[stable2021,structural2021,structural2024]~^ ERROR: mismatched types - //[stable2021]~| types differ in mutability - //[structural2021,structural2024]~| cannot match inherited `&` with `&mut` pattern + //[stable2021]~| NOTE_NONVIRAL types differ in mutability + //[structural2021,structural2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern #[cfg(any(classic2021, classic2024))] let _: u32 = x; } @@ -113,69 +113,69 @@ fn structural_errors_1() { fn structural_errors_2() { let [&&mut x] = &[&mut 0]; //[stable2021,classic2021,structural2021,structural2024]~^ ERROR: mismatched types - //[stable2021]~| types differ in mutability - //[classic2021,structural2021] expected integer, found `&mut _` - //[structural2024]~| cannot match inherited `&` with `&mut` pattern + //[stable2021]~| NOTE_NONVIRAL types differ in mutability + //[classic2021,structural2021] NOTE_NONVIRAL expected integer, found `&mut _` + //[structural2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern #[cfg(classic2024)] let _: u32 = x; let [&&mut x] = &mut [&mut 0]; //[stable2021,classic2021,structural2021,structural2024]~^ ERROR: mismatched types - //[stable2021]~| types differ in mutability - //[classic2021,structural2021] expected integer, found `&mut _` - //[structural2024]~| cannot match inherited `&` with `&mut` pattern + //[stable2021]~| NOTE_NONVIRAL types differ in mutability + //[classic2021,structural2021] NOTE_NONVIRAL expected integer, found `&mut _` + //[structural2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern #[cfg(classic2024)] let _: u32 = x; let [&&mut ref x] = &[&mut 0]; //[stable2021,classic2021,structural2021,structural2024]~^ ERROR: mismatched types - //[stable2021]~| types differ in mutability - //[classic2021,structural2021] expected integer, found `&mut _` - //[structural2024]~| cannot match inherited `&` with `&mut` pattern + //[stable2021]~| NOTE_NONVIRAL types differ in mutability + //[classic2021,structural2021] NOTE_NONVIRAL expected integer, found `&mut _` + //[structural2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern #[cfg(classic2024)] let _: &u32 = x; let [&&mut ref x] = &mut [&mut 0]; //[stable2021,classic2021,structural2021,structural2024]~^ ERROR: mismatched types - //[stable2021]~| types differ in mutability - //[classic2021,structural2021] expected integer, found `&mut _` - //[structural2024]~| cannot match inherited `&` with `&mut` pattern + //[stable2021]~| NOTE_NONVIRAL types differ in mutability + //[classic2021,structural2021] NOTE_NONVIRAL expected integer, found `&mut _` + //[structural2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern #[cfg(classic2024)] let _: &u32 = x; let [&&mut mut x] = &[&mut 0]; //[stable2021,classic2021,structural2021,structural2024]~^ ERROR: mismatched types - //[stable2021]~| types differ in mutability - //[classic2021,structural2021] expected integer, found `&mut _` - //[structural2024]~| cannot match inherited `&` with `&mut` pattern + //[stable2021]~| NOTE_NONVIRAL types differ in mutability + //[classic2021,structural2021] NOTE_NONVIRAL expected integer, found `&mut _` + //[structural2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern #[cfg(classic2024)] let _: u32 = x; let [&&mut mut x] = &mut [&mut 0]; //[stable2021,classic2021,structural2021,structural2024]~^ ERROR: mismatched types - //[stable2021]~| types differ in mutability - //[classic2021,structural2021] expected integer, found `&mut _` - //[structural2024]~| cannot match inherited `&` with `&mut` pattern + //[stable2021]~| NOTE_NONVIRAL types differ in mutability + //[classic2021,structural2021] NOTE_NONVIRAL expected integer, found `&mut _` + //[structural2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern #[cfg(classic2024)] let _: u32 = x; } fn classic_errors_0() { let [&mut x] = &[&mut 0]; //[classic2024]~^ ERROR: mismatched types - //[classic2024]~| cannot match inherited `&` with `&mut` pattern + //[classic2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern #[cfg(any(stable2021, classic2021, structural2021))] let _: u32 = x; #[cfg(structural2024)] let _: &u32 = x; let [&mut &x] = &[&mut 0]; //[stable2021,classic2021,structural2021,classic2024]~^ ERROR: mismatched types - //[stable2021]~| expected integer, found `&_` - //[classic2024]~| cannot match inherited `&` with `&mut` pattern + //[stable2021]~| NOTE_NONVIRAL expected integer, found `&_` + //[classic2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern #[cfg(structural2024)] let _: u32 = x; let [&mut &ref x] = &[&mut 0]; //[stable2021,classic2021,structural2021,classic2024]~^ ERROR: mismatched types - //[stable2021]~| expected integer, found `&_` - //[classic2024]~| cannot match inherited `&` with `&mut` pattern + //[stable2021]~| NOTE_NONVIRAL expected integer, found `&_` + //[classic2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern #[cfg(structural2024)] let _: &u32 = x; let [&mut &(mut x)] = &[&mut 0]; //[stable2021,classic2021,structural2021,classic2024]~^ ERROR: mismatched types - //[stable2021]~| expected integer, found `&_` - //[classic2024]~| cannot match inherited `&` with `&mut` pattern + //[stable2021]~| NOTE_NONVIRAL expected integer, found `&_` + //[classic2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern #[cfg(structural2024)] let _: u32 = x; } diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.rs b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.rs index ea6f028fe4b8b..dc8e4216d3e9f 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.rs +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.rs @@ -40,14 +40,14 @@ fn errors_from_eating_the_real_reference() { fn errors_from_eating_the_real_reference_caught_in_hir_typeck_on_stable() { let [&ref x] = &[&mut 0]; //[stable2021]~^ ERROR: mismatched types - //[stable2021]~| types differ in mutability + //[stable2021]~| NOTE_NONVIRAL types differ in mutability //[structural2024]~^^^ ERROR: binding modifiers may only be written when the default binding mode is `move` #[cfg(any(classic2021, structural2021))] let _: &u32 = x; #[cfg(classic2024)] let _: &&mut u32 = x; let [&ref x] = &mut [&mut 0]; //[stable2021]~^ ERROR: mismatched types - //[stable2021]~| types differ in mutability + //[stable2021]~| NOTE_NONVIRAL types differ in mutability //[structural2024]~^^^ ERROR: binding modifiers may only be written when the default binding mode is `move` #[cfg(any(classic2021, structural2021))] let _: &u32 = x; #[cfg(classic2024)] let _: &&mut u32 = x; @@ -57,7 +57,7 @@ fn errors_from_eating_the_real_reference_caught_in_hir_typeck_on_stable() { fn errors_dependent_on_eating_order_caught_in_hir_typeck_when_eating_outer() { let [&mut ref x] = &[&mut 0]; //[classic2024]~^ ERROR: mismatched types - //[classic2024]~| cannot match inherited `&` with `&mut` pattern + //[classic2024]~| NOTE_NONVIRAL cannot match inherited `&` with `&mut` pattern //[structural2024]~^^^ ERROR: binding modifiers may only be written when the default binding mode is `move` #[cfg(any(stable2021, classic2021, structural2021))] let _: &u32 = x; } diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/well-typed-edition-2024.rs b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/well-typed-edition-2024.rs index 877b10dcfd548..30fc6fad69c1d 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/well-typed-edition-2024.rs +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/well-typed-edition-2024.rs @@ -31,63 +31,63 @@ pub fn main() { } if let Some(Some(&&x)) = &Some(Some(&0)) { //[stable2021,classic2021,structural2021]~^ ERROR mismatched types - //[stable2021,classic2021,structural2021]~| expected integer, found `&_` + //[stable2021,classic2021,structural2021]~| NOTE_NONVIRAL expected integer, found `&_` #[cfg(any(classic2024, structural2024))] let _: u32 = x; } // Tests for eating a lone inherited reference if let Some(Some(&x)) = &Some(&Some(0)) { //[stable2021]~^ ERROR mismatched types - //[stable2021]~| expected integer, found `&_` + //[stable2021]~| NOTE_NONVIRAL expected integer, found `&_` #[cfg(any(classic2021, structural2021, classic2024, structural2024))] let _: u32 = x; } if let Some(&Some(x)) = &Some(Some(0)) { //[stable2021]~^ ERROR mismatched types - //[stable2021]~| expected `Option<{integer}>`, found `&_` + //[stable2021]~| NOTE_NONVIRAL expected `Option<{integer}>`, found `&_` #[cfg(any(classic2021, structural2021, classic2024, structural2024))] let _: u32 = x; } if let Some(Some(&mut x)) = &mut Some(&mut Some(0)) { //[stable2021]~^ ERROR mismatched types - //[stable2021]~| expected integer, found `&mut _` + //[stable2021]~| NOTE_NONVIRAL expected integer, found `&mut _` #[cfg(any(classic2021, structural2021, classic2024, structural2024))] let _: u32 = x; } // Tests for `&` patterns matching real `&mut` reference types if let Some(&Some(&x)) = Some(&Some(&mut 0)) { //[stable2021]~^ ERROR mismatched types - //[stable2021]~| types differ in mutability + //[stable2021]~| NOTE_NONVIRAL types differ in mutability #[cfg(any(classic2021, structural2021, classic2024, structural2024))] let _: u32 = x; } // Tests for eating only one layer and also eating a lone inherited reference if let Some(&Some(&x)) = &Some(&Some(0)) { //[stable2021,classic2021,structural2021]~^ ERROR mismatched types - //[stable2021,classic2021,structural2021]~| expected integer, found `&_` + //[stable2021,classic2021,structural2021]~| NOTE_NONVIRAL expected integer, found `&_` #[cfg(any(classic2024, structural2024))] let _: u32 = x; } // Tests for `&` matching a lone inherited possibly-`&mut` reference if let Some(&Some(Some(&x))) = &Some(Some(&mut Some(0))) { //[stable2021]~^ ERROR mismatched types - //[stable2021]~| expected `Option<&mut Option<{integer}>>`, found `&_` + //[stable2021]~| NOTE_NONVIRAL expected `Option<&mut Option<{integer}>>`, found `&_` #[cfg(any(classic2021, structural2021, classic2024, structural2024))] let _: u32 = x; } if let Some(&Some(x)) = &mut Some(Some(0)) { //[stable2021]~^ ERROR mismatched types - //[stable2021]~| expected `Option<{integer}>`, found `&_` + //[stable2021]~| NOTE_NONVIRAL expected `Option<{integer}>`, found `&_` #[cfg(any(classic2021, structural2021, classic2024, structural2024))] let _: u32 = x; } // Tests eating one layer, eating a lone inherited ref, and `&` eating `&mut` (realness varies) if let Some(&Some(&x)) = &Some(&mut Some(0)) { //[stable2021,classic2021,structural2021]~^ ERROR mismatched types - //[stable2021]~| types differ in mutability - //[classic2021,structural2021]~| expected integer, found `&_` + //[stable2021]~| NOTE_NONVIRAL types differ in mutability + //[classic2021,structural2021]~| NOTE_NONVIRAL expected integer, found `&_` #[cfg(any(classic2024, structural2024))] let _: u32 = x; } if let Some(&Some(&x)) = &mut Some(&Some(0)) { //[stable2021,classic2021,structural2021]~^ ERROR mismatched types - //[stable2021,classic2021,structural2021]~| expected integer, found `&_` + //[stable2021,classic2021,structural2021]~| NOTE_NONVIRAL expected integer, found `&_` #[cfg(any(classic2024, structural2024))] let _: u32 = x; } @@ -95,20 +95,20 @@ pub fn main() { // inner reference causes a mutability mismatch. i.e. tests for "fallback-to-outer" deref rules. let [&mut x] = &mut [&0]; //[stable2021]~^ ERROR mismatched types - //[stable2021]~| types differ in mutability + //[stable2021]~| NOTE_NONVIRAL types differ in mutability #[cfg(any(classic2021, structural2021))] let _: u32 = x; #[cfg(any(classic2024, structural2024))] let _: &u32 = x; let [&mut ref x] = &mut [&0]; //[stable2021]~^ ERROR mismatched types - //[stable2021]~| types differ in mutability + //[stable2021]~| NOTE_NONVIRAL types differ in mutability #[cfg(any(classic2021, structural2021))] let _: &u32 = x; #[cfg(any(classic2024, structural2024))] let _: &&u32 = x; fn borrowck_error_on_structural2021() { let [&mut ref mut x] = &mut [&0]; //[stable2021]~^ ERROR mismatched types - //[stable2021]~| types differ in mutability + //[stable2021]~| NOTE_NONVIRAL types differ in mutability //[classic2021,structural2021]~^^^ ERROR cannot borrow data in a `&` reference as mutable #[cfg(any(classic2024, structural2024))] let _: &mut &u32 = x; } @@ -116,25 +116,25 @@ pub fn main() { let [&mut mut x] = &mut [&0]; //[stable2021]~^ ERROR mismatched types - //[stable2021]~| types differ in mutability + //[stable2021]~| NOTE_NONVIRAL types differ in mutability #[cfg(any(classic2021, structural2021))] let _: u32 = x; #[cfg(any(classic2024, structural2024))] let _: &u32 = x; let [&mut &x] = &mut [&0]; //[stable2021,classic2021,structural2021]~^ ERROR mismatched types - //[stable2021]~| types differ in mutability - //[classic2021,structural2021]~| expected integer, found `&_` + //[stable2021]~| NOTE_NONVIRAL types differ in mutability + //[classic2021,structural2021]~| NOTE_NONVIRAL expected integer, found `&_` #[cfg(any(classic2024, structural2024))] let _: u32 = x; let [&mut &ref x] = &mut [&0]; //[stable2021,classic2021,structural2021]~^ ERROR mismatched types - //[stable2021]~| types differ in mutability - //[classic2021,structural2021]~| expected integer, found `&_` + //[stable2021]~| NOTE_NONVIRAL types differ in mutability + //[classic2021,structural2021]~| NOTE_NONVIRAL expected integer, found `&_` #[cfg(any(classic2024, structural2024))] let _: &u32 = x; let [&mut &(mut x)] = &mut [&0]; //[stable2021,classic2021,structural2021]~^ ERROR mismatched types - //[stable2021]~| types differ in mutability - //[classic2021,structural2021]~| expected integer, found `&_` + //[stable2021]~| NOTE_NONVIRAL types differ in mutability + //[classic2021,structural2021]~| NOTE_NONVIRAL expected integer, found `&_` #[cfg(any(classic2024, structural2024))] let _: u32 = x; } diff --git a/tests/ui/pattern/usefulness/issue-31561.rs b/tests/ui/pattern/usefulness/issue-31561.rs index 82414f0418bb2..77a78ab1fe5c7 100644 --- a/tests/ui/pattern/usefulness/issue-31561.rs +++ b/tests/ui/pattern/usefulness/issue-31561.rs @@ -7,5 +7,5 @@ enum Thing { fn main() { let Thing::Foo(y) = Thing::Foo(1); //~^ ERROR refutable pattern in local binding - //~| `Thing::Bar` and `Thing::Baz` not covered + //~| NOTE_NONVIRAL `Thing::Bar` and `Thing::Baz` not covered } diff --git a/tests/ui/pattern/usefulness/issue-39362.rs b/tests/ui/pattern/usefulness/issue-39362.rs index ea3c8f88e0b36..bbb26be4a8b0a 100644 --- a/tests/ui/pattern/usefulness/issue-39362.rs +++ b/tests/ui/pattern/usefulness/issue-39362.rs @@ -9,7 +9,7 @@ enum Bar { fn test(f: Foo) { match f { //~^ ERROR non-exhaustive patterns - //~| patterns + //~| NOTE_NONVIRAL patterns Foo::Bar { bar: Bar::A, .. } => (), Foo::Bar { bar: Bar::B, .. } => (), } diff --git a/tests/ui/pattern/usefulness/issue-72377.rs b/tests/ui/pattern/usefulness/issue-72377.rs index b5ad3075ca725..b2c44f1dc6942 100644 --- a/tests/ui/pattern/usefulness/issue-72377.rs +++ b/tests/ui/pattern/usefulness/issue-72377.rs @@ -7,7 +7,7 @@ fn main() { match (x, y) { //~^ ERROR non-exhaustive patterns: `(X::A, Some(X::A))`, `(X::A, Some(X::B))`, `(X::B, Some(X::B))` and 2 - //~| more not covered + //~| NOTE_NONVIRAL more not covered (_, None) => false, (v, Some(w)) if v == w => true, (X::B, Some(X::C)) => false, diff --git a/tests/ui/pattern/usefulness/refutable-pattern-errors.rs b/tests/ui/pattern/usefulness/refutable-pattern-errors.rs index 7603da1bb2ce8..553d071dcf1da 100644 --- a/tests/ui/pattern/usefulness/refutable-pattern-errors.rs +++ b/tests/ui/pattern/usefulness/refutable-pattern-errors.rs @@ -1,9 +1,9 @@ fn func((1, (Some(1), 2..=3)): (isize, (Option, isize))) {} //~^ ERROR refutable pattern in function argument -//~| `(..=0_isize, _)` and `(2_isize.., _)` not covered +//~| NOTE_NONVIRAL `(..=0_isize, _)` and `(2_isize.., _)` not covered fn main() { let (1, (Some(1), 2..=3)) = (1, (None, 2)); //~^ ERROR refutable pattern in local binding - //~| `(i32::MIN..=0_i32, _)` and `(2_i32..=i32::MAX, _)` not covered + //~| NOTE_NONVIRAL `(i32::MIN..=0_i32, _)` and `(2_i32..=i32::MAX, _)` not covered } diff --git a/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.rs b/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.rs index 51ff641509df5..c61fe65e73726 100644 --- a/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.rs +++ b/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.rs @@ -1,6 +1,6 @@ fn main() { let f = |3: isize| println!("hello"); //~^ ERROR refutable pattern in closure argument - //~| `..=2_isize` and `4_isize..` not covered + //~| NOTE_NONVIRAL `..=2_isize` and `4_isize..` not covered f(4); } diff --git a/tests/ui/pptypedef.rs b/tests/ui/pptypedef.rs index e28d323f88371..dca50aa4fc347 100644 --- a/tests/ui/pptypedef.rs +++ b/tests/ui/pptypedef.rs @@ -3,9 +3,9 @@ fn let_in(x: T, f: F) where F: FnOnce(T) {} fn main() { let_in(3u32, |i| { assert!(i == 3i32); }); //~^ ERROR mismatched types - //~| expected `u32`, found `i32` + //~| NOTE_NONVIRAL expected `u32`, found `i32` let_in(3i32, |i| { assert!(i == 3u32); }); //~^ ERROR mismatched types - //~| expected `i32`, found `u32` + //~| NOTE_NONVIRAL expected `i32`, found `u32` } diff --git a/tests/ui/privacy/privacy2.rs b/tests/ui/privacy/privacy2.rs index c82cd4425596f..40d8cd07e0d32 100644 --- a/tests/ui/privacy/privacy2.rs +++ b/tests/ui/privacy/privacy2.rs @@ -20,7 +20,7 @@ fn test1() { //~^ ERROR requires `sized` lang_item use bar::foo; //~^ ERROR unresolved import `bar::foo` [E0432] - //~| no `foo` in `bar` + //~| NOTE_NONVIRAL no `foo` in `bar` } fn test2() { diff --git a/tests/ui/ptr-coercion.rs b/tests/ui/ptr-coercion.rs index 193899034c7b4..bb0d856c12622 100644 --- a/tests/ui/ptr-coercion.rs +++ b/tests/ui/ptr-coercion.rs @@ -5,19 +5,19 @@ pub fn main() { // *const -> *mut let x: *const isize = &42; let x: *mut isize = x; //~ ERROR mismatched types - //~| expected raw pointer `*mut isize` - //~| found raw pointer `*const isize` - //~| types differ in mutability + //~| NOTE_NONVIRAL expected raw pointer `*mut isize` + //~| NOTE_NONVIRAL found raw pointer `*const isize` + //~| NOTE_NONVIRAL types differ in mutability // & -> *mut let x: *mut isize = &42; //~ ERROR mismatched types - //~| expected raw pointer `*mut isize` - //~| found reference `&isize` - //~| types differ in mutability + //~| NOTE_NONVIRAL expected raw pointer `*mut isize` + //~| NOTE_NONVIRAL found reference `&isize` + //~| NOTE_NONVIRAL types differ in mutability let x: *const isize = &42; let x: *mut isize = x; //~ ERROR mismatched types - //~| expected raw pointer `*mut isize` - //~| found raw pointer `*const isize` - //~| types differ in mutability + //~| NOTE_NONVIRAL expected raw pointer `*mut isize` + //~| NOTE_NONVIRAL found raw pointer `*const isize` + //~| NOTE_NONVIRAL types differ in mutability } diff --git a/tests/ui/recursion_limit/empty.rs b/tests/ui/recursion_limit/empty.rs index 59dae106c0001..ed7ac04ff98a3 100644 --- a/tests/ui/recursion_limit/empty.rs +++ b/tests/ui/recursion_limit/empty.rs @@ -1,8 +1,8 @@ // Test the parse error for an empty recursion_limit #![recursion_limit = ""] //~ ERROR `limit` must be a non-negative integer - //~| `limit` must be a non-negative integer + //~| NOTE_NONVIRAL `limit` must be a non-negative integer //~| ERROR `limit` must be a non-negative integer - //~| `limit` must be a non-negative integer + //~| NOTE_NONVIRAL `limit` must be a non-negative integer fn main() {} diff --git a/tests/ui/recursion_limit/invalid_digit.rs b/tests/ui/recursion_limit/invalid_digit.rs index 03df3e7a92713..d31a4bc5a2128 100644 --- a/tests/ui/recursion_limit/invalid_digit.rs +++ b/tests/ui/recursion_limit/invalid_digit.rs @@ -1,7 +1,7 @@ // Test the parse error for an invalid digit in recursion_limit #![recursion_limit = "-100"] //~ ERROR `limit` must be a non-negative integer - //~| not a valid integer + //~| NOTE_NONVIRAL not a valid integer //~| ERROR `limit` must be a non-negative integer - //~| not a valid integer + //~| NOTE_NONVIRAL not a valid integer fn main() {} diff --git a/tests/ui/recursion_limit/overflow.rs b/tests/ui/recursion_limit/overflow.rs index c733ba6b93ce5..8dbca29da814f 100644 --- a/tests/ui/recursion_limit/overflow.rs +++ b/tests/ui/recursion_limit/overflow.rs @@ -2,8 +2,8 @@ #![recursion_limit = "999999999999999999999999"] //~^ ERROR `limit` must be a non-negative integer -//~| `limit` is too large +//~| NOTE_NONVIRAL `limit` is too large //~| ERROR `limit` must be a non-negative integer -//~| `limit` is too large +//~| NOTE_NONVIRAL `limit` is too large fn main() {} diff --git a/tests/ui/repeat-expr/repeat_count.rs b/tests/ui/repeat-expr/repeat_count.rs index 18610bc5bb086..736f8d7d42396 100644 --- a/tests/ui/repeat-expr/repeat_count.rs +++ b/tests/ui/repeat-expr/repeat_count.rs @@ -6,29 +6,29 @@ fn main() { //~^ ERROR attempt to use a non-constant value in a constant [E0435] let b = [0; ()]; //~^ ERROR mismatched types - //~| expected `usize`, found `()` + //~| NOTE_NONVIRAL expected `usize`, found `()` let c = [0; true]; //~^ ERROR mismatched types - //~| expected `usize`, found `bool` + //~| NOTE_NONVIRAL expected `usize`, found `bool` let d = [0; 0.5]; //~^ ERROR mismatched types - //~| expected `usize`, found floating-point number + //~| NOTE_NONVIRAL expected `usize`, found floating-point number let e = [0; "foo"]; //~^ ERROR mismatched types - //~| expected `usize`, found `&str` + //~| NOTE_NONVIRAL expected `usize`, found `&str` let f = [0; -4_isize]; //~^ ERROR mismatched types - //~| expected `usize`, found `isize` + //~| NOTE_NONVIRAL expected `usize`, found `isize` let f = [0_usize; -1_isize]; //~^ ERROR mismatched types - //~| expected `usize`, found `isize` + //~| NOTE_NONVIRAL expected `usize`, found `isize` let f = [0; 4u8]; //~^ ERROR mismatched types - //~| expected `usize`, found `u8` + //~| NOTE_NONVIRAL expected `usize`, found `u8` struct G { g: (), } let g = [0; G { g: () }]; //~^ ERROR mismatched types - //~| expected `usize`, found `G` + //~| NOTE_NONVIRAL expected `usize`, found `G` } diff --git a/tests/ui/resolve/issue-23716.rs b/tests/ui/resolve/issue-23716.rs index e9139c0aa143f..c9665c2baae6d 100644 --- a/tests/ui/resolve/issue-23716.rs +++ b/tests/ui/resolve/issue-23716.rs @@ -2,7 +2,7 @@ static foo: i32 = 0; fn bar(foo: i32) {} //~^ ERROR function parameters cannot shadow statics -//~| cannot be named the same as a static +//~| NOTE_NONVIRAL cannot be named the same as a static mod submod { pub static answer: i32 = 42; @@ -12,6 +12,6 @@ use self::submod::answer; fn question(answer: i32) {} //~^ ERROR function parameters cannot shadow statics -//~| cannot be named the same as a static +//~| NOTE_NONVIRAL cannot be named the same as a static fn main() { } diff --git a/tests/ui/resolve/issue-5035.rs b/tests/ui/resolve/issue-5035.rs index 49fa312f9d257..2d134cb2b6521 100644 --- a/tests/ui/resolve/issue-5035.rs +++ b/tests/ui/resolve/issue-5035.rs @@ -3,7 +3,7 @@ type K = dyn I; impl K for isize {} //~ ERROR expected trait, found type alias `K` use ImportError; //~ ERROR unresolved import `ImportError` [E0432] - //~^ no `ImportError` in the root + //~^ NOTE_NONVIRAL no `ImportError` in the root impl ImportError for () {} // check that this is not an additional error (cf. issue #35142) fn main() {} diff --git a/tests/ui/resolve/resolve-conflict-item-vs-import.rs b/tests/ui/resolve/resolve-conflict-item-vs-import.rs index 4308c7a27501a..ba03e3a5830c3 100644 --- a/tests/ui/resolve/resolve-conflict-item-vs-import.rs +++ b/tests/ui/resolve/resolve-conflict-item-vs-import.rs @@ -2,7 +2,7 @@ use std::mem::transmute; fn transmute() {} //~^ ERROR the name `transmute` is defined multiple times -//~| `transmute` redefined here -//~| `transmute` must be defined only once in the value namespace of this module +//~| NOTE_NONVIRAL `transmute` redefined here +//~| NOTE_NONVIRAL `transmute` must be defined only once in the value namespace of this module fn main() { } diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.rs index 69a283c31633d..e665b1af84d45 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.rs @@ -3,20 +3,20 @@ #[non_exhaustive] pub enum NonExhaustiveEnum { Unit, - //~^ not covered + //~^ NOTE_NONVIRAL not covered Tuple(u32), - //~^ not covered + //~^ NOTE_NONVIRAL not covered Struct { field: u32 } - //~^ not covered + //~^ NOTE_NONVIRAL not covered } pub enum NormalEnum { Unit, - //~^ not covered + //~^ NOTE_NONVIRAL not covered Tuple(u32), - //~^ not covered + //~^ NOTE_NONVIRAL not covered Struct { field: u32 } - //~^ not covered + //~^ NOTE_NONVIRAL not covered } #[non_exhaustive] diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs index ba800e315b15a..049ab32ce5dcf 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs @@ -231,7 +231,7 @@ fn main() { // Check that matching on a reference results in a correct diagnostic match &non_enum { //~^ ERROR some variants are not matched explicitly - //~| pattern `&NonExhaustiveEnum::Struct { .. }` not covered + //~| NOTE_NONVIRAL pattern `&NonExhaustiveEnum::Struct { .. }` not covered NonExhaustiveEnum::Unit => {} NonExhaustiveEnum::Tuple(_) => {} _ => {} @@ -239,21 +239,21 @@ fn main() { match (true, &non_enum) { //~^ ERROR some variants are not matched explicitly - //~| patterns `(_, &NonExhaustiveEnum::Tuple(_))` and `(_, &NonExhaustiveEnum::Struct { .. })` not covered + //~| NOTE_NONVIRAL patterns `(_, &NonExhaustiveEnum::Tuple(_))` and `(_, &NonExhaustiveEnum::Struct { .. })` not covered (true, NonExhaustiveEnum::Unit) => {} _ => {} } match (&non_enum, true) { //~^ ERROR some variants are not matched explicitly - //~| patterns `(&NonExhaustiveEnum::Tuple(_), _)` and `(&NonExhaustiveEnum::Struct { .. }, _)` not covered + //~| NOTE_NONVIRAL patterns `(&NonExhaustiveEnum::Tuple(_), _)` and `(&NonExhaustiveEnum::Struct { .. }, _)` not covered (NonExhaustiveEnum::Unit, true) => {} _ => {} } match Some(&non_enum) { //~^ ERROR some variants are not matched explicitly - //~| pattern `Some(&NonExhaustiveEnum::Struct { .. })` not covered + //~| NOTE_NONVIRAL pattern `Some(&NonExhaustiveEnum::Struct { .. })` not covered Some(NonExhaustiveEnum::Unit | NonExhaustiveEnum::Tuple(_)) => {} _ => {} } diff --git a/tests/ui/simd/const-err-trumps-simd-err.rs b/tests/ui/simd/const-err-trumps-simd-err.rs index fb87fe1cbca83..04af28eb5a3c2 100644 --- a/tests/ui/simd/const-err-trumps-simd-err.rs +++ b/tests/ui/simd/const-err-trumps-simd-err.rs @@ -15,7 +15,7 @@ struct int8x4_t([u8; 4]); fn get_elem(a: int8x4_t) -> u8 { const { assert!(LANE < 4); } // the error should be here... //~^ ERROR failed - //~| assertion failed + //~| NOTE_NONVIRAL assertion failed unsafe { simd_extract(a, LANE) } // ...not here } diff --git a/tests/ui/structs/default-field-values/failures.rs b/tests/ui/structs/default-field-values/failures.rs index 4461302e841d0..bf41fbb6d75c4 100644 --- a/tests/ui/structs/default-field-values/failures.rs +++ b/tests/ui/structs/default-field-values/failures.rs @@ -56,10 +56,10 @@ fn main () { let _ = Bar { bar: S, .. }; // ok let _ = Qux::<4> { .. }; let _ = Rak(..); //~ ERROR E0308 - //~^ you might have meant to use `..` to skip providing + //~^ HELP_NONVIRAL you might have meant to use `..` to skip providing let _ = Rak(0, ..); //~ ERROR E0061 - //~^ you might have meant to use `..` to skip providing + //~^ HELP_NONVIRAL you might have meant to use `..` to skip providing let _ = Rak(.., 0); //~ ERROR E0061 - //~^ you might have meant to use `..` to skip providing + //~^ HELP_NONVIRAL you might have meant to use `..` to skip providing let _ = Rak { .. }; // ok } diff --git a/tests/ui/structs/structure-constructor-type-mismatch.rs b/tests/ui/structs/structure-constructor-type-mismatch.rs index 21cd9d08b21d1..a2cce8251aa03 100644 --- a/tests/ui/structs/structure-constructor-type-mismatch.rs +++ b/tests/ui/structs/structure-constructor-type-mismatch.rs @@ -16,32 +16,32 @@ fn main() { let pt = PointF { x: 1, //~^ ERROR mismatched types - //~| expected `f32`, found integer + //~| NOTE_NONVIRAL expected `f32`, found integer y: 2, //~^ ERROR mismatched types - //~| expected `f32`, found integer + //~| NOTE_NONVIRAL expected `f32`, found integer }; let pt2 = Point:: { x: 3, //~^ ERROR mismatched types - //~| expected `f32`, found integer + //~| NOTE_NONVIRAL expected `f32`, found integer y: 4, //~^ ERROR mismatched types - //~| expected `f32`, found integer + //~| NOTE_NONVIRAL expected `f32`, found integer }; let pair = PairF { x: 5, //~^ ERROR mismatched types - //~| expected `f32`, found integer + //~| NOTE_NONVIRAL expected `f32`, found integer y: 6, }; let pair2 = PairF:: { x: 7, //~^ ERROR mismatched types - //~| expected `f32`, found integer + //~| NOTE_NONVIRAL expected `f32`, found integer y: 8, }; diff --git a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.rs b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.rs index 1a440a90cd734..f3f1e61c1cafd 100644 --- a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.rs +++ b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.rs @@ -1,10 +1,10 @@ fn main() { let A = 3; //~^ ERROR refutable pattern in local binding - //~| patterns `i32::MIN..=1_i32` and `3_i32..=i32::MAX` not covered + //~| NOTE_NONVIRAL patterns `i32::MIN..=1_i32` and `3_i32..=i32::MAX` not covered //~| HELP introduce a variable instead //~| SUGGESTION A_var const A: i32 = 2; - //~^ missing patterns are not covered because `A` is interpreted as a constant pattern, not a new variable + //~^ NOTE_NONVIRAL missing patterns are not covered because `A` is interpreted as a constant pattern, not a new variable } diff --git a/tests/ui/traits/bound/same-crate-name.rs b/tests/ui/traits/bound/same-crate-name.rs index 06d79a0c8b8d1..8c6a5710c0bcb 100644 --- a/tests/ui/traits/bound/same-crate-name.rs +++ b/tests/ui/traits/bound/same-crate-name.rs @@ -30,8 +30,8 @@ fn main() { extern crate crate_a1 as a; a::try_foo(foo); //~^ ERROR E0277 - //~| trait impl with same name found - //~| perhaps two different versions of crate `crate_a2` + //~| HELP_NONVIRAL trait impl with same name found + //~| NOTE_NONVIRAL perhaps two different versions of crate `crate_a2` // We don't want to see the "version mismatch" help message here // because `implements_no_traits` has no impl for `Foo` @@ -50,6 +50,6 @@ fn main() { // impls for the correct trait where the path is not misleading. a::try_foo(other_variant_implements_correct_trait); //~^ ERROR E0277 - //~| the trait `main::a::Bar` is implemented for `ImplementsTraitForUsize` + //~| HELP_NONVIRAL the trait `main::a::Bar` is implemented for `ImplementsTraitForUsize` } } diff --git a/tests/ui/traits/impl-method-mismatch.rs b/tests/ui/traits/impl-method-mismatch.rs index 62580755c814e..ce18f44affec0 100644 --- a/tests/ui/traits/impl-method-mismatch.rs +++ b/tests/ui/traits/impl-method-mismatch.rs @@ -6,8 +6,8 @@ impl Mumbo for usize { // Cannot have a larger effect than the trait: unsafe fn jumbo(&self, x: &usize) { *self + *x; } //~^ ERROR method `jumbo` has an incompatible type for trait - //~| expected signature `fn - //~| found signature `unsafe fn + //~| NOTE_NONVIRAL expected signature `fn + //~| NOTE_NONVIRAL found signature `unsafe fn } fn main() {} diff --git a/tests/ui/tuple/tuple-arity-mismatch.rs b/tests/ui/tuple/tuple-arity-mismatch.rs index f1e525c93e17f..14a8ef33da2dc 100644 --- a/tests/ui/tuple/tuple-arity-mismatch.rs +++ b/tests/ui/tuple/tuple-arity-mismatch.rs @@ -5,13 +5,13 @@ fn first((value, _): (isize, f64)) -> isize { value } fn main() { let y = first ((1,2.0,3)); //~^ ERROR mismatched types - //~| expected tuple `(isize, f64)` - //~| found tuple `(isize, f64, {integer})` - //~| expected a tuple with 2 elements, found one with 3 elements + //~| NOTE_NONVIRAL expected tuple `(isize, f64)` + //~| NOTE_NONVIRAL found tuple `(isize, f64, {integer})` + //~| NOTE_NONVIRAL expected a tuple with 2 elements, found one with 3 elements let y = first ((1,)); //~^ ERROR mismatched types - //~| expected tuple `(isize, f64)` - //~| found tuple `(isize,)` - //~| expected a tuple with 2 elements, found one with 1 element + //~| NOTE_NONVIRAL expected tuple `(isize, f64)` + //~| NOTE_NONVIRAL found tuple `(isize,)` + //~| NOTE_NONVIRAL expected a tuple with 2 elements, found one with 1 element } diff --git a/tests/ui/type/type-mismatch-multiple.rs b/tests/ui/type/type-mismatch-multiple.rs index 55d6ceef1ded0..24abfceac6708 100644 --- a/tests/ui/type/type-mismatch-multiple.rs +++ b/tests/ui/type/type-mismatch-multiple.rs @@ -2,6 +2,6 @@ fn main() { let a: bool = 1; let b: i32 = true; } //~^ ERROR mismatched types -//~| expected `bool`, found integer +//~| NOTE_NONVIRAL expected `bool`, found integer //~| ERROR mismatched types -//~| expected `i32`, found `bool` +//~| NOTE_NONVIRAL expected `i32`, found `bool` diff --git a/tests/ui/type/type-parameter-names.rs b/tests/ui/type/type-parameter-names.rs index b54a3fae0c1a1..7c85540e93867 100644 --- a/tests/ui/type/type-parameter-names.rs +++ b/tests/ui/type/type-parameter-names.rs @@ -4,9 +4,9 @@ fn foo(x: Foo) -> Bar { x //~^ ERROR mismatched types -//~| expected type parameter `Bar`, found type parameter `Foo` -//~| expected type parameter `Bar` -//~| found type parameter `Foo` +//~| NOTE_NONVIRAL expected type parameter `Bar`, found type parameter `Foo` +//~| NOTE_NONVIRAL expected type parameter `Bar` +//~| NOTE_NONVIRAL found type parameter `Foo` } fn main() {} diff --git a/tests/ui/type/type-params-in-different-spaces-1.rs b/tests/ui/type/type-params-in-different-spaces-1.rs index 6efd14d378532..cad9392068e11 100644 --- a/tests/ui/type/type-params-in-different-spaces-1.rs +++ b/tests/ui/type/type-params-in-different-spaces-1.rs @@ -3,9 +3,9 @@ use std::ops::Add; trait BrokenAdd: Copy + Add { fn broken_add(&self, rhs: T) -> Self { *self + rhs //~ ERROR mismatched types - //~| expected type parameter `Self`, found type parameter `T` - //~| expected type parameter `Self` - //~| found type parameter `T` + //~| NOTE_NONVIRAL expected type parameter `Self`, found type parameter `T` + //~| NOTE_NONVIRAL expected type parameter `Self` + //~| NOTE_NONVIRAL found type parameter `T` } } diff --git a/tests/ui/typeck/issue-16338.rs b/tests/ui/typeck/issue-16338.rs index 321b3576cd61f..218fb53cb0eb0 100644 --- a/tests/ui/typeck/issue-16338.rs +++ b/tests/ui/typeck/issue-16338.rs @@ -6,5 +6,5 @@ struct Slice { fn main() { let Slice { data: data, len: len } = "foo"; //~^ ERROR mismatched types - //~| found struct `Slice<_>` + //~| NOTE_NONVIRAL found struct `Slice<_>` } diff --git a/tests/ui/typeck/suppressed-error.rs b/tests/ui/typeck/suppressed-error.rs index 1e39be4608091..51cf069f10740 100644 --- a/tests/ui/typeck/suppressed-error.rs +++ b/tests/ui/typeck/suppressed-error.rs @@ -1,8 +1,8 @@ fn main() { let (x, y) = (); //~^ ERROR mismatched types -//~| expected unit type `()` -//~| found tuple `(_, _)` -//~| expected `()`, found +//~| NOTE_NONVIRAL expected unit type `()` +//~| NOTE_NONVIRAL found tuple `(_, _)` +//~| NOTE_NONVIRAL expected `()`, found return x; } diff --git a/tests/ui/typeck/tag-that-dare-not-speak-its-name.rs b/tests/ui/typeck/tag-that-dare-not-speak-its-name.rs index 0e76ec246d7c3..b6f53bcd928d8 100644 --- a/tests/ui/typeck/tag-that-dare-not-speak-its-name.rs +++ b/tests/ui/typeck/tag-that-dare-not-speak-its-name.rs @@ -10,7 +10,7 @@ fn main() { let y; let x : char = last(y); //~^ ERROR mismatched types - //~| expected type `char` - //~| found enum `Option<_>` - //~| expected `char`, found `Option<_>` + //~| NOTE_NONVIRAL expected type `char` + //~| NOTE_NONVIRAL found enum `Option<_>` + //~| NOTE_NONVIRAL expected `char`, found `Option<_>` } diff --git a/tests/ui/typeck/terr-in-field.rs b/tests/ui/typeck/terr-in-field.rs index cfe350ef86db2..616a1251e811d 100644 --- a/tests/ui/typeck/terr-in-field.rs +++ b/tests/ui/typeck/terr-in-field.rs @@ -11,7 +11,7 @@ struct Bar { fn want_foo(f: Foo) {} fn have_bar(b: Bar) { want_foo(b); //~ ERROR mismatched types - //~| expected `Foo`, found `Bar` + //~| NOTE_NONVIRAL expected `Foo`, found `Bar` } fn main() {} diff --git a/tests/ui/typeck/terr-sorts.rs b/tests/ui/typeck/terr-sorts.rs index c1e2f7daee5ec..d2f86b638343d 100644 --- a/tests/ui/typeck/terr-sorts.rs +++ b/tests/ui/typeck/terr-sorts.rs @@ -8,8 +8,8 @@ type Bar = Box; fn want_foo(f: Foo) {} fn have_bar(b: Bar) { want_foo(b); //~ ERROR mismatched types - //~| expected struct `Foo` - //~| found struct `Box` + //~| NOTE_NONVIRAL expected struct `Foo` + //~| NOTE_NONVIRAL found struct `Box` } fn main() {} diff --git a/tests/ui/typeck/typeck_type_placeholder_mismatch.rs b/tests/ui/typeck/typeck_type_placeholder_mismatch.rs index 718b6deed1bb1..d27d38c88647e 100644 --- a/tests/ui/typeck/typeck_type_placeholder_mismatch.rs +++ b/tests/ui/typeck/typeck_type_placeholder_mismatch.rs @@ -12,16 +12,16 @@ pub fn main() { fn test1() { let x: Foo<_> = Bar::(PhantomData); //~^ ERROR mismatched types - //~| expected struct `Foo<_>` - //~| found struct `Bar` - //~| expected `Foo<_>`, found `Bar` + //~| NOTE_NONVIRAL expected struct `Foo<_>` + //~| NOTE_NONVIRAL found struct `Bar` + //~| NOTE_NONVIRAL expected `Foo<_>`, found `Bar` let y: Foo = x; } fn test2() { let x: Foo<_> = Bar::(PhantomData); //~^ ERROR mismatched types - //~| expected struct `Foo<_>` - //~| found struct `Bar` - //~| expected `Foo<_>`, found `Bar` + //~| NOTE_NONVIRAL expected struct `Foo<_>` + //~| NOTE_NONVIRAL found struct `Bar` + //~| NOTE_NONVIRAL expected `Foo<_>`, found `Bar` } diff --git a/tests/ui/typeof/type_mismatch.rs b/tests/ui/typeof/type_mismatch.rs index 3f8339fa5beaf..774e94640169e 100644 --- a/tests/ui/typeof/type_mismatch.rs +++ b/tests/ui/typeof/type_mismatch.rs @@ -5,5 +5,5 @@ fn main() { let b: typeof(a) = 1i8; //~^ ERROR `typeof` is a reserved keyword but unimplemented //~| ERROR mismatched types - //~| expected `u8`, found `i8` + //~| NOTE_NONVIRAL expected `u8`, found `i8` } diff --git a/tests/ui/ufcs/ufcs-explicit-self-bad.rs b/tests/ui/ufcs/ufcs-explicit-self-bad.rs index 29586dccfc950..6abd5365b9a57 100644 --- a/tests/ui/ufcs/ufcs-explicit-self-bad.rs +++ b/tests/ui/ufcs/ufcs-explicit-self-bad.rs @@ -7,7 +7,7 @@ struct Foo { impl Foo { fn foo(self: isize, x: isize) -> isize { //~^ ERROR invalid `self` parameter type - self.f + x //~ ERROR: doesn't have fields + self.f + x //~ ERROR doesn't have fields } } @@ -39,13 +39,13 @@ impl<'a, T> SomeTrait for &'a Bar { //~| ERROR has an incompatible type for trait fn dummy3(self: &&Bar) {} //~^ ERROR mismatched `self` parameter type - //~| expected reference `&'a Bar<_>` - //~| found reference `&Bar<_>` - //~| lifetime mismatch + //~| NOTE_NONVIRAL expected reference `&'a Bar<_>` + //~| NOTE_NONVIRAL found reference `&Bar<_>` + //~| NOTE_NONVIRAL lifetime mismatch //~| ERROR mismatched `self` parameter type - //~| expected reference `&'a Bar<_>` - //~| found reference `&Bar<_>` - //~| lifetime mismatch + //~| NOTE_NONVIRAL expected reference `&'a Bar<_>` + //~| NOTE_NONVIRAL found reference `&Bar<_>` + //~| NOTE_NONVIRAL lifetime mismatch } fn main() { diff --git a/tests/ui/unsafe/unsafe-trait-impl.rs b/tests/ui/unsafe/unsafe-trait-impl.rs index 9fd9ff65288d9..5f351dd6761e9 100644 --- a/tests/ui/unsafe/unsafe-trait-impl.rs +++ b/tests/ui/unsafe/unsafe-trait-impl.rs @@ -7,8 +7,8 @@ trait Foo { impl Foo for u32 { fn len(&self) -> u32 { *self } //~^ ERROR method `len` has an incompatible type for trait - //~| expected signature `unsafe fn(&_) -> _` - //~| found signature `fn(&_) -> _` + //~| NOTE_NONVIRAL expected signature `unsafe fn(&_) -> _` + //~| NOTE_NONVIRAL found signature `fn(&_) -> _` } fn main() { } diff --git a/tests/ui/wf/range-expr-root-of-constant-issue-40749.rs b/tests/ui/wf/range-expr-root-of-constant-issue-40749.rs index 0a847853b121e..5c7351426ff18 100644 --- a/tests/ui/wf/range-expr-root-of-constant-issue-40749.rs +++ b/tests/ui/wf/range-expr-root-of-constant-issue-40749.rs @@ -1,6 +1,6 @@ fn main() { [0; ..10]; //~^ ERROR mismatched types - //~| expected type `usize` - //~| found struct `RangeTo<{integer}>` + //~| NOTE_NONVIRAL expected type `usize` + //~| NOTE_NONVIRAL found struct `RangeTo<{integer}>` }