From a917fd5f98913a04b839cccca43558f4e4fc831b Mon Sep 17 00:00:00 2001 From: yukang Date: Tue, 11 Feb 2025 22:16:07 +0800 Subject: [PATCH 01/19] Fix diagnostic when using = instead of : in let bindings --- .../rustc_resolve/src/late/diagnostics.rs | 23 +++++++++++++++- .../let-binding-suggest-issue-133713.fixed | 12 +++++++++ .../let-binding-suggest-issue-133713.rs | 12 +++++++++ .../let-binding-suggest-issue-133713.stderr | 27 +++++++++++++++++++ 4 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 tests/ui/suggestions/let-binding-suggest-issue-133713.fixed create mode 100644 tests/ui/suggestions/let-binding-suggest-issue-133713.rs create mode 100644 tests/ui/suggestions/let-binding-suggest-issue-133713.stderr diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index a80b68d9773d4..0962865e7f190 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -2347,9 +2347,14 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { // try to give a suggestion for this pattern: `name = blah`, which is common in other languages // suggest `let name = blah` to introduce a new binding fn let_binding_suggestion(&mut self, err: &mut Diag<'_>, ident_span: Span) -> bool { + if ident_span.from_expansion() { + return false; + } + + // only suggest when the code is a assignment without prefix code if let Some(Expr { kind: ExprKind::Assign(lhs, ..), .. }) = self.diag_metadata.in_assignment && let ast::ExprKind::Path(None, ref path) = lhs.kind - && !ident_span.from_expansion() + && self.r.tcx.sess.source_map().is_line_before_span_empty(ident_span) { let (span, text) = match path.segments.first() { Some(seg) if let Some(name) = seg.ident.as_str().strip_prefix("let") => { @@ -2368,6 +2373,22 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { ); return true; } + + // a special case for #133713 + // '=' maybe a typo of `:`, which is a type annotation instead of assignment + if err.code == Some(E0423) + && let Some((let_span, None, Some(val_span))) = self.diag_metadata.current_let_binding + && val_span.contains(ident_span) + && val_span.lo() == ident_span.lo() + { + err.span_suggestion_verbose( + let_span.shrink_to_hi().to(val_span.shrink_to_lo()), + "you might have meant to use `:` for type annotation", + ": ", + Applicability::MaybeIncorrect, + ); + return true; + } false } diff --git a/tests/ui/suggestions/let-binding-suggest-issue-133713.fixed b/tests/ui/suggestions/let-binding-suggest-issue-133713.fixed new file mode 100644 index 0000000000000..9f9c1d1bc5aa1 --- /dev/null +++ b/tests/ui/suggestions/let-binding-suggest-issue-133713.fixed @@ -0,0 +1,12 @@ +//@ run-rustfix +#![allow(dead_code)] + +fn demo1() { + let _last: u64 = 0; //~ ERROR expected value, found builtin type `u64` +} + +fn demo2() { + let _val: u64; //~ ERROR expected value, found builtin type `u64` +} + +fn main() {} diff --git a/tests/ui/suggestions/let-binding-suggest-issue-133713.rs b/tests/ui/suggestions/let-binding-suggest-issue-133713.rs new file mode 100644 index 0000000000000..ae218237a8d5c --- /dev/null +++ b/tests/ui/suggestions/let-binding-suggest-issue-133713.rs @@ -0,0 +1,12 @@ +//@ run-rustfix +#![allow(dead_code)] + +fn demo1() { + let _last = u64 = 0; //~ ERROR expected value, found builtin type `u64` +} + +fn demo2() { + let _val = u64; //~ ERROR expected value, found builtin type `u64` +} + +fn main() {} diff --git a/tests/ui/suggestions/let-binding-suggest-issue-133713.stderr b/tests/ui/suggestions/let-binding-suggest-issue-133713.stderr new file mode 100644 index 0000000000000..185ad9c928b48 --- /dev/null +++ b/tests/ui/suggestions/let-binding-suggest-issue-133713.stderr @@ -0,0 +1,27 @@ +error[E0423]: expected value, found builtin type `u64` + --> $DIR/let-binding-suggest-issue-133713.rs:5:17 + | +LL | let _last = u64 = 0; + | ^^^ + | +help: you might have meant to use `:` for type annotation + | +LL - let _last = u64 = 0; +LL + let _last: u64 = 0; + | + +error[E0423]: expected value, found builtin type `u64` + --> $DIR/let-binding-suggest-issue-133713.rs:9:16 + | +LL | let _val = u64; + | ^^^ + | +help: you might have meant to use `:` for type annotation + | +LL - let _val = u64; +LL + let _val: u64; + | + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0423`. From d82219a4fa06bfa47fc5aac64844c461905ae77d Mon Sep 17 00:00:00 2001 From: Matthew Maurer Date: Wed, 12 Feb 2025 00:37:33 +0000 Subject: [PATCH 02/19] debuginfo: Set bitwidth appropriately in enum variant tags Previously, we unconditionally set the bitwidth to 128-bits, the largest an discrimnator would possibly be. Then, LLVM would cut down the constant by chopping off leading zeroes before emitting the DWARF. LLVM only supported 64-bit descriminators, so this would also have occasionally resulted in truncated data (or an assert) if more than 64-bits were used. LLVM added support for 128-bit enumerators in llvm/llvm-project#125578 That patchset also trusts the constant to describe how wide the variant tag is. As a result, we went from emitting tags that looked like: DW_AT_discr_value (0xfe) (`form1`) to emitting tags that looked like: DW_AT_discr_value (<0x10> fe ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 ) This makes the `DW_AT_discr_value` encode at the bitwidth of the tag, which: 1. Is probably closer to our intentions in terms of describing the data. 2. Doesn't invoke the 128-bit support which may not be supported by all debuggers / downstream tools. 3. Will result in smaller debug information. --- .../src/debuginfo/metadata/enums/native.rs | 8 +++++++- tests/codegen/enum/enum-debug-niche-2.rs | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/native.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/native.rs index 11824398f243e..187d97c54c873 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/native.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/native.rs @@ -437,6 +437,12 @@ fn build_enum_variant_member_di_node<'ll, 'tcx>( .source_info .unwrap_or_else(|| (unknown_file_metadata(cx), UNKNOWN_LINE_NUMBER)); + let discr = discr_value.opt_single_val().map(|value| { + let tag_base_type = tag_base_type(cx.tcx, enum_type_and_layout); + let size = cx.size_of(tag_base_type); + cx.const_uint_big(cx.type_ix(size.bits()), value) + }); + unsafe { llvm::LLVMRustDIBuilderCreateVariantMemberType( DIB(cx), @@ -448,7 +454,7 @@ fn build_enum_variant_member_di_node<'ll, 'tcx>( enum_type_and_layout.size.bits(), enum_type_and_layout.align.abi.bits() as u32, Size::ZERO.bits(), - discr_value.opt_single_val().map(|value| cx.const_u128(value)), + discr, DIFlags::FlagZero, variant_member_info.variant_struct_type_di_node, ) diff --git a/tests/codegen/enum/enum-debug-niche-2.rs b/tests/codegen/enum/enum-debug-niche-2.rs index 58f43fe3ec6bf..80a4081f15b10 100644 --- a/tests/codegen/enum/enum-debug-niche-2.rs +++ b/tests/codegen/enum/enum-debug-niche-2.rs @@ -5,8 +5,8 @@ //@ ignore-msvc // // CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_variant_part,{{.*}}size: 32,{{.*}} -// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Placeholder",{{.*}}extraData: i128 4294967295{{[,)].*}} -// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Error",{{.*}}extraData: i128 0{{[,)].*}} +// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Placeholder",{{.*}}extraData: i32 -1{{[,)].*}} +// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Error",{{.*}}extraData: i32 0{{[,)].*}} #![feature(never_type)] #[derive(Copy, Clone)] From e663819856d605df63ea798f969aff123ead7e27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Wed, 12 Feb 2025 20:02:21 +0100 Subject: [PATCH 03/19] Move `llvm.ccache` to `build.ccache` (S)ccache can be useful for more things that just LLVM. For example, we will soon want to use it also for GCC, and theoretically also for building stage0 Rust tools. --- config.example.toml | 5 +++++ src/bootstrap/configure.py | 12 ++++++++---- src/bootstrap/src/core/config/config.rs | 20 ++++++++++++-------- src/bootstrap/src/utils/change_tracker.rs | 5 +++++ 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/config.example.toml b/config.example.toml index 1a8f42428ab87..ad79f5d5a80c0 100644 --- a/config.example.toml +++ b/config.example.toml @@ -424,6 +424,11 @@ # What custom diff tool to use for displaying compiletest tests. #compiletest-diff-tool = +# Indicates whether ccache is used when building certain artifacts (e.g. LLVM). +# Set to `true` to use the first `ccache` in PATH, or set an absolute path to use +# a specific version. +#ccache = false + # ============================================================================= # General install configuration options # ============================================================================= diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index a86c20d46bda5..ac971a64d7c22 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -44,10 +44,14 @@ def v(*args): o("verbose-tests", "rust.verbose-tests", "enable verbose output when running tests") o( "ccache", - "llvm.ccache", - "invoke gcc/clang via ccache to reuse object files between builds", + "build.ccache", + "invoke gcc/clang/rustc via ccache to reuse object files between builds", +) +o( + "sccache", + None, + "invoke gcc/clang/rustc via sccache to reuse object files between builds", ) -o("sccache", None, "invoke gcc/clang via sccache to reuse object files between builds") o("local-rust", None, "use an installed rustc rather than downloading a snapshot") v("local-rust-root", None, "set prefix for local rust binary") o( @@ -510,7 +514,7 @@ def apply_args(known_args, option_checking, config): build_triple = build(known_args) if option.name == "sccache": - set("llvm.ccache", "sccache", config) + set("build.ccache", "sccache", config) elif option.name == "local-rust": for path in os.environ["PATH"].split(os.pathsep): if os.path.exists(path + "/rustc"): diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index d3ed7ecddd3d7..0ee476d19c9d3 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -935,6 +935,7 @@ define_config! { optimized_compiler_builtins: Option = "optimized-compiler-builtins", jobs: Option = "jobs", compiletest_diff_tool: Option = "compiletest-diff-tool", + ccache: Option = "ccache", } } @@ -1622,6 +1623,7 @@ impl Config { optimized_compiler_builtins, jobs, compiletest_diff_tool, + mut ccache, } = toml.build.unwrap_or_default(); config.jobs = Some(threads_from_config(flags.jobs.unwrap_or(jobs.unwrap_or(0)))); @@ -2006,7 +2008,7 @@ impl Config { tests, enzyme, plugins, - ccache, + ccache: llvm_ccache, static_libstdcpp, libzstd, ninja, @@ -2029,13 +2031,7 @@ impl Config { download_ci_llvm, build_config, } = llvm; - match ccache { - Some(StringOrBool::String(ref s)) => config.ccache = Some(s.to_string()), - Some(StringOrBool::Bool(true)) => { - config.ccache = Some("ccache".to_string()); - } - Some(StringOrBool::Bool(false)) | None => {} - } + ccache = ccache.or(llvm_ccache); set(&mut config.ninja_in_file, ninja); llvm_tests = tests; llvm_enzyme = enzyme; @@ -2189,6 +2185,14 @@ impl Config { } } + match ccache { + Some(StringOrBool::String(ref s)) => config.ccache = Some(s.to_string()), + Some(StringOrBool::Bool(true)) => { + config.ccache = Some("ccache".to_string()); + } + Some(StringOrBool::Bool(false)) | None => {} + } + if config.llvm_from_ci { let triple = &config.build.triple; let ci_llvm_bin = config.ci_llvm_root().join("bin"); diff --git a/src/bootstrap/src/utils/change_tracker.rs b/src/bootstrap/src/utils/change_tracker.rs index 6f62df28e4949..9b23cf1843ef5 100644 --- a/src/bootstrap/src/utils/change_tracker.rs +++ b/src/bootstrap/src/utils/change_tracker.rs @@ -345,4 +345,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[ severity: ChangeSeverity::Info, summary: "Rustdoc now respects the value of rust.lto.", }, + ChangeInfo { + change_id: 136941, + severity: ChangeSeverity::Info, + summary: "The llvm.ccache option has moved to build.ccache. llvm.ccache is now deprecated.", + }, ]; From 2c4922cf29beb8c3742c5d8dee4a9d89367b4ff2 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Wed, 12 Feb 2025 15:13:34 -0700 Subject: [PATCH 04/19] rustdoc: use better, consistent SVG icons for scraped examples This continues two ongoing projects: - Replacing ascii art with real icons that don't look like syntax, are understandable to people who're familiar with desktop computers and smart devices, and aren't ugly. - Using labels and tooltips to clarify these icons, when the limits of popular iconography hit us. In this case, I've added tooltips, because, unfortunately, there's not room for always-visible labels. --- src/librustdoc/html/static/css/rustdoc.css | 43 ++++++++++++++++++- .../html/static/js/scrape-examples.js | 12 ++++-- .../scrape-examples-button-focus.goml | 26 +++++++++++ 3 files changed, 76 insertions(+), 5 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index f39c0e4a31400..4f5f8f92264c1 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -41,6 +41,19 @@ xmlns="http://www.w3.org/2000/svg" fill="black" height="18px">\ --font-family: "Source Serif 4", NanumBarunGothic, serif; --font-family-code: "Source Code Pro", monospace; --line-number-padding: 4px; + /* scraped examples icons (34x33px) */ + --prev-arrow-image: url('data:image/svg+xml,'); + --next-arrow-image: url('data:image/svg+xml,'); + --expand-arrow-image: url('data:image/svg+xml,'); + --collapse-arrow-image: url('data:image/svg+xml,'); } :root.sans-serif { @@ -1729,7 +1742,10 @@ instead, we check that it's not a "finger" cursor. padding: 2px 0 0 4px; } .example-wrap .button-holder .copy-button::before, -.example-wrap .test-arrow::before { +.example-wrap .test-arrow::before, +.example-wrap .button-holder .prev::before, +.example-wrap .button-holder .next::before, +.example-wrap .button-holder .expand::before { filter: var(--copy-path-img-filter); } .example-wrap .button-holder .copy-button::before { @@ -1744,6 +1760,24 @@ instead, we check that it's not a "finger" cursor. padding-right: 5px; } +.example-wrap .button-holder .prev, +.example-wrap .button-holder .next, +.example-wrap .button-holder .expand { + line-height: 0px; +} +.example-wrap .button-holder .prev::before { + content: var(--prev-arrow-image); +} +.example-wrap .button-holder .next::before { + content: var(--next-arrow-image); +} +.example-wrap .button-holder .expand::before { + content: var(--expand-arrow-image); +} +.example-wrap .button-holder .expand.collapse::before { + content: var(--collapse-arrow-image); +} + .code-attribute { font-weight: 300; color: var(--code-attribute-color); @@ -2012,6 +2046,13 @@ button#toggle-all-docs:before { filter: var(--settings-menu-filter); } +button#toggle-all-docs.will-expand:before { + /* Custom arrow icon */ + content: url('data:image/svg+xml,\ + '); +} + #help-button > a:before { /* Question mark with circle */ content: url('data:image/svg+xml, 1) { - const next = createScrapeButton(buttonHolder, "next", "≻"); - const prev = createScrapeButton(buttonHolder, "prev", "≺"); + const next = createScrapeButton(buttonHolder, "next", "Next usage"); + const prev = createScrapeButton(buttonHolder, "prev", "Previous usage"); // Toggle through list of examples in a given file const onChangeLoc = changeIndex => { @@ -94,9 +94,13 @@ expandButton.addEventListener("click", () => { if (hasClass(example, "expanded")) { removeClass(example, "expanded"); + removeClass(expandButton, "collapse"); + expandButton.title = "Show all"; scrollToLoc(example, locs[0][0], isHidden); } else { addClass(example, "expanded"); + addClass(expandButton, "collapse"); + expandButton.title = "Show single example"; } }); } diff --git a/tests/rustdoc-gui/scrape-examples-button-focus.goml b/tests/rustdoc-gui/scrape-examples-button-focus.goml index d53993ac08bae..12246a3766151 100644 --- a/tests/rustdoc-gui/scrape-examples-button-focus.goml +++ b/tests/rustdoc-gui/scrape-examples-button-focus.goml @@ -19,3 +19,29 @@ press-key: "Enter" assert-property: (".scraped-example-list > .scraped-example .rust", { "scrollTop": |initialScrollTop| }, NEAR) + +// Make sure all the buttons are the same size +store-property: (".scraped-example-list > .scraped-example .prev", { + "offsetWidth": buttonWidth, + "offsetHeight": buttonHeight, +}) +assert-property: (".scraped-example-list > .scraped-example .prev", { + "offsetWidth": |buttonWidth|, + "offsetHeight": |buttonHeight|, + "title": "Previous usage", +}) +assert-property: (".scraped-example-list > .scraped-example .next", { + "offsetWidth": |buttonWidth|, + "offsetHeight": |buttonHeight|, + "title": "Next usage", +}) +assert-property: (".scraped-example-list > .scraped-example .expand", { + "offsetWidth": |buttonWidth|, + "offsetHeight": |buttonHeight|, + "title": "Show all", +}) +assert-property: (".scraped-example-list > .scraped-example .copy-button", { + "offsetWidth": |buttonWidth|, + "offsetHeight": |buttonHeight|, + "title": "Copy code to clipboard", +}) From ab786d3b98d640b1208eff371c1184e3e8ce1d17 Mon Sep 17 00:00:00 2001 From: Zalathar Date: Tue, 11 Feb 2025 14:09:11 +1100 Subject: [PATCH 05/19] coverage: Eliminate more counters by giving them to unreachable nodes When preparing a function's coverage counters and metadata during codegen, any part of the original coverage graph that was removed by MIR optimizations can be treated as having an execution count of zero. Somewhat counter-intuitively, if we give those unreachable nodes a _higher_ priority for receiving physical counters (instead of counter expressions), that ends up reducing the total number of physical counters needed. This works because if a node is unreachable, we don't actually create a physical counter for it. Instead that node gets a fixed zero counter, and any other node that would have relied on that physical counter in its counter expression can just ignore that term completely. --- .../src/coverage/counters.rs | 8 +- .../rustc_mir_transform/src/coverage/query.rs | 19 +- tests/coverage/assert_not.cov-map | 12 +- tests/coverage/async2.cov-map | 12 +- tests/coverage/bad_counter_ids.cov-map | 18 +- tests/coverage/conditions.cov-map | 321 +++++++++--------- tests/coverage/drop_trait.cov-map | 6 +- tests/coverage/generics.cov-map | 6 +- tests/coverage/loops_branches.cov-map | 34 +- tests/coverage/try_error_result.cov-map | 24 +- tests/coverage/while.cov-map | 6 +- 11 files changed, 237 insertions(+), 229 deletions(-) diff --git a/compiler/rustc_mir_transform/src/coverage/counters.rs b/compiler/rustc_mir_transform/src/coverage/counters.rs index 6f9984d5d0ac3..039f346495be0 100644 --- a/compiler/rustc_mir_transform/src/coverage/counters.rs +++ b/compiler/rustc_mir_transform/src/coverage/counters.rs @@ -114,12 +114,8 @@ pub(crate) fn transcribe_counters( let mut new_counters_for_sites = |sites: Vec| { sites.into_iter().map(|node| new.ensure_phys_counter(node)).collect::>() }; - let mut pos = new_counters_for_sites(pos); - let mut neg = new_counters_for_sites(neg); - - // These sorts are also not strictly necessary; see above. - pos.sort(); - neg.sort(); + let pos = new_counters_for_sites(pos); + let neg = new_counters_for_sites(neg); let pos_counter = new.make_sum(&pos).unwrap_or(CovTerm::Zero); let new_counter = new.make_subtracted_sum(pos_counter, &neg); diff --git a/compiler/rustc_mir_transform/src/coverage/query.rs b/compiler/rustc_mir_transform/src/coverage/query.rs index cd89fbe772d4c..ef86358b2057a 100644 --- a/compiler/rustc_mir_transform/src/coverage/query.rs +++ b/compiler/rustc_mir_transform/src/coverage/query.rs @@ -123,11 +123,20 @@ fn coverage_ids_info<'tcx>( } } - // FIXME(Zalathar): It should be possible to sort `priority_list[1..]` by - // `!bcbs_seen.contains(bcb)` to simplify the mappings even further, at the - // expense of some churn in the tests. When doing so, also consider removing - // the sorts in `transcribe_counters`. - let node_counters = make_node_counters(&fn_cov_info.node_flow_data, &fn_cov_info.priority_list); + // Clone the priority list so that we can re-sort it. + let mut priority_list = fn_cov_info.priority_list.clone(); + // The first ID in the priority list represents the synthetic "sink" node, + // and must remain first so that it _never_ gets a physical counter. + debug_assert_eq!(priority_list[0], priority_list.iter().copied().max().unwrap()); + assert!(!bcbs_seen.contains(priority_list[0])); + // Partition the priority list, so that unreachable nodes (removed by MIR opts) + // are sorted later and therefore are _more_ likely to get a physical counter. + // This is counter-intuitive, but it means that `transcribe_counters` can + // easily skip those unused physical counters and replace them with zero. + // (The original ordering remains in effect within both partitions.) + priority_list[1..].sort_by_key(|&bcb| !bcbs_seen.contains(bcb)); + + let node_counters = make_node_counters(&fn_cov_info.node_flow_data, &priority_list); let coverage_counters = transcribe_counters(&node_counters, &bcb_needs_counter, &bcbs_seen); let CoverageCounters { diff --git a/tests/coverage/assert_not.cov-map b/tests/coverage/assert_not.cov-map index 35568a98af444..526110ebbb764 100644 --- a/tests/coverage/assert_not.cov-map +++ b/tests/coverage/assert_not.cov-map @@ -1,13 +1,13 @@ Function name: assert_not::main -Raw bytes (29): 0x[01, 01, 00, 05, 01, 06, 01, 01, 12, 05, 02, 05, 00, 14, 09, 01, 05, 00, 14, 0d, 01, 05, 00, 16, 0d, 01, 01, 00, 02] +Raw bytes (29): 0x[01, 01, 00, 05, 01, 06, 01, 01, 12, 01, 02, 05, 00, 14, 01, 01, 05, 00, 14, 01, 01, 05, 00, 16, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 5 - Code(Counter(0)) at (prev + 6, 1) to (start + 1, 18) -- Code(Counter(1)) at (prev + 2, 5) to (start + 0, 20) -- Code(Counter(2)) at (prev + 1, 5) to (start + 0, 20) -- Code(Counter(3)) at (prev + 1, 5) to (start + 0, 22) -- Code(Counter(3)) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c3 +- Code(Counter(0)) at (prev + 2, 5) to (start + 0, 20) +- Code(Counter(0)) at (prev + 1, 5) to (start + 0, 20) +- Code(Counter(0)) at (prev + 1, 5) to (start + 0, 22) +- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) +Highest counter ID seen: c0 diff --git a/tests/coverage/async2.cov-map b/tests/coverage/async2.cov-map index 7660f917b65aa..c2a0645ee9a8c 100644 --- a/tests/coverage/async2.cov-map +++ b/tests/coverage/async2.cov-map @@ -8,16 +8,16 @@ Number of file 0 mappings: 1 Highest counter ID seen: c0 Function name: async2::async_func::{closure#0} -Raw bytes (24): 0x[01, 01, 00, 04, 01, 0f, 17, 03, 09, 05, 03, 0a, 02, 06, 00, 02, 05, 00, 06, 01, 01, 01, 00, 02] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 0f, 17, 03, 09, 01, 03, 0a, 02, 06, 00, 02, 05, 00, 06, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 4 - Code(Counter(0)) at (prev + 15, 23) to (start + 3, 9) -- Code(Counter(1)) at (prev + 3, 10) to (start + 2, 6) +- Code(Counter(0)) at (prev + 3, 10) to (start + 2, 6) - Code(Zero) at (prev + 2, 5) to (start + 0, 6) - Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c1 +Highest counter ID seen: c0 Function name: async2::async_func_just_println Raw bytes (9): 0x[01, 01, 00, 01, 01, 17, 01, 00, 24] @@ -47,14 +47,14 @@ Number of file 0 mappings: 1 Highest counter ID seen: c0 Function name: async2::non_async_func -Raw bytes (24): 0x[01, 01, 00, 04, 01, 07, 01, 03, 09, 05, 03, 0a, 02, 06, 00, 02, 05, 00, 06, 01, 01, 01, 00, 02] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 07, 01, 03, 09, 01, 03, 0a, 02, 06, 00, 02, 05, 00, 06, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 4 - Code(Counter(0)) at (prev + 7, 1) to (start + 3, 9) -- Code(Counter(1)) at (prev + 3, 10) to (start + 2, 6) +- Code(Counter(0)) at (prev + 3, 10) to (start + 2, 6) - Code(Zero) at (prev + 2, 5) to (start + 0, 6) - Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c1 +Highest counter ID seen: c0 diff --git a/tests/coverage/bad_counter_ids.cov-map b/tests/coverage/bad_counter_ids.cov-map index ba30627844937..baac0073fcbec 100644 --- a/tests/coverage/bad_counter_ids.cov-map +++ b/tests/coverage/bad_counter_ids.cov-map @@ -20,25 +20,25 @@ Number of file 0 mappings: 3 Highest counter ID seen: c0 Function name: bad_counter_ids::eq_good -Raw bytes (14): 0x[01, 01, 00, 02, 01, 10, 01, 02, 1f, 05, 03, 01, 00, 02] +Raw bytes (14): 0x[01, 01, 00, 02, 01, 10, 01, 02, 1f, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 2 - Code(Counter(0)) at (prev + 16, 1) to (start + 2, 31) -- Code(Counter(1)) at (prev + 3, 1) to (start + 0, 2) -Highest counter ID seen: c1 +- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) +Highest counter ID seen: c0 Function name: bad_counter_ids::eq_good_message -Raw bytes (19): 0x[01, 01, 00, 03, 01, 15, 01, 02, 0f, 00, 02, 20, 00, 2b, 05, 01, 01, 00, 02] +Raw bytes (19): 0x[01, 01, 00, 03, 01, 15, 01, 02, 0f, 00, 02, 20, 00, 2b, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 3 - Code(Counter(0)) at (prev + 21, 1) to (start + 2, 15) - Code(Zero) at (prev + 2, 32) to (start + 0, 43) -- Code(Counter(1)) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c1 +- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) +Highest counter ID seen: c0 Function name: bad_counter_ids::ne_bad Raw bytes (14): 0x[01, 01, 00, 02, 01, 2e, 01, 02, 1f, 00, 03, 01, 00, 02] @@ -51,15 +51,15 @@ Number of file 0 mappings: 2 Highest counter ID seen: c0 Function name: bad_counter_ids::ne_bad_message -Raw bytes (19): 0x[01, 01, 00, 03, 01, 33, 01, 02, 0f, 05, 02, 20, 00, 2b, 00, 01, 01, 00, 02] +Raw bytes (19): 0x[01, 01, 00, 03, 01, 33, 01, 02, 0f, 01, 02, 20, 00, 2b, 00, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 3 - Code(Counter(0)) at (prev + 51, 1) to (start + 2, 15) -- Code(Counter(1)) at (prev + 2, 32) to (start + 0, 43) +- Code(Counter(0)) at (prev + 2, 32) to (start + 0, 43) - Code(Zero) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c1 +Highest counter ID seen: c0 Function name: bad_counter_ids::ne_good Raw bytes (14): 0x[01, 01, 00, 02, 01, 1a, 01, 02, 1f, 01, 03, 01, 00, 02] diff --git a/tests/coverage/conditions.cov-map b/tests/coverage/conditions.cov-map index 549b8bb0a2096..2d12f4bf7744a 100644 --- a/tests/coverage/conditions.cov-map +++ b/tests/coverage/conditions.cov-map @@ -1,192 +1,191 @@ Function name: conditions::main -Raw bytes (545): 0x[01, 01, 4d, 09, 0d, 01, 09, 0d, 71, 0d, 27, 71, 75, 27, 79, 71, 75, 0d, 23, 27, 79, 71, 75, 01, 03, 03, 15, 19, 65, 19, 4f, 65, 69, 4f, 6d, 65, 69, 19, 4b, 4f, 6d, 65, 69, 03, ef, 01, 15, 19, 15, 19, 1d, 25, 29, 59, 29, 7f, 59, 5d, 7f, 61, 59, 5d, 29, 7b, 7f, 61, 59, 5d, 1d, 87, 01, 25, 29, e7, 01, 1d, eb, 01, 29, ef, 01, 25, 15, 19, 31, 35, e7, 01, 1d, eb, 01, 29, ef, 01, 25, 15, 19, e7, 01, f7, 01, eb, 01, 29, ef, 01, 25, 15, 19, 1d, 31, 35, 4d, 35, df, 01, 4d, 51, df, 01, 55, 4d, 51, 35, db, 01, df, 01, 55, 4d, 51, e7, 01, f3, 01, eb, 01, 29, ef, 01, 25, 15, 19, f7, 01, 35, 1d, 31, 39, 3d, 31, 35, af, 02, 39, 31, 35, 3d, 41, 3d, a7, 02, 41, 45, a7, 02, 49, 41, 45, 3d, a3, 02, a7, 02, 49, 41, 45, af, 02, b3, 02, 31, 35, 39, 3d, 44, 01, 03, 01, 02, 0c, 05, 02, 0d, 02, 06, 00, 02, 05, 00, 06, 03, 03, 09, 00, 0a, 01, 00, 10, 00, 1d, 09, 01, 09, 01, 0a, 06, 02, 0f, 00, 1c, 0d, 01, 0c, 00, 19, 0a, 00, 1d, 00, 2a, 0e, 00, 2e, 00, 3c, 23, 00, 3d, 02, 0a, 1e, 02, 09, 00, 0a, 0d, 01, 09, 01, 12, 2a, 03, 09, 00, 0f, 03, 03, 09, 01, 0c, 11, 01, 0d, 02, 06, 00, 02, 05, 00, 06, 03, 02, 08, 00, 15, 15, 00, 16, 02, 06, 2e, 02, 0f, 00, 1c, 19, 01, 0c, 00, 19, 32, 00, 1d, 00, 2a, 36, 00, 2e, 00, 3c, 4b, 00, 3d, 02, 0a, 46, 02, 09, 00, 0a, 19, 01, 09, 00, 17, 52, 02, 09, 00, 0f, ef, 01, 03, 08, 00, 0c, 1d, 01, 0d, 01, 10, 21, 01, 11, 02, 0a, 00, 02, 09, 00, 0a, 1d, 02, 0c, 00, 19, 25, 00, 1a, 02, 0a, 5e, 04, 11, 00, 1e, 29, 01, 10, 00, 1d, 62, 00, 21, 00, 2e, 66, 00, 32, 00, 40, 7b, 00, 41, 02, 0e, 76, 02, 0d, 00, 0e, 29, 01, 0d, 00, 1b, 82, 01, 02, 0d, 00, 13, 00, 02, 05, 00, 06, 9e, 01, 02, 09, 01, 0c, 2d, 01, 0d, 02, 06, 00, 02, 05, 00, 06, af, 02, 02, 09, 00, 0a, 9e, 01, 00, 10, 00, 1d, 31, 00, 1e, 02, 06, ae, 01, 02, 0f, 00, 1c, 35, 01, 0c, 00, 19, c2, 01, 00, 1d, 00, 2a, c6, 01, 00, 2e, 00, 3c, db, 01, 00, 3d, 02, 0a, d6, 01, 02, 09, 00, 0a, 35, 01, 09, 00, 17, e2, 01, 02, 0d, 02, 0f, b3, 02, 05, 09, 00, 0a, af, 02, 00, 10, 00, 1d, 39, 00, 1e, 02, 06, 82, 02, 02, 0f, 00, 1c, 3d, 01, 0c, 00, 19, 8a, 02, 00, 1d, 00, 2a, 8e, 02, 00, 2e, 00, 3c, a3, 02, 00, 3d, 02, 0a, 9e, 02, 02, 09, 00, 0a, 3d, 01, 09, 00, 17, aa, 02, 02, 09, 00, 0f, 01, 02, 01, 00, 02] +Raw bytes (533): 0x[01, 01, 47, 05, 09, 01, 05, 09, 5d, 09, 27, 5d, 61, 27, 65, 5d, 61, 09, 23, 27, 65, 5d, 61, 01, 03, 03, 0d, 11, 51, 11, 4f, 51, 55, 4f, 59, 51, 55, 11, 4b, 4f, 59, 51, 55, 03, 97, 01, 0d, 11, 0d, 11, 0d, 11, 0d, 11, 0d, 11, 97, 01, 15, 0d, 11, 19, 45, 19, 8f, 01, 45, 49, 8f, 01, 4d, 45, 49, 19, 8b, 01, 8f, 01, 4d, 45, 49, 97, 01, db, 01, 0d, 11, 15, 19, 15, 19, 15, 19, 1d, 21, 15, 19, db, 01, 1d, 15, 19, 21, 39, 21, d3, 01, 39, 3d, d3, 01, 41, 39, 3d, 21, cf, 01, d3, 01, 41, 39, 3d, db, 01, 97, 02, 15, 19, 1d, 21, 25, 29, 1d, 21, 97, 02, 25, 1d, 21, 29, 2d, 29, 8f, 02, 2d, 31, 8f, 02, 35, 2d, 31, 29, 8b, 02, 8f, 02, 35, 2d, 31, 97, 02, 9b, 02, 1d, 21, 25, 29, 44, 01, 03, 01, 02, 0c, 01, 02, 0d, 02, 06, 00, 02, 05, 00, 06, 03, 03, 09, 00, 0a, 01, 00, 10, 00, 1d, 05, 01, 09, 01, 0a, 06, 02, 0f, 00, 1c, 09, 01, 0c, 00, 19, 0a, 00, 1d, 00, 2a, 0e, 00, 2e, 00, 3c, 23, 00, 3d, 02, 0a, 1e, 02, 09, 00, 0a, 09, 01, 09, 01, 12, 2a, 03, 09, 00, 0f, 03, 03, 09, 01, 0c, 03, 01, 0d, 02, 06, 00, 02, 05, 00, 06, 03, 02, 08, 00, 15, 0d, 00, 16, 02, 06, 2e, 02, 0f, 00, 1c, 11, 01, 0c, 00, 19, 32, 00, 1d, 00, 2a, 36, 00, 2e, 00, 3c, 4b, 00, 3d, 02, 0a, 46, 02, 09, 00, 0a, 11, 01, 09, 00, 17, 52, 02, 09, 00, 0f, 97, 01, 03, 08, 00, 0c, 97, 01, 01, 0d, 01, 10, 97, 01, 01, 11, 02, 0a, 00, 02, 09, 00, 0a, 97, 01, 02, 0c, 00, 19, 15, 00, 1a, 02, 0a, 6a, 04, 11, 00, 1e, 19, 01, 10, 00, 1d, 72, 00, 21, 00, 2e, 76, 00, 32, 00, 40, 8b, 01, 00, 41, 02, 0e, 86, 01, 02, 0d, 00, 0e, 19, 01, 0d, 00, 1b, 92, 01, 02, 0d, 00, 13, 00, 02, 05, 00, 06, db, 01, 02, 09, 01, 0c, db, 01, 01, 0d, 02, 06, 00, 02, 05, 00, 06, 97, 02, 02, 09, 00, 0a, db, 01, 00, 10, 00, 1d, 1d, 00, 1e, 02, 06, ae, 01, 02, 0f, 00, 1c, 21, 01, 0c, 00, 19, b6, 01, 00, 1d, 00, 2a, ba, 01, 00, 2e, 00, 3c, cf, 01, 00, 3d, 02, 0a, ca, 01, 02, 09, 00, 0a, 21, 01, 09, 00, 17, d6, 01, 02, 0d, 02, 0f, 9b, 02, 05, 09, 00, 0a, 97, 02, 00, 10, 00, 1d, 25, 00, 1e, 02, 06, ea, 01, 02, 0f, 00, 1c, 29, 01, 0c, 00, 19, f2, 01, 00, 1d, 00, 2a, f6, 01, 00, 2e, 00, 3c, 8b, 02, 00, 3d, 02, 0a, 86, 02, 02, 09, 00, 0a, 29, 01, 09, 00, 17, 92, 02, 02, 09, 00, 0f, 01, 02, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 77 -- expression 0 operands: lhs = Counter(2), rhs = Counter(3) -- expression 1 operands: lhs = Counter(0), rhs = Counter(2) -- expression 2 operands: lhs = Counter(3), rhs = Counter(28) -- expression 3 operands: lhs = Counter(3), rhs = Expression(9, Add) -- expression 4 operands: lhs = Counter(28), rhs = Counter(29) -- expression 5 operands: lhs = Expression(9, Add), rhs = Counter(30) -- expression 6 operands: lhs = Counter(28), rhs = Counter(29) -- expression 7 operands: lhs = Counter(3), rhs = Expression(8, Add) -- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(30) -- expression 9 operands: lhs = Counter(28), rhs = Counter(29) +Number of expressions: 71 +- expression 0 operands: lhs = Counter(1), rhs = Counter(2) +- expression 1 operands: lhs = Counter(0), rhs = Counter(1) +- expression 2 operands: lhs = Counter(2), rhs = Counter(23) +- expression 3 operands: lhs = Counter(2), rhs = Expression(9, Add) +- expression 4 operands: lhs = Counter(23), rhs = Counter(24) +- expression 5 operands: lhs = Expression(9, Add), rhs = Counter(25) +- expression 6 operands: lhs = Counter(23), rhs = Counter(24) +- expression 7 operands: lhs = Counter(2), rhs = Expression(8, Add) +- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(25) +- expression 9 operands: lhs = Counter(23), rhs = Counter(24) - expression 10 operands: lhs = Counter(0), rhs = Expression(0, Add) -- expression 11 operands: lhs = Expression(0, Add), rhs = Counter(5) -- expression 12 operands: lhs = Counter(6), rhs = Counter(25) -- expression 13 operands: lhs = Counter(6), rhs = Expression(19, Add) -- expression 14 operands: lhs = Counter(25), rhs = Counter(26) -- expression 15 operands: lhs = Expression(19, Add), rhs = Counter(27) -- expression 16 operands: lhs = Counter(25), rhs = Counter(26) -- expression 17 operands: lhs = Counter(6), rhs = Expression(18, Add) -- expression 18 operands: lhs = Expression(19, Add), rhs = Counter(27) -- expression 19 operands: lhs = Counter(25), rhs = Counter(26) -- expression 20 operands: lhs = Expression(0, Add), rhs = Expression(59, Add) -- expression 21 operands: lhs = Counter(5), rhs = Counter(6) -- expression 22 operands: lhs = Counter(5), rhs = Counter(6) -- expression 23 operands: lhs = Counter(7), rhs = Counter(9) -- expression 24 operands: lhs = Counter(10), rhs = Counter(22) -- expression 25 operands: lhs = Counter(10), rhs = Expression(31, Add) -- expression 26 operands: lhs = Counter(22), rhs = Counter(23) -- expression 27 operands: lhs = Expression(31, Add), rhs = Counter(24) -- expression 28 operands: lhs = Counter(22), rhs = Counter(23) -- expression 29 operands: lhs = Counter(10), rhs = Expression(30, Add) -- expression 30 operands: lhs = Expression(31, Add), rhs = Counter(24) -- expression 31 operands: lhs = Counter(22), rhs = Counter(23) -- expression 32 operands: lhs = Counter(7), rhs = Expression(33, Add) -- expression 33 operands: lhs = Counter(9), rhs = Counter(10) -- expression 34 operands: lhs = Expression(57, Add), rhs = Counter(7) -- expression 35 operands: lhs = Expression(58, Add), rhs = Counter(10) -- expression 36 operands: lhs = Expression(59, Add), rhs = Counter(9) -- expression 37 operands: lhs = Counter(5), rhs = Counter(6) -- expression 38 operands: lhs = Counter(12), rhs = Counter(13) -- expression 39 operands: lhs = Expression(57, Add), rhs = Counter(7) -- expression 40 operands: lhs = Expression(58, Add), rhs = Counter(10) -- expression 41 operands: lhs = Expression(59, Add), rhs = Counter(9) +- expression 11 operands: lhs = Expression(0, Add), rhs = Counter(3) +- expression 12 operands: lhs = Counter(4), rhs = Counter(20) +- expression 13 operands: lhs = Counter(4), rhs = Expression(19, Add) +- expression 14 operands: lhs = Counter(20), rhs = Counter(21) +- expression 15 operands: lhs = Expression(19, Add), rhs = Counter(22) +- expression 16 operands: lhs = Counter(20), rhs = Counter(21) +- expression 17 operands: lhs = Counter(4), rhs = Expression(18, Add) +- expression 18 operands: lhs = Expression(19, Add), rhs = Counter(22) +- expression 19 operands: lhs = Counter(20), rhs = Counter(21) +- expression 20 operands: lhs = Expression(0, Add), rhs = Expression(37, Add) +- expression 21 operands: lhs = Counter(3), rhs = Counter(4) +- expression 22 operands: lhs = Counter(3), rhs = Counter(4) +- expression 23 operands: lhs = Counter(3), rhs = Counter(4) +- expression 24 operands: lhs = Counter(3), rhs = Counter(4) +- expression 25 operands: lhs = Counter(3), rhs = Counter(4) +- expression 26 operands: lhs = Expression(37, Add), rhs = Counter(5) +- expression 27 operands: lhs = Counter(3), rhs = Counter(4) +- expression 28 operands: lhs = Counter(6), rhs = Counter(17) +- expression 29 operands: lhs = Counter(6), rhs = Expression(35, Add) +- expression 30 operands: lhs = Counter(17), rhs = Counter(18) +- expression 31 operands: lhs = Expression(35, Add), rhs = Counter(19) +- expression 32 operands: lhs = Counter(17), rhs = Counter(18) +- expression 33 operands: lhs = Counter(6), rhs = Expression(34, Add) +- expression 34 operands: lhs = Expression(35, Add), rhs = Counter(19) +- expression 35 operands: lhs = Counter(17), rhs = Counter(18) +- expression 36 operands: lhs = Expression(37, Add), rhs = Expression(54, Add) +- expression 37 operands: lhs = Counter(3), rhs = Counter(4) +- expression 38 operands: lhs = Counter(5), rhs = Counter(6) +- expression 39 operands: lhs = Counter(5), rhs = Counter(6) +- expression 40 operands: lhs = Counter(5), rhs = Counter(6) +- expression 41 operands: lhs = Counter(7), rhs = Counter(8) - expression 42 operands: lhs = Counter(5), rhs = Counter(6) -- expression 43 operands: lhs = Expression(57, Add), rhs = Expression(61, Add) -- expression 44 operands: lhs = Expression(58, Add), rhs = Counter(10) -- expression 45 operands: lhs = Expression(59, Add), rhs = Counter(9) -- expression 46 operands: lhs = Counter(5), rhs = Counter(6) -- expression 47 operands: lhs = Counter(7), rhs = Counter(12) -- expression 48 operands: lhs = Counter(13), rhs = Counter(19) -- expression 49 operands: lhs = Counter(13), rhs = Expression(55, Add) -- expression 50 operands: lhs = Counter(19), rhs = Counter(20) -- expression 51 operands: lhs = Expression(55, Add), rhs = Counter(21) -- expression 52 operands: lhs = Counter(19), rhs = Counter(20) -- expression 53 operands: lhs = Counter(13), rhs = Expression(54, Add) -- expression 54 operands: lhs = Expression(55, Add), rhs = Counter(21) -- expression 55 operands: lhs = Counter(19), rhs = Counter(20) -- expression 56 operands: lhs = Expression(57, Add), rhs = Expression(60, Add) -- expression 57 operands: lhs = Expression(58, Add), rhs = Counter(10) -- expression 58 operands: lhs = Expression(59, Add), rhs = Counter(9) -- expression 59 operands: lhs = Counter(5), rhs = Counter(6) -- expression 60 operands: lhs = Expression(61, Add), rhs = Counter(13) -- expression 61 operands: lhs = Counter(7), rhs = Counter(12) -- expression 62 operands: lhs = Counter(14), rhs = Counter(15) -- expression 63 operands: lhs = Counter(12), rhs = Counter(13) -- expression 64 operands: lhs = Expression(75, Add), rhs = Counter(14) -- expression 65 operands: lhs = Counter(12), rhs = Counter(13) -- expression 66 operands: lhs = Counter(15), rhs = Counter(16) -- expression 67 operands: lhs = Counter(15), rhs = Expression(73, Add) -- expression 68 operands: lhs = Counter(16), rhs = Counter(17) -- expression 69 operands: lhs = Expression(73, Add), rhs = Counter(18) -- expression 70 operands: lhs = Counter(16), rhs = Counter(17) -- expression 71 operands: lhs = Counter(15), rhs = Expression(72, Add) -- expression 72 operands: lhs = Expression(73, Add), rhs = Counter(18) -- expression 73 operands: lhs = Counter(16), rhs = Counter(17) -- expression 74 operands: lhs = Expression(75, Add), rhs = Expression(76, Add) -- expression 75 operands: lhs = Counter(12), rhs = Counter(13) -- expression 76 operands: lhs = Counter(14), rhs = Counter(15) +- expression 43 operands: lhs = Expression(54, Add), rhs = Counter(7) +- expression 44 operands: lhs = Counter(5), rhs = Counter(6) +- expression 45 operands: lhs = Counter(8), rhs = Counter(14) +- expression 46 operands: lhs = Counter(8), rhs = Expression(52, Add) +- expression 47 operands: lhs = Counter(14), rhs = Counter(15) +- expression 48 operands: lhs = Expression(52, Add), rhs = Counter(16) +- expression 49 operands: lhs = Counter(14), rhs = Counter(15) +- expression 50 operands: lhs = Counter(8), rhs = Expression(51, Add) +- expression 51 operands: lhs = Expression(52, Add), rhs = Counter(16) +- expression 52 operands: lhs = Counter(14), rhs = Counter(15) +- expression 53 operands: lhs = Expression(54, Add), rhs = Expression(69, Add) +- expression 54 operands: lhs = Counter(5), rhs = Counter(6) +- expression 55 operands: lhs = Counter(7), rhs = Counter(8) +- expression 56 operands: lhs = Counter(9), rhs = Counter(10) +- expression 57 operands: lhs = Counter(7), rhs = Counter(8) +- expression 58 operands: lhs = Expression(69, Add), rhs = Counter(9) +- expression 59 operands: lhs = Counter(7), rhs = Counter(8) +- expression 60 operands: lhs = Counter(10), rhs = Counter(11) +- expression 61 operands: lhs = Counter(10), rhs = Expression(67, Add) +- expression 62 operands: lhs = Counter(11), rhs = Counter(12) +- expression 63 operands: lhs = Expression(67, Add), rhs = Counter(13) +- expression 64 operands: lhs = Counter(11), rhs = Counter(12) +- expression 65 operands: lhs = Counter(10), rhs = Expression(66, Add) +- expression 66 operands: lhs = Expression(67, Add), rhs = Counter(13) +- expression 67 operands: lhs = Counter(11), rhs = Counter(12) +- expression 68 operands: lhs = Expression(69, Add), rhs = Expression(70, Add) +- expression 69 operands: lhs = Counter(7), rhs = Counter(8) +- expression 70 operands: lhs = Counter(9), rhs = Counter(10) Number of file 0 mappings: 68 - Code(Counter(0)) at (prev + 3, 1) to (start + 2, 12) -- Code(Counter(1)) at (prev + 2, 13) to (start + 2, 6) +- Code(Counter(0)) at (prev + 2, 13) to (start + 2, 6) - Code(Zero) at (prev + 2, 5) to (start + 0, 6) - Code(Expression(0, Add)) at (prev + 3, 9) to (start + 0, 10) - = (c2 + c3) + = (c1 + c2) - Code(Counter(0)) at (prev + 0, 16) to (start + 0, 29) -- Code(Counter(2)) at (prev + 1, 9) to (start + 1, 10) +- Code(Counter(1)) at (prev + 1, 9) to (start + 1, 10) - Code(Expression(1, Sub)) at (prev + 2, 15) to (start + 0, 28) - = (c0 - c2) -- Code(Counter(3)) at (prev + 1, 12) to (start + 0, 25) + = (c0 - c1) +- Code(Counter(2)) at (prev + 1, 12) to (start + 0, 25) - Code(Expression(2, Sub)) at (prev + 0, 29) to (start + 0, 42) - = (c3 - c28) + = (c2 - c23) - Code(Expression(3, Sub)) at (prev + 0, 46) to (start + 0, 60) - = (c3 - (c28 + c29)) + = (c2 - (c23 + c24)) - Code(Expression(8, Add)) at (prev + 0, 61) to (start + 2, 10) - = ((c28 + c29) + c30) + = ((c23 + c24) + c25) - Code(Expression(7, Sub)) at (prev + 2, 9) to (start + 0, 10) - = (c3 - ((c28 + c29) + c30)) -- Code(Counter(3)) at (prev + 1, 9) to (start + 1, 18) + = (c2 - ((c23 + c24) + c25)) +- Code(Counter(2)) at (prev + 1, 9) to (start + 1, 18) - Code(Expression(10, Sub)) at (prev + 3, 9) to (start + 0, 15) - = (c0 - (c2 + c3)) + = (c0 - (c1 + c2)) - Code(Expression(0, Add)) at (prev + 3, 9) to (start + 1, 12) - = (c2 + c3) -- Code(Counter(4)) at (prev + 1, 13) to (start + 2, 6) + = (c1 + c2) +- Code(Expression(0, Add)) at (prev + 1, 13) to (start + 2, 6) + = (c1 + c2) - Code(Zero) at (prev + 2, 5) to (start + 0, 6) - Code(Expression(0, Add)) at (prev + 2, 8) to (start + 0, 21) - = (c2 + c3) -- Code(Counter(5)) at (prev + 0, 22) to (start + 2, 6) + = (c1 + c2) +- Code(Counter(3)) at (prev + 0, 22) to (start + 2, 6) - Code(Expression(11, Sub)) at (prev + 2, 15) to (start + 0, 28) - = ((c2 + c3) - c5) -- Code(Counter(6)) at (prev + 1, 12) to (start + 0, 25) + = ((c1 + c2) - c3) +- Code(Counter(4)) at (prev + 1, 12) to (start + 0, 25) - Code(Expression(12, Sub)) at (prev + 0, 29) to (start + 0, 42) - = (c6 - c25) + = (c4 - c20) - Code(Expression(13, Sub)) at (prev + 0, 46) to (start + 0, 60) - = (c6 - (c25 + c26)) + = (c4 - (c20 + c21)) - Code(Expression(18, Add)) at (prev + 0, 61) to (start + 2, 10) - = ((c25 + c26) + c27) + = ((c20 + c21) + c22) - Code(Expression(17, Sub)) at (prev + 2, 9) to (start + 0, 10) - = (c6 - ((c25 + c26) + c27)) -- Code(Counter(6)) at (prev + 1, 9) to (start + 0, 23) + = (c4 - ((c20 + c21) + c22)) +- Code(Counter(4)) at (prev + 1, 9) to (start + 0, 23) - Code(Expression(20, Sub)) at (prev + 2, 9) to (start + 0, 15) - = ((c2 + c3) - (c5 + c6)) -- Code(Expression(59, Add)) at (prev + 3, 8) to (start + 0, 12) - = (c5 + c6) -- Code(Counter(7)) at (prev + 1, 13) to (start + 1, 16) -- Code(Counter(8)) at (prev + 1, 17) to (start + 2, 10) + = ((c1 + c2) - (c3 + c4)) +- Code(Expression(37, Add)) at (prev + 3, 8) to (start + 0, 12) + = (c3 + c4) +- Code(Expression(37, Add)) at (prev + 1, 13) to (start + 1, 16) + = (c3 + c4) +- Code(Expression(37, Add)) at (prev + 1, 17) to (start + 2, 10) + = (c3 + c4) - Code(Zero) at (prev + 2, 9) to (start + 0, 10) -- Code(Counter(7)) at (prev + 2, 12) to (start + 0, 25) -- Code(Counter(9)) at (prev + 0, 26) to (start + 2, 10) -- Code(Expression(23, Sub)) at (prev + 4, 17) to (start + 0, 30) - = (c7 - c9) -- Code(Counter(10)) at (prev + 1, 16) to (start + 0, 29) -- Code(Expression(24, Sub)) at (prev + 0, 33) to (start + 0, 46) - = (c10 - c22) -- Code(Expression(25, Sub)) at (prev + 0, 50) to (start + 0, 64) - = (c10 - (c22 + c23)) -- Code(Expression(30, Add)) at (prev + 0, 65) to (start + 2, 14) - = ((c22 + c23) + c24) -- Code(Expression(29, Sub)) at (prev + 2, 13) to (start + 0, 14) - = (c10 - ((c22 + c23) + c24)) -- Code(Counter(10)) at (prev + 1, 13) to (start + 0, 27) -- Code(Expression(32, Sub)) at (prev + 2, 13) to (start + 0, 19) - = (c7 - (c9 + c10)) +- Code(Expression(37, Add)) at (prev + 2, 12) to (start + 0, 25) + = (c3 + c4) +- Code(Counter(5)) at (prev + 0, 26) to (start + 2, 10) +- Code(Expression(26, Sub)) at (prev + 4, 17) to (start + 0, 30) + = ((c3 + c4) - c5) +- Code(Counter(6)) at (prev + 1, 16) to (start + 0, 29) +- Code(Expression(28, Sub)) at (prev + 0, 33) to (start + 0, 46) + = (c6 - c17) +- Code(Expression(29, Sub)) at (prev + 0, 50) to (start + 0, 64) + = (c6 - (c17 + c18)) +- Code(Expression(34, Add)) at (prev + 0, 65) to (start + 2, 14) + = ((c17 + c18) + c19) +- Code(Expression(33, Sub)) at (prev + 2, 13) to (start + 0, 14) + = (c6 - ((c17 + c18) + c19)) +- Code(Counter(6)) at (prev + 1, 13) to (start + 0, 27) +- Code(Expression(36, Sub)) at (prev + 2, 13) to (start + 0, 19) + = ((c3 + c4) - (c5 + c6)) - Code(Zero) at (prev + 2, 5) to (start + 0, 6) -- Code(Expression(39, Sub)) at (prev + 2, 9) to (start + 1, 12) - = ((((c5 + c6) + c9) + c10) - c7) -- Code(Counter(11)) at (prev + 1, 13) to (start + 2, 6) +- Code(Expression(54, Add)) at (prev + 2, 9) to (start + 1, 12) + = (c5 + c6) +- Code(Expression(54, Add)) at (prev + 1, 13) to (start + 2, 6) + = (c5 + c6) - Code(Zero) at (prev + 2, 5) to (start + 0, 6) -- Code(Expression(75, Add)) at (prev + 2, 9) to (start + 0, 10) - = (c12 + c13) -- Code(Expression(39, Sub)) at (prev + 0, 16) to (start + 0, 29) - = ((((c5 + c6) + c9) + c10) - c7) -- Code(Counter(12)) at (prev + 0, 30) to (start + 2, 6) +- Code(Expression(69, Add)) at (prev + 2, 9) to (start + 0, 10) + = (c7 + c8) +- Code(Expression(54, Add)) at (prev + 0, 16) to (start + 0, 29) + = (c5 + c6) +- Code(Counter(7)) at (prev + 0, 30) to (start + 2, 6) - Code(Expression(43, Sub)) at (prev + 2, 15) to (start + 0, 28) - = ((((c5 + c6) + c9) + c10) - (c7 + c12)) -- Code(Counter(13)) at (prev + 1, 12) to (start + 0, 25) -- Code(Expression(48, Sub)) at (prev + 0, 29) to (start + 0, 42) - = (c13 - c19) -- Code(Expression(49, Sub)) at (prev + 0, 46) to (start + 0, 60) - = (c13 - (c19 + c20)) -- Code(Expression(54, Add)) at (prev + 0, 61) to (start + 2, 10) - = ((c19 + c20) + c21) -- Code(Expression(53, Sub)) at (prev + 2, 9) to (start + 0, 10) - = (c13 - ((c19 + c20) + c21)) -- Code(Counter(13)) at (prev + 1, 9) to (start + 0, 23) -- Code(Expression(56, Sub)) at (prev + 2, 13) to (start + 2, 15) - = ((((c5 + c6) + c9) + c10) - ((c7 + c12) + c13)) -- Code(Expression(76, Add)) at (prev + 5, 9) to (start + 0, 10) - = (c14 + c15) -- Code(Expression(75, Add)) at (prev + 0, 16) to (start + 0, 29) - = (c12 + c13) -- Code(Counter(14)) at (prev + 0, 30) to (start + 2, 6) -- Code(Expression(64, Sub)) at (prev + 2, 15) to (start + 0, 28) - = ((c12 + c13) - c14) -- Code(Counter(15)) at (prev + 1, 12) to (start + 0, 25) -- Code(Expression(66, Sub)) at (prev + 0, 29) to (start + 0, 42) - = (c15 - c16) -- Code(Expression(67, Sub)) at (prev + 0, 46) to (start + 0, 60) - = (c15 - (c16 + c17)) -- Code(Expression(72, Add)) at (prev + 0, 61) to (start + 2, 10) - = ((c16 + c17) + c18) -- Code(Expression(71, Sub)) at (prev + 2, 9) to (start + 0, 10) - = (c15 - ((c16 + c17) + c18)) -- Code(Counter(15)) at (prev + 1, 9) to (start + 0, 23) -- Code(Expression(74, Sub)) at (prev + 2, 9) to (start + 0, 15) - = ((c12 + c13) - (c14 + c15)) + = ((c5 + c6) - c7) +- Code(Counter(8)) at (prev + 1, 12) to (start + 0, 25) +- Code(Expression(45, Sub)) at (prev + 0, 29) to (start + 0, 42) + = (c8 - c14) +- Code(Expression(46, Sub)) at (prev + 0, 46) to (start + 0, 60) + = (c8 - (c14 + c15)) +- Code(Expression(51, Add)) at (prev + 0, 61) to (start + 2, 10) + = ((c14 + c15) + c16) +- Code(Expression(50, Sub)) at (prev + 2, 9) to (start + 0, 10) + = (c8 - ((c14 + c15) + c16)) +- Code(Counter(8)) at (prev + 1, 9) to (start + 0, 23) +- Code(Expression(53, Sub)) at (prev + 2, 13) to (start + 2, 15) + = ((c5 + c6) - (c7 + c8)) +- Code(Expression(70, Add)) at (prev + 5, 9) to (start + 0, 10) + = (c9 + c10) +- Code(Expression(69, Add)) at (prev + 0, 16) to (start + 0, 29) + = (c7 + c8) +- Code(Counter(9)) at (prev + 0, 30) to (start + 2, 6) +- Code(Expression(58, Sub)) at (prev + 2, 15) to (start + 0, 28) + = ((c7 + c8) - c9) +- Code(Counter(10)) at (prev + 1, 12) to (start + 0, 25) +- Code(Expression(60, Sub)) at (prev + 0, 29) to (start + 0, 42) + = (c10 - c11) +- Code(Expression(61, Sub)) at (prev + 0, 46) to (start + 0, 60) + = (c10 - (c11 + c12)) +- Code(Expression(66, Add)) at (prev + 0, 61) to (start + 2, 10) + = ((c11 + c12) + c13) +- Code(Expression(65, Sub)) at (prev + 2, 9) to (start + 0, 10) + = (c10 - ((c11 + c12) + c13)) +- Code(Counter(10)) at (prev + 1, 9) to (start + 0, 23) +- Code(Expression(68, Sub)) at (prev + 2, 9) to (start + 0, 15) + = ((c7 + c8) - (c9 + c10)) - Code(Counter(0)) at (prev + 2, 1) to (start + 0, 2) -Highest counter ID seen: c15 +Highest counter ID seen: c10 diff --git a/tests/coverage/drop_trait.cov-map b/tests/coverage/drop_trait.cov-map index a97c0f8794c43..16facf2eddf26 100644 --- a/tests/coverage/drop_trait.cov-map +++ b/tests/coverage/drop_trait.cov-map @@ -8,14 +8,14 @@ Number of file 0 mappings: 1 Highest counter ID seen: c0 Function name: drop_trait::main -Raw bytes (24): 0x[01, 01, 00, 04, 01, 0e, 01, 05, 0c, 05, 06, 09, 01, 16, 00, 02, 06, 04, 0b, 01, 05, 01, 00, 02] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 0e, 01, 05, 0c, 01, 06, 09, 01, 16, 00, 02, 06, 04, 0b, 01, 05, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 4 - Code(Counter(0)) at (prev + 14, 1) to (start + 5, 12) -- Code(Counter(1)) at (prev + 6, 9) to (start + 1, 22) +- Code(Counter(0)) at (prev + 6, 9) to (start + 1, 22) - Code(Zero) at (prev + 2, 6) to (start + 4, 11) - Code(Counter(0)) at (prev + 5, 1) to (start + 0, 2) -Highest counter ID seen: c1 +Highest counter ID seen: c0 diff --git a/tests/coverage/generics.cov-map b/tests/coverage/generics.cov-map index d082bd54493d7..bc5661afdc194 100644 --- a/tests/coverage/generics.cov-map +++ b/tests/coverage/generics.cov-map @@ -35,14 +35,14 @@ Number of file 0 mappings: 1 Highest counter ID seen: c0 Function name: generics::main -Raw bytes (24): 0x[01, 01, 00, 04, 01, 16, 01, 08, 0c, 05, 09, 09, 01, 16, 00, 02, 06, 04, 0b, 01, 05, 01, 00, 02] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 16, 01, 08, 0c, 01, 09, 09, 01, 16, 00, 02, 06, 04, 0b, 01, 05, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 4 - Code(Counter(0)) at (prev + 22, 1) to (start + 8, 12) -- Code(Counter(1)) at (prev + 9, 9) to (start + 1, 22) +- Code(Counter(0)) at (prev + 9, 9) to (start + 1, 22) - Code(Zero) at (prev + 2, 6) to (start + 4, 11) - Code(Counter(0)) at (prev + 5, 1) to (start + 0, 2) -Highest counter ID seen: c1 +Highest counter ID seen: c0 diff --git a/tests/coverage/loops_branches.cov-map b/tests/coverage/loops_branches.cov-map index 640d5f15be0ee..2cb0f948b3e1d 100644 --- a/tests/coverage/loops_branches.cov-map +++ b/tests/coverage/loops_branches.cov-map @@ -1,36 +1,36 @@ Function name: ::fmt -Raw bytes (112): 0x[01, 01, 04, 07, 0b, 01, 11, 09, 0d, 0d, 11, 14, 01, 09, 05, 01, 10, 05, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 05, 01, 0d, 00, 0e, 05, 01, 0d, 00, 1e, 09, 00, 1e, 00, 1f, 00, 01, 10, 01, 0a, 11, 03, 0d, 00, 0e, 0d, 00, 12, 00, 17, 11, 01, 10, 00, 14, 15, 01, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 15, 01, 11, 00, 12, 15, 01, 11, 00, 22, 02, 00, 22, 00, 23, 00, 01, 14, 01, 0e, 0e, 03, 09, 00, 0f, 01, 01, 05, 00, 06] +Raw bytes (112): 0x[01, 01, 04, 07, 0b, 01, 0d, 05, 09, 09, 0d, 14, 01, 09, 05, 01, 10, 01, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 01, 01, 0d, 00, 0e, 01, 01, 0d, 00, 1e, 05, 00, 1e, 00, 1f, 00, 01, 10, 01, 0a, 0d, 03, 0d, 00, 0e, 09, 00, 12, 00, 17, 0d, 01, 10, 00, 14, 0d, 01, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 0d, 01, 11, 00, 12, 0d, 01, 11, 00, 22, 02, 00, 22, 00, 23, 00, 01, 14, 01, 0e, 0e, 03, 09, 00, 0f, 01, 01, 05, 00, 06] Number of files: 1 - file 0 => global file 1 Number of expressions: 4 - expression 0 operands: lhs = Expression(1, Add), rhs = Expression(2, Add) -- expression 1 operands: lhs = Counter(0), rhs = Counter(4) -- expression 2 operands: lhs = Counter(2), rhs = Counter(3) -- expression 3 operands: lhs = Counter(3), rhs = Counter(4) +- expression 1 operands: lhs = Counter(0), rhs = Counter(3) +- expression 2 operands: lhs = Counter(1), rhs = Counter(2) +- expression 3 operands: lhs = Counter(2), rhs = Counter(3) Number of file 0 mappings: 20 - Code(Counter(0)) at (prev + 9, 5) to (start + 1, 16) -- Code(Counter(1)) at (prev + 2, 16) to (start + 0, 21) +- Code(Counter(0)) at (prev + 2, 16) to (start + 0, 21) - Code(Zero) at (prev + 1, 23) to (start + 0, 27) - Code(Zero) at (prev + 0, 28) to (start + 0, 30) -- Code(Counter(1)) at (prev + 1, 13) to (start + 0, 14) -- Code(Counter(1)) at (prev + 1, 13) to (start + 0, 30) -- Code(Counter(2)) at (prev + 0, 30) to (start + 0, 31) +- Code(Counter(0)) at (prev + 1, 13) to (start + 0, 14) +- Code(Counter(0)) at (prev + 1, 13) to (start + 0, 30) +- Code(Counter(1)) at (prev + 0, 30) to (start + 0, 31) - Code(Zero) at (prev + 1, 16) to (start + 1, 10) -- Code(Counter(4)) at (prev + 3, 13) to (start + 0, 14) -- Code(Counter(3)) at (prev + 0, 18) to (start + 0, 23) -- Code(Counter(4)) at (prev + 1, 16) to (start + 0, 20) -- Code(Counter(5)) at (prev + 1, 20) to (start + 0, 25) +- Code(Counter(3)) at (prev + 3, 13) to (start + 0, 14) +- Code(Counter(2)) at (prev + 0, 18) to (start + 0, 23) +- Code(Counter(3)) at (prev + 1, 16) to (start + 0, 20) +- Code(Counter(3)) at (prev + 1, 20) to (start + 0, 25) - Code(Zero) at (prev + 1, 27) to (start + 0, 31) - Code(Zero) at (prev + 0, 32) to (start + 0, 34) -- Code(Counter(5)) at (prev + 1, 17) to (start + 0, 18) -- Code(Counter(5)) at (prev + 1, 17) to (start + 0, 34) +- Code(Counter(3)) at (prev + 1, 17) to (start + 0, 18) +- Code(Counter(3)) at (prev + 1, 17) to (start + 0, 34) - Code(Expression(0, Sub)) at (prev + 0, 34) to (start + 0, 35) - = ((c0 + c4) - (c2 + c3)) + = ((c0 + c3) - (c1 + c2)) - Code(Zero) at (prev + 1, 20) to (start + 1, 14) - Code(Expression(3, Sub)) at (prev + 3, 9) to (start + 0, 15) - = (c3 - c4) + = (c2 - c3) - Code(Counter(0)) at (prev + 1, 5) to (start + 0, 6) -Highest counter ID seen: c5 +Highest counter ID seen: c3 Function name: ::fmt Raw bytes (112): 0x[01, 01, 04, 07, 0b, 01, 09, 05, 0d, 05, 09, 14, 01, 22, 05, 01, 11, 00, 01, 12, 01, 0a, 01, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 01, 01, 0d, 00, 0e, 01, 01, 0d, 00, 1e, 0d, 00, 1e, 00, 1f, 09, 02, 0d, 00, 0e, 05, 00, 12, 00, 17, 09, 01, 10, 00, 15, 00, 00, 16, 01, 0e, 09, 02, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 09, 01, 11, 00, 12, 09, 01, 11, 00, 22, 02, 00, 22, 00, 23, 0e, 03, 09, 00, 0f, 01, 01, 05, 00, 06] diff --git a/tests/coverage/try_error_result.cov-map b/tests/coverage/try_error_result.cov-map index 03012f744c18c..35b2c36a57519 100644 --- a/tests/coverage/try_error_result.cov-map +++ b/tests/coverage/try_error_result.cov-map @@ -55,27 +55,31 @@ Number of file 0 mappings: 4 Highest counter ID seen: c1 Function name: try_error_result::test1 -Raw bytes (63): 0x[01, 01, 02, 09, 0d, 05, 09, 0b, 01, 0d, 01, 02, 17, 05, 07, 09, 00, 0e, 09, 02, 09, 04, 1a, 0d, 06, 0d, 00, 29, 11, 00, 29, 00, 2a, 00, 01, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 02, 04, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 06, 03, 05, 00, 0b, 01, 01, 01, 00, 02] +Raw bytes (67): 0x[01, 01, 04, 07, 05, 01, 09, 05, 01, 05, 09, 0b, 01, 0d, 01, 02, 17, 05, 07, 09, 00, 0e, 09, 02, 09, 04, 1a, 02, 06, 0d, 00, 29, 02, 00, 29, 00, 2a, 00, 01, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 0a, 04, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 0e, 03, 05, 00, 0b, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 2 -- expression 0 operands: lhs = Counter(2), rhs = Counter(3) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) +Number of expressions: 4 +- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(1) +- expression 1 operands: lhs = Counter(0), rhs = Counter(2) +- expression 2 operands: lhs = Counter(1), rhs = Counter(0) +- expression 3 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 11 - Code(Counter(0)) at (prev + 13, 1) to (start + 2, 23) - Code(Counter(1)) at (prev + 7, 9) to (start + 0, 14) - Code(Counter(2)) at (prev + 2, 9) to (start + 4, 26) -- Code(Counter(3)) at (prev + 6, 13) to (start + 0, 41) -- Code(Counter(4)) at (prev + 0, 41) to (start + 0, 42) +- Code(Expression(0, Sub)) at (prev + 6, 13) to (start + 0, 41) + = ((c0 + c2) - c1) +- Code(Expression(0, Sub)) at (prev + 0, 41) to (start + 0, 42) + = ((c0 + c2) - c1) - Code(Zero) at (prev + 1, 13) to (start + 0, 42) - Code(Zero) at (prev + 0, 42) to (start + 0, 43) -- Code(Expression(0, Sub)) at (prev + 4, 13) to (start + 0, 42) - = (c2 - c3) +- Code(Expression(2, Sub)) at (prev + 4, 13) to (start + 0, 42) + = (c1 - c0) - Code(Zero) at (prev + 0, 42) to (start + 0, 43) -- Code(Expression(1, Sub)) at (prev + 3, 5) to (start + 0, 11) +- Code(Expression(3, Sub)) at (prev + 3, 5) to (start + 0, 11) = (c1 - c2) - Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c4 +Highest counter ID seen: c2 Function name: try_error_result::test2 Raw bytes (336): 0x[01, 01, 36, 0d, 11, 0d, 3f, 11, 15, 0d, 37, 3b, 1d, 3f, 19, 11, 15, 0d, 3f, 11, 15, 0d, 3b, 3f, 19, 11, 15, 0d, 37, 3b, 1d, 3f, 19, 11, 15, 41, 53, 21, 25, 41, 21, 41, 53, 21, 25, 09, 73, 77, 2d, 0d, 29, 09, 0d, 09, 77, 0d, 29, 09, 73, 77, 2d, 0d, 29, 45, 8b, 01, 31, 35, 45, 31, 45, 8b, 01, 31, 35, 49, 9f, 01, 39, 3d, 49, 39, 49, 9f, 01, 39, 3d, 05, 09, ab, 01, 09, af, 01, 3d, b3, 01, 39, b7, 01, 35, bb, 01, 31, bf, 01, 2d, c3, 01, 29, c7, 01, 25, cb, 01, 21, cf, 01, 1d, d3, 01, 19, d7, 01, 15, 05, 11, 28, 01, 3d, 01, 03, 17, 05, 08, 09, 00, 0e, 09, 02, 09, 04, 1a, 0d, 06, 0d, 00, 2f, 11, 00, 2f, 00, 30, 02, 00, 31, 03, 35, 15, 04, 11, 00, 12, 1e, 02, 11, 04, 12, 32, 05, 11, 00, 14, 1e, 00, 17, 00, 41, 19, 00, 41, 00, 42, 26, 00, 43, 00, 5f, 1d, 00, 5f, 00, 60, 32, 01, 0d, 00, 20, 4e, 01, 11, 00, 14, 41, 00, 17, 00, 41, 21, 00, 41, 00, 42, 4a, 00, 43, 00, 60, 25, 00, 60, 00, 61, 4e, 01, 0d, 00, 20, 6e, 04, 11, 00, 14, 62, 00, 17, 00, 42, 29, 00, 42, 00, 43, 66, 00, 44, 00, 61, 2d, 00, 61, 00, 62, 6e, 01, 0d, 00, 20, 86, 01, 01, 11, 00, 14, 45, 00, 17, 01, 36, 31, 01, 36, 00, 37, 82, 01, 01, 12, 00, 2f, 35, 00, 2f, 00, 30, 86, 01, 01, 0d, 00, 20, 9a, 01, 01, 11, 00, 14, 49, 00, 17, 01, 36, 39, 02, 11, 00, 12, 96, 01, 01, 12, 00, 2f, 3d, 01, 11, 00, 12, 9a, 01, 02, 0d, 00, 20, a2, 01, 03, 05, 00, 0b, a6, 01, 01, 01, 00, 02] diff --git a/tests/coverage/while.cov-map b/tests/coverage/while.cov-map index d42aa8a7b847d..5a6698128cbd3 100644 --- a/tests/coverage/while.cov-map +++ b/tests/coverage/while.cov-map @@ -1,12 +1,12 @@ Function name: while::main -Raw bytes (24): 0x[01, 01, 00, 04, 01, 01, 01, 01, 10, 05, 02, 0b, 00, 14, 00, 00, 15, 02, 06, 01, 03, 01, 00, 02] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 01, 01, 01, 10, 01, 02, 0b, 00, 14, 00, 00, 15, 02, 06, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 4 - Code(Counter(0)) at (prev + 1, 1) to (start + 1, 16) -- Code(Counter(1)) at (prev + 2, 11) to (start + 0, 20) +- Code(Counter(0)) at (prev + 2, 11) to (start + 0, 20) - Code(Zero) at (prev + 0, 21) to (start + 2, 6) - Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) -Highest counter ID seen: c1 +Highest counter ID seen: c0 From 9940da08c90c4a0b57250141e7c1d3d6e5a6e592 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Thu, 13 Feb 2025 02:54:07 +0000 Subject: [PATCH 06/19] Use underline suggestions for purely 'additive' replacements --- compiler/rustc_errors/src/emitter.rs | 3 +- compiler/rustc_errors/src/lib.rs | 11 ++++ .../defaults-suitability.current.stderr | 5 +- .../defaults-suitability.next.stderr | 5 +- tests/ui/associated-types/issue-38821.stderr | 10 ++-- .../issue-54108.current.stderr | 5 +- .../associated-types/issue-54108.next.stderr | 5 +- tests/ui/attributes/rustc_confusables.stderr | 5 +- .../rustc_confusables_std_cases.stderr | 10 ++-- .../issue-115259-suggest-iter-mut.stderr | 5 +- .../issue-62387-suggest-iter-mut-2.stderr | 5 +- .../issue-62387-suggest-iter-mut.stderr | 10 ++-- tests/ui/c-variadic/issue-86053-1.stderr | 5 +- tests/ui/cfg/cfg-method-receiver.stderr | 5 +- tests/ui/check-cfg/diagnotics.cargo.stderr | 5 +- tests/ui/check-cfg/diagnotics.rustc.stderr | 5 +- .../2229_closure_analysis/bad-pattern.stderr | 5 +- tests/ui/closures/issue-78720.stderr | 5 +- tests/ui/compare-method/bad-self-type.stderr | 5 +- .../ensure_is_evaluatable.stderr | 5 +- .../fn_with_two_const_inputs.stderr | 5 +- .../abstract-const-as-cast-3.stderr | 20 +++----- .../doesnt_unify_evaluatable.stderr | 5 +- .../const_kind_expr/issue_114151.stderr | 5 +- .../const_kind_expr/wf_obligation.stderr | 5 +- ...e-a-closure-or-coroutine-ice-113776.stderr | 5 +- .../consts/const-pattern-irrefutable.stderr | 15 +++--- .../dont-suggest-hygienic-fields.stderr | 5 +- .../dropck/explicit-drop-bounds.bad1.stderr | 10 ++-- .../issue-90528-unsizing-suggestion-3.stderr | 5 +- .../ui/empty/empty-struct-braces-expr.stderr | 10 ++-- tests/ui/empty/empty-struct-tuple-pat.stderr | 5 +- tests/ui/extern/not-in-block.stderr | 10 ++-- .../no-inline-literals-out-of-range.stderr | 5 +- .../no-method-suggested-traits.stderr | 30 +++++------ tests/ui/imports/glob-resolve1.stderr | 5 +- .../ui/imports/issue-45829/import-self.stderr | 5 +- tests/ui/issues/issue-32004.stderr | 5 +- .../ui/issues/issue-41652/issue-41652.stderr | 5 +- tests/ui/issues/issue-51874.stderr | 5 +- tests/ui/issues/issue-5358-1.stderr | 5 +- tests/ui/issues/issue-56175.stderr | 5 +- .../issue-119696-err-on-fn.stderr | 5 +- .../issue-119697-extra-let.stderr | 5 +- .../let_underscore/let_underscore_drop.stderr | 5 +- .../let_underscore/let_underscore_lock.stderr | 20 +++----- tests/ui/lint/static-mut-refs.e2021.stderr | 30 +++++------ tests/ui/lint/static-mut-refs.e2024.stderr | 30 +++++------ tests/ui/lint/type-overflow.stderr | 10 ++-- ...ue-67691-unused-field-in-or-pattern.stderr | 10 ++-- tests/ui/lint/wide_pointer_comparisons.stderr | 5 +- .../macros/expr_2021_cargo_fix_edition.stderr | 10 ++-- .../macro-backtrace-invalid-internals.stderr | 10 ++-- tests/ui/methods/issues/issue-90315.stderr | 5 +- .../method-on-ambiguous-numeric-type.stderr | 5 +- tests/ui/mir/issue-112269.stderr | 10 ++-- ...use_of_moved_value_copy_suggestions.stderr | 5 +- .../projection-no-regions-closure.stderr | 10 ++-- .../projection-no-regions-fn.stderr | 10 ++-- .../char/whitespace-character-literal.stderr | 5 +- tests/ui/parser/extern-no-fn.stderr | 5 +- .../issues/issue-87086-colon-path-sep.stderr | 30 +++++------ .../ui/parser/missing-fn-issue-65381-2.stderr | 5 +- .../parser/misspelled-keywords/const.stderr | 5 +- .../turbofish-arg-with-stray-colon.stderr | 5 +- tests/ui/parser/use-colon-as-mod-sep.stderr | 20 +++----- .../pat-tuple-field-count-cross.stderr | 5 +- tests/ui/pattern/pat-tuple-overfield.stderr | 5 +- .../patkind-ref-binding-issue-114896.stderr | 5 +- .../patkind-ref-binding-issue-122415.stderr | 5 +- tests/ui/privacy/privacy5.stderr | 50 ++++++++----------- tests/ui/pub/pub-ident-fn-or-struct.stderr | 5 +- tests/ui/resolve/issue-39226.stderr | 5 +- tests/ui/resolve/issue-55673.stderr | 5 +- tests/ui/resolve/issue-73427.stderr | 35 ++++++------- tests/ui/resolve/privacy-enum-ctor.stderr | 5 +- ...t.import_trait_associated_functions.stderr | 5 +- ...lve-issue-135614-assoc-const.normal.stderr | 5 +- ...e-with-name-similar-to-struct-field.stderr | 5 +- .../typo-suggestion-mistyped-in-path.stderr | 5 +- ...lity-attribute-implies-using-stable.stderr | 5 +- ...ty-attribute-implies-using-unstable.stderr | 5 +- ...lity-attribute-implies-using-stable.stderr | 5 +- ...ty-attribute-implies-using-unstable.stderr | 5 +- tests/ui/statics/issue-15261.stderr | 5 +- .../statics/static-mut-shared-parens.stderr | 5 +- tests/ui/statics/static-mut-xc.stderr | 5 +- tests/ui/statics/static-recursive.stderr | 5 +- .../struct-fields-hints-no-dupe.stderr | 5 +- tests/ui/suggestions/bound-suggestions.stderr | 5 +- ...const-pat-non-exaustive-let-new-var.stderr | 5 +- .../suggestions/crate-or-module-typo.stderr | 10 ++-- ...atible-trait-should-use-where-sized.stderr | 5 +- tests/ui/suggestions/field-access.stderr | 15 +++--- .../imm-ref-trait-object-literal.stderr | 5 +- .../impl-trait-missing-lifetime-gated.stderr | 20 +++----- ...-turbofish-surrounding-angle-braket.stderr | 5 +- ...t-field-type-including-single-colon.stderr | 10 ++-- .../ui/suggestions/suggest-change-mut.stderr | 5 +- tests/ui/suggestions/suggest-methods.stderr | 5 +- tests/ui/suggestions/suggest-variants.stderr | 10 ++-- .../type-ascription-instead-of-path-2.stderr | 5 +- ...-ascription-instead-of-path-in-type.stderr | 5 +- .../type-match-with-late-bound.stderr | 15 +++--- tests/ui/transmutability/assoc-bound.stderr | 5 +- tests/ui/typeck/issue-29181.stderr | 5 +- tests/ui/typeck/method-chain-gats.stderr | 5 +- 107 files changed, 361 insertions(+), 523 deletions(-) diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 4824dc098ada2..7d58e6f29da7c 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -1982,7 +1982,8 @@ impl HumanEmitter { { debug!(?complete, ?parts, ?highlights); - let has_deletion = parts.iter().any(|p| p.is_deletion(sm) || p.is_replacement(sm)); + let has_deletion = + parts.iter().any(|p| p.is_deletion(sm) || p.is_destructive_replacement(sm)); let is_multiline = complete.lines().count() > 1; if i == 0 { diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 9af17db9a6e6c..4a186565a7bfc 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -230,6 +230,17 @@ impl SubstitutionPart { !self.snippet.is_empty() && self.replaces_meaningful_content(sm) } + /// Whether this is a replacement that overwrites source with a snippet + /// in a way that isn't a superset of the original string. For example, + /// replacing "abc" with "abcde" is not destructive, but replacing it + /// it with "abx" is, since the "c" character is lost. + pub fn is_destructive_replacement(&self, sm: &SourceMap) -> bool { + self.is_replacement(sm) + && !sm + .span_to_snippet(self.span) + .is_ok_and(|snippet| self.snippet.trim_start().starts_with(snippet.trim_start())) + } + fn replaces_meaningful_content(&self, sm: &SourceMap) -> bool { sm.span_to_snippet(self.span) .map_or(!self.span.is_empty(), |snippet| !snippet.trim().is_empty()) diff --git a/tests/ui/associated-types/defaults-suitability.current.stderr b/tests/ui/associated-types/defaults-suitability.current.stderr index b9ea541e98119..61247cee1f34d 100644 --- a/tests/ui/associated-types/defaults-suitability.current.stderr +++ b/tests/ui/associated-types/defaults-suitability.current.stderr @@ -134,9 +134,8 @@ LL | type Baz = T; | --- required by a bound in this associated type help: consider further restricting type parameter `T` with trait `Clone` | -LL - Self::Baz: Clone, -LL + Self::Baz: Clone, T: std::clone::Clone - | +LL | Self::Baz: Clone, T: std::clone::Clone + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/tests/ui/associated-types/defaults-suitability.next.stderr b/tests/ui/associated-types/defaults-suitability.next.stderr index b9ea541e98119..61247cee1f34d 100644 --- a/tests/ui/associated-types/defaults-suitability.next.stderr +++ b/tests/ui/associated-types/defaults-suitability.next.stderr @@ -134,9 +134,8 @@ LL | type Baz = T; | --- required by a bound in this associated type help: consider further restricting type parameter `T` with trait `Clone` | -LL - Self::Baz: Clone, -LL + Self::Baz: Clone, T: std::clone::Clone - | +LL | Self::Baz: Clone, T: std::clone::Clone + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/tests/ui/associated-types/issue-38821.stderr b/tests/ui/associated-types/issue-38821.stderr index b29e9cc16e294..58f019704e7a7 100644 --- a/tests/ui/associated-types/issue-38821.stderr +++ b/tests/ui/associated-types/issue-38821.stderr @@ -13,9 +13,8 @@ LL | impl IntoNullable for T { | unsatisfied trait bound introduced here help: consider extending the `where` clause, but there might be an alternative better way to express this requirement | -LL - Expr: Expression::Nullable>, -LL + Expr: Expression::Nullable>, ::SqlType: NotNull - | +LL | Expr: Expression::Nullable>, ::SqlType: NotNull + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied --> $DIR/issue-38821.rs:40:1 @@ -38,9 +37,8 @@ LL | impl IntoNullable for T { | unsatisfied trait bound introduced here help: consider extending the `where` clause, but there might be an alternative better way to express this requirement | -LL - Expr: Expression::Nullable>, -LL + Expr: Expression::Nullable>, ::SqlType: NotNull - | +LL | Expr: Expression::Nullable>, ::SqlType: NotNull + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied --> $DIR/issue-38821.rs:23:10 diff --git a/tests/ui/associated-types/issue-54108.current.stderr b/tests/ui/associated-types/issue-54108.current.stderr index 1b2285b214fe1..8850b4548e33a 100644 --- a/tests/ui/associated-types/issue-54108.current.stderr +++ b/tests/ui/associated-types/issue-54108.current.stderr @@ -12,9 +12,8 @@ LL | type Size: Add; | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Encoder::Size` help: consider further restricting the associated type | -LL - T: SubEncoder, -LL + T: SubEncoder, ::ActualSize: Add - | +LL | T: SubEncoder, ::ActualSize: Add + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/associated-types/issue-54108.next.stderr b/tests/ui/associated-types/issue-54108.next.stderr index cc80ab63901e3..5e2fa551afe30 100644 --- a/tests/ui/associated-types/issue-54108.next.stderr +++ b/tests/ui/associated-types/issue-54108.next.stderr @@ -12,9 +12,8 @@ LL | type Size: Add; | ^^^^^^^^^^^^^^^^^^^ required by this bound in `Encoder::Size` help: consider further restricting the associated type | -LL - T: SubEncoder, -LL + T: SubEncoder, ::ActualSize: Add - | +LL | T: SubEncoder, ::ActualSize: Add + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/attributes/rustc_confusables.stderr b/tests/ui/attributes/rustc_confusables.stderr index f475e9c494e0e..9ba1e3270573f 100644 --- a/tests/ui/attributes/rustc_confusables.stderr +++ b/tests/ui/attributes/rustc_confusables.stderr @@ -35,9 +35,8 @@ LL | x.inser(); | help: there is a method `insert` with a similar name | -LL - x.inser(); -LL + x.insert(); - | +LL | x.insert(); + | ~~~~~~ error[E0599]: no method named `foo` found for struct `rustc_confusables_across_crate::BTreeSet` in the current scope --> $DIR/rustc_confusables.rs:15:7 diff --git a/tests/ui/attributes/rustc_confusables_std_cases.stderr b/tests/ui/attributes/rustc_confusables_std_cases.stderr index b9acf2d31abe2..7108887043b2c 100644 --- a/tests/ui/attributes/rustc_confusables_std_cases.stderr +++ b/tests/ui/attributes/rustc_confusables_std_cases.stderr @@ -38,9 +38,8 @@ LL | let mut x = VecDeque::new(); | ----- earlier `x` shadowed here with type `VecDeque` help: you might have meant to use `push_back` | -LL - x.push(1); -LL + x.push_back(1); - | +LL | x.push_back(1); + | ~~~~~~~~~ error[E0599]: no method named `length` found for struct `Vec<{integer}>` in the current scope --> $DIR/rustc_confusables_std_cases.rs:15:7 @@ -98,9 +97,8 @@ note: method defined here --> $SRC_DIR/alloc/src/string.rs:LL:COL help: you might have meant to use `push_str` | -LL - String::new().push(""); -LL + String::new().push_str(""); - | +LL | String::new().push_str(""); + | ~~~~~~~~ error[E0599]: no method named `append` found for struct `String` in the current scope --> $DIR/rustc_confusables_std_cases.rs:24:19 diff --git a/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr index 53b833e7c9194..40ab2e61d6a42 100644 --- a/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr +++ b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr @@ -8,9 +8,8 @@ LL | self.layers.iter().fold(0, |result, mut layer| result + layer.proce | help: you may want to use `iter_mut` here | -LL - self.layers.iter().fold(0, |result, mut layer| result + layer.process()) -LL + self.layers.iter_mut().fold(0, |result, mut layer| result + layer.process()) - | +LL | self.layers.iter_mut().fold(0, |result, mut layer| result + layer.process()) + | ~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr index 86d53012cf357..466f19eb0ab95 100644 --- a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr +++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr @@ -8,9 +8,8 @@ LL | vec.iter().flat_map(|container| container.things()).cloned().co | help: you may want to use `iter_mut` here | -LL - vec.iter().flat_map(|container| container.things()).cloned().collect::>(); -LL + vec.iter_mut().flat_map(|container| container.things()).cloned().collect::>(); - | +LL | vec.iter_mut().flat_map(|container| container.things()).cloned().collect::>(); + | ~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr b/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr index f0a17d76a6787..fd58e43302025 100644 --- a/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr +++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr @@ -8,9 +8,8 @@ LL | v.iter().for_each(|a| a.double()); | help: you may want to use `iter_mut` here | -LL - v.iter().for_each(|a| a.double()); -LL + v.iter_mut().for_each(|a| a.double()); - | +LL | v.iter_mut().for_each(|a| a.double()); + | ~~~~~~~~ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference --> $DIR/issue-62387-suggest-iter-mut.rs:25:39 @@ -22,9 +21,8 @@ LL | v.iter().rev().rev().for_each(|a| a.double()); | help: you may want to use `iter_mut` here | -LL - v.iter().rev().rev().for_each(|a| a.double()); -LL + v.iter_mut().rev().rev().for_each(|a| a.double()); - | +LL | v.iter_mut().rev().rev().for_each(|a| a.double()); + | ~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/c-variadic/issue-86053-1.stderr b/tests/ui/c-variadic/issue-86053-1.stderr index 4ad3b73fd661a..67a619e46d57d 100644 --- a/tests/ui/c-variadic/issue-86053-1.stderr +++ b/tests/ui/c-variadic/issue-86053-1.stderr @@ -63,9 +63,8 @@ LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize | help: a trait with a similar name exists | -LL - self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { -LL + self , ... , self , self , ... ) where Fn : FnOnce ( & 'a & 'b usize ) { - | +LL | self , ... , self , self , ... ) where Fn : FnOnce ( & 'a & 'b usize ) { + | ~~ help: you might be missing a type parameter | LL | fn ordering4 < 'a , 'b, F > ( a : , self , self , self , diff --git a/tests/ui/cfg/cfg-method-receiver.stderr b/tests/ui/cfg/cfg-method-receiver.stderr index 639413b90faa3..5767a7c1b4b1c 100644 --- a/tests/ui/cfg/cfg-method-receiver.stderr +++ b/tests/ui/cfg/cfg-method-receiver.stderr @@ -16,9 +16,8 @@ LL | cbor_map! { #[cfg(test)] 4}; = note: this error originates in the macro `cbor_map` (in Nightly builds, run with -Z macro-backtrace for more info) help: you must specify a concrete type for this numeric value, like `i32` | -LL - cbor_map! { #[cfg(test)] 4}; -LL + cbor_map! { #[cfg(test)] 4_i32}; - | +LL | cbor_map! { #[cfg(test)] 4_i32}; + | ~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/check-cfg/diagnotics.cargo.stderr b/tests/ui/check-cfg/diagnotics.cargo.stderr index ab7111eca24ce..a75a45b7d3727 100644 --- a/tests/ui/check-cfg/diagnotics.cargo.stderr +++ b/tests/ui/check-cfg/diagnotics.cargo.stderr @@ -17,9 +17,8 @@ LL | #[cfg(featur = "foo")] = note: see for more information about checking conditional configuration help: there is a config with a similar name and value | -LL - #[cfg(featur = "foo")] -LL + #[cfg(feature = "foo")] - | +LL | #[cfg(feature = "foo")] + | ~~~~~~~ warning: unexpected `cfg` condition name: `featur` --> $DIR/diagnotics.rs:17:7 diff --git a/tests/ui/check-cfg/diagnotics.rustc.stderr b/tests/ui/check-cfg/diagnotics.rustc.stderr index 4aae1f00e7067..df549b31364a3 100644 --- a/tests/ui/check-cfg/diagnotics.rustc.stderr +++ b/tests/ui/check-cfg/diagnotics.rustc.stderr @@ -19,9 +19,8 @@ LL | #[cfg(featur = "foo")] = note: see for more information about checking conditional configuration help: there is a config with a similar name and value | -LL - #[cfg(featur = "foo")] -LL + #[cfg(feature = "foo")] - | +LL | #[cfg(feature = "foo")] + | ~~~~~~~ warning: unexpected `cfg` condition name: `featur` --> $DIR/diagnotics.rs:17:7 diff --git a/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr b/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr index f5cbecc5704c6..b5ad8eb790f2b 100644 --- a/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr +++ b/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr @@ -108,9 +108,8 @@ LL | let PAT = v1; = note: the matched value is of type `u32` help: introduce a variable instead | -LL - let PAT = v1; -LL + let PAT_var = v1; - | +LL | let PAT_var = v1; + | ~~~~~~~ error: aborting due to 7 previous errors diff --git a/tests/ui/closures/issue-78720.stderr b/tests/ui/closures/issue-78720.stderr index acce1dc191a2b..5d65c87b0fd61 100644 --- a/tests/ui/closures/issue-78720.stderr +++ b/tests/ui/closures/issue-78720.stderr @@ -15,9 +15,8 @@ LL | _func: F, | help: a trait with a similar name exists | -LL - _func: F, -LL + _func: Fn, - | +LL | _func: Fn, + | ~~ help: you might be missing a type parameter | LL | struct Map2 { diff --git a/tests/ui/compare-method/bad-self-type.stderr b/tests/ui/compare-method/bad-self-type.stderr index f662b5a11cb39..0a05b0a83af4f 100644 --- a/tests/ui/compare-method/bad-self-type.stderr +++ b/tests/ui/compare-method/bad-self-type.stderr @@ -8,9 +8,8 @@ LL | fn poll(self, _: &mut Context<'_>) -> Poll<()> { found signature `fn(MyFuture, &mut Context<'_>) -> Poll<_>` help: change the self-receiver type to match the trait | -LL - fn poll(self, _: &mut Context<'_>) -> Poll<()> { -LL + fn poll(self: Pin<&mut MyFuture>, _: &mut Context<'_>) -> Poll<()> { - | +LL | fn poll(self: Pin<&mut MyFuture>, _: &mut Context<'_>) -> Poll<()> { + | ~~~~~~~~~~~~~~~~~~~~~~~~ error[E0053]: method `foo` has an incompatible type for trait --> $DIR/bad-self-type.rs:22:18 diff --git a/tests/ui/const-generics/ensure_is_evaluatable.stderr b/tests/ui/const-generics/ensure_is_evaluatable.stderr index 397902846ecb0..62f8bc34f2edd 100644 --- a/tests/ui/const-generics/ensure_is_evaluatable.stderr +++ b/tests/ui/const-generics/ensure_is_evaluatable.stderr @@ -14,9 +14,8 @@ LL | [(); N + 1]:, | ^^^^^ required by this bound in `bar` help: try adding a `where` bound | -LL - [(); M + 1]:, -LL + [(); M + 1]:, [(); N + 1]: - | +LL | [(); M + 1]:, [(); N + 1]: + | ~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/fn_with_two_const_inputs.stderr b/tests/ui/const-generics/fn_with_two_const_inputs.stderr index 147a2c91fd075..c0a913a21fd2d 100644 --- a/tests/ui/const-generics/fn_with_two_const_inputs.stderr +++ b/tests/ui/const-generics/fn_with_two_const_inputs.stderr @@ -14,9 +14,8 @@ LL | [(); N + 1]:, | ^^^^^ required by this bound in `bar` help: try adding a `where` bound | -LL - [(); both(N + 1, M + 1)]:, -LL + [(); both(N + 1, M + 1)]:, [(); N + 1]: - | +LL | [(); both(N + 1, M + 1)]:, [(); N + 1]: + | ~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr b/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr index 9cb71ad8a0966..3622ef16a9608 100644 --- a/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr +++ b/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr @@ -16,9 +16,8 @@ LL | fn assert_impl() {} | ^^^^^ required by this bound in `assert_impl` help: try adding a `where` bound | -LL - EvaluatableU128<{N as u128}>:, { -LL + EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { - | +LL | EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:17:5 @@ -52,9 +51,8 @@ LL | fn assert_impl() {} | ^^^^^ required by this bound in `assert_impl` help: try adding a `where` bound | -LL - EvaluatableU128<{N as u128}>:, { -LL + EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { - | +LL | EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:20:5 @@ -116,9 +114,8 @@ LL | fn assert_impl() {} | ^^^^^ required by this bound in `assert_impl` help: try adding a `where` bound | -LL - EvaluatableU128<{N as _}>:, { -LL + EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { - | +LL | EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:35:5 @@ -152,9 +149,8 @@ LL | fn assert_impl() {} | ^^^^^ required by this bound in `assert_impl` help: try adding a `where` bound | -LL - EvaluatableU128<{N as _}>:, { -LL + EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { - | +LL | EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:38:5 diff --git a/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr b/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr index b43ce5eca4359..f3a38fcc00544 100644 --- a/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr +++ b/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr @@ -6,9 +6,8 @@ LL | bar::<{ T::ASSOC }>(); | help: try adding a `where` bound | -LL - fn foo() where [(); U::ASSOC]:, { -LL + fn foo() where [(); U::ASSOC]:, [(); { T::ASSOC }]: { - | +LL | fn foo() where [(); U::ASSOC]:, [(); { T::ASSOC }]: { + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr index 86e35e17a0771..4d1fb02b59e91 100644 --- a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr @@ -26,9 +26,8 @@ LL | foo::<_, L>([(); L + 1 + L]); | help: try adding a `where` bound | -LL - [(); (L - 1) + 1 + L]:, -LL + [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: - | +LL | [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: + | ~~~~~~~~~~~~~~~~~~ error: unconstrained generic constant --> $DIR/issue_114151.rs:17:17 diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr index c63a79e64ed94..99eab935a094c 100644 --- a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr @@ -15,9 +15,8 @@ LL | foo::<_, L>([(); L + 1 + L]); | help: try adding a `where` bound | -LL - [(); (L - 1) + 1 + L]:, -LL + [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: - | +LL | [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: + | ~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr index c63beeac367b0..86fbca585057a 100644 --- a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr +++ b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr @@ -9,9 +9,8 @@ LL | let f: F = async { 1 }; | help: a trait with a similar name exists | -LL - let f: F = async { 1 }; -LL + let f: Fn = async { 1 }; - | +LL | let f: Fn = async { 1 }; + | ~~ help: you might be missing a type parameter | LL | fn f( diff --git a/tests/ui/consts/const-pattern-irrefutable.stderr b/tests/ui/consts/const-pattern-irrefutable.stderr index a97e35e385fa5..4fa8caa57ce6e 100644 --- a/tests/ui/consts/const-pattern-irrefutable.stderr +++ b/tests/ui/consts/const-pattern-irrefutable.stderr @@ -12,9 +12,8 @@ LL | let a = 4; = note: the matched value is of type `u8` help: introduce a variable instead | -LL - let a = 4; -LL + let a_var = 4; - | +LL | let a_var = 4; + | ~~~~~ error[E0005]: refutable pattern in local binding --> $DIR/const-pattern-irrefutable.rs:28:9 @@ -48,9 +47,8 @@ LL | let d = (4, 4); = note: the matched value is of type `(u8, u8)` help: introduce a variable instead | -LL - let d = (4, 4); -LL + let d_var = (4, 4); - | +LL | let d_var = (4, 4); + | ~~~~~ error[E0005]: refutable pattern in local binding --> $DIR/const-pattern-irrefutable.rs:36:9 @@ -71,9 +69,8 @@ LL | struct S { = note: the matched value is of type `S` help: introduce a variable instead | -LL - let e = S { -LL + let e_var = S { - | +LL | let e_var = S { + | ~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr index 72b65006a3fb5..473c9a339fc25 100644 --- a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr +++ b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr @@ -10,9 +10,8 @@ LL | const CRATE: Crate = Crate { fiel: () }; = note: this error originates in the macro `environment` (in Nightly builds, run with -Z macro-backtrace for more info) help: a field with a similar name exists | -LL - const CRATE: Crate = Crate { fiel: () }; -LL + const CRATE: Crate = Crate { field: () }; - | +LL | const CRATE: Crate = Crate { field: () }; + | ~~~~~ error[E0609]: no field `field` on type `Compound` --> $DIR/dont-suggest-hygienic-fields.rs:24:16 diff --git a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr index 650244ac02a9e..2caa779ffabac 100644 --- a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr +++ b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr @@ -11,9 +11,8 @@ LL | struct DropMe(T); | ^^^^ required by this bound in `DropMe` help: consider further restricting type parameter `T` with trait `Copy` | -LL - [T; 1]: Copy, // But `[T; 1]: Copy` does not imply `T: Copy` -LL + [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` - | +LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` + | ~~~~~~~~~~~~~~~~~~~~~~ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/explicit-drop-bounds.rs:32:18 @@ -28,9 +27,8 @@ LL | struct DropMe(T); | ^^^^ required by this bound in `DropMe` help: consider further restricting type parameter `T` with trait `Copy` | -LL - [T; 1]: Copy, // But `[T; 1]: Copy` does not imply `T: Copy` -LL + [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` - | +LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr b/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr index c54cc858129c3..774d5ba3c892c 100644 --- a/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr +++ b/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr @@ -67,9 +67,8 @@ LL | fn wants_write(_: impl Write) {} | ^^^^^ required by this bound in `wants_write` help: consider changing this borrow's mutability | -LL - wants_write(&[0u8][..]); -LL + wants_write(&mut [0u8][..]); - | +LL | wants_write(&mut [0u8][..]); + | ~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/empty/empty-struct-braces-expr.stderr b/tests/ui/empty/empty-struct-braces-expr.stderr index 3411702a12dfb..140b6e009b7a2 100644 --- a/tests/ui/empty/empty-struct-braces-expr.stderr +++ b/tests/ui/empty/empty-struct-braces-expr.stderr @@ -14,9 +14,8 @@ LL | pub struct XEmpty2; | help: use struct literal syntax instead | -LL - let e1 = Empty1; -LL + let e1 = Empty1 {}; - | +LL | let e1 = Empty1 {}; + | ~~~~~~~~~ help: a unit struct with a similar name exists | LL - let e1 = Empty1; @@ -38,9 +37,8 @@ LL | pub struct XEmpty2; | help: use struct literal syntax instead | -LL - let xe1 = XEmpty1; -LL + let xe1 = XEmpty1 {}; - | +LL | let xe1 = XEmpty1 {}; + | ~~~~~~~~~~ help: a unit struct with a similar name exists | LL - let xe1 = XEmpty1; diff --git a/tests/ui/empty/empty-struct-tuple-pat.stderr b/tests/ui/empty/empty-struct-tuple-pat.stderr index 3906a0e20608a..19e44bacaa079 100644 --- a/tests/ui/empty/empty-struct-tuple-pat.stderr +++ b/tests/ui/empty/empty-struct-tuple-pat.stderr @@ -46,9 +46,8 @@ LL | XEmpty5(), | help: use the tuple variant pattern syntax instead | -LL - XE::XEmpty5 => (), -LL + XE::XEmpty5() => (), - | +LL | XE::XEmpty5() => (), + | ~~~~~~~~~~~~~ help: a unit variant with a similar name exists | LL - XE::XEmpty5 => (), diff --git a/tests/ui/extern/not-in-block.stderr b/tests/ui/extern/not-in-block.stderr index f35d98e994889..cd1cd0fa50e64 100644 --- a/tests/ui/extern/not-in-block.stderr +++ b/tests/ui/extern/not-in-block.stderr @@ -11,9 +11,8 @@ LL + extern fn none_fn(x: bool) -> i32 { } | help: if you meant to declare an externally defined function, use an `extern` block | -LL - extern fn none_fn(x: bool) -> i32; -LL + extern { fn none_fn(x: bool) -> i32; } - | +LL | extern { fn none_fn(x: bool) -> i32; } + | ~~~~~~~~ + error: free function without a body --> $DIR/not-in-block.rs:6:1 @@ -28,9 +27,8 @@ LL + extern "C" fn c_fn(x: bool) -> i32 { } | help: if you meant to declare an externally defined function, use an `extern` block | -LL - extern "C" fn c_fn(x: bool) -> i32; -LL + extern "C" { fn c_fn(x: bool) -> i32; } - | +LL | extern "C" { fn c_fn(x: bool) -> i32; } + | ~~~~~~~~~~~~ + error: aborting due to 2 previous errors diff --git a/tests/ui/fmt/no-inline-literals-out-of-range.stderr b/tests/ui/fmt/no-inline-literals-out-of-range.stderr index 78047eabf4993..25486b8547295 100644 --- a/tests/ui/fmt/no-inline-literals-out-of-range.stderr +++ b/tests/ui/fmt/no-inline-literals-out-of-range.stderr @@ -51,9 +51,8 @@ LL | format_args!("{}", 0xffff_ffff); // treat unsuffixed literals as i32 = help: consider using the type `u32` instead help: to use as a negative number (decimal `-1`), consider using the type `u32` for the literal and cast it to `i32` | -LL - format_args!("{}", 0xffff_ffff); // treat unsuffixed literals as i32 -LL + format_args!("{}", 0xffff_ffffu32 as i32); // treat unsuffixed literals as i32 - | +LL | format_args!("{}", 0xffff_ffffu32 as i32); // treat unsuffixed literals as i32 + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/tests/ui/impl-trait/no-method-suggested-traits.stderr b/tests/ui/impl-trait/no-method-suggested-traits.stderr index af6d492c74d16..676247d1a423b 100644 --- a/tests/ui/impl-trait/no-method-suggested-traits.stderr +++ b/tests/ui/impl-trait/no-method-suggested-traits.stderr @@ -17,9 +17,8 @@ LL + use no_method_suggested_traits::qux::PrivPub; | help: there is a method `method2` with a similar name | -LL - 1u32.method(); -LL + 1u32.method2(); - | +LL | 1u32.method2(); + | ~~~~~~~ error[E0599]: no method named `method` found for struct `Rc<&mut Box<&u32>>` in the current scope --> $DIR/no-method-suggested-traits.rs:26:44 @@ -40,9 +39,8 @@ LL + use no_method_suggested_traits::qux::PrivPub; | help: there is a method `method2` with a similar name | -LL - std::rc::Rc::new(&mut Box::new(&1u32)).method(); -LL + std::rc::Rc::new(&mut Box::new(&1u32)).method2(); - | +LL | std::rc::Rc::new(&mut Box::new(&1u32)).method2(); + | ~~~~~~~ error[E0599]: no method named `method` found for type `char` in the current scope --> $DIR/no-method-suggested-traits.rs:30:9 @@ -60,9 +58,8 @@ LL + use foo::Bar; | help: there is a method `method2` with a similar name | -LL - 'a'.method(); -LL + 'a'.method2(); - | +LL | 'a'.method2(); + | ~~~~~~~ error[E0599]: no method named `method` found for struct `Rc<&mut Box<&char>>` in the current scope --> $DIR/no-method-suggested-traits.rs:32:43 @@ -77,9 +74,8 @@ LL + use foo::Bar; | help: there is a method `method2` with a similar name | -LL - std::rc::Rc::new(&mut Box::new(&'a')).method(); -LL + std::rc::Rc::new(&mut Box::new(&'a')).method2(); - | +LL | std::rc::Rc::new(&mut Box::new(&'a')).method2(); + | ~~~~~~~ error[E0599]: no method named `method` found for type `i32` in the current scope --> $DIR/no-method-suggested-traits.rs:35:10 @@ -99,9 +95,8 @@ LL + use no_method_suggested_traits::foo::PubPub; | help: there is a method `method3` with a similar name | -LL - 1i32.method(); -LL + 1i32.method3(); - | +LL | 1i32.method3(); + | ~~~~~~~ error[E0599]: no method named `method` found for struct `Rc<&mut Box<&i32>>` in the current scope --> $DIR/no-method-suggested-traits.rs:37:44 @@ -116,9 +111,8 @@ LL + use no_method_suggested_traits::foo::PubPub; | help: there is a method `method3` with a similar name | -LL - std::rc::Rc::new(&mut Box::new(&1i32)).method(); -LL + std::rc::Rc::new(&mut Box::new(&1i32)).method3(); - | +LL | std::rc::Rc::new(&mut Box::new(&1i32)).method3(); + | ~~~~~~~ error[E0599]: no method named `method` found for struct `Foo` in the current scope --> $DIR/no-method-suggested-traits.rs:40:9 diff --git a/tests/ui/imports/glob-resolve1.stderr b/tests/ui/imports/glob-resolve1.stderr index 6a48e36d37894..4401ef58732e8 100644 --- a/tests/ui/imports/glob-resolve1.stderr +++ b/tests/ui/imports/glob-resolve1.stderr @@ -37,9 +37,8 @@ LL | | } | |_____^ help: you might have meant to use the following enum variant | -LL - B; -LL + B::B1; - | +LL | B::B1; + | ~~~~~ error[E0425]: cannot find value `C` in this scope --> $DIR/glob-resolve1.rs:29:5 diff --git a/tests/ui/imports/issue-45829/import-self.stderr b/tests/ui/imports/issue-45829/import-self.stderr index 62bc559b77866..f15beac5e16da 100644 --- a/tests/ui/imports/issue-45829/import-self.stderr +++ b/tests/ui/imports/issue-45829/import-self.stderr @@ -32,9 +32,8 @@ LL | use foo::{self}; = note: `foo` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL - use foo::{self}; -LL + use foo::{self as other_foo}; - | +LL | use foo::{self as other_foo}; + | ~~~~~~~~~~~~~~~~~ error[E0255]: the name `foo` is defined multiple times --> $DIR/import-self.rs:12:5 diff --git a/tests/ui/issues/issue-32004.stderr b/tests/ui/issues/issue-32004.stderr index 88395cd852092..6fa548015fa28 100644 --- a/tests/ui/issues/issue-32004.stderr +++ b/tests/ui/issues/issue-32004.stderr @@ -11,9 +11,8 @@ LL | Foo::Bar => {} | help: use the tuple variant pattern syntax instead | -LL - Foo::Bar => {} -LL + Foo::Bar(_) => {} - | +LL | Foo::Bar(_) => {} + | ~~~~~~~~~~~ help: a unit variant with a similar name exists | LL - Foo::Bar => {} diff --git a/tests/ui/issues/issue-41652/issue-41652.stderr b/tests/ui/issues/issue-41652/issue-41652.stderr index c8299f28d3454..a5a2fab2ede03 100644 --- a/tests/ui/issues/issue-41652/issue-41652.stderr +++ b/tests/ui/issues/issue-41652/issue-41652.stderr @@ -6,9 +6,8 @@ LL | 3.f() | help: you must specify a concrete type for this numeric value, like `i32` | -LL - 3.f() -LL + 3_i32.f() - | +LL | 3_i32.f() + | ~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-51874.stderr b/tests/ui/issues/issue-51874.stderr index 18328450145b2..5be3695dd4548 100644 --- a/tests/ui/issues/issue-51874.stderr +++ b/tests/ui/issues/issue-51874.stderr @@ -6,9 +6,8 @@ LL | let a = (1.0).pow(1.0); | help: you must specify a concrete type for this numeric value, like `f32` | -LL - let a = (1.0).pow(1.0); -LL + let a = (1.0_f32).pow(1.0); - | +LL | let a = (1.0_f32).pow(1.0); + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-5358-1.stderr b/tests/ui/issues/issue-5358-1.stderr index f598cf33911f3..1bb946ce4cb54 100644 --- a/tests/ui/issues/issue-5358-1.stderr +++ b/tests/ui/issues/issue-5358-1.stderr @@ -14,9 +14,8 @@ LL | S(Either::Right(_)) => {} | ++ + help: you might have meant to use field `0` whose type is `Either` | -LL - match S(Either::Left(5)) { -LL + match S(Either::Left(5)).0 { - | +LL | match S(Either::Left(5)).0 { + | ~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-56175.stderr b/tests/ui/issues/issue-56175.stderr index 695aa2ac79696..50c26b83dd379 100644 --- a/tests/ui/issues/issue-56175.stderr +++ b/tests/ui/issues/issue-56175.stderr @@ -16,9 +16,8 @@ LL + use reexported_trait::Trait; | help: there is a method `trait_method_b` with a similar name | -LL - reexported_trait::FooStruct.trait_method(); -LL + reexported_trait::FooStruct.trait_method_b(); - | +LL | reexported_trait::FooStruct.trait_method_b(); + | ~~~~~~~~~~~~~~ error[E0599]: no method named `trait_method_b` found for struct `FooStruct` in the current scope --> $DIR/issue-56175.rs:7:33 diff --git a/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr b/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr index a244d7604d7cf..59f473b14d80c 100644 --- a/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr +++ b/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr @@ -11,9 +11,8 @@ LL | #![deny(let_underscore_drop)] | ^^^^^^^^^^^^^^^^^^^ help: consider binding to an unused variable to avoid immediately dropping the value | -LL - let _ = foo(); -LL + let _unused = foo(); - | +LL | let _unused = foo(); + | ~~~~~~~ help: consider immediately dropping the value | LL - let _ = foo(); diff --git a/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr b/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr index 8773d5df44310..3cef341ddb008 100644 --- a/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr +++ b/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr @@ -28,9 +28,8 @@ LL | let _ = field; | help: consider binding to an unused variable to avoid immediately dropping the value | -LL - let _ = field; -LL + let _unused = field; - | +LL | let _unused = field; + | ~~~~~~~ help: consider immediately dropping the value | LL - let _ = field; diff --git a/tests/ui/lint/let_underscore/let_underscore_drop.stderr b/tests/ui/lint/let_underscore/let_underscore_drop.stderr index c7984d629daa0..a326cd4fec4f3 100644 --- a/tests/ui/lint/let_underscore/let_underscore_drop.stderr +++ b/tests/ui/lint/let_underscore/let_underscore_drop.stderr @@ -11,9 +11,8 @@ LL | #![warn(let_underscore_drop)] | ^^^^^^^^^^^^^^^^^^^ help: consider binding to an unused variable to avoid immediately dropping the value | -LL - let _ = NontrivialDrop; -LL + let _unused = NontrivialDrop; - | +LL | let _unused = NontrivialDrop; + | ~~~~~~~ help: consider immediately dropping the value | LL - let _ = NontrivialDrop; diff --git a/tests/ui/lint/let_underscore/let_underscore_lock.stderr b/tests/ui/lint/let_underscore/let_underscore_lock.stderr index 60d5ed649f5ee..90f661d379e64 100644 --- a/tests/ui/lint/let_underscore/let_underscore_lock.stderr +++ b/tests/ui/lint/let_underscore/let_underscore_lock.stderr @@ -7,9 +7,8 @@ LL | let _ = data.lock().unwrap(); = note: `#[deny(let_underscore_lock)]` on by default help: consider binding to an unused variable to avoid immediately dropping the value | -LL - let _ = data.lock().unwrap(); -LL + let _unused = data.lock().unwrap(); - | +LL | let _unused = data.lock().unwrap(); + | ~~~~~~~ help: consider immediately dropping the value | LL - let _ = data.lock().unwrap(); @@ -24,9 +23,8 @@ LL | let _ = data.lock(); | help: consider binding to an unused variable to avoid immediately dropping the value | -LL - let _ = data.lock(); -LL + let _unused = data.lock(); - | +LL | let _unused = data.lock(); + | ~~~~~~~ help: consider immediately dropping the value | LL - let _ = data.lock(); @@ -42,9 +40,8 @@ LL | let (_, _) = (data.lock(), 1); = help: consider immediately dropping the value using `drop(..)` after the `let` statement help: consider binding to an unused variable to avoid immediately dropping the value | -LL - let (_, _) = (data.lock(), 1); -LL + let (_unused, _) = (data.lock(), 1); - | +LL | let (_unused, _) = (data.lock(), 1); + | ~~~~~~~ error: non-binding let on a synchronization lock --> $DIR/let_underscore_lock.rs:16:26 @@ -55,9 +52,8 @@ LL | let (_a, Struct { a: _ }) = (0, Struct { a: data.lock() }); = help: consider immediately dropping the value using `drop(..)` after the `let` statement help: consider binding to an unused variable to avoid immediately dropping the value | -LL - let (_a, Struct { a: _ }) = (0, Struct { a: data.lock() }); -LL + let (_a, Struct { a: _unused }) = (0, Struct { a: data.lock() }); - | +LL | let (_a, Struct { a: _unused }) = (0, Struct { a: data.lock() }); + | ~~~~~~~ error: non-binding let on a synchronization lock --> $DIR/let_underscore_lock.rs:18:6 diff --git a/tests/ui/lint/static-mut-refs.e2021.stderr b/tests/ui/lint/static-mut-refs.e2021.stderr index abd579b336f07..39a4056dd7f44 100644 --- a/tests/ui/lint/static-mut-refs.e2021.stderr +++ b/tests/ui/lint/static-mut-refs.e2021.stderr @@ -9,9 +9,8 @@ LL | let _y = &X; = note: `#[warn(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer | -LL - let _y = &X; -LL + let _y = &raw const X; - | +LL | let _y = &raw const X; + | ~~~~~~~~~~ warning: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:42:18 @@ -46,9 +45,8 @@ LL | let (_b, _c) = (&X, &Y); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let (_b, _c) = (&X, &Y); -LL + let (_b, _c) = (&raw const X, &Y); - | +LL | let (_b, _c) = (&raw const X, &Y); + | ~~~~~~~~~~ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:54:29 @@ -60,9 +58,8 @@ LL | let (_b, _c) = (&X, &Y); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let (_b, _c) = (&X, &Y); -LL + let (_b, _c) = (&X, &raw const Y); - | +LL | let (_b, _c) = (&X, &raw const Y); + | ~~~~~~~~~~ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:60:13 @@ -74,9 +71,8 @@ LL | foo(&X); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - foo(&X); -LL + foo(&raw const X); - | +LL | foo(&raw const X); + | ~~~~~~~~~~ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:66:17 @@ -106,9 +102,8 @@ LL | let _v = &A.value; = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let _v = &A.value; -LL + let _v = &raw const A.value; - | +LL | let _v = &raw const A.value; + | ~~~~~~~~~~ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:80:18 @@ -120,9 +115,8 @@ LL | let _s = &A.s.value; = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let _s = &A.s.value; -LL + let _s = &raw const A.s.value; - | +LL | let _s = &raw const A.s.value; + | ~~~~~~~~~~ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:84:22 diff --git a/tests/ui/lint/static-mut-refs.e2024.stderr b/tests/ui/lint/static-mut-refs.e2024.stderr index 1387cdf0b3240..51eaf2785d151 100644 --- a/tests/ui/lint/static-mut-refs.e2024.stderr +++ b/tests/ui/lint/static-mut-refs.e2024.stderr @@ -9,9 +9,8 @@ LL | let _y = &X; = note: `#[deny(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer | -LL - let _y = &X; -LL + let _y = &raw const X; - | +LL | let _y = &raw const X; + | ~~~~~~~~~~ error: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:42:18 @@ -46,9 +45,8 @@ LL | let (_b, _c) = (&X, &Y); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let (_b, _c) = (&X, &Y); -LL + let (_b, _c) = (&raw const X, &Y); - | +LL | let (_b, _c) = (&raw const X, &Y); + | ~~~~~~~~~~ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:54:29 @@ -60,9 +58,8 @@ LL | let (_b, _c) = (&X, &Y); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let (_b, _c) = (&X, &Y); -LL + let (_b, _c) = (&X, &raw const Y); - | +LL | let (_b, _c) = (&X, &raw const Y); + | ~~~~~~~~~~ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:60:13 @@ -74,9 +71,8 @@ LL | foo(&X); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - foo(&X); -LL + foo(&raw const X); - | +LL | foo(&raw const X); + | ~~~~~~~~~~ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:66:17 @@ -106,9 +102,8 @@ LL | let _v = &A.value; = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let _v = &A.value; -LL + let _v = &raw const A.value; - | +LL | let _v = &raw const A.value; + | ~~~~~~~~~~ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:80:18 @@ -120,9 +115,8 @@ LL | let _s = &A.s.value; = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let _s = &A.s.value; -LL + let _s = &raw const A.s.value; - | +LL | let _s = &raw const A.s.value; + | ~~~~~~~~~~ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:84:22 diff --git a/tests/ui/lint/type-overflow.stderr b/tests/ui/lint/type-overflow.stderr index 0ac67fddaa72a..4e68e7ee80f0c 100644 --- a/tests/ui/lint/type-overflow.stderr +++ b/tests/ui/lint/type-overflow.stderr @@ -66,9 +66,8 @@ LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000; = help: consider using the type `u128` instead help: to use as a negative number (decimal `-170141183460469231731687303715884105728`), consider using the type `u128` for the literal and cast it to `i128` | -LL - let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000; -LL + let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000u128 as i128; - | +LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000u128 as i128; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: literal out of range for `i32` --> $DIR/type-overflow.rs:27:16 @@ -117,9 +116,8 @@ LL | let fail = 0x8FFF_FFFF_FFFF_FFFE; = help: consider using the type `u64` instead help: to use as a negative number (decimal `-2`), consider using the type `u32` for the literal and cast it to `i32` | -LL - let fail = 0x8FFF_FFFF_FFFF_FFFE; -LL + let fail = 0x8FFF_FFFF_FFFF_FFFEu32 as i32; - | +LL | let fail = 0x8FFF_FFFF_FFFF_FFFEu32 as i32; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: literal out of range for `i8` --> $DIR/type-overflow.rs:46:17 diff --git a/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr b/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr index 8922f484d3e92..a5bd396f73ff1 100644 --- a/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr +++ b/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr @@ -12,9 +12,8 @@ LL | #![deny(unused)] = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]` help: try ignoring the field | -LL - A { i, j } | B { i, j } => { -LL + A { i, j: _ } | B { i, j: _ } => { - | +LL | A { i, j: _ } | B { i, j: _ } => { + | ~~~~ ~~~~ error: unused variable: `j` --> $DIR/issue-67691-unused-field-in-or-pattern.rs:30:16 @@ -36,9 +35,8 @@ LL | Some(A { i, j } | B { i, j }) => { | help: try ignoring the field | -LL - Some(A { i, j } | B { i, j }) => { -LL + Some(A { i, j: _ } | B { i, j: _ }) => { - | +LL | Some(A { i, j: _ } | B { i, j: _ }) => { + | ~~~~ ~~~~ error: unused variable: `j` --> $DIR/issue-67691-unused-field-in-or-pattern.rs:52:21 diff --git a/tests/ui/lint/wide_pointer_comparisons.stderr b/tests/ui/lint/wide_pointer_comparisons.stderr index f5f8060902bdc..5a0b914d8320e 100644 --- a/tests/ui/lint/wide_pointer_comparisons.stderr +++ b/tests/ui/lint/wide_pointer_comparisons.stderr @@ -627,9 +627,8 @@ LL | cmp!(a, b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL - cmp!(a, b); -LL + cmp!(std::ptr::addr_eq(a, b)); - | +LL | cmp!(std::ptr::addr_eq(a, b)); + | ++++++++++++++++++ + warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:159:39 diff --git a/tests/ui/macros/expr_2021_cargo_fix_edition.stderr b/tests/ui/macros/expr_2021_cargo_fix_edition.stderr index 8ab6938fe19c8..fe1fd4a26a028 100644 --- a/tests/ui/macros/expr_2021_cargo_fix_edition.stderr +++ b/tests/ui/macros/expr_2021_cargo_fix_edition.stderr @@ -13,9 +13,8 @@ LL | #![warn(edition_2024_expr_fragment_specifier)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: to keep the existing behavior, use the `expr_2021` fragment specifier | -LL - ($e:expr) => { -LL + ($e:expr_2021) => { - | +LL | ($e:expr_2021) => { + | ~~~~~~~~~ warning: the `expr` fragment specifier will accept more expressions in the 2024 edition --> $DIR/expr_2021_cargo_fix_edition.rs:11:11 @@ -27,9 +26,8 @@ LL | ($($i:expr)*) => { }; = note: for more information, see Migration Guide help: to keep the existing behavior, use the `expr_2021` fragment specifier | -LL - ($($i:expr)*) => { }; -LL + ($($i:expr_2021)*) => { }; - | +LL | ($($i:expr_2021)*) => { }; + | ~~~~~~~~~ warning: 2 warnings emitted diff --git a/tests/ui/macros/macro-backtrace-invalid-internals.stderr b/tests/ui/macros/macro-backtrace-invalid-internals.stderr index bb8250d58b06c..aa8f06a0df13b 100644 --- a/tests/ui/macros/macro-backtrace-invalid-internals.stderr +++ b/tests/ui/macros/macro-backtrace-invalid-internals.stderr @@ -43,9 +43,8 @@ LL | real_method_stmt!(); = note: this error originates in the macro `real_method_stmt` (in Nightly builds, run with -Z macro-backtrace for more info) help: you must specify a concrete type for this numeric value, like `f32` | -LL - 2.0.neg() -LL + 2.0_f32.neg() - | +LL | 2.0_f32.neg() + | ~~~~~~~ error[E0599]: no method named `fake` found for type `{integer}` in the current scope --> $DIR/macro-backtrace-invalid-internals.rs:23:13 @@ -92,9 +91,8 @@ LL | let _ = real_method_expr!(); = note: this error originates in the macro `real_method_expr` (in Nightly builds, run with -Z macro-backtrace for more info) help: you must specify a concrete type for this numeric value, like `f32` | -LL - 2.0.neg() -LL + 2.0_f32.neg() - | +LL | 2.0_f32.neg() + | ~~~~~~~ error: aborting due to 8 previous errors diff --git a/tests/ui/methods/issues/issue-90315.stderr b/tests/ui/methods/issues/issue-90315.stderr index e194a9188342f..0466bb0a0c997 100644 --- a/tests/ui/methods/issues/issue-90315.stderr +++ b/tests/ui/methods/issues/issue-90315.stderr @@ -181,9 +181,8 @@ LL | let _res: i32 = ..6.take(2).sum(); | help: you must specify a concrete type for this numeric value, like `i32` | -LL - let _res: i32 = ..6.take(2).sum(); -LL + let _res: i32 = ..6_i32.take(2).sum(); - | +LL | let _res: i32 = ..6_i32.take(2).sum(); + | ~~~~~ error: aborting due to 18 previous errors diff --git a/tests/ui/methods/method-on-ambiguous-numeric-type.stderr b/tests/ui/methods/method-on-ambiguous-numeric-type.stderr index d688bcc90c8d3..124270402727d 100644 --- a/tests/ui/methods/method-on-ambiguous-numeric-type.stderr +++ b/tests/ui/methods/method-on-ambiguous-numeric-type.stderr @@ -6,9 +6,8 @@ LL | let x = 2.0.neg(); | help: you must specify a concrete type for this numeric value, like `f32` | -LL - let x = 2.0.neg(); -LL + let x = 2.0_f32.neg(); - | +LL | let x = 2.0_f32.neg(); + | ~~~~~~~ error[E0689]: can't call method `neg` on ambiguous numeric type `{float}` --> $DIR/method-on-ambiguous-numeric-type.rs:17:15 diff --git a/tests/ui/mir/issue-112269.stderr b/tests/ui/mir/issue-112269.stderr index 29b69cb7e2083..80f329e2ce026 100644 --- a/tests/ui/mir/issue-112269.stderr +++ b/tests/ui/mir/issue-112269.stderr @@ -11,9 +11,8 @@ LL | let x: i32 = 3; = note: the matched value is of type `i32` help: introduce a variable instead | -LL - let x: i32 = 3; -LL + let x_var: i32 = 3; - | +LL | let x_var: i32 = 3; + | ~~~~~ error[E0005]: refutable pattern in local binding --> $DIR/issue-112269.rs:7:9 @@ -28,9 +27,8 @@ LL | let y = 4; = note: the matched value is of type `i32` help: introduce a variable instead | -LL - let y = 4; -LL + let y_var = 4; - | +LL | let y_var = 4; + | ~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr b/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr index 62f087ca6b736..784945dbbaeae 100644 --- a/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr +++ b/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr @@ -195,9 +195,8 @@ LL | [t, t]; | - you could clone this value help: consider further restricting type parameter `T` with trait `Copy` | -LL - T:, -LL + T:, T: Copy - | +LL | T:, T: Copy + | ~~~~~~~~~ error: aborting due to 11 previous errors diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr index 980670fee6973..4f93fb4eaea34 100644 --- a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -33,9 +33,8 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | help: consider adding an explicit lifetime bound | -LL - T: Iterator, -LL + T: Iterator, ::Item: 'a - | +LL | T: Iterator, ::Item: 'a + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: external requirements --> $DIR/projection-no-regions-closure.rs:34:23 @@ -96,9 +95,8 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | help: consider adding an explicit lifetime bound | -LL - T: 'b + Iterator, -LL + T: 'b + Iterator, ::Item: 'a - | +LL | T: 'b + Iterator, ::Item: 'a + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: external requirements --> $DIR/projection-no-regions-closure.rs:52:23 diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr index 53da981d70298..da76ac1c474a3 100644 --- a/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr +++ b/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr @@ -9,9 +9,8 @@ LL | Box::new(x.next()) | help: consider adding an explicit lifetime bound | -LL - T: Iterator, -LL + T: Iterator, ::Item: 'a - | +LL | T: Iterator, ::Item: 'a + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0309]: the associated type `::Item` may not live long enough --> $DIR/projection-no-regions-fn.rs:28:5 @@ -24,9 +23,8 @@ LL | Box::new(x.next()) | help: consider adding an explicit lifetime bound | -LL - T: 'b + Iterator, -LL + T: 'b + Iterator, ::Item: 'a - | +LL | T: 'b + Iterator, ::Item: 'a + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/parser/char/whitespace-character-literal.stderr b/tests/ui/parser/char/whitespace-character-literal.stderr index 53f2eb3ecbab2..f273b5d61d57f 100644 --- a/tests/ui/parser/char/whitespace-character-literal.stderr +++ b/tests/ui/parser/char/whitespace-character-literal.stderr @@ -11,9 +11,8 @@ LL | let _hair_space_around = ' x​'; | ^^ help: consider removing the non-printing characters | -LL - let _hair_space_around = ' x​'; -LL + let _hair_space_around = 'x​'; - | +LL | let _hair_space_around = 'x​'; + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/extern-no-fn.stderr b/tests/ui/parser/extern-no-fn.stderr index 2ee905429c4ab..03826e4a93b7a 100644 --- a/tests/ui/parser/extern-no-fn.stderr +++ b/tests/ui/parser/extern-no-fn.stderr @@ -11,9 +11,8 @@ LL | } | help: if you meant to call a macro, try | -LL - f(); -LL + f!(); - | +LL | f!(); + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr index fa84836894599..f6330e51e0dce 100644 --- a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr +++ b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr @@ -8,9 +8,8 @@ LL | Foo:Bar => {} | help: maybe write a path separator here | -LL - Foo:Bar => {} -LL + Foo::Bar => {} - | +LL | Foo::Bar => {} + | ~~ error: expected one of `!`, `(`, `...`, `..=`, `..`, `::`, `{`, or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:23:17 @@ -22,9 +21,8 @@ LL | qux::Foo:Bar => {} | help: maybe write a path separator here | -LL - qux::Foo:Bar => {} -LL + qux::Foo::Bar => {} - | +LL | qux::Foo::Bar => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:29:12 @@ -36,9 +34,8 @@ LL | qux:Foo::Baz => {} | help: maybe write a path separator here | -LL - qux:Foo::Baz => {} -LL + qux::Foo::Baz => {} - | +LL | qux::Foo::Baz => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:35:12 @@ -64,9 +61,8 @@ LL | if let Foo:Bar = f() { | help: maybe write a path separator here | -LL - if let Foo:Bar = f() { -LL + if let Foo::Bar = f() { - | +LL | if let Foo::Bar = f() { + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:49:16 @@ -106,9 +102,8 @@ LL | Foo:Bar::Baz => {} | help: maybe write a path separator here | -LL - Foo:Bar::Baz => {} -LL + Foo::Bar::Baz => {} - | +LL | Foo::Bar::Baz => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:75:12 @@ -120,9 +115,8 @@ LL | Foo:Bar => {} | help: maybe write a path separator here | -LL - Foo:Bar => {} -LL + Foo::Bar => {} - | +LL | Foo::Bar => {} + | ~~ warning: irrefutable `if let` pattern --> $DIR/issue-87086-colon-path-sep.rs:40:8 diff --git a/tests/ui/parser/missing-fn-issue-65381-2.stderr b/tests/ui/parser/missing-fn-issue-65381-2.stderr index ba2cf497df23e..e13d395d70d7f 100644 --- a/tests/ui/parser/missing-fn-issue-65381-2.stderr +++ b/tests/ui/parser/missing-fn-issue-65381-2.stderr @@ -6,9 +6,8 @@ LL | main(); | help: if you meant to call a macro, try | -LL - main(); -LL + main!(); - | +LL | main!(); + | ~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/const.stderr b/tests/ui/parser/misspelled-keywords/const.stderr index ca76f51f4ed31..35e4d731db768 100644 --- a/tests/ui/parser/misspelled-keywords/const.stderr +++ b/tests/ui/parser/misspelled-keywords/const.stderr @@ -6,9 +6,8 @@ LL | cons A: u8 = 10; | help: there is a keyword `const` with a similar name | -LL - cons A: u8 = 10; -LL + const A: u8 = 10; - | +LL | const A: u8 = 10; + | ~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr b/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr index 15866211954bf..551b2e3ff09b0 100644 --- a/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr +++ b/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr @@ -7,9 +7,8 @@ LL | let x = Tr; = note: type ascription syntax has been removed, see issue #101728 help: maybe write a path separator here | -LL - let x = Tr; -LL + let x = Tr; - | +LL | let x = Tr; + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/use-colon-as-mod-sep.stderr b/tests/ui/parser/use-colon-as-mod-sep.stderr index f25a779f31f3b..347b271df9900 100644 --- a/tests/ui/parser/use-colon-as-mod-sep.stderr +++ b/tests/ui/parser/use-colon-as-mod-sep.stderr @@ -7,9 +7,8 @@ LL | use std::process:Command; = note: import paths are delimited using `::` help: use double colon | -LL - use std::process:Command; -LL + use std::process::Command; - | +LL | use std::process::Command; + | ~~ error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:5:8 @@ -20,9 +19,8 @@ LL | use std:fs::File; = note: import paths are delimited using `::` help: use double colon | -LL - use std:fs::File; -LL + use std::fs::File; - | +LL | use std::fs::File; + | ~~ error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:7:8 @@ -33,9 +31,8 @@ LL | use std:collections:HashMap; = note: import paths are delimited using `::` help: use double colon | -LL - use std:collections:HashMap; -LL + use std::collections:HashMap; - | +LL | use std::collections:HashMap; + | ~~ error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:7:20 @@ -46,9 +43,8 @@ LL | use std:collections:HashMap; = note: import paths are delimited using `::` help: use double colon | -LL - use std:collections:HashMap; -LL + use std:collections::HashMap; - | +LL | use std:collections::HashMap; + | ~~ error: aborting due to 4 previous errors diff --git a/tests/ui/pattern/pat-tuple-field-count-cross.stderr b/tests/ui/pattern/pat-tuple-field-count-cross.stderr index c084ec0b532ed..931db37c78ef1 100644 --- a/tests/ui/pattern/pat-tuple-field-count-cross.stderr +++ b/tests/ui/pattern/pat-tuple-field-count-cross.stderr @@ -121,9 +121,8 @@ LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) } | help: use the tuple variant pattern syntax instead | -LL - E1::Z1 => {} -LL + E1::Z1() => {} - | +LL | E1::Z1() => {} + | ~~~~~~~~ help: a unit variant with a similar name exists | LL - E1::Z1 => {} diff --git a/tests/ui/pattern/pat-tuple-overfield.stderr b/tests/ui/pattern/pat-tuple-overfield.stderr index 4e8261cb15b84..ea3663ea40e76 100644 --- a/tests/ui/pattern/pat-tuple-overfield.stderr +++ b/tests/ui/pattern/pat-tuple-overfield.stderr @@ -155,9 +155,8 @@ LL | E1::Z1 => {} | help: use the tuple variant pattern syntax instead | -LL - E1::Z1 => {} -LL + E1::Z1() => {} - | +LL | E1::Z1() => {} + | ~~~~~~~~ help: a unit variant with a similar name exists | LL - E1::Z1 => {} diff --git a/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr b/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr index a12b94176c076..e9c2fccaba284 100644 --- a/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr +++ b/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr @@ -6,9 +6,8 @@ LL | b.make_ascii_uppercase(); | help: consider changing this to be mutable | -LL - let &b = a; -LL + let &(mut b) = a; - | +LL | let &(mut b) = a; + | ~~~~~ + error: aborting due to 1 previous error diff --git a/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr b/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr index 68141af491068..e93b8bbacccdd 100644 --- a/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr +++ b/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr @@ -6,9 +6,8 @@ LL | mutate(&mut x); | help: consider changing this to be mutable | -LL - fn foo(&x: &i32) { -LL + fn foo(&(mut x): &i32) { - | +LL | fn foo(&(mut x): &i32) { + | ~~~~~ + error: aborting due to 1 previous error diff --git a/tests/ui/privacy/privacy5.stderr b/tests/ui/privacy/privacy5.stderr index 8f28f629ba3ba..ec3abe9b81629 100644 --- a/tests/ui/privacy/privacy5.stderr +++ b/tests/ui/privacy/privacy5.stderr @@ -52,9 +52,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `A` is private --> $DIR/privacy5.rs:56:12 @@ -262,9 +261,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:69:12 @@ -282,9 +280,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:70:12 @@ -302,9 +299,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:71:12 @@ -322,9 +318,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:72:18 @@ -342,9 +337,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:73:18 @@ -362,9 +356,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:74:18 @@ -382,9 +375,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:75:18 @@ -402,9 +394,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `A` is private --> $DIR/privacy5.rs:83:17 @@ -460,9 +451,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `A` is private --> $DIR/privacy5.rs:90:20 diff --git a/tests/ui/pub/pub-ident-fn-or-struct.stderr b/tests/ui/pub/pub-ident-fn-or-struct.stderr index 1bdb547be1e51..ceadc510c63ef 100644 --- a/tests/ui/pub/pub-ident-fn-or-struct.stderr +++ b/tests/ui/pub/pub-ident-fn-or-struct.stderr @@ -6,9 +6,8 @@ LL | pub S (foo) bar | help: if you meant to call a macro, try | -LL - pub S (foo) bar -LL + pub S! (foo) bar - | +LL | pub S! (foo) bar + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/resolve/issue-39226.stderr b/tests/ui/resolve/issue-39226.stderr index 3d771b4fc42a2..84f9ad531f082 100644 --- a/tests/ui/resolve/issue-39226.stderr +++ b/tests/ui/resolve/issue-39226.stderr @@ -9,9 +9,8 @@ LL | handle: Handle | help: use struct literal syntax instead | -LL - handle: Handle -LL + handle: Handle {} - | +LL | handle: Handle {} + | ~~~~~~~~~ help: a local variable with a similar name exists | LL - handle: Handle diff --git a/tests/ui/resolve/issue-55673.stderr b/tests/ui/resolve/issue-55673.stderr index 30b1cd09085b6..86dfca068a37c 100644 --- a/tests/ui/resolve/issue-55673.stderr +++ b/tests/ui/resolve/issue-55673.stderr @@ -18,9 +18,8 @@ LL | T::Baa: std::fmt::Debug, | help: consider further restricting type parameter `T` with trait `Foo` | -LL - T::Baa: std::fmt::Debug, -LL + T::Baa: std::fmt::Debug, T: Foo - | +LL | T::Baa: std::fmt::Debug, T: Foo + | ~~~~~~~~ help: ...and changing the associated type name | LL - T::Baa: std::fmt::Debug, diff --git a/tests/ui/resolve/issue-73427.stderr b/tests/ui/resolve/issue-73427.stderr index 890bb04f24dac..3c49fe3a8de57 100644 --- a/tests/ui/resolve/issue-73427.stderr +++ b/tests/ui/resolve/issue-73427.stderr @@ -20,9 +20,8 @@ help: you might have meant to use one of the following enum variants LL - A.foo(); LL + (A::Tuple()).foo(); | -LL - A.foo(); -LL + A::Unit.foo(); - | +LL | A::Unit.foo(); + | ~~~~~~~ help: alternatively, the following enum variant is available | LL - A.foo(); @@ -61,9 +60,8 @@ LL | | } | |_^ help: you might have meant to use the following enum variant | -LL - C.foo(); -LL + C::Unit.foo(); - | +LL | C::Unit.foo(); + | ~~~~~~~ help: alternatively, the following enum variant is available | LL - C.foo(); @@ -86,9 +84,8 @@ LL | | } | |_^ help: you might have meant to use the following enum variant | -LL - D.foo(); -LL + D::Unit.foo(); - | +LL | D::Unit.foo(); + | ~~~~~~~ help: alternatively, the following enum variant is available | LL - D.foo(); @@ -144,12 +141,10 @@ LL | | } | |_^ help: try to match against one of the enum's variants | -LL - if let A(3) = x { } -LL + if let A::Tuple(3) = x { } - | -LL - if let A(3) = x { } -LL + if let A::TupleWithFields(3) = x { } - | +LL | if let A::Tuple(3) = x { } + | ~~~~~~~~ +LL | if let A::TupleWithFields(3) = x { } + | ~~~~~~~~~~~~~~~~~~ error[E0423]: expected function, tuple struct or tuple variant, found enum `A` --> $DIR/issue-73427.rs:46:13 @@ -171,12 +166,10 @@ LL | | } | |_^ help: try to construct one of the enum's variants | -LL - let x = A(3); -LL + let x = A::Tuple(3); - | -LL - let x = A(3); -LL + let x = A::TupleWithFields(3); - | +LL | let x = A::Tuple(3); + | ~~~~~~~~ +LL | let x = A::TupleWithFields(3); + | ~~~~~~~~~~~~~~~~~~ error: aborting due to 7 previous errors diff --git a/tests/ui/resolve/privacy-enum-ctor.stderr b/tests/ui/resolve/privacy-enum-ctor.stderr index 3bbab3716afe7..fb6787274fac8 100644 --- a/tests/ui/resolve/privacy-enum-ctor.stderr +++ b/tests/ui/resolve/privacy-enum-ctor.stderr @@ -124,9 +124,8 @@ LL | | } | |_____^ help: you might have meant to use the following enum variant | -LL - let _: E = E; -LL + let _: E = E::Unit; - | +LL | let _: E = E::Unit; + | ~~~~~~~ help: alternatively, the following enum variant is available | LL - let _: E = E; diff --git a/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr b/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr index 3d6d47578c37a..b41fa1818e25a 100644 --- a/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr +++ b/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr @@ -11,9 +11,8 @@ LL | const DEFAULT: u32 = 0; = note: the matched value is of type `u32` help: introduce a variable instead | -LL - let DEFAULT: u32 = 0; -LL + let DEFAULT_var: u32 = 0; - | +LL | let DEFAULT_var: u32 = 0; + | ~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr b/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr index f041487da41dd..908f5bdd89749 100644 --- a/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr +++ b/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr @@ -21,9 +21,8 @@ LL | const DEFAULT: u32 = 0; = note: the matched value is of type `u32` help: introduce a variable instead | -LL - let DEFAULT: u32 = 0; -LL + let DEFAULT_var: u32 = 0; - | +LL | let DEFAULT_var: u32 = 0; + | ~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr index 15fdb975a1b29..d183f06c5fd4e 100644 --- a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr +++ b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr @@ -66,9 +66,8 @@ LL | Self::BAR; | ++++++ help: a constant with a similar name exists | -LL - BAR; -LL + BARR; - | +LL | BARR; + | ~~~~ error[E0412]: cannot find type `Baz` in this scope --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:37:18 diff --git a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr index 1ea7f1d39cb95..e7651f7704c7c 100644 --- a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr +++ b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr @@ -39,9 +39,8 @@ LL | modul::foo(); | help: there is a crate or module with a similar name | -LL - modul::foo(); -LL + module::foo(); - | +LL | module::foo(); + | ~~~~~~ error[E0433]: failed to resolve: use of undeclared type `Trai` --> $DIR/typo-suggestion-mistyped-in-path.rs:39:5 diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr b/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr index 4cbd93d17cfee..050834ab67609 100644 --- a/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr @@ -11,9 +11,8 @@ LL | #![deny(stable_features)] | ^^^^^^^^^^^^^^^ help: if you are using features which are still unstable, change to using `const_foobar` | -LL - #![feature(const_foo)] -LL + #![feature(const_foobar)] - | +LL | #![feature(const_foobar)] + | ~~~~~~~~~~~~ help: if you are using features which are now stable, remove this line | LL - #![feature(const_foo)] diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr b/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr index 38331919ee8ff..50cc14c3b4f65 100644 --- a/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr @@ -11,9 +11,8 @@ LL | #![deny(stable_features)] | ^^^^^^^^^^^^^^^ help: if you are using features which are still unstable, change to using `const_foobar` | -LL - #![feature(const_foo)] -LL + #![feature(const_foobar)] - | +LL | #![feature(const_foobar)] + | ~~~~~~~~~~~~ help: if you are using features which are now stable, remove this line | LL - #![feature(const_foo)] diff --git a/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr b/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr index 1080b977410d7..d783f1e8e4044 100644 --- a/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr +++ b/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr @@ -11,9 +11,8 @@ LL | #![deny(stable_features)] | ^^^^^^^^^^^^^^^ help: if you are using features which are still unstable, change to using `foobar` | -LL - #![feature(foo)] -LL + #![feature(foobar)] - | +LL | #![feature(foobar)] + | ~~~~~~ help: if you are using features which are now stable, remove this line | LL - #![feature(foo)] diff --git a/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr b/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr index 02cb25633ab0b..4940650fd4261 100644 --- a/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr +++ b/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr @@ -11,9 +11,8 @@ LL | #![deny(stable_features)] | ^^^^^^^^^^^^^^^ help: if you are using features which are still unstable, change to using `foobar` | -LL - #![feature(foo)] -LL + #![feature(foobar)] - | +LL | #![feature(foobar)] + | ~~~~~~ help: if you are using features which are now stable, remove this line | LL - #![feature(foo)] diff --git a/tests/ui/statics/issue-15261.stderr b/tests/ui/statics/issue-15261.stderr index 7edd79e08b1ef..4067d151de3d4 100644 --- a/tests/ui/statics/issue-15261.stderr +++ b/tests/ui/statics/issue-15261.stderr @@ -9,9 +9,8 @@ LL | static n: &'static usize = unsafe { &n_mut }; = note: `#[warn(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer | -LL - static n: &'static usize = unsafe { &n_mut }; -LL + static n: &'static usize = unsafe { &raw const n_mut }; - | +LL | static n: &'static usize = unsafe { &raw const n_mut }; + | ~~~~~~~~~~ warning: 1 warning emitted diff --git a/tests/ui/statics/static-mut-shared-parens.stderr b/tests/ui/statics/static-mut-shared-parens.stderr index f428f9a18d4e6..ad6ad68c3157d 100644 --- a/tests/ui/statics/static-mut-shared-parens.stderr +++ b/tests/ui/statics/static-mut-shared-parens.stderr @@ -9,9 +9,8 @@ LL | let _ = unsafe { (&TEST) as *const usize }; = note: `#[warn(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer | -LL - let _ = unsafe { (&TEST) as *const usize }; -LL + let _ = unsafe { (&raw const TEST) as *const usize }; - | +LL | let _ = unsafe { (&raw const TEST) as *const usize }; + | ~~~~~~~~~~ warning: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-shared-parens.rs:11:22 diff --git a/tests/ui/statics/static-mut-xc.stderr b/tests/ui/statics/static-mut-xc.stderr index d03835c30d8b0..77ce49b883fce 100644 --- a/tests/ui/statics/static-mut-xc.stderr +++ b/tests/ui/statics/static-mut-xc.stderr @@ -54,9 +54,8 @@ LL | static_bound(&static_mut_xc::a); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - static_bound(&static_mut_xc::a); -LL + static_bound(&raw const static_mut_xc::a); - | +LL | static_bound(&raw const static_mut_xc::a); + | ~~~~~~~~~~ warning: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-xc.rs:35:22 diff --git a/tests/ui/statics/static-recursive.stderr b/tests/ui/statics/static-recursive.stderr index 8ea997fa21404..f2dd5b8a6cfe8 100644 --- a/tests/ui/statics/static-recursive.stderr +++ b/tests/ui/statics/static-recursive.stderr @@ -9,9 +9,8 @@ LL | static mut S: *const u8 = unsafe { &S as *const *const u8 as *const u8 }; = note: `#[warn(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer | -LL - static mut S: *const u8 = unsafe { &S as *const *const u8 as *const u8 }; -LL + static mut S: *const u8 = unsafe { &raw const S as *const *const u8 as *const u8 }; - | +LL | static mut S: *const u8 = unsafe { &raw const S as *const *const u8 as *const u8 }; + | ~~~~~~~~~~ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-recursive.rs:19:20 diff --git a/tests/ui/structs/struct-fields-hints-no-dupe.stderr b/tests/ui/structs/struct-fields-hints-no-dupe.stderr index 650f6ddfa88b0..2b88d802833c3 100644 --- a/tests/ui/structs/struct-fields-hints-no-dupe.stderr +++ b/tests/ui/structs/struct-fields-hints-no-dupe.stderr @@ -6,9 +6,8 @@ LL | bar : 42, | help: a field with a similar name exists | -LL - bar : 42, -LL + barr : 42, - | +LL | barr : 42, + | ~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/bound-suggestions.stderr b/tests/ui/suggestions/bound-suggestions.stderr index 51a6a51e7da92..e30deb11398e6 100644 --- a/tests/ui/suggestions/bound-suggestions.stderr +++ b/tests/ui/suggestions/bound-suggestions.stderr @@ -43,9 +43,8 @@ LL | println!("{:?} {:?}", x, y); = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting type parameter `Y` with trait `Debug` | -LL - fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug, { -LL + fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug { - | +LL | fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug { + | ~~~~~~~~~~~~~~~~~~~~ error[E0277]: `X` doesn't implement `Debug` --> $DIR/bound-suggestions.rs:33:22 diff --git a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr index 55a353c40ca30..4f92d3aceefe0 100644 --- a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr +++ b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr @@ -12,9 +12,8 @@ LL | const A: i32 = 2; = note: the matched value is of type `i32` help: introduce a variable instead | -LL - let A = 3; -LL + let A_var = 3; - | +LL | let A_var = 3; + | ~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/crate-or-module-typo.stderr b/tests/ui/suggestions/crate-or-module-typo.stderr index 0ca0582105be0..cbe765731b46c 100644 --- a/tests/ui/suggestions/crate-or-module-typo.stderr +++ b/tests/ui/suggestions/crate-or-module-typo.stderr @@ -6,9 +6,8 @@ LL | use st::cell::Cell; | help: there is a crate or module with a similar name | -LL - use st::cell::Cell; -LL + use std::cell::Cell; - | +LL | use std::cell::Cell; + | ~~~ error[E0432]: unresolved import `bas` --> $DIR/crate-or-module-typo.rs:11:5 @@ -30,9 +29,8 @@ LL | bar: st::cell::Cell | help: there is a crate or module with a similar name | -LL - bar: st::cell::Cell -LL + bar: std::cell::Cell - | +LL | bar: std::cell::Cell + | ~~~ help: consider importing this module | LL + use std::cell; diff --git a/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr b/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr index ac93c5df05e0d..a58c2a584f75e 100644 --- a/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr +++ b/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr @@ -20,9 +20,8 @@ LL | fn foo(&self) where Self: Other, { } | +++++ help: alternatively, consider constraining `foo` so it does not apply to trait objects | -LL - fn foo() where Self: Other, { } -LL + fn foo() where Self: Other, Self: Sized { } - | +LL | fn foo() where Self: Other, Self: Sized { } + | ~~~~~~~~~~~~~ help: consider changing method `bar`'s `self` parameter to be `&self` | LL - fn bar(self: ()) {} diff --git a/tests/ui/suggestions/field-access.stderr b/tests/ui/suggestions/field-access.stderr index 4696950930f33..7d816b5bfdd17 100644 --- a/tests/ui/suggestions/field-access.stderr +++ b/tests/ui/suggestions/field-access.stderr @@ -11,9 +11,8 @@ LL | if let B::Fst = a {}; | help: you might have meant to use field `b` whose type is `B` | -LL - if let B::Fst = a {}; -LL + if let B::Fst = a.b {}; - | +LL | if let B::Fst = a.b {}; + | ~~~ error[E0308]: mismatched types --> $DIR/field-access.rs:25:9 @@ -29,9 +28,8 @@ LL | B::Fst => (), | help: you might have meant to use field `b` whose type is `B` | -LL - match a { -LL + match a.b { - | +LL | match a.b { + | ~~~ error[E0308]: mismatched types --> $DIR/field-access.rs:26:9 @@ -47,9 +45,8 @@ LL | B::Snd => (), | help: you might have meant to use field `b` whose type is `B` | -LL - match a { -LL + match a.b { - | +LL | match a.b { + | ~~~ error[E0308]: mismatched types --> $DIR/field-access.rs:32:9 diff --git a/tests/ui/suggestions/imm-ref-trait-object-literal.stderr b/tests/ui/suggestions/imm-ref-trait-object-literal.stderr index 90dee9005abae..79fa468dc4947 100644 --- a/tests/ui/suggestions/imm-ref-trait-object-literal.stderr +++ b/tests/ui/suggestions/imm-ref-trait-object-literal.stderr @@ -14,9 +14,8 @@ LL | fn foo(_: X) {} | ^^^^^ required by this bound in `foo` help: consider changing this borrow's mutability | -LL - foo(&s); -LL + foo(&mut s); - | +LL | foo(&mut s); + | ~~~~ error[E0277]: the trait bound `S: Trait` is not satisfied --> $DIR/imm-ref-trait-object-literal.rs:13:7 diff --git a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr index 299cf1d74d51d..89cda2a56e064 100644 --- a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr +++ b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr @@ -11,9 +11,8 @@ LL | fn g(mut x: impl Iterator) -> Option<&'static ()> { x.next( | +++++++ help: consider introducing a named lifetime parameter | -LL - fn g(mut x: impl Iterator) -> Option<&()> { x.next() } -LL + fn g<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } - | +LL | fn g<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } + | ++++ ~~~ ~~~ help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Iterator) -> Option<&()> { x.next() } @@ -33,9 +32,8 @@ LL | async fn i(mut x: impl Iterator) -> Option<&'static ()> { x | +++++++ help: consider introducing a named lifetime parameter | -LL - async fn i(mut x: impl Iterator) -> Option<&()> { x.next() } -LL + async fn i<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } - | +LL | async fn i<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } + | ++++ ~~~ ~~~ help: alternatively, you might want to return an owned value | LL - async fn i(mut x: impl Iterator) -> Option<&()> { x.next() } @@ -101,9 +99,8 @@ LL | fn g(mut x: impl Foo) -> Option<&'static ()> { x.next() } | +++++++ help: consider introducing a named lifetime parameter | -LL - fn g(mut x: impl Foo) -> Option<&()> { x.next() } -LL + fn g<'a>(mut x: impl Foo) -> Option<&'a ()> { x.next() } - | +LL | fn g<'a>(mut x: impl Foo) -> Option<&'a ()> { x.next() } + | ++++ ~~~ help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Foo) -> Option<&()> { x.next() } @@ -123,9 +120,8 @@ LL | fn g(mut x: impl Foo<()>) -> Option<&'static ()> { x.next() } | +++++++ help: consider introducing a named lifetime parameter | -LL - fn g(mut x: impl Foo<()>) -> Option<&()> { x.next() } -LL + fn g<'a>(mut x: impl Foo<()>) -> Option<&'a ()> { x.next() } - | +LL | fn g<'a>(mut x: impl Foo<()>) -> Option<&'a ()> { x.next() } + | ++++ ~~~ help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Foo<()>) -> Option<&()> { x.next() } diff --git a/tests/ui/suggestions/recover-missing-turbofish-surrounding-angle-braket.stderr b/tests/ui/suggestions/recover-missing-turbofish-surrounding-angle-braket.stderr index 06f465e9c0d23..d43d1f9bb7e8a 100644 --- a/tests/ui/suggestions/recover-missing-turbofish-surrounding-angle-braket.stderr +++ b/tests/ui/suggestions/recover-missing-turbofish-surrounding-angle-braket.stderr @@ -41,9 +41,8 @@ LL | let _ = vec![1, 2, 3].into_iter().collect::Vec<_>>(); | help: surround the type parameters with angle brackets | -LL - let _ = vec![1, 2, 3].into_iter().collect::Vec<_>>(); -LL + let _ = vec![1, 2, 3].into_iter().collect::>(); - | +LL | let _ = vec![1, 2, 3].into_iter().collect::>(); + | + error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/struct-field-type-including-single-colon.stderr b/tests/ui/suggestions/struct-field-type-including-single-colon.stderr index 247454b8710c9..4dd514480da40 100644 --- a/tests/ui/suggestions/struct-field-type-including-single-colon.stderr +++ b/tests/ui/suggestions/struct-field-type-including-single-colon.stderr @@ -6,9 +6,8 @@ LL | a: foo:A, | help: write a path separator here | -LL - a: foo:A, -LL + a: foo::A, - | +LL | a: foo::A, + | ~~ error: expected `,`, or `}`, found `:` --> $DIR/struct-field-type-including-single-colon.rs:9:11 @@ -26,9 +25,8 @@ LL | b: foo::bar:B, | help: write a path separator here | -LL - b: foo::bar:B, -LL + b: foo::bar::B, - | +LL | b: foo::bar::B, + | ~~ error: expected `,`, or `}`, found `:` --> $DIR/struct-field-type-including-single-colon.rs:15:16 diff --git a/tests/ui/suggestions/suggest-change-mut.stderr b/tests/ui/suggestions/suggest-change-mut.stderr index 5315456efea84..216d1e810fd72 100644 --- a/tests/ui/suggestions/suggest-change-mut.stderr +++ b/tests/ui/suggestions/suggest-change-mut.stderr @@ -19,9 +19,8 @@ LL | fn issue_81421(mut stream: T) where &T: std::io::Read { | +++++++++++++++++++++++ help: consider changing this borrow's mutability | -LL - let mut stream_reader = BufReader::new(&stream); -LL + let mut stream_reader = BufReader::new(&mut stream); - | +LL | let mut stream_reader = BufReader::new(&mut stream); + | ~~~~ error[E0599]: the method `read_until` exists for struct `BufReader<&T>`, but its trait bounds were not satisfied --> $DIR/suggest-change-mut.rs:16:23 diff --git a/tests/ui/suggestions/suggest-methods.stderr b/tests/ui/suggestions/suggest-methods.stderr index 6f1c2cc4cab09..f9f6e5f86fc96 100644 --- a/tests/ui/suggestions/suggest-methods.stderr +++ b/tests/ui/suggestions/suggest-methods.stderr @@ -45,9 +45,8 @@ LL | let _ = 63u32.count_o(); | help: there is a method `count_ones` with a similar name | -LL - let _ = 63u32.count_o(); -LL + let _ = 63u32.count_ones(); - | +LL | let _ = 63u32.count_ones(); + | ~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/suggest-variants.stderr b/tests/ui/suggestions/suggest-variants.stderr index b422da8fbfac1..7d62604e23f1e 100644 --- a/tests/ui/suggestions/suggest-variants.stderr +++ b/tests/ui/suggestions/suggest-variants.stderr @@ -24,9 +24,8 @@ LL | println!("My shape is {:?}", Shape::Circl { size: 5}); | help: there is a variant with a similar name | -LL - println!("My shape is {:?}", Shape::Circl { size: 5}); -LL + println!("My shape is {:?}", Shape::Circle { size: 5}); - | +LL | println!("My shape is {:?}", Shape::Circle { size: 5}); + | ~~~~~~ error[E0599]: no variant named `Rombus` found for enum `Shape` --> $DIR/suggest-variants.rs:14:41 @@ -63,9 +62,8 @@ LL | Shape::Circl; | help: there is a variant with a similar name | -LL - Shape::Circl; -LL + Shape::Circle { radius: /* value */ }; - | +LL | Shape::Circle { radius: /* value */ }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no variant or associated item named `Rombus` found for enum `Shape` in the current scope --> $DIR/suggest-variants.rs:17:12 diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr b/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr index 70e8f5b58acb3..ba0682cda3212 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr @@ -7,9 +7,8 @@ LL | let _ = vec![Ok(2)].into_iter().collect:,_>>()?; = note: type ascription syntax has been removed, see issue #101728 help: maybe write a path separator here | -LL - let _ = vec![Ok(2)].into_iter().collect:,_>>()?; -LL + let _ = vec![Ok(2)].into_iter().collect::,_>>()?; - | +LL | let _ = vec![Ok(2)].into_iter().collect::,_>>()?; + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr index 5ba56d095f73d..56b6a69a283f4 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr @@ -6,9 +6,8 @@ LL | let _: Vec = A::B; | help: you might have meant to write a path instead of an associated type bound | -LL - let _: Vec = A::B; -LL + let _: Vec = A::B; - | +LL | let _: Vec = A::B; + | ~~ error[E0107]: struct takes at least 1 generic argument but 0 generic arguments were supplied --> $DIR/type-ascription-instead-of-path-in-type.rs:6:12 diff --git a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr index 1117ee7efb30d..40e16dde6e4a4 100644 --- a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr +++ b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr @@ -25,9 +25,8 @@ LL | for F: 'a, | ^^ help: consider adding an explicit lifetime bound | -LL - for F: 'a, -LL + for F: 'a, !1_"F": 'a - | +LL | for F: 'a, !1_"F": 'a + | ~~~~~~~~~~~~ error[E0309]: the placeholder type `!1_"F"` may not live long enough --> $DIR/type-match-with-late-bound.rs:11:1 @@ -40,9 +39,8 @@ LL | {} | help: consider adding an explicit lifetime bound | -LL - for F: 'a, -LL + for F: 'a, !1_"F": 'a - | +LL | for F: 'a, !1_"F": 'a + | ~~~~~~~~~~~~ error[E0309]: the placeholder type `!2_"F"` may not live long enough --> $DIR/type-match-with-late-bound.rs:11:1 @@ -55,9 +53,8 @@ LL | {} | help: consider adding an explicit lifetime bound | -LL - for F: 'a, -LL + for F: 'a, !2_"F": 'a - | +LL | for F: 'a, !2_"F": 'a + | ~~~~~~~~~~~~ error: aborting due to 3 previous errors; 1 warning emitted diff --git a/tests/ui/transmutability/assoc-bound.stderr b/tests/ui/transmutability/assoc-bound.stderr index 4ff67bd636ada..b3c7680bf2949 100644 --- a/tests/ui/transmutability/assoc-bound.stderr +++ b/tests/ui/transmutability/assoc-bound.stderr @@ -12,9 +12,8 @@ LL | type AssocB: std::mem::TransmuteFrom<()>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `B::AssocB` help: consider further restricting the associated type | -LL - T: A, -LL + T: A, ::AssocA: TransmuteFrom<(), Assume { alignment: false, lifetimes: false, safety: false, validity: false }> - | +LL | T: A, ::AssocA: TransmuteFrom<(), Assume { alignment: false, lifetimes: false, safety: false, validity: false }> + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0277]: `()` cannot be safely transmuted into `<&i32 as A>::AssocA` --> $DIR/assoc-bound.rs:24:19 diff --git a/tests/ui/typeck/issue-29181.stderr b/tests/ui/typeck/issue-29181.stderr index e73c3e5188183..53addf2fe4d09 100644 --- a/tests/ui/typeck/issue-29181.stderr +++ b/tests/ui/typeck/issue-29181.stderr @@ -12,9 +12,8 @@ LL | let _ = |x: f64| x * 2.0.exp(); | help: you must specify a concrete type for this numeric value, like `f32` | -LL - let _ = |x: f64| x * 2.0.exp(); -LL + let _ = |x: f64| x * 2.0_f32.exp(); - | +LL | let _ = |x: f64| x * 2.0_f32.exp(); + | ~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/method-chain-gats.stderr b/tests/ui/typeck/method-chain-gats.stderr index 902255a28a621..6338379221471 100644 --- a/tests/ui/typeck/method-chain-gats.stderr +++ b/tests/ui/typeck/method-chain-gats.stderr @@ -19,9 +19,8 @@ LL | Self::Base: Functor; | ^^^^^^^^^^ required by this bound in `Functor::fmap` help: consider further restricting the associated type | -LL - T::Base: Functor = T::Base>, -LL + T::Base: Functor = T::Base>, ::Base: Functor - | +LL | T::Base: Functor = T::Base>, ::Base: Functor + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error From ccec268d6a59b8ee1308a461a9ec1e1eecd35592 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Thu, 13 Feb 2025 03:07:18 +0000 Subject: [PATCH 07/19] Consider add-prefix replacements too --- compiler/rustc_errors/src/lib.rs | 7 ++- .../2229_closure_analysis/issue-118144.stderr | 5 +- .../ui/empty/empty-struct-braces-expr.stderr | 5 +- .../error-recovery-issue-55897.stderr | 5 +- tests/ui/error-codes/E0027.stderr | 15 ++--- ...-gate-unboxed-closures-manual-impls.stderr | 5 +- ...est-import-issue-120074.edition2015.stderr | 5 +- ...est-import-issue-120074.edition2021.stderr | 5 +- .../issue-57741.stderr | 20 +++---- .../let-else/let-else-deref-coercion.stderr | 10 ++-- tests/ui/lexer/lex-bad-char-literals-1.stderr | 5 +- .../lifetimes/borrowck-let-suggestion.stderr | 5 +- .../lint-strict-provenance-lossy-casts.stderr | 5 +- tests/ui/match/issue-56685.stderr | 20 +++---- tests/ui/mismatched_types/issue-112036.stderr | 5 +- tests/ui/namespace/namespace-mix.stderr | 20 +++---- tests/ui/object-pointer-types.stderr | 5 +- tests/ui/parser/bad-char-literals.stderr | 5 +- .../bad-escape-suggest-raw-string.stderr | 5 +- tests/ui/parser/byte-literals.stderr | 5 +- ...sue-65257-invalid-var-decl-recovery.stderr | 10 ++-- .../issues/issue-87086-colon-path-sep.stderr | 15 ++--- .../parser/type-ascription-in-pattern.stderr | 10 ++-- .../usefulness/doc-hidden-fields.stderr | 45 ++++++-------- .../usefulness/stable-gated-fields.stderr | 15 ++--- tests/ui/privacy/suggest-box-new.stderr | 10 ++-- tests/ui/pub/pub-restricted.stderr | 25 ++++---- .../const-with-typo-in-pattern-binding.stderr | 5 +- .../resolve/resolve-inconsistent-names.stderr | 10 ++-- .../rfc-2008-non-exhaustive/struct.stderr | 15 ++--- .../rfc-2008-non-exhaustive/variant.stderr | 10 ++-- .../not-allowed.stderr | 5 +- .../rust-2018/trait-import-suggestions.stderr | 5 +- .../structs/struct-pat-derived-error.stderr | 15 ++--- .../structs/struct-tuple-field-names.stderr | 15 ++--- ...ing-field-when-specifying-same-type.stderr | 60 ++++++++----------- ...suggest-deref-in-match-issue-132784.stderr | 50 +++++++--------- .../type-mismatch-byte-literal.stderr | 15 ++--- .../inaccessible-test-modules.stderr | 5 +- .../assoc_type_bound_with_struct.stderr | 20 +++---- tests/ui/type/issue-100584.stderr | 10 ++-- .../pattern_type_mismatch.stderr | 10 ++-- .../typeck/mismatched-map-under-self.stderr | 5 +- .../unresolved/unresolved-candidates.stderr | 5 +- 44 files changed, 222 insertions(+), 330 deletions(-) diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 4a186565a7bfc..855b9734cdc5e 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -236,9 +236,10 @@ impl SubstitutionPart { /// it with "abx" is, since the "c" character is lost. pub fn is_destructive_replacement(&self, sm: &SourceMap) -> bool { self.is_replacement(sm) - && !sm - .span_to_snippet(self.span) - .is_ok_and(|snippet| self.snippet.trim_start().starts_with(snippet.trim_start())) + && !sm.span_to_snippet(self.span).is_ok_and(|snippet| { + self.snippet.trim_start().starts_with(snippet.trim_start()) + || self.snippet.trim_end().ends_with(snippet.trim_end()) + }) } fn replaces_meaningful_content(&self, sm: &SourceMap) -> bool { diff --git a/tests/ui/closures/2229_closure_analysis/issue-118144.stderr b/tests/ui/closures/2229_closure_analysis/issue-118144.stderr index f717343122ee3..87084e6023729 100644 --- a/tests/ui/closures/2229_closure_analysis/issue-118144.stderr +++ b/tests/ui/closures/2229_closure_analysis/issue-118144.stderr @@ -8,9 +8,8 @@ LL | V(x) = func_arg; | help: consider dereferencing to access the inner value using the Deref trait | -LL - V(x) = func_arg; -LL + V(x) = &*func_arg; - | +LL | V(x) = &*func_arg; + | ~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/empty/empty-struct-braces-expr.stderr b/tests/ui/empty/empty-struct-braces-expr.stderr index 140b6e009b7a2..cdedb3f20aab3 100644 --- a/tests/ui/empty/empty-struct-braces-expr.stderr +++ b/tests/ui/empty/empty-struct-braces-expr.stderr @@ -125,9 +125,8 @@ LL | let xe3 = XE::Empty3; | help: there is a variant with a similar name | -LL - let xe3 = XE::Empty3; -LL + let xe3 = XE::XEmpty3; - | +LL | let xe3 = XE::XEmpty3; + | ~~~~~~~ error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope --> $DIR/empty-struct-braces-expr.rs:26:19 diff --git a/tests/ui/env-macro/error-recovery-issue-55897.stderr b/tests/ui/env-macro/error-recovery-issue-55897.stderr index cda9aa330d221..5a20bf8b16869 100644 --- a/tests/ui/env-macro/error-recovery-issue-55897.stderr +++ b/tests/ui/env-macro/error-recovery-issue-55897.stderr @@ -30,9 +30,8 @@ LL | use env; | help: consider importing this module instead | -LL - use env; -LL + use std::env; - | +LL | use std::env; + | ~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/error-codes/E0027.stderr b/tests/ui/error-codes/E0027.stderr index 701e636dc581c..4a102629ad504 100644 --- a/tests/ui/error-codes/E0027.stderr +++ b/tests/ui/error-codes/E0027.stderr @@ -6,19 +6,16 @@ LL | Dog { age: x } => {} | help: include the missing field in the pattern | -LL - Dog { age: x } => {} -LL + Dog { age: x, name } => {} - | +LL | Dog { age: x, name } => {} + | ~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - Dog { age: x } => {} -LL + Dog { age: x, name: _ } => {} - | +LL | Dog { age: x, name: _ } => {} + | ~~~~~~~~~~~ help: or always ignore missing fields here | -LL - Dog { age: x } => {} -LL + Dog { age: x, .. } => {} - | +LL | Dog { age: x, .. } => {} + | ~~~~~~ error[E0027]: pattern does not mention field `age` --> $DIR/E0027.rs:15:9 diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr index 7271ca48877ab..a50e5f2f73d90 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr @@ -95,9 +95,8 @@ LL | extern "rust-call" fn call(self, args: ()) -> () {} found signature `extern "rust-call" fn(Foo, ()) -> ()` help: change the self-receiver type to match the trait | -LL - extern "rust-call" fn call(self, args: ()) -> () {} -LL + extern "rust-call" fn call(&self, args: ()) -> () {} - | +LL | extern "rust-call" fn call(&self, args: ()) -> () {} + | ~~~~~ error[E0183]: manual implementations of `FnOnce` are experimental --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6 diff --git a/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr b/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr index c9cfe769aeb29..414eeee0fedc8 100644 --- a/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr +++ b/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr @@ -6,9 +6,8 @@ LL | println!("Hello, {}!", crate::bar::do_the_thing); | help: a similar path exists | -LL - println!("Hello, {}!", crate::bar::do_the_thing); -LL + println!("Hello, {}!", crate::foo::bar::do_the_thing); - | +LL | println!("Hello, {}!", crate::foo::bar::do_the_thing); + | ~~~~~~~~ help: consider importing this module | LL + use foo::bar; diff --git a/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr b/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr index c9cfe769aeb29..414eeee0fedc8 100644 --- a/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr +++ b/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr @@ -6,9 +6,8 @@ LL | println!("Hello, {}!", crate::bar::do_the_thing); | help: a similar path exists | -LL - println!("Hello, {}!", crate::bar::do_the_thing); -LL + println!("Hello, {}!", crate::foo::bar::do_the_thing); - | +LL | println!("Hello, {}!", crate::foo::bar::do_the_thing); + | ~~~~~~~~ help: consider importing this module | LL + use foo::bar; diff --git a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr index 713a19f6cb0f7..3c19b68cffbb3 100644 --- a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr +++ b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr @@ -10,9 +10,8 @@ LL | T::A(a) | T::B(a) => a, found enum `T` help: consider dereferencing the boxed value | -LL - let y = match x { -LL + let y = match *x { - | +LL | let y = match *x { + | ~~ error[E0308]: mismatched types --> $DIR/issue-57741.rs:20:19 @@ -26,9 +25,8 @@ LL | T::A(a) | T::B(a) => a, found enum `T` help: consider dereferencing the boxed value | -LL - let y = match x { -LL + let y = match *x { - | +LL | let y = match *x { + | ~~ error[E0308]: mismatched types --> $DIR/issue-57741.rs:27:9 @@ -42,9 +40,8 @@ LL | S::A { a } | S::B { b: a } => a, found enum `S` help: consider dereferencing the boxed value | -LL - let y = match x { -LL + let y = match *x { - | +LL | let y = match *x { + | ~~ error[E0308]: mismatched types --> $DIR/issue-57741.rs:27:22 @@ -58,9 +55,8 @@ LL | S::A { a } | S::B { b: a } => a, found enum `S` help: consider dereferencing the boxed value | -LL - let y = match x { -LL + let y = match *x { - | +LL | let y = match *x { + | ~~ error: aborting due to 4 previous errors diff --git a/tests/ui/let-else/let-else-deref-coercion.stderr b/tests/ui/let-else/let-else-deref-coercion.stderr index 07347af76e4d3..da8b1f4c48e97 100644 --- a/tests/ui/let-else/let-else-deref-coercion.stderr +++ b/tests/ui/let-else/let-else-deref-coercion.stderr @@ -8,9 +8,8 @@ LL | let Bar::Present(z) = self else { | help: consider dereferencing to access the inner value using the Deref trait | -LL - let Bar::Present(z) = self else { -LL + let Bar::Present(z) = &**self else { - | +LL | let Bar::Present(z) = &**self else { + | ~~~~~~~ error[E0308]: mismatched types --> $DIR/let-else-deref-coercion.rs:68:13 @@ -22,9 +21,8 @@ LL | let Bar(z) = x; | help: consider dereferencing to access the inner value using the Deref trait | -LL - let Bar(z) = x; -LL + let Bar(z) = &**x; - | +LL | let Bar(z) = &**x; + | ~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/lexer/lex-bad-char-literals-1.stderr b/tests/ui/lexer/lex-bad-char-literals-1.stderr index 49683c10237b3..bf13df90be335 100644 --- a/tests/ui/lexer/lex-bad-char-literals-1.stderr +++ b/tests/ui/lexer/lex-bad-char-literals-1.stderr @@ -32,9 +32,8 @@ LL | "\●" = help: for more information, visit help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal | -LL - "\●" -LL + r"\●" - | +LL | r"\●" + | ~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/lifetimes/borrowck-let-suggestion.stderr b/tests/ui/lifetimes/borrowck-let-suggestion.stderr index e0adb16414059..cca7f52957e4c 100644 --- a/tests/ui/lifetimes/borrowck-let-suggestion.stderr +++ b/tests/ui/lifetimes/borrowck-let-suggestion.stderr @@ -12,9 +12,8 @@ LL | x.use_mut(); = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider consuming the `Vec` when turning it into an `Iterator` | -LL - let mut x = vec![1].iter(); -LL + let mut x = vec![1].into_iter(); - | +LL | let mut x = vec![1].into_iter(); + | ~~~~~~~~~ help: consider using a `let` binding to create a longer lived value | LL ~ let binding = vec![1]; diff --git a/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr b/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr index aeee69ae7afa1..1f528bdb28ff4 100644 --- a/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr +++ b/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr @@ -25,9 +25,8 @@ LL | let addr_32bit = &x as *const u8 as u32; = help: if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_provenance()` instead help: use `.addr()` to obtain the address of a pointer | -LL - let addr_32bit = &x as *const u8 as u32; -LL + let addr_32bit = (&x as *const u8).addr() as u32; - | +LL | let addr_32bit = (&x as *const u8).addr() as u32; + | + ~~~~~~~~~~~~~~~ error: under strict provenance it is considered bad style to cast pointer `*const u8` to integer `usize` --> $DIR/lint-strict-provenance-lossy-casts.rs:14:20 diff --git a/tests/ui/match/issue-56685.stderr b/tests/ui/match/issue-56685.stderr index 9655a38081165..ccf357d4aa00e 100644 --- a/tests/ui/match/issue-56685.stderr +++ b/tests/ui/match/issue-56685.stderr @@ -11,9 +11,8 @@ LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore | -LL - E::A(x) | E::B(x) => {} -LL + E::A(_x) | E::B(_x) => {} - | +LL | E::A(_x) | E::B(_x) => {} + | ~~ ~~ error: unused variable: `x` --> $DIR/issue-56685.rs:25:14 @@ -23,9 +22,8 @@ LL | F::A(x, y) | F::B(x, y) => { y }, | help: if this is intentional, prefix it with an underscore | -LL - F::A(x, y) | F::B(x, y) => { y }, -LL + F::A(_x, y) | F::B(_x, y) => { y }, - | +LL | F::A(_x, y) | F::B(_x, y) => { y }, + | ~~ ~~ error: unused variable: `a` --> $DIR/issue-56685.rs:27:14 @@ -47,9 +45,8 @@ LL | let _ = if let F::A(x, y) | F::B(x, y) = F::A(1, 2) { | help: if this is intentional, prefix it with an underscore | -LL - let _ = if let F::A(x, y) | F::B(x, y) = F::A(1, 2) { -LL + let _ = if let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { - | +LL | let _ = if let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { + | ~~ ~~ error: unused variable: `x` --> $DIR/issue-56685.rs:39:20 @@ -59,9 +56,8 @@ LL | while let F::A(x, y) | F::B(x, y) = F::A(1, 2) { | help: if this is intentional, prefix it with an underscore | -LL - while let F::A(x, y) | F::B(x, y) = F::A(1, 2) { -LL + while let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { - | +LL | while let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { + | ~~ ~~ error: aborting due to 6 previous errors diff --git a/tests/ui/mismatched_types/issue-112036.stderr b/tests/ui/mismatched_types/issue-112036.stderr index 29559980cb45e..bd446b3d78cb2 100644 --- a/tests/ui/mismatched_types/issue-112036.stderr +++ b/tests/ui/mismatched_types/issue-112036.stderr @@ -8,9 +8,8 @@ LL | fn drop(self) {} found signature `fn(Foo)` help: change the self-receiver type to match the trait | -LL - fn drop(self) {} -LL + fn drop(&mut self) {} - | +LL | fn drop(&mut self) {} + | ~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/namespace/namespace-mix.stderr b/tests/ui/namespace/namespace-mix.stderr index 41891c5144ba7..b80363fe8f848 100644 --- a/tests/ui/namespace/namespace-mix.stderr +++ b/tests/ui/namespace/namespace-mix.stderr @@ -10,9 +10,8 @@ LL | check(m1::S); = note: can't use a type alias as a constructor help: a tuple struct with a similar name exists | -LL - check(m1::S); -LL + check(m1::TS); - | +LL | check(m1::TS); + | ~~ help: consider importing one of these constants instead | LL + use m2::S; @@ -39,9 +38,8 @@ LL | pub struct TS(); = note: can't use a type alias as a constructor help: a tuple struct with a similar name exists | -LL - check(xm1::S); -LL + check(xm1::TS); - | +LL | check(xm1::TS); + | ~~ help: consider importing one of these constants instead | LL + use m2::S; @@ -66,9 +64,8 @@ LL | check(m7::V); = note: can't use a type alias as a constructor help: a tuple variant with a similar name exists | -LL - check(m7::V); -LL + check(m7::TV); - | +LL | check(m7::TV); + | ~~ help: consider importing one of these constants instead | LL + use m8::V; @@ -95,9 +92,8 @@ LL | TV(), = note: can't use a type alias as a constructor help: a tuple variant with a similar name exists | -LL - check(xm7::V); -LL + check(xm7::TV); - | +LL | check(xm7::TV); + | ~~ help: consider importing one of these constants instead | LL + use m8::V; diff --git a/tests/ui/object-pointer-types.stderr b/tests/ui/object-pointer-types.stderr index 7e3a13dd90bef..7d915ebdab657 100644 --- a/tests/ui/object-pointer-types.stderr +++ b/tests/ui/object-pointer-types.stderr @@ -9,9 +9,8 @@ LL | x.owned(); | help: there is a method `to_owned` with a similar name | -LL - x.owned(); -LL + x.to_owned(); - | +LL | x.to_owned(); + | ~~~~~~~~ error[E0599]: no method named `owned` found for mutable reference `&mut dyn Foo` in the current scope --> $DIR/object-pointer-types.rs:17:7 diff --git a/tests/ui/parser/bad-char-literals.stderr b/tests/ui/parser/bad-char-literals.stderr index 3513055cb550b..1b047aa46193b 100644 --- a/tests/ui/parser/bad-char-literals.stderr +++ b/tests/ui/parser/bad-char-literals.stderr @@ -6,9 +6,8 @@ LL | '''; | help: escape the character | -LL - '''; -LL + '\''; - | +LL | '\''; + | ~~ error: character constant must be escaped: `\n` --> $DIR/bad-char-literals.rs:10:6 diff --git a/tests/ui/parser/bad-escape-suggest-raw-string.stderr b/tests/ui/parser/bad-escape-suggest-raw-string.stderr index 5afa1f4a7f800..6dd4ad512a8e3 100644 --- a/tests/ui/parser/bad-escape-suggest-raw-string.stderr +++ b/tests/ui/parser/bad-escape-suggest-raw-string.stderr @@ -7,9 +7,8 @@ LL | let bad = "ab\[c"; = help: for more information, visit help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal | -LL - let bad = "ab\[c"; -LL + let bad = r"ab\[c"; - | +LL | let bad = r"ab\[c"; + | ~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/byte-literals.stderr b/tests/ui/parser/byte-literals.stderr index fe3cfb23de85b..9e1c2df3e56ef 100644 --- a/tests/ui/parser/byte-literals.stderr +++ b/tests/ui/parser/byte-literals.stderr @@ -39,9 +39,8 @@ LL | b'''; | help: escape the character | -LL - b'''; -LL + b'\''; - | +LL | b'\''; + | ~~ error: non-ASCII character in byte literal --> $DIR/byte-literals.rs:10:7 diff --git a/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr b/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr index 767f63d69582f..7fc2db0fa5591 100644 --- a/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr +++ b/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr @@ -54,9 +54,8 @@ LL | mut n = 0; | help: missing keyword | -LL - mut n = 0; -LL + let mut n = 0; - | +LL | let mut n = 0; + | ~~~~~~~ error: invalid variable declaration --> $DIR/issue-65257-invalid-var-decl-recovery.rs:16:5 @@ -66,9 +65,8 @@ LL | mut var; | help: missing keyword | -LL - mut var; -LL + let mut var; - | +LL | let mut var; + | ~~~~~~~ error[E0308]: mismatched types --> $DIR/issue-65257-invalid-var-decl-recovery.rs:20:33 diff --git a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr index f6330e51e0dce..b6e24faf5dabb 100644 --- a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr +++ b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr @@ -47,9 +47,8 @@ LL | qux: Foo::Baz if true => {} | help: maybe write a path separator here | -LL - qux: Foo::Baz if true => {} -LL + qux::Foo::Baz if true => {} - | +LL | qux::Foo::Baz if true => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:40:15 @@ -74,9 +73,8 @@ LL | ref qux: Foo::Baz => {} | help: maybe write a path separator here | -LL - ref qux: Foo::Baz => {} -LL + ref qux::Foo::Baz => {} - | +LL | ref qux::Foo::Baz => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:58:16 @@ -88,9 +86,8 @@ LL | mut qux: Foo::Baz => {} | help: maybe write a path separator here | -LL - mut qux: Foo::Baz => {} -LL + mut qux::Foo::Baz => {} - | +LL | mut qux::Foo::Baz => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:69:12 diff --git a/tests/ui/parser/type-ascription-in-pattern.stderr b/tests/ui/parser/type-ascription-in-pattern.stderr index d29c76baa7b53..0919075499368 100644 --- a/tests/ui/parser/type-ascription-in-pattern.stderr +++ b/tests/ui/parser/type-ascription-in-pattern.stderr @@ -8,9 +8,8 @@ LL | x: i32 => x, | help: maybe write a path separator here | -LL - x: i32 => x, -LL + x::i32 => x, - | +LL | x::i32 => x, + | ~~ error: expected one of `...`, `..=`, `..`, or `|`, found `:` --> $DIR/type-ascription-in-pattern.rs:12:11 @@ -38,9 +37,8 @@ LL | x: i32 => (), | help: maybe write a path separator here | -LL - x: i32 => (), -LL + x::i32 => (), - | +LL | x::i32 => (), + | ~~ error[E0308]: mismatched types --> $DIR/type-ascription-in-pattern.rs:3:19 diff --git a/tests/ui/pattern/usefulness/doc-hidden-fields.stderr b/tests/ui/pattern/usefulness/doc-hidden-fields.stderr index 2f53ebe6f3f58..158eac9a1bd14 100644 --- a/tests/ui/pattern/usefulness/doc-hidden-fields.stderr +++ b/tests/ui/pattern/usefulness/doc-hidden-fields.stderr @@ -17,19 +17,16 @@ LL | let HiddenStruct { one } = HiddenStruct::default(); | help: include the missing field in the pattern and ignore the inaccessible fields | -LL - let HiddenStruct { one } = HiddenStruct::default(); -LL + let HiddenStruct { one, two, .. } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, two, .. } = HiddenStruct::default(); + | ~~~~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - let HiddenStruct { one } = HiddenStruct::default(); -LL + let HiddenStruct { one, two: _, .. } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, two: _, .. } = HiddenStruct::default(); + | ~~~~~~~~~~~~~~ help: or always ignore missing fields here | -LL - let HiddenStruct { one } = HiddenStruct::default(); -LL + let HiddenStruct { one, .. } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, .. } = HiddenStruct::default(); + | ~~~~~~ error[E0027]: pattern does not mention field `two` --> $DIR/doc-hidden-fields.rs:21:9 @@ -39,19 +36,16 @@ LL | let HiddenStruct { one, hide } = HiddenStruct::default(); | help: include the missing field in the pattern | -LL - let HiddenStruct { one, hide } = HiddenStruct::default(); -LL + let HiddenStruct { one, hide, two } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, hide, two } = HiddenStruct::default(); + | ~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - let HiddenStruct { one, hide } = HiddenStruct::default(); -LL + let HiddenStruct { one, hide, two: _ } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, hide, two: _ } = HiddenStruct::default(); + | ~~~~~~~~~~ help: or always ignore missing fields here | -LL - let HiddenStruct { one, hide } = HiddenStruct::default(); -LL + let HiddenStruct { one, hide, .. } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, hide, .. } = HiddenStruct::default(); + | ~~~~~~ error[E0027]: pattern does not mention field `im_hidden` --> $DIR/doc-hidden-fields.rs:24:9 @@ -61,19 +55,16 @@ LL | let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; | help: include the missing field in the pattern | -LL - let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; -LL + let InCrate { a, b, im_hidden } = InCrate { a: 0, b: false, im_hidden: 0 }; - | +LL | let InCrate { a, b, im_hidden } = InCrate { a: 0, b: false, im_hidden: 0 }; + | ~~~~~~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; -LL + let InCrate { a, b, im_hidden: _ } = InCrate { a: 0, b: false, im_hidden: 0 }; - | +LL | let InCrate { a, b, im_hidden: _ } = InCrate { a: 0, b: false, im_hidden: 0 }; + | ~~~~~~~~~~~~~~~~ help: or always ignore missing fields here | -LL - let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; -LL + let InCrate { a, b, .. } = InCrate { a: 0, b: false, im_hidden: 0 }; - | +LL | let InCrate { a, b, .. } = InCrate { a: 0, b: false, im_hidden: 0 }; + | ~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/pattern/usefulness/stable-gated-fields.stderr b/tests/ui/pattern/usefulness/stable-gated-fields.stderr index 7b44bc79acff3..d6e9bac7c136b 100644 --- a/tests/ui/pattern/usefulness/stable-gated-fields.stderr +++ b/tests/ui/pattern/usefulness/stable-gated-fields.stderr @@ -6,19 +6,16 @@ LL | let UnstableStruct { stable } = UnstableStruct::default(); | help: include the missing field in the pattern and ignore the inaccessible fields | -LL - let UnstableStruct { stable } = UnstableStruct::default(); -LL + let UnstableStruct { stable, stable2, .. } = UnstableStruct::default(); - | +LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default(); + | ~~~~~~~~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - let UnstableStruct { stable } = UnstableStruct::default(); -LL + let UnstableStruct { stable, stable2: _, .. } = UnstableStruct::default(); - | +LL | let UnstableStruct { stable, stable2: _, .. } = UnstableStruct::default(); + | ~~~~~~~~~~~~~~~~~~ help: or always ignore missing fields here | -LL - let UnstableStruct { stable } = UnstableStruct::default(); -LL + let UnstableStruct { stable, .. } = UnstableStruct::default(); - | +LL | let UnstableStruct { stable, .. } = UnstableStruct::default(); + | ~~~~~~ error: pattern requires `..` due to inaccessible fields --> $DIR/stable-gated-fields.rs:11:9 diff --git a/tests/ui/privacy/suggest-box-new.stderr b/tests/ui/privacy/suggest-box-new.stderr index da8405fd0e850..80885a8f2f1d7 100644 --- a/tests/ui/privacy/suggest-box-new.stderr +++ b/tests/ui/privacy/suggest-box-new.stderr @@ -9,9 +9,8 @@ LL | let _ = std::collections::HashMap(); | help: you might have meant to use an associated function to build this type | -LL - let _ = std::collections::HashMap(); -LL + let _ = std::collections::HashMap::new(); - | +LL | let _ = std::collections::HashMap::new(); + | ~~~~~~~ LL - let _ = std::collections::HashMap(); LL + let _ = std::collections::HashMap::with_capacity(_); | @@ -23,9 +22,8 @@ LL + let _ = std::collections::HashMap::with_capacity_and_hasher(_, _); | help: consider using the `Default` trait | -LL - let _ = std::collections::HashMap(); -LL + let _ = ::default(); - | +LL | let _ = ::default(); + | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0423]: cannot initialize a tuple struct which contains private fields --> $DIR/suggest-box-new.rs:8:19 diff --git a/tests/ui/pub/pub-restricted.stderr b/tests/ui/pub/pub-restricted.stderr index 35c48c6d7692c..fc177aa2033e1 100644 --- a/tests/ui/pub/pub-restricted.stderr +++ b/tests/ui/pub/pub-restricted.stderr @@ -10,9 +10,8 @@ LL | pub (a) fn afn() {} `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `a` with `in` | -LL - pub (a) fn afn() {} -LL + pub (in a) fn afn() {} - | +LL | pub (in a) fn afn() {} + | ~~~~ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:4:6 @@ -26,9 +25,8 @@ LL | pub (b) fn bfn() {} `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `b` with `in` | -LL - pub (b) fn bfn() {} -LL + pub (in b) fn bfn() {} - | +LL | pub (in b) fn bfn() {} + | ~~~~ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:5:6 @@ -42,9 +40,8 @@ LL | pub (crate::a) fn cfn() {} `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `crate::a` with `in` | -LL - pub (crate::a) fn cfn() {} -LL + pub (in crate::a) fn cfn() {} - | +LL | pub (in crate::a) fn cfn() {} + | ~~~~~~~~~~~ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:22:14 @@ -58,9 +55,8 @@ LL | pub (a) invalid: usize, `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `a` with `in` | -LL - pub (a) invalid: usize, -LL + pub (in a) invalid: usize, - | +LL | pub (in a) invalid: usize, + | ~~~~ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:31:6 @@ -74,9 +70,8 @@ LL | pub (xyz) fn xyz() {} `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `xyz` with `in` | -LL - pub (xyz) fn xyz() {} -LL + pub (in xyz) fn xyz() {} - | +LL | pub (in xyz) fn xyz() {} + | ~~~~~~ error[E0742]: visibilities can only be restricted to ancestor modules --> $DIR/pub-restricted.rs:23:17 diff --git a/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr b/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr index f142f91064fad..b3cc90ff1f501 100644 --- a/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr +++ b/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr @@ -73,9 +73,8 @@ LL | _ => {} | help: you might have meant to pattern match against the value of constant `ARCH` instead of introducing a new catch-all binding | -LL - ARCH => {} -LL + std::env::consts::ARCH => {} - | +LL | std::env::consts::ARCH => {} + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/tests/ui/resolve/resolve-inconsistent-names.stderr b/tests/ui/resolve/resolve-inconsistent-names.stderr index 3197e0b08949b..d6240fb8f872c 100644 --- a/tests/ui/resolve/resolve-inconsistent-names.stderr +++ b/tests/ui/resolve/resolve-inconsistent-names.stderr @@ -34,9 +34,8 @@ LL | (A, B) | (ref B, c) | (c, A) => () | help: if you meant to match on unit variant `E::A`, use the full path in the pattern | -LL - (A, B) | (ref B, c) | (c, A) => () -LL + (E::A, B) | (ref B, c) | (c, A) => () - | +LL | (E::A, B) | (ref B, c) | (c, A) => () + | ~~~~ error[E0408]: variable `B` is not bound in all patterns --> $DIR/resolve-inconsistent-names.rs:19:31 @@ -65,9 +64,8 @@ LL | (CONST1, _) | (_, Const2) => () | help: if you meant to match on constant `m::Const2`, use the full path in the pattern | -LL - (CONST1, _) | (_, Const2) => () -LL + (CONST1, _) | (_, m::Const2) => () - | +LL | (CONST1, _) | (_, m::Const2) => () + | ~~~~~~~~~ error[E0408]: variable `CONST1` is not bound in all patterns --> $DIR/resolve-inconsistent-names.rs:31:23 diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr index d0244f39769a7..39b1ef1e078c7 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr @@ -58,9 +58,8 @@ LL | let NormalStruct { first_field, second_field } = ns; | help: add `..` at the end of the field list to ignore all other fields | -LL - let NormalStruct { first_field, second_field } = ns; -LL + let NormalStruct { first_field, second_field , .. } = ns; - | +LL | let NormalStruct { first_field, second_field , .. } = ns; + | ~~~~~~ error[E0423]: cannot initialize a tuple struct which contains private fields --> $DIR/struct.rs:20:14 @@ -76,9 +75,8 @@ LL | let TupleStruct { 0: first_field, 1: second_field } = ts; | help: add `..` at the end of the field list to ignore all other fields | -LL - let TupleStruct { 0: first_field, 1: second_field } = ts; -LL + let TupleStruct { 0: first_field, 1: second_field , .. } = ts; - | +LL | let TupleStruct { 0: first_field, 1: second_field , .. } = ts; + | ~~~~~~ error[E0638]: `..` required with struct marked as non-exhaustive --> $DIR/struct.rs:35:9 @@ -88,9 +86,8 @@ LL | let UnitStruct { } = us; | help: add `..` at the end of the field list to ignore all other fields | -LL - let UnitStruct { } = us; -LL + let UnitStruct { .. } = us; - | +LL | let UnitStruct { .. } = us; + | ~~~~ error: aborting due to 9 previous errors diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr index 4cabd5a81402c..4083f57a9cdf9 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr @@ -82,9 +82,8 @@ LL | NonExhaustiveVariants::Struct { field } => "" | help: add `..` at the end of the field list to ignore all other fields | -LL - NonExhaustiveVariants::Struct { field } => "" -LL + NonExhaustiveVariants::Struct { field , .. } => "" - | +LL | NonExhaustiveVariants::Struct { field , .. } => "" + | ~~~~~~ error[E0638]: `..` required with variant marked as non-exhaustive --> $DIR/variant.rs:30:12 @@ -94,9 +93,8 @@ LL | if let NonExhaustiveVariants::Struct { field } = variant_struct { | help: add `..` at the end of the field list to ignore all other fields | -LL - if let NonExhaustiveVariants::Struct { field } = variant_struct { -LL + if let NonExhaustiveVariants::Struct { field , .. } = variant_struct { - | +LL | if let NonExhaustiveVariants::Struct { field , .. } = variant_struct { + | ~~~~~~ error: aborting due to 8 previous errors diff --git a/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr b/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr index 37a0f2bcaa882..d0c084f7bd5d0 100644 --- a/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr +++ b/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr @@ -6,9 +6,8 @@ LL | use alloc; | help: consider importing this module instead | -LL - use alloc; -LL + use std::alloc; - | +LL | use std::alloc; + | ~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/trait-import-suggestions.stderr b/tests/ui/rust-2018/trait-import-suggestions.stderr index 077b4a6cf2f71..8632bca6b1023 100644 --- a/tests/ui/rust-2018/trait-import-suggestions.stderr +++ b/tests/ui/rust-2018/trait-import-suggestions.stderr @@ -34,9 +34,8 @@ LL + use crate::foo::Bar; | help: there is a method `foobar` with a similar name | -LL - x.bar(); -LL + x.foobar(); - | +LL | x.foobar(); + | ~~~~~~ error[E0599]: no method named `baz` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:29:7 diff --git a/tests/ui/structs/struct-pat-derived-error.stderr b/tests/ui/structs/struct-pat-derived-error.stderr index a086de0898302..628a007e7693f 100644 --- a/tests/ui/structs/struct-pat-derived-error.stderr +++ b/tests/ui/structs/struct-pat-derived-error.stderr @@ -24,19 +24,16 @@ LL | let A { x, y } = self.d; | help: include the missing fields in the pattern | -LL - let A { x, y } = self.d; -LL + let A { x, y, b, c } = self.d; - | +LL | let A { x, y, b, c } = self.d; + | ~~~~~~~~ help: if you don't care about these missing fields, you can explicitly ignore them | -LL - let A { x, y } = self.d; -LL + let A { x, y, b: _, c: _ } = self.d; - | +LL | let A { x, y, b: _, c: _ } = self.d; + | ~~~~~~~~~~~~~~ help: or always ignore missing fields here | -LL - let A { x, y } = self.d; -LL + let A { x, y, .. } = self.d; - | +LL | let A { x, y, .. } = self.d; + | ~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/structs/struct-tuple-field-names.stderr b/tests/ui/structs/struct-tuple-field-names.stderr index 7692010aa5430..ef3869dda5355 100644 --- a/tests/ui/structs/struct-tuple-field-names.stderr +++ b/tests/ui/structs/struct-tuple-field-names.stderr @@ -30,19 +30,16 @@ LL | if let E::S { 0: a } = x { | help: include the missing field in the pattern | -LL - if let E::S { 0: a } = x { -LL + if let E::S { 0: a, 1: _ } = x { - | +LL | if let E::S { 0: a, 1: _ } = x { + | ~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - if let E::S { 0: a } = x { -LL + if let E::S { 0: a, 1: _ } = x { - | +LL | if let E::S { 0: a, 1: _ } = x { + | ~~~~~~~~ help: or always ignore missing fields here | -LL - if let E::S { 0: a } = x { -LL + if let E::S { 0: a, .. } = x { - | +LL | if let E::S { 0: a, .. } = x { + | ~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr index befc6a1b538a3..af530e2b75931 100644 --- a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr +++ b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr @@ -15,19 +15,16 @@ LL | Foo::Bar { a, aa: 1, c } => (), | help: include the missing field in the pattern | -LL - Foo::Bar { a, aa: 1, c } => (), -LL + Foo::Bar { a, aa: 1, c, b } => (), - | +LL | Foo::Bar { a, aa: 1, c, b } => (), + | ~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - Foo::Bar { a, aa: 1, c } => (), -LL + Foo::Bar { a, aa: 1, c, b: _ } => (), - | +LL | Foo::Bar { a, aa: 1, c, b: _ } => (), + | ~~~~~~~~ help: or always ignore missing fields here | -LL - Foo::Bar { a, aa: 1, c } => (), -LL + Foo::Bar { a, aa: 1, c, .. } => (), - | +LL | Foo::Bar { a, aa: 1, c, .. } => (), + | ~~~~~~ error[E0026]: variant `Foo::Baz` does not have a field named `bb` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:13:20 @@ -46,19 +43,16 @@ LL | Foo::Baz { bb: 1.0 } => (), | help: include the missing field in the pattern | -LL - Foo::Baz { bb: 1.0 } => (), -LL + Foo::Baz { bb: 1.0, a } => (), - | +LL | Foo::Baz { bb: 1.0, a } => (), + | ~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - Foo::Baz { bb: 1.0 } => (), -LL + Foo::Baz { bb: 1.0, a: _ } => (), - | +LL | Foo::Baz { bb: 1.0, a: _ } => (), + | ~~~~~~~~ help: or always ignore missing fields here | -LL - Foo::Baz { bb: 1.0 } => (), -LL + Foo::Baz { bb: 1.0, .. } => (), - | +LL | Foo::Baz { bb: 1.0, .. } => (), + | ~~~~~~ error[E0026]: variant `Foo::Bar` does not have a field named `aa` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:20:23 @@ -74,19 +68,16 @@ LL | Foo::Bar { a, aa: "", c } => (), | help: include the missing field in the pattern | -LL - Foo::Bar { a, aa: "", c } => (), -LL + Foo::Bar { a, aa: "", c, b } => (), - | +LL | Foo::Bar { a, aa: "", c, b } => (), + | ~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - Foo::Bar { a, aa: "", c } => (), -LL + Foo::Bar { a, aa: "", c, b: _ } => (), - | +LL | Foo::Bar { a, aa: "", c, b: _ } => (), + | ~~~~~~~~ help: or always ignore missing fields here | -LL - Foo::Bar { a, aa: "", c } => (), -LL + Foo::Bar { a, aa: "", c, .. } => (), - | +LL | Foo::Bar { a, aa: "", c, .. } => (), + | ~~~~~~ error[E0026]: variant `Foo::Baz` does not have a field named `bb` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:23:20 @@ -102,19 +93,16 @@ LL | Foo::Baz { bb: "" } => (), | help: include the missing field in the pattern | -LL - Foo::Baz { bb: "" } => (), -LL + Foo::Baz { bb: "", a } => (), - | +LL | Foo::Baz { bb: "", a } => (), + | ~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - Foo::Baz { bb: "" } => (), -LL + Foo::Baz { bb: "", a: _ } => (), - | +LL | Foo::Baz { bb: "", a: _ } => (), + | ~~~~~~~~ help: or always ignore missing fields here | -LL - Foo::Baz { bb: "" } => (), -LL + Foo::Baz { bb: "", .. } => (), - | +LL | Foo::Baz { bb: "", .. } => (), + | ~~~~~~ error: aborting due to 8 previous errors diff --git a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr index 54c927b59d47f..5af2c3fbd9b98 100644 --- a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr +++ b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr @@ -11,9 +11,8 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match x { -LL + match *x { - | +LL | match *x { + | ~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:9:9 @@ -28,9 +27,8 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match x { -LL + match *x { - | +LL | match *x { + | ~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:16:9 @@ -79,9 +77,8 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match y { -LL + match *y { - | +LL | match *y { + | ~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:28:9 @@ -96,9 +93,8 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match y { -LL + match *y { - | +LL | match *y { + | ~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:36:9 @@ -147,9 +143,8 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match z_const { -LL + match &**z_const { - | +LL | match &**z_const { + | ~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:48:9 @@ -164,9 +159,8 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match z_const { -LL + match &**z_const { - | +LL | match &**z_const { + | ~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:57:9 @@ -181,9 +175,8 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match z_mut { -LL + match &**z_mut { - | +LL | match &**z_mut { + | ~~~~~~~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:59:9 @@ -198,9 +191,8 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match z_mut { -LL + match &**z_mut { - | +LL | match &**z_mut { + | ~~~~~~~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:68:9 @@ -215,9 +207,8 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match y_mut { -LL + match &**y_mut { - | +LL | match &**y_mut { + | ~~~~~~~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:70:9 @@ -232,9 +223,8 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match y_mut { -LL + match &**y_mut { - | +LL | match &**y_mut { + | ~~~~~~~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:79:9 diff --git a/tests/ui/suggestions/type-mismatch-byte-literal.stderr b/tests/ui/suggestions/type-mismatch-byte-literal.stderr index e96ead569d980..3d27149f0dcf1 100644 --- a/tests/ui/suggestions/type-mismatch-byte-literal.stderr +++ b/tests/ui/suggestions/type-mismatch-byte-literal.stderr @@ -8,9 +8,8 @@ LL | let _x: u8 = 'X'; | help: if you meant to write a byte literal, prefix with `b` | -LL - let _x: u8 = 'X'; -LL + let _x: u8 = b'X'; - | +LL | let _x: u8 = b'X'; + | ~~~~ error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:11:9 @@ -27,9 +26,8 @@ LL | fn foo(_t: u8) {} | ^^^ ------ help: if you meant to write a byte literal, prefix with `b` | -LL - foo('#'); -LL + foo(b'#'); - | +LL | foo(b'#'); + | ~~~~ error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:15:18 @@ -41,9 +39,8 @@ LL | let _a: u8 = '\x20'; | help: if you meant to write a byte literal, prefix with `b` | -LL - let _a: u8 = '\x20'; -LL + let _a: u8 = b'\x20'; - | +LL | let _a: u8 = b'\x20'; + | ~~~~~~~ error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:20:9 diff --git a/tests/ui/test-attrs/inaccessible-test-modules.stderr b/tests/ui/test-attrs/inaccessible-test-modules.stderr index 39f69b164fb00..7635f579d66b9 100644 --- a/tests/ui/test-attrs/inaccessible-test-modules.stderr +++ b/tests/ui/test-attrs/inaccessible-test-modules.stderr @@ -12,9 +12,8 @@ LL | use test as y; | help: consider importing this module instead | -LL - use test as y; -LL + use test::test as y; - | +LL | use test::test as y; + | ~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr index 23974c5b4aaa4..7985b611a4f60 100644 --- a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr +++ b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr @@ -14,9 +14,8 @@ LL + struct Foo where T: Bar, T: Bar { | help: a trait with a similar name exists | -LL - struct Foo where T: Bar, ::Baz: String { -LL + struct Foo where T: Bar, ::Baz: ToString { - | +LL | struct Foo where T: Bar, ::Baz: ToString { + | ~~~~~~~~ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:9:54 @@ -34,9 +33,8 @@ LL + struct Qux<'a, T> where T: Bar, &'a T: Bar { | help: a trait with a similar name exists | -LL - struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: String { -LL + struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: ToString { - | +LL | struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: ToString { + | ~~~~~~~~ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:13:45 @@ -54,9 +52,8 @@ LL + fn foo(_: T) where T: Bar { | help: a trait with a similar name exists | -LL - fn foo(_: T) where ::Baz: String { -LL + fn foo(_: T) where ::Baz: ToString { - | +LL | fn foo(_: T) where ::Baz: ToString { + | ~~~~~~~~ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:16:57 @@ -74,9 +71,8 @@ LL + fn qux<'a, T: Bar>(_: &'a T) where &'a T: Bar { | help: a trait with a similar name exists | -LL - fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: String { -LL + fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: ToString { - | +LL | fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: ToString { + | ~~~~~~~~ error[E0405]: cannot find trait `Unresolved` in this scope --> $DIR/assoc_type_bound_with_struct.rs:19:31 diff --git a/tests/ui/type/issue-100584.stderr b/tests/ui/type/issue-100584.stderr index 7cbab1540660c..e1db14d1f001b 100644 --- a/tests/ui/type/issue-100584.stderr +++ b/tests/ui/type/issue-100584.stderr @@ -19,9 +19,8 @@ LL | let _ = format!("{xyza}"); | ++++++++ + help: if this is intentional, prefix it with an underscore | -LL - fn foo(xyza: &str) { -LL + fn foo(_xyza: &str) { - | +LL | fn foo(_xyza: &str) { + | ~~~~~ error: unused variable: `xyza` --> $DIR/issue-100584.rs:7:9 @@ -38,9 +37,8 @@ LL | let _ = format!("aaa{xyza}bbb"); | ++++++++ + help: if this is intentional, prefix it with an underscore | -LL - fn foo3(xyza: &str) { -LL + fn foo3(_xyza: &str) { - | +LL | fn foo3(_xyza: &str) { + | ~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/type/pattern_types/pattern_type_mismatch.stderr b/tests/ui/type/pattern_types/pattern_type_mismatch.stderr index aaf41ed6eba23..19b0c1059c86f 100644 --- a/tests/ui/type/pattern_types/pattern_type_mismatch.stderr +++ b/tests/ui/type/pattern_types/pattern_type_mismatch.stderr @@ -6,9 +6,8 @@ LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); | help: if you meant to write a byte literal, prefix with `b` | -LL - const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); -LL + const BAD_NESTING4: pattern_type!(u8 is b'a'..='a') = todo!(); - | +LL | const BAD_NESTING4: pattern_type!(u8 is b'a'..='a') = todo!(); + | ~~~~ error[E0308]: mismatched types --> $DIR/pattern_type_mismatch.rs:8:47 @@ -18,9 +17,8 @@ LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); | help: if you meant to write a byte literal, prefix with `b` | -LL - const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); -LL + const BAD_NESTING4: pattern_type!(u8 is 'a'..=b'a') = todo!(); - | +LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..=b'a') = todo!(); + | ~~~~ error[E0308]: mismatched types --> $DIR/pattern_type_mismatch.rs:12:43 diff --git a/tests/ui/typeck/mismatched-map-under-self.stderr b/tests/ui/typeck/mismatched-map-under-self.stderr index fd6b3093ec977..59de00a58bbea 100644 --- a/tests/ui/typeck/mismatched-map-under-self.stderr +++ b/tests/ui/typeck/mismatched-map-under-self.stderr @@ -13,9 +13,8 @@ LL | fn values(&self) -> Self::Values; found signature `fn(Option<_>)` help: change the self-receiver type to match the trait | -LL - fn values(self) -> Self::Values { -LL + fn values(&self) -> Self::Values { - | +LL | fn values(&self) -> Self::Values { + | ~~~~~ error[E0631]: type mismatch in function arguments --> $DIR/mismatched-map-under-self.rs:12:18 diff --git a/tests/ui/unresolved/unresolved-candidates.stderr b/tests/ui/unresolved/unresolved-candidates.stderr index 0810f90306e89..7ef2f6b1a2922 100644 --- a/tests/ui/unresolved/unresolved-candidates.stderr +++ b/tests/ui/unresolved/unresolved-candidates.stderr @@ -6,9 +6,8 @@ LL | use Trait; | help: consider importing this trait instead | -LL - use Trait; -LL + use a::Trait; - | +LL | use a::Trait; + | ~~~~~~~~ error[E0405]: cannot find trait `Trait` in this scope --> $DIR/unresolved-candidates.rs:10:10 From 66ebee4dd2f55dadca0eaad72139eb3c5ea4c6ea Mon Sep 17 00:00:00 2001 From: jyn Date: Wed, 12 Feb 2025 23:01:22 -0500 Subject: [PATCH 08/19] Compiletest should not inherit all host RUSTFLAGS I told rhelmot to do this in #134913. But it's not correct; compiletest shouldn't inherit RUSTFLAGS at all. Pass a single new --host-rustcflags to compiletest instead, without overwriting any existing arguments. Fixes the following failure, which only happens when building llvm from source and then running `x test --stage 1 ui-fulldeps`: ``` diff --git a/tests/ui-fulldeps/fluent-messages/test.stderr b/tests/ui-fulldeps/fluent-messages/test.stderr index 0b3bb14ce51..978ac46c5a2 100644 --- a/tests/ui-fulldeps/fluent-messages/test.stderr +++ b/tests/ui-fulldeps/fluent-messages/test.stderr @@ -1,3 +1,8 @@ +warning[E0602]: unknown lint: `linker_messages` + | + = note: requested on the command line with `-A linker_messages` + = note: `#[warn(unknown_lints)]` on by default ``` --- src/bootstrap/src/core/build_steps/test.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 509875a469f1f..2b4e9d48a2456 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -1969,13 +1969,12 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the if !builder.config.dry_run() && suite.ends_with("fulldeps") { let llvm_libdir = command(&llvm_config).arg("--libdir").run_capture_stdout(builder).stdout(); - let mut rustflags = env::var("RUSTFLAGS").unwrap_or_default(); - if target.is_msvc() { - rustflags.push_str(&format!("-Clink-arg=-LIBPATH:{llvm_libdir}")); + let link_llvm = if target.is_msvc() { + format!("-Clink-arg=-LIBPATH:{llvm_libdir}") } else { - rustflags.push_str(&format!("-Clink-arg=-L{llvm_libdir}")); - } - cmd.env("RUSTFLAGS", rustflags); + format!("-Clink-arg=-L{llvm_libdir}") + }; + cmd.arg("--host-rustcflags").arg(link_llvm); } if !builder.config.dry_run() && matches!(mode, "run-make" | "coverage-run") { From 1b5337cdf67d0b4d8d7074105c95c7d2e406632d Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Thu, 13 Feb 2025 03:21:25 +0000 Subject: [PATCH 09/19] Trim suggestion parts to the subset that is purely additive --- compiler/rustc_errors/src/emitter.rs | 22 +++++++--- compiler/rustc_errors/src/lib.rs | 18 ++++++++ .../clippy/tests/ui/implicit_return.stderr | 42 +++++++------------ .../tests/ui/legacy_numeric_constants.stderr | 5 +-- .../defaults-suitability.current.stderr | 2 +- .../defaults-suitability.next.stderr | 2 +- tests/ui/associated-types/issue-38821.stderr | 4 +- .../issue-54108.current.stderr | 2 +- .../associated-types/issue-54108.next.stderr | 2 +- tests/ui/attributes/rustc_confusables.stderr | 2 +- .../rustc_confusables_std_cases.stderr | 4 +- .../issue-115259-suggest-iter-mut.stderr | 2 +- .../issue-62387-suggest-iter-mut-2.stderr | 2 +- .../issue-62387-suggest-iter-mut.stderr | 4 +- tests/ui/c-variadic/issue-86053-1.stderr | 2 +- tests/ui/cfg/cfg-method-receiver.stderr | 2 +- tests/ui/check-cfg/diagnotics.cargo.stderr | 2 +- tests/ui/check-cfg/diagnotics.rustc.stderr | 2 +- .../2229_closure_analysis/bad-pattern.stderr | 2 +- .../2229_closure_analysis/issue-118144.stderr | 2 +- tests/ui/closures/issue-78720.stderr | 2 +- tests/ui/compare-method/bad-self-type.stderr | 2 +- .../ensure_is_evaluatable.stderr | 2 +- .../fn_with_two_const_inputs.stderr | 2 +- .../abstract-const-as-cast-3.stderr | 8 ++-- .../doesnt_unify_evaluatable.stderr | 2 +- .../const_kind_expr/issue_114151.stderr | 2 +- .../const_kind_expr/wf_obligation.stderr | 2 +- ...e-a-closure-or-coroutine-ice-113776.stderr | 2 +- .../consts/const-pattern-irrefutable.stderr | 6 +-- .../dont-suggest-hygienic-fields.stderr | 2 +- .../dropck/explicit-drop-bounds.bad1.stderr | 4 +- .../issue-90528-unsizing-suggestion-3.stderr | 2 +- .../ui/empty/empty-struct-braces-expr.stderr | 6 +-- tests/ui/empty/empty-struct-tuple-pat.stderr | 2 +- .../error-recovery-issue-55897.stderr | 2 +- tests/ui/error-codes/E0027.stderr | 6 +-- tests/ui/extern/not-in-block.stderr | 4 +- ...-gate-unboxed-closures-manual-impls.stderr | 2 +- .../no-inline-literals-out-of-range.stderr | 2 +- .../no-method-suggested-traits.stderr | 12 +++--- tests/ui/imports/glob-resolve1.stderr | 2 +- .../ui/imports/issue-45829/import-self.stderr | 2 +- ...est-import-issue-120074.edition2015.stderr | 2 +- ...est-import-issue-120074.edition2021.stderr | 2 +- tests/ui/issues/issue-32004.stderr | 2 +- .../ui/issues/issue-41652/issue-41652.stderr | 2 +- tests/ui/issues/issue-51874.stderr | 2 +- tests/ui/issues/issue-5358-1.stderr | 2 +- tests/ui/issues/issue-56175.stderr | 2 +- .../issue-57741.stderr | 8 ++-- .../let-else/let-else-deref-coercion.stderr | 4 +- tests/ui/lexer/lex-bad-char-literals-1.stderr | 2 +- .../lifetimes/borrowck-let-suggestion.stderr | 2 +- .../issue-119696-err-on-fn.stderr | 2 +- .../issue-119697-extra-let.stderr | 2 +- .../let_underscore/let_underscore_drop.stderr | 2 +- .../let_underscore/let_underscore_lock.stderr | 8 ++-- .../lint-strict-provenance-lossy-casts.stderr | 2 +- tests/ui/lint/static-mut-refs.e2021.stderr | 12 +++--- tests/ui/lint/static-mut-refs.e2024.stderr | 12 +++--- tests/ui/lint/type-overflow.stderr | 4 +- ...ue-67691-unused-field-in-or-pattern.stderr | 4 +- .../macros/expr_2021_cargo_fix_edition.stderr | 4 +- .../macro-backtrace-invalid-internals.stderr | 4 +- tests/ui/match/issue-56685.stderr | 8 ++-- tests/ui/methods/issues/issue-90315.stderr | 2 +- .../method-on-ambiguous-numeric-type.stderr | 2 +- tests/ui/mir/issue-112269.stderr | 4 +- tests/ui/mismatched_types/issue-112036.stderr | 2 +- ...use_of_moved_value_copy_suggestions.stderr | 2 +- tests/ui/namespace/namespace-mix.stderr | 8 ++-- .../projection-no-regions-closure.stderr | 4 +- .../projection-no-regions-fn.stderr | 4 +- tests/ui/object-pointer-types.stderr | 2 +- tests/ui/parser/bad-char-literals.stderr | 2 +- .../bad-escape-suggest-raw-string.stderr | 2 +- tests/ui/parser/byte-literals.stderr | 2 +- tests/ui/parser/extern-no-fn.stderr | 2 +- ...sue-65257-invalid-var-decl-recovery.stderr | 4 +- .../issues/issue-87086-colon-path-sep.stderr | 12 +++--- .../ui/parser/missing-fn-issue-65381-2.stderr | 2 +- .../parser/misspelled-keywords/const.stderr | 2 +- .../turbofish-arg-with-stray-colon.stderr | 2 +- tests/ui/parser/use-colon-as-mod-sep.stderr | 8 ++-- .../pat-tuple-field-count-cross.stderr | 2 +- tests/ui/pattern/pat-tuple-overfield.stderr | 2 +- .../patkind-ref-binding-issue-114896.stderr | 2 +- .../patkind-ref-binding-issue-122415.stderr | 2 +- .../usefulness/doc-hidden-fields.stderr | 18 ++++---- .../usefulness/stable-gated-fields.stderr | 6 +-- tests/ui/privacy/suggest-box-new.stderr | 4 +- tests/ui/pub/pub-ident-fn-or-struct.stderr | 2 +- tests/ui/pub/pub-restricted.stderr | 10 ++--- .../const-with-typo-in-pattern-binding.stderr | 2 +- tests/ui/resolve/issue-39226.stderr | 2 +- tests/ui/resolve/issue-55673.stderr | 2 +- tests/ui/resolve/issue-73427.stderr | 14 +++---- tests/ui/resolve/privacy-enum-ctor.stderr | 2 +- .../resolve/resolve-inconsistent-names.stderr | 4 +- ...t.import_trait_associated_functions.stderr | 2 +- ...lve-issue-135614-assoc-const.normal.stderr | 2 +- ...e-with-name-similar-to-struct-field.stderr | 2 +- .../typo-suggestion-mistyped-in-path.stderr | 2 +- .../rfc-2008-non-exhaustive/struct.stderr | 6 +-- .../rfc-2008-non-exhaustive/variant.stderr | 4 +- .../not-allowed.stderr | 2 +- .../rust-2018/trait-import-suggestions.stderr | 2 +- ...lity-attribute-implies-using-stable.stderr | 2 +- ...ty-attribute-implies-using-unstable.stderr | 2 +- ...lity-attribute-implies-using-stable.stderr | 2 +- ...ty-attribute-implies-using-unstable.stderr | 2 +- tests/ui/statics/issue-15261.stderr | 2 +- .../statics/static-mut-shared-parens.stderr | 2 +- tests/ui/statics/static-mut-xc.stderr | 2 +- tests/ui/statics/static-recursive.stderr | 2 +- .../struct-fields-hints-no-dupe.stderr | 2 +- .../structs/struct-pat-derived-error.stderr | 6 +-- .../structs/struct-tuple-field-names.stderr | 6 +-- ...ing-field-when-specifying-same-type.stderr | 24 +++++------ tests/ui/suggestions/bound-suggestions.stderr | 2 +- ...const-pat-non-exaustive-let-new-var.stderr | 2 +- .../suggestions/crate-or-module-typo.stderr | 4 +- ...atible-trait-should-use-where-sized.stderr | 2 +- tests/ui/suggestions/field-access.stderr | 6 +-- .../imm-ref-trait-object-literal.stderr | 2 +- .../impl-trait-missing-lifetime-gated.stderr | 8 ++-- ...t-field-type-including-single-colon.stderr | 4 +- .../ui/suggestions/suggest-change-mut.stderr | 2 +- ...suggest-deref-in-match-issue-132784.stderr | 20 ++++----- tests/ui/suggestions/suggest-methods.stderr | 2 +- tests/ui/suggestions/suggest-variants.stderr | 4 +- .../type-ascription-instead-of-path-2.stderr | 2 +- ...-ascription-instead-of-path-in-type.stderr | 2 +- .../type-mismatch-byte-literal.stderr | 6 +-- .../inaccessible-test-modules.stderr | 2 +- .../assoc_type_bound_with_struct.stderr | 8 ++-- .../type-match-with-late-bound.stderr | 6 +-- tests/ui/transmutability/assoc-bound.stderr | 2 +- tests/ui/type/issue-100584.stderr | 4 +- .../pattern_type_mismatch.stderr | 4 +- tests/ui/typeck/issue-29181.stderr | 2 +- tests/ui/typeck/method-chain-gats.stderr | 2 +- .../typeck/mismatched-map-under-self.stderr | 2 +- .../unresolved/unresolved-candidates.stderr | 2 +- 145 files changed, 317 insertions(+), 300 deletions(-) diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 7d58e6f29da7c..634afacf53900 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -1976,9 +1976,11 @@ impl HumanEmitter { Some(Style::HeaderMsg), ); + let other_suggestions = suggestions.len().saturating_sub(MAX_SUGGESTIONS); + let mut row_num = 2; for (i, (complete, parts, highlights, _)) in - suggestions.iter().enumerate().take(MAX_SUGGESTIONS) + suggestions.into_iter().enumerate().take(MAX_SUGGESTIONS) { debug!(?complete, ?parts, ?highlights); @@ -2168,7 +2170,7 @@ impl HumanEmitter { self.draw_code_line( &mut buffer, &mut row_num, - highlight_parts, + &highlight_parts, line_pos + line_start, line, show_code_change, @@ -2214,7 +2216,12 @@ impl HumanEmitter { if let DisplaySuggestion::Diff | DisplaySuggestion::Underline | DisplaySuggestion::Add = show_code_change { - for part in parts { + for mut part in parts { + // If this is a replacement of, e.g. `"a"` into `"ab"`, adjust the + // suggestion and snippet to look as if we just suggested to add + // `"b"`, which is typically much easier for the user to understand. + part.trim_trivial_replacements(sm); + let snippet = if let Ok(snippet) = sm.span_to_snippet(part.span) { snippet } else { @@ -2377,9 +2384,12 @@ impl HumanEmitter { row_num = row + 1; } } - if suggestions.len() > MAX_SUGGESTIONS { - let others = suggestions.len() - MAX_SUGGESTIONS; - let msg = format!("and {} other candidate{}", others, pluralize!(others)); + if other_suggestions > 0 { + let msg = format!( + "and {} other candidate{}", + other_suggestions, + pluralize!(other_suggestions) + ); buffer.puts(row_num, max_line_num_len + 3, &msg, Style::NoStyle); } diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 855b9734cdc5e..8ff5dc1259697 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -246,6 +246,24 @@ impl SubstitutionPart { sm.span_to_snippet(self.span) .map_or(!self.span.is_empty(), |snippet| !snippet.trim().is_empty()) } + + /// Try to turn a replacement into an addition when the span that is being + /// overwritten matches either the prefix or suffix of the replacement. + fn trim_trivial_replacements(&mut self, sm: &SourceMap) { + if self.snippet.is_empty() { + return; + } + let Ok(snippet) = sm.span_to_snippet(self.span) else { + return; + }; + if self.snippet.starts_with(&snippet) { + self.span = self.span.shrink_to_hi(); + self.snippet = self.snippet[snippet.len()..].to_string(); + } else if self.snippet.ends_with(&snippet) { + self.span = self.span.shrink_to_lo(); + self.snippet = self.snippet[..self.snippet.len() - snippet.len()].to_string(); + } + } } impl CodeSuggestion { diff --git a/src/tools/clippy/tests/ui/implicit_return.stderr b/src/tools/clippy/tests/ui/implicit_return.stderr index 0d2faa5e067bf..7ea72307450c7 100644 --- a/src/tools/clippy/tests/ui/implicit_return.stderr +++ b/src/tools/clippy/tests/ui/implicit_return.stderr @@ -8,8 +8,7 @@ LL | true = help: to override `-D warnings` add `#[allow(clippy::implicit_return)]` help: add `return` as shown | -LL - true -LL + return true +LL | return true | error: missing `return` statement @@ -20,9 +19,8 @@ LL | if true { true } else { false } | help: add `return` as shown | -LL - if true { true } else { false } -LL + if true { return true } else { false } - | +LL | if true { return true } else { false } + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:19:29 @@ -32,9 +30,8 @@ LL | if true { true } else { false } | help: add `return` as shown | -LL - if true { true } else { false } -LL + if true { true } else { return false } - | +LL | if true { true } else { return false } + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:25:17 @@ -44,9 +41,8 @@ LL | true => false, | help: add `return` as shown | -LL - true => false, -LL + true => return false, - | +LL | true => return false, + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:26:20 @@ -56,9 +52,8 @@ LL | false => { true }, | help: add `return` as shown | -LL - false => { true }, -LL + false => { return true }, - | +LL | false => { return true }, + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:39:9 @@ -104,9 +99,8 @@ LL | let _ = || { true }; | help: add `return` as shown | -LL - let _ = || { true }; -LL + let _ = || { return true }; - | +LL | let _ = || { return true }; + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:73:16 @@ -116,9 +110,8 @@ LL | let _ = || true; | help: add `return` as shown | -LL - let _ = || true; -LL + let _ = || return true; - | +LL | let _ = || return true; + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:81:5 @@ -128,8 +121,7 @@ LL | format!("test {}", "test") | help: add `return` as shown | -LL - format!("test {}", "test") -LL + return format!("test {}", "test") +LL | return format!("test {}", "test") | error: missing `return` statement @@ -140,8 +132,7 @@ LL | m!(true, false) | help: add `return` as shown | -LL - m!(true, false) -LL + return m!(true, false) +LL | return m!(true, false) | error: missing `return` statement @@ -191,8 +182,7 @@ LL | true | help: add `return` as shown | -LL - true -LL + return true +LL | return true | error: aborting due to 16 previous errors diff --git a/src/tools/clippy/tests/ui/legacy_numeric_constants.stderr b/src/tools/clippy/tests/ui/legacy_numeric_constants.stderr index 74fe09e0f5c60..91dfe79d55bab 100644 --- a/src/tools/clippy/tests/ui/legacy_numeric_constants.stderr +++ b/src/tools/clippy/tests/ui/legacy_numeric_constants.stderr @@ -68,9 +68,8 @@ LL | MAX; | help: use the associated constant instead | -LL - MAX; -LL + u32::MAX; - | +LL | u32::MAX; + | +++++ error: usage of a legacy numeric method --> tests/ui/legacy_numeric_constants.rs:49:10 diff --git a/tests/ui/associated-types/defaults-suitability.current.stderr b/tests/ui/associated-types/defaults-suitability.current.stderr index 61247cee1f34d..5e19674250f0b 100644 --- a/tests/ui/associated-types/defaults-suitability.current.stderr +++ b/tests/ui/associated-types/defaults-suitability.current.stderr @@ -135,7 +135,7 @@ LL | type Baz = T; help: consider further restricting type parameter `T` with trait `Clone` | LL | Self::Baz: Clone, T: std::clone::Clone - | ~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++ error: aborting due to 8 previous errors diff --git a/tests/ui/associated-types/defaults-suitability.next.stderr b/tests/ui/associated-types/defaults-suitability.next.stderr index 61247cee1f34d..5e19674250f0b 100644 --- a/tests/ui/associated-types/defaults-suitability.next.stderr +++ b/tests/ui/associated-types/defaults-suitability.next.stderr @@ -135,7 +135,7 @@ LL | type Baz = T; help: consider further restricting type parameter `T` with trait `Clone` | LL | Self::Baz: Clone, T: std::clone::Clone - | ~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++ error: aborting due to 8 previous errors diff --git a/tests/ui/associated-types/issue-38821.stderr b/tests/ui/associated-types/issue-38821.stderr index 58f019704e7a7..dc919299710bc 100644 --- a/tests/ui/associated-types/issue-38821.stderr +++ b/tests/ui/associated-types/issue-38821.stderr @@ -14,7 +14,7 @@ LL | impl IntoNullable for T { help: consider extending the `where` clause, but there might be an alternative better way to express this requirement | LL | Expr: Expression::Nullable>, ::SqlType: NotNull - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++++++++++++++ error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied --> $DIR/issue-38821.rs:40:1 @@ -38,7 +38,7 @@ LL | impl IntoNullable for T { help: consider extending the `where` clause, but there might be an alternative better way to express this requirement | LL | Expr: Expression::Nullable>, ::SqlType: NotNull - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++++++++++++++ error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied --> $DIR/issue-38821.rs:23:10 diff --git a/tests/ui/associated-types/issue-54108.current.stderr b/tests/ui/associated-types/issue-54108.current.stderr index 8850b4548e33a..115a591c68f16 100644 --- a/tests/ui/associated-types/issue-54108.current.stderr +++ b/tests/ui/associated-types/issue-54108.current.stderr @@ -13,7 +13,7 @@ LL | type Size: Add; help: consider further restricting the associated type | LL | T: SubEncoder, ::ActualSize: Add - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/associated-types/issue-54108.next.stderr b/tests/ui/associated-types/issue-54108.next.stderr index 5e2fa551afe30..e6d65d8246a11 100644 --- a/tests/ui/associated-types/issue-54108.next.stderr +++ b/tests/ui/associated-types/issue-54108.next.stderr @@ -13,7 +13,7 @@ LL | type Size: Add; help: consider further restricting the associated type | LL | T: SubEncoder, ::ActualSize: Add - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/attributes/rustc_confusables.stderr b/tests/ui/attributes/rustc_confusables.stderr index 9ba1e3270573f..dc71d974daf56 100644 --- a/tests/ui/attributes/rustc_confusables.stderr +++ b/tests/ui/attributes/rustc_confusables.stderr @@ -36,7 +36,7 @@ LL | x.inser(); help: there is a method `insert` with a similar name | LL | x.insert(); - | ~~~~~~ + | + error[E0599]: no method named `foo` found for struct `rustc_confusables_across_crate::BTreeSet` in the current scope --> $DIR/rustc_confusables.rs:15:7 diff --git a/tests/ui/attributes/rustc_confusables_std_cases.stderr b/tests/ui/attributes/rustc_confusables_std_cases.stderr index 7108887043b2c..f2d9ebe2c0eae 100644 --- a/tests/ui/attributes/rustc_confusables_std_cases.stderr +++ b/tests/ui/attributes/rustc_confusables_std_cases.stderr @@ -39,7 +39,7 @@ LL | let mut x = VecDeque::new(); help: you might have meant to use `push_back` | LL | x.push_back(1); - | ~~~~~~~~~ + | +++++ error[E0599]: no method named `length` found for struct `Vec<{integer}>` in the current scope --> $DIR/rustc_confusables_std_cases.rs:15:7 @@ -98,7 +98,7 @@ note: method defined here help: you might have meant to use `push_str` | LL | String::new().push_str(""); - | ~~~~~~~~ + | ++++ error[E0599]: no method named `append` found for struct `String` in the current scope --> $DIR/rustc_confusables_std_cases.rs:24:19 diff --git a/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr index 40ab2e61d6a42..61c01f0f024fe 100644 --- a/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr +++ b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr @@ -9,7 +9,7 @@ LL | self.layers.iter().fold(0, |result, mut layer| result + layer.proce help: you may want to use `iter_mut` here | LL | self.layers.iter_mut().fold(0, |result, mut layer| result + layer.process()) - | ~~~~~~~~ + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr index 466f19eb0ab95..c6955317d87d5 100644 --- a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr +++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr @@ -9,7 +9,7 @@ LL | vec.iter().flat_map(|container| container.things()).cloned().co help: you may want to use `iter_mut` here | LL | vec.iter_mut().flat_map(|container| container.things()).cloned().collect::>(); - | ~~~~~~~~ + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr b/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr index fd58e43302025..ae4920b2a8cb0 100644 --- a/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr +++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr @@ -9,7 +9,7 @@ LL | v.iter().for_each(|a| a.double()); help: you may want to use `iter_mut` here | LL | v.iter_mut().for_each(|a| a.double()); - | ~~~~~~~~ + | ++++ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference --> $DIR/issue-62387-suggest-iter-mut.rs:25:39 @@ -22,7 +22,7 @@ LL | v.iter().rev().rev().for_each(|a| a.double()); help: you may want to use `iter_mut` here | LL | v.iter_mut().rev().rev().for_each(|a| a.double()); - | ~~~~~~~~ + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/c-variadic/issue-86053-1.stderr b/tests/ui/c-variadic/issue-86053-1.stderr index 67a619e46d57d..ce31f0d300f1f 100644 --- a/tests/ui/c-variadic/issue-86053-1.stderr +++ b/tests/ui/c-variadic/issue-86053-1.stderr @@ -64,7 +64,7 @@ LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize help: a trait with a similar name exists | LL | self , ... , self , self , ... ) where Fn : FnOnce ( & 'a & 'b usize ) { - | ~~ + | + help: you might be missing a type parameter | LL | fn ordering4 < 'a , 'b, F > ( a : , self , self , self , diff --git a/tests/ui/cfg/cfg-method-receiver.stderr b/tests/ui/cfg/cfg-method-receiver.stderr index 5767a7c1b4b1c..44f3d8d058e04 100644 --- a/tests/ui/cfg/cfg-method-receiver.stderr +++ b/tests/ui/cfg/cfg-method-receiver.stderr @@ -17,7 +17,7 @@ LL | cbor_map! { #[cfg(test)] 4}; help: you must specify a concrete type for this numeric value, like `i32` | LL | cbor_map! { #[cfg(test)] 4_i32}; - | ~~~~~ + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/check-cfg/diagnotics.cargo.stderr b/tests/ui/check-cfg/diagnotics.cargo.stderr index a75a45b7d3727..ebfc9a935d20c 100644 --- a/tests/ui/check-cfg/diagnotics.cargo.stderr +++ b/tests/ui/check-cfg/diagnotics.cargo.stderr @@ -18,7 +18,7 @@ LL | #[cfg(featur = "foo")] help: there is a config with a similar name and value | LL | #[cfg(feature = "foo")] - | ~~~~~~~ + | + warning: unexpected `cfg` condition name: `featur` --> $DIR/diagnotics.rs:17:7 diff --git a/tests/ui/check-cfg/diagnotics.rustc.stderr b/tests/ui/check-cfg/diagnotics.rustc.stderr index df549b31364a3..8860b3ff5da57 100644 --- a/tests/ui/check-cfg/diagnotics.rustc.stderr +++ b/tests/ui/check-cfg/diagnotics.rustc.stderr @@ -20,7 +20,7 @@ LL | #[cfg(featur = "foo")] help: there is a config with a similar name and value | LL | #[cfg(feature = "foo")] - | ~~~~~~~ + | + warning: unexpected `cfg` condition name: `featur` --> $DIR/diagnotics.rs:17:7 diff --git a/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr b/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr index b5ad8eb790f2b..ced582c9ff5a0 100644 --- a/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr +++ b/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr @@ -109,7 +109,7 @@ LL | let PAT = v1; help: introduce a variable instead | LL | let PAT_var = v1; - | ~~~~~~~ + | ++++ error: aborting due to 7 previous errors diff --git a/tests/ui/closures/2229_closure_analysis/issue-118144.stderr b/tests/ui/closures/2229_closure_analysis/issue-118144.stderr index 87084e6023729..bfe4afc4b58cb 100644 --- a/tests/ui/closures/2229_closure_analysis/issue-118144.stderr +++ b/tests/ui/closures/2229_closure_analysis/issue-118144.stderr @@ -9,7 +9,7 @@ LL | V(x) = func_arg; help: consider dereferencing to access the inner value using the Deref trait | LL | V(x) = &*func_arg; - | ~~~~~~~~~~ + | ++ error: aborting due to 1 previous error diff --git a/tests/ui/closures/issue-78720.stderr b/tests/ui/closures/issue-78720.stderr index 5d65c87b0fd61..90672cd83d7cf 100644 --- a/tests/ui/closures/issue-78720.stderr +++ b/tests/ui/closures/issue-78720.stderr @@ -16,7 +16,7 @@ LL | _func: F, help: a trait with a similar name exists | LL | _func: Fn, - | ~~ + | + help: you might be missing a type parameter | LL | struct Map2 { diff --git a/tests/ui/compare-method/bad-self-type.stderr b/tests/ui/compare-method/bad-self-type.stderr index 0a05b0a83af4f..bc1587883a352 100644 --- a/tests/ui/compare-method/bad-self-type.stderr +++ b/tests/ui/compare-method/bad-self-type.stderr @@ -9,7 +9,7 @@ LL | fn poll(self, _: &mut Context<'_>) -> Poll<()> { help: change the self-receiver type to match the trait | LL | fn poll(self: Pin<&mut MyFuture>, _: &mut Context<'_>) -> Poll<()> { - | ~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++ error[E0053]: method `foo` has an incompatible type for trait --> $DIR/bad-self-type.rs:22:18 diff --git a/tests/ui/const-generics/ensure_is_evaluatable.stderr b/tests/ui/const-generics/ensure_is_evaluatable.stderr index 62f8bc34f2edd..0a03ea49de179 100644 --- a/tests/ui/const-generics/ensure_is_evaluatable.stderr +++ b/tests/ui/const-generics/ensure_is_evaluatable.stderr @@ -15,7 +15,7 @@ LL | [(); N + 1]:, help: try adding a `where` bound | LL | [(); M + 1]:, [(); N + 1]: - | ~~~~~~~~~~~~~~ + | ++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/fn_with_two_const_inputs.stderr b/tests/ui/const-generics/fn_with_two_const_inputs.stderr index c0a913a21fd2d..7fb79da2d6143 100644 --- a/tests/ui/const-generics/fn_with_two_const_inputs.stderr +++ b/tests/ui/const-generics/fn_with_two_const_inputs.stderr @@ -15,7 +15,7 @@ LL | [(); N + 1]:, help: try adding a `where` bound | LL | [(); both(N + 1, M + 1)]:, [(); N + 1]: - | ~~~~~~~~~~~~~~ + | ++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr b/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr index 3622ef16a9608..8d0b2e914732d 100644 --- a/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr +++ b/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr @@ -17,7 +17,7 @@ LL | fn assert_impl() {} help: try adding a `where` bound | LL | EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:17:5 @@ -52,7 +52,7 @@ LL | fn assert_impl() {} help: try adding a `where` bound | LL | EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:20:5 @@ -115,7 +115,7 @@ LL | fn assert_impl() {} help: try adding a `where` bound | LL | EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:35:5 @@ -150,7 +150,7 @@ LL | fn assert_impl() {} help: try adding a `where` bound | LL | EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:38:5 diff --git a/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr b/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr index f3a38fcc00544..6cf4e881adae8 100644 --- a/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr +++ b/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr @@ -7,7 +7,7 @@ LL | bar::<{ T::ASSOC }>(); help: try adding a `where` bound | LL | fn foo() where [(); U::ASSOC]:, [(); { T::ASSOC }]: { - | ~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr index 4d1fb02b59e91..3c79cbeb730d5 100644 --- a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr @@ -27,7 +27,7 @@ LL | foo::<_, L>([(); L + 1 + L]); help: try adding a `where` bound | LL | [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: - | ~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++ error: unconstrained generic constant --> $DIR/issue_114151.rs:17:17 diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr index 99eab935a094c..af4543e7ef2bb 100644 --- a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr @@ -16,7 +16,7 @@ LL | foo::<_, L>([(); L + 1 + L]); help: try adding a `where` bound | LL | [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: - | ~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr index 86fbca585057a..b9db7461699fe 100644 --- a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr +++ b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr @@ -10,7 +10,7 @@ LL | let f: F = async { 1 }; help: a trait with a similar name exists | LL | let f: Fn = async { 1 }; - | ~~ + | + help: you might be missing a type parameter | LL | fn f( diff --git a/tests/ui/consts/const-pattern-irrefutable.stderr b/tests/ui/consts/const-pattern-irrefutable.stderr index 4fa8caa57ce6e..06bd01bff79f0 100644 --- a/tests/ui/consts/const-pattern-irrefutable.stderr +++ b/tests/ui/consts/const-pattern-irrefutable.stderr @@ -13,7 +13,7 @@ LL | let a = 4; help: introduce a variable instead | LL | let a_var = 4; - | ~~~~~ + | ++++ error[E0005]: refutable pattern in local binding --> $DIR/const-pattern-irrefutable.rs:28:9 @@ -48,7 +48,7 @@ LL | let d = (4, 4); help: introduce a variable instead | LL | let d_var = (4, 4); - | ~~~~~ + | ++++ error[E0005]: refutable pattern in local binding --> $DIR/const-pattern-irrefutable.rs:36:9 @@ -70,7 +70,7 @@ LL | struct S { help: introduce a variable instead | LL | let e_var = S { - | ~~~~~ + | ++++ error: aborting due to 4 previous errors diff --git a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr index 473c9a339fc25..411eec8496339 100644 --- a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr +++ b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr @@ -11,7 +11,7 @@ LL | const CRATE: Crate = Crate { fiel: () }; help: a field with a similar name exists | LL | const CRATE: Crate = Crate { field: () }; - | ~~~~~ + | + error[E0609]: no field `field` on type `Compound` --> $DIR/dont-suggest-hygienic-fields.rs:24:16 diff --git a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr index 2caa779ffabac..12d7f5b6cd301 100644 --- a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr +++ b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr @@ -12,7 +12,7 @@ LL | struct DropMe(T); help: consider further restricting type parameter `T` with trait `Copy` | LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` - | ~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/explicit-drop-bounds.rs:32:18 @@ -28,7 +28,7 @@ LL | struct DropMe(T); help: consider further restricting type parameter `T` with trait `Copy` | LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` - | ~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr b/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr index 774d5ba3c892c..db749436855d5 100644 --- a/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr +++ b/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr @@ -68,7 +68,7 @@ LL | fn wants_write(_: impl Write) {} help: consider changing this borrow's mutability | LL | wants_write(&mut [0u8][..]); - | ~~~~ + | +++ error: aborting due to 4 previous errors diff --git a/tests/ui/empty/empty-struct-braces-expr.stderr b/tests/ui/empty/empty-struct-braces-expr.stderr index cdedb3f20aab3..8ec8ecf46bf06 100644 --- a/tests/ui/empty/empty-struct-braces-expr.stderr +++ b/tests/ui/empty/empty-struct-braces-expr.stderr @@ -15,7 +15,7 @@ LL | pub struct XEmpty2; help: use struct literal syntax instead | LL | let e1 = Empty1 {}; - | ~~~~~~~~~ + | ++ help: a unit struct with a similar name exists | LL - let e1 = Empty1; @@ -38,7 +38,7 @@ LL | pub struct XEmpty2; help: use struct literal syntax instead | LL | let xe1 = XEmpty1 {}; - | ~~~~~~~~~~ + | ++ help: a unit struct with a similar name exists | LL - let xe1 = XEmpty1; @@ -126,7 +126,7 @@ LL | let xe3 = XE::Empty3; help: there is a variant with a similar name | LL | let xe3 = XE::XEmpty3; - | ~~~~~~~ + | + error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope --> $DIR/empty-struct-braces-expr.rs:26:19 diff --git a/tests/ui/empty/empty-struct-tuple-pat.stderr b/tests/ui/empty/empty-struct-tuple-pat.stderr index 19e44bacaa079..09b454653f62f 100644 --- a/tests/ui/empty/empty-struct-tuple-pat.stderr +++ b/tests/ui/empty/empty-struct-tuple-pat.stderr @@ -47,7 +47,7 @@ LL | XEmpty5(), help: use the tuple variant pattern syntax instead | LL | XE::XEmpty5() => (), - | ~~~~~~~~~~~~~ + | ++ help: a unit variant with a similar name exists | LL - XE::XEmpty5 => (), diff --git a/tests/ui/env-macro/error-recovery-issue-55897.stderr b/tests/ui/env-macro/error-recovery-issue-55897.stderr index 5a20bf8b16869..f1cacf5420eb6 100644 --- a/tests/ui/env-macro/error-recovery-issue-55897.stderr +++ b/tests/ui/env-macro/error-recovery-issue-55897.stderr @@ -31,7 +31,7 @@ LL | use env; help: consider importing this module instead | LL | use std::env; - | ~~~~~~~~ + | +++++ error: aborting due to 4 previous errors diff --git a/tests/ui/error-codes/E0027.stderr b/tests/ui/error-codes/E0027.stderr index 4a102629ad504..3a1ebf2971946 100644 --- a/tests/ui/error-codes/E0027.stderr +++ b/tests/ui/error-codes/E0027.stderr @@ -7,15 +7,15 @@ LL | Dog { age: x } => {} help: include the missing field in the pattern | LL | Dog { age: x, name } => {} - | ~~~~~~~~ + | ++++++ help: if you don't care about this missing field, you can explicitly ignore it | LL | Dog { age: x, name: _ } => {} - | ~~~~~~~~~~~ + | +++++++++ help: or always ignore missing fields here | LL | Dog { age: x, .. } => {} - | ~~~~~~ + | ++++ error[E0027]: pattern does not mention field `age` --> $DIR/E0027.rs:15:9 diff --git a/tests/ui/extern/not-in-block.stderr b/tests/ui/extern/not-in-block.stderr index cd1cd0fa50e64..e35c50343fcc4 100644 --- a/tests/ui/extern/not-in-block.stderr +++ b/tests/ui/extern/not-in-block.stderr @@ -12,7 +12,7 @@ LL + extern fn none_fn(x: bool) -> i32 { } help: if you meant to declare an externally defined function, use an `extern` block | LL | extern { fn none_fn(x: bool) -> i32; } - | ~~~~~~~~ + + | + + error: free function without a body --> $DIR/not-in-block.rs:6:1 @@ -28,7 +28,7 @@ LL + extern "C" fn c_fn(x: bool) -> i32 { } help: if you meant to declare an externally defined function, use an `extern` block | LL | extern "C" { fn c_fn(x: bool) -> i32; } - | ~~~~~~~~~~~~ + + | + + error: aborting due to 2 previous errors diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr index a50e5f2f73d90..214725b77c049 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr @@ -96,7 +96,7 @@ LL | extern "rust-call" fn call(self, args: ()) -> () {} help: change the self-receiver type to match the trait | LL | extern "rust-call" fn call(&self, args: ()) -> () {} - | ~~~~~ + | + error[E0183]: manual implementations of `FnOnce` are experimental --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6 diff --git a/tests/ui/fmt/no-inline-literals-out-of-range.stderr b/tests/ui/fmt/no-inline-literals-out-of-range.stderr index 25486b8547295..e17023887046f 100644 --- a/tests/ui/fmt/no-inline-literals-out-of-range.stderr +++ b/tests/ui/fmt/no-inline-literals-out-of-range.stderr @@ -52,7 +52,7 @@ LL | format_args!("{}", 0xffff_ffff); // treat unsuffixed literals as i32 help: to use as a negative number (decimal `-1`), consider using the type `u32` for the literal and cast it to `i32` | LL | format_args!("{}", 0xffff_ffffu32 as i32); // treat unsuffixed literals as i32 - | ~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++ error: aborting due to 5 previous errors diff --git a/tests/ui/impl-trait/no-method-suggested-traits.stderr b/tests/ui/impl-trait/no-method-suggested-traits.stderr index 676247d1a423b..0a974668188e2 100644 --- a/tests/ui/impl-trait/no-method-suggested-traits.stderr +++ b/tests/ui/impl-trait/no-method-suggested-traits.stderr @@ -18,7 +18,7 @@ LL + use no_method_suggested_traits::qux::PrivPub; help: there is a method `method2` with a similar name | LL | 1u32.method2(); - | ~~~~~~~ + | + error[E0599]: no method named `method` found for struct `Rc<&mut Box<&u32>>` in the current scope --> $DIR/no-method-suggested-traits.rs:26:44 @@ -40,7 +40,7 @@ LL + use no_method_suggested_traits::qux::PrivPub; help: there is a method `method2` with a similar name | LL | std::rc::Rc::new(&mut Box::new(&1u32)).method2(); - | ~~~~~~~ + | + error[E0599]: no method named `method` found for type `char` in the current scope --> $DIR/no-method-suggested-traits.rs:30:9 @@ -59,7 +59,7 @@ LL + use foo::Bar; help: there is a method `method2` with a similar name | LL | 'a'.method2(); - | ~~~~~~~ + | + error[E0599]: no method named `method` found for struct `Rc<&mut Box<&char>>` in the current scope --> $DIR/no-method-suggested-traits.rs:32:43 @@ -75,7 +75,7 @@ LL + use foo::Bar; help: there is a method `method2` with a similar name | LL | std::rc::Rc::new(&mut Box::new(&'a')).method2(); - | ~~~~~~~ + | + error[E0599]: no method named `method` found for type `i32` in the current scope --> $DIR/no-method-suggested-traits.rs:35:10 @@ -96,7 +96,7 @@ LL + use no_method_suggested_traits::foo::PubPub; help: there is a method `method3` with a similar name | LL | 1i32.method3(); - | ~~~~~~~ + | + error[E0599]: no method named `method` found for struct `Rc<&mut Box<&i32>>` in the current scope --> $DIR/no-method-suggested-traits.rs:37:44 @@ -112,7 +112,7 @@ LL + use no_method_suggested_traits::foo::PubPub; help: there is a method `method3` with a similar name | LL | std::rc::Rc::new(&mut Box::new(&1i32)).method3(); - | ~~~~~~~ + | + error[E0599]: no method named `method` found for struct `Foo` in the current scope --> $DIR/no-method-suggested-traits.rs:40:9 diff --git a/tests/ui/imports/glob-resolve1.stderr b/tests/ui/imports/glob-resolve1.stderr index 4401ef58732e8..75e65681c3ab8 100644 --- a/tests/ui/imports/glob-resolve1.stderr +++ b/tests/ui/imports/glob-resolve1.stderr @@ -38,7 +38,7 @@ LL | | } help: you might have meant to use the following enum variant | LL | B::B1; - | ~~~~~ + | ++++ error[E0425]: cannot find value `C` in this scope --> $DIR/glob-resolve1.rs:29:5 diff --git a/tests/ui/imports/issue-45829/import-self.stderr b/tests/ui/imports/issue-45829/import-self.stderr index f15beac5e16da..b392d93c15410 100644 --- a/tests/ui/imports/issue-45829/import-self.stderr +++ b/tests/ui/imports/issue-45829/import-self.stderr @@ -33,7 +33,7 @@ LL | use foo::{self}; help: you can use `as` to change the binding name of the import | LL | use foo::{self as other_foo}; - | ~~~~~~~~~~~~~~~~~ + | ++++++++++++ error[E0255]: the name `foo` is defined multiple times --> $DIR/import-self.rs:12:5 diff --git a/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr b/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr index 414eeee0fedc8..10b8db62edc91 100644 --- a/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr +++ b/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr @@ -7,7 +7,7 @@ LL | println!("Hello, {}!", crate::bar::do_the_thing); help: a similar path exists | LL | println!("Hello, {}!", crate::foo::bar::do_the_thing); - | ~~~~~~~~ + | +++++ help: consider importing this module | LL + use foo::bar; diff --git a/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr b/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr index 414eeee0fedc8..10b8db62edc91 100644 --- a/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr +++ b/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr @@ -7,7 +7,7 @@ LL | println!("Hello, {}!", crate::bar::do_the_thing); help: a similar path exists | LL | println!("Hello, {}!", crate::foo::bar::do_the_thing); - | ~~~~~~~~ + | +++++ help: consider importing this module | LL + use foo::bar; diff --git a/tests/ui/issues/issue-32004.stderr b/tests/ui/issues/issue-32004.stderr index 6fa548015fa28..fcbec97661b4b 100644 --- a/tests/ui/issues/issue-32004.stderr +++ b/tests/ui/issues/issue-32004.stderr @@ -12,7 +12,7 @@ LL | Foo::Bar => {} help: use the tuple variant pattern syntax instead | LL | Foo::Bar(_) => {} - | ~~~~~~~~~~~ + | +++ help: a unit variant with a similar name exists | LL - Foo::Bar => {} diff --git a/tests/ui/issues/issue-41652/issue-41652.stderr b/tests/ui/issues/issue-41652/issue-41652.stderr index a5a2fab2ede03..4a81e76af75ec 100644 --- a/tests/ui/issues/issue-41652/issue-41652.stderr +++ b/tests/ui/issues/issue-41652/issue-41652.stderr @@ -7,7 +7,7 @@ LL | 3.f() help: you must specify a concrete type for this numeric value, like `i32` | LL | 3_i32.f() - | ~~~~~ + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-51874.stderr b/tests/ui/issues/issue-51874.stderr index 5be3695dd4548..5c9331b4e1e1a 100644 --- a/tests/ui/issues/issue-51874.stderr +++ b/tests/ui/issues/issue-51874.stderr @@ -7,7 +7,7 @@ LL | let a = (1.0).pow(1.0); help: you must specify a concrete type for this numeric value, like `f32` | LL | let a = (1.0_f32).pow(1.0); - | ~~~~~~~ + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-5358-1.stderr b/tests/ui/issues/issue-5358-1.stderr index 1bb946ce4cb54..e68db865dc414 100644 --- a/tests/ui/issues/issue-5358-1.stderr +++ b/tests/ui/issues/issue-5358-1.stderr @@ -15,7 +15,7 @@ LL | S(Either::Right(_)) => {} help: you might have meant to use field `0` whose type is `Either` | LL | match S(Either::Left(5)).0 { - | ~~~~~~~~~~~~~~~~~~~~ + | ++ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-56175.stderr b/tests/ui/issues/issue-56175.stderr index 50c26b83dd379..df4cd6ce8a700 100644 --- a/tests/ui/issues/issue-56175.stderr +++ b/tests/ui/issues/issue-56175.stderr @@ -17,7 +17,7 @@ LL + use reexported_trait::Trait; help: there is a method `trait_method_b` with a similar name | LL | reexported_trait::FooStruct.trait_method_b(); - | ~~~~~~~~~~~~~~ + | ++ error[E0599]: no method named `trait_method_b` found for struct `FooStruct` in the current scope --> $DIR/issue-56175.rs:7:33 diff --git a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr index 3c19b68cffbb3..62d83a5461484 100644 --- a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr +++ b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr @@ -11,7 +11,7 @@ LL | T::A(a) | T::B(a) => a, help: consider dereferencing the boxed value | LL | let y = match *x { - | ~~ + | + error[E0308]: mismatched types --> $DIR/issue-57741.rs:20:19 @@ -26,7 +26,7 @@ LL | T::A(a) | T::B(a) => a, help: consider dereferencing the boxed value | LL | let y = match *x { - | ~~ + | + error[E0308]: mismatched types --> $DIR/issue-57741.rs:27:9 @@ -41,7 +41,7 @@ LL | S::A { a } | S::B { b: a } => a, help: consider dereferencing the boxed value | LL | let y = match *x { - | ~~ + | + error[E0308]: mismatched types --> $DIR/issue-57741.rs:27:22 @@ -56,7 +56,7 @@ LL | S::A { a } | S::B { b: a } => a, help: consider dereferencing the boxed value | LL | let y = match *x { - | ~~ + | + error: aborting due to 4 previous errors diff --git a/tests/ui/let-else/let-else-deref-coercion.stderr b/tests/ui/let-else/let-else-deref-coercion.stderr index da8b1f4c48e97..543737868c9ff 100644 --- a/tests/ui/let-else/let-else-deref-coercion.stderr +++ b/tests/ui/let-else/let-else-deref-coercion.stderr @@ -9,7 +9,7 @@ LL | let Bar::Present(z) = self else { help: consider dereferencing to access the inner value using the Deref trait | LL | let Bar::Present(z) = &**self else { - | ~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/let-else-deref-coercion.rs:68:13 @@ -22,7 +22,7 @@ LL | let Bar(z) = x; help: consider dereferencing to access the inner value using the Deref trait | LL | let Bar(z) = &**x; - | ~~~~ + | +++ error: aborting due to 2 previous errors diff --git a/tests/ui/lexer/lex-bad-char-literals-1.stderr b/tests/ui/lexer/lex-bad-char-literals-1.stderr index bf13df90be335..0985e274c0284 100644 --- a/tests/ui/lexer/lex-bad-char-literals-1.stderr +++ b/tests/ui/lexer/lex-bad-char-literals-1.stderr @@ -33,7 +33,7 @@ LL | "\●" help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal | LL | r"\●" - | ~~~~~ + | + error: aborting due to 4 previous errors diff --git a/tests/ui/lifetimes/borrowck-let-suggestion.stderr b/tests/ui/lifetimes/borrowck-let-suggestion.stderr index cca7f52957e4c..4703d7f10dc28 100644 --- a/tests/ui/lifetimes/borrowck-let-suggestion.stderr +++ b/tests/ui/lifetimes/borrowck-let-suggestion.stderr @@ -13,7 +13,7 @@ LL | x.use_mut(); help: consider consuming the `Vec` when turning it into an `Iterator` | LL | let mut x = vec![1].into_iter(); - | ~~~~~~~~~ + | +++++ help: consider using a `let` binding to create a longer lived value | LL ~ let binding = vec![1]; diff --git a/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr b/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr index 59f473b14d80c..105506968b16a 100644 --- a/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr +++ b/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr @@ -12,7 +12,7 @@ LL | #![deny(let_underscore_drop)] help: consider binding to an unused variable to avoid immediately dropping the value | LL | let _unused = foo(); - | ~~~~~~~ + | ++++++ help: consider immediately dropping the value | LL - let _ = foo(); diff --git a/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr b/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr index 3cef341ddb008..3ff57ab441dc9 100644 --- a/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr +++ b/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr @@ -29,7 +29,7 @@ LL | let _ = field; help: consider binding to an unused variable to avoid immediately dropping the value | LL | let _unused = field; - | ~~~~~~~ + | ++++++ help: consider immediately dropping the value | LL - let _ = field; diff --git a/tests/ui/lint/let_underscore/let_underscore_drop.stderr b/tests/ui/lint/let_underscore/let_underscore_drop.stderr index a326cd4fec4f3..001827b0d37f5 100644 --- a/tests/ui/lint/let_underscore/let_underscore_drop.stderr +++ b/tests/ui/lint/let_underscore/let_underscore_drop.stderr @@ -12,7 +12,7 @@ LL | #![warn(let_underscore_drop)] help: consider binding to an unused variable to avoid immediately dropping the value | LL | let _unused = NontrivialDrop; - | ~~~~~~~ + | ++++++ help: consider immediately dropping the value | LL - let _ = NontrivialDrop; diff --git a/tests/ui/lint/let_underscore/let_underscore_lock.stderr b/tests/ui/lint/let_underscore/let_underscore_lock.stderr index 90f661d379e64..a54a23e364b3b 100644 --- a/tests/ui/lint/let_underscore/let_underscore_lock.stderr +++ b/tests/ui/lint/let_underscore/let_underscore_lock.stderr @@ -8,7 +8,7 @@ LL | let _ = data.lock().unwrap(); help: consider binding to an unused variable to avoid immediately dropping the value | LL | let _unused = data.lock().unwrap(); - | ~~~~~~~ + | ++++++ help: consider immediately dropping the value | LL - let _ = data.lock().unwrap(); @@ -24,7 +24,7 @@ LL | let _ = data.lock(); help: consider binding to an unused variable to avoid immediately dropping the value | LL | let _unused = data.lock(); - | ~~~~~~~ + | ++++++ help: consider immediately dropping the value | LL - let _ = data.lock(); @@ -41,7 +41,7 @@ LL | let (_, _) = (data.lock(), 1); help: consider binding to an unused variable to avoid immediately dropping the value | LL | let (_unused, _) = (data.lock(), 1); - | ~~~~~~~ + | ++++++ error: non-binding let on a synchronization lock --> $DIR/let_underscore_lock.rs:16:26 @@ -53,7 +53,7 @@ LL | let (_a, Struct { a: _ }) = (0, Struct { a: data.lock() }); help: consider binding to an unused variable to avoid immediately dropping the value | LL | let (_a, Struct { a: _unused }) = (0, Struct { a: data.lock() }); - | ~~~~~~~ + | ++++++ error: non-binding let on a synchronization lock --> $DIR/let_underscore_lock.rs:18:6 diff --git a/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr b/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr index 1f528bdb28ff4..bcef0ae424e68 100644 --- a/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr +++ b/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr @@ -26,7 +26,7 @@ LL | let addr_32bit = &x as *const u8 as u32; help: use `.addr()` to obtain the address of a pointer | LL | let addr_32bit = (&x as *const u8).addr() as u32; - | + ~~~~~~~~~~~~~~~ + | + ++++++++ error: under strict provenance it is considered bad style to cast pointer `*const u8` to integer `usize` --> $DIR/lint-strict-provenance-lossy-casts.rs:14:20 diff --git a/tests/ui/lint/static-mut-refs.e2021.stderr b/tests/ui/lint/static-mut-refs.e2021.stderr index 39a4056dd7f44..337d5d0b307ee 100644 --- a/tests/ui/lint/static-mut-refs.e2021.stderr +++ b/tests/ui/lint/static-mut-refs.e2021.stderr @@ -10,7 +10,7 @@ LL | let _y = &X; help: use `&raw const` instead to create a raw pointer | LL | let _y = &raw const X; - | ~~~~~~~~~~ + | +++++++++ warning: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:42:18 @@ -46,7 +46,7 @@ LL | let (_b, _c) = (&X, &Y); help: use `&raw const` instead to create a raw pointer | LL | let (_b, _c) = (&raw const X, &Y); - | ~~~~~~~~~~ + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:54:29 @@ -59,7 +59,7 @@ LL | let (_b, _c) = (&X, &Y); help: use `&raw const` instead to create a raw pointer | LL | let (_b, _c) = (&X, &raw const Y); - | ~~~~~~~~~~ + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:60:13 @@ -72,7 +72,7 @@ LL | foo(&X); help: use `&raw const` instead to create a raw pointer | LL | foo(&raw const X); - | ~~~~~~~~~~ + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:66:17 @@ -103,7 +103,7 @@ LL | let _v = &A.value; help: use `&raw const` instead to create a raw pointer | LL | let _v = &raw const A.value; - | ~~~~~~~~~~ + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:80:18 @@ -116,7 +116,7 @@ LL | let _s = &A.s.value; help: use `&raw const` instead to create a raw pointer | LL | let _s = &raw const A.s.value; - | ~~~~~~~~~~ + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:84:22 diff --git a/tests/ui/lint/static-mut-refs.e2024.stderr b/tests/ui/lint/static-mut-refs.e2024.stderr index 51eaf2785d151..cf7f0a86f4fe7 100644 --- a/tests/ui/lint/static-mut-refs.e2024.stderr +++ b/tests/ui/lint/static-mut-refs.e2024.stderr @@ -10,7 +10,7 @@ LL | let _y = &X; help: use `&raw const` instead to create a raw pointer | LL | let _y = &raw const X; - | ~~~~~~~~~~ + | +++++++++ error: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:42:18 @@ -46,7 +46,7 @@ LL | let (_b, _c) = (&X, &Y); help: use `&raw const` instead to create a raw pointer | LL | let (_b, _c) = (&raw const X, &Y); - | ~~~~~~~~~~ + | +++++++++ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:54:29 @@ -59,7 +59,7 @@ LL | let (_b, _c) = (&X, &Y); help: use `&raw const` instead to create a raw pointer | LL | let (_b, _c) = (&X, &raw const Y); - | ~~~~~~~~~~ + | +++++++++ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:60:13 @@ -72,7 +72,7 @@ LL | foo(&X); help: use `&raw const` instead to create a raw pointer | LL | foo(&raw const X); - | ~~~~~~~~~~ + | +++++++++ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:66:17 @@ -103,7 +103,7 @@ LL | let _v = &A.value; help: use `&raw const` instead to create a raw pointer | LL | let _v = &raw const A.value; - | ~~~~~~~~~~ + | +++++++++ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:80:18 @@ -116,7 +116,7 @@ LL | let _s = &A.s.value; help: use `&raw const` instead to create a raw pointer | LL | let _s = &raw const A.s.value; - | ~~~~~~~~~~ + | +++++++++ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:84:22 diff --git a/tests/ui/lint/type-overflow.stderr b/tests/ui/lint/type-overflow.stderr index 4e68e7ee80f0c..6ba0c9d907c5e 100644 --- a/tests/ui/lint/type-overflow.stderr +++ b/tests/ui/lint/type-overflow.stderr @@ -67,7 +67,7 @@ LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000; help: to use as a negative number (decimal `-170141183460469231731687303715884105728`), consider using the type `u128` for the literal and cast it to `i128` | LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000u128 as i128; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++ warning: literal out of range for `i32` --> $DIR/type-overflow.rs:27:16 @@ -117,7 +117,7 @@ LL | let fail = 0x8FFF_FFFF_FFFF_FFFE; help: to use as a negative number (decimal `-2`), consider using the type `u32` for the literal and cast it to `i32` | LL | let fail = 0x8FFF_FFFF_FFFF_FFFEu32 as i32; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++ warning: literal out of range for `i8` --> $DIR/type-overflow.rs:46:17 diff --git a/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr b/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr index a5bd396f73ff1..2d43e61258069 100644 --- a/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr +++ b/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr @@ -13,7 +13,7 @@ LL | #![deny(unused)] help: try ignoring the field | LL | A { i, j: _ } | B { i, j: _ } => { - | ~~~~ ~~~~ + | +++ +++ error: unused variable: `j` --> $DIR/issue-67691-unused-field-in-or-pattern.rs:30:16 @@ -36,7 +36,7 @@ LL | Some(A { i, j } | B { i, j }) => { help: try ignoring the field | LL | Some(A { i, j: _ } | B { i, j: _ }) => { - | ~~~~ ~~~~ + | +++ +++ error: unused variable: `j` --> $DIR/issue-67691-unused-field-in-or-pattern.rs:52:21 diff --git a/tests/ui/macros/expr_2021_cargo_fix_edition.stderr b/tests/ui/macros/expr_2021_cargo_fix_edition.stderr index fe1fd4a26a028..a2c281d9c0a11 100644 --- a/tests/ui/macros/expr_2021_cargo_fix_edition.stderr +++ b/tests/ui/macros/expr_2021_cargo_fix_edition.stderr @@ -14,7 +14,7 @@ LL | #![warn(edition_2024_expr_fragment_specifier)] help: to keep the existing behavior, use the `expr_2021` fragment specifier | LL | ($e:expr_2021) => { - | ~~~~~~~~~ + | +++++ warning: the `expr` fragment specifier will accept more expressions in the 2024 edition --> $DIR/expr_2021_cargo_fix_edition.rs:11:11 @@ -27,7 +27,7 @@ LL | ($($i:expr)*) => { }; help: to keep the existing behavior, use the `expr_2021` fragment specifier | LL | ($($i:expr_2021)*) => { }; - | ~~~~~~~~~ + | +++++ warning: 2 warnings emitted diff --git a/tests/ui/macros/macro-backtrace-invalid-internals.stderr b/tests/ui/macros/macro-backtrace-invalid-internals.stderr index aa8f06a0df13b..836098bd9c04e 100644 --- a/tests/ui/macros/macro-backtrace-invalid-internals.stderr +++ b/tests/ui/macros/macro-backtrace-invalid-internals.stderr @@ -44,7 +44,7 @@ LL | real_method_stmt!(); help: you must specify a concrete type for this numeric value, like `f32` | LL | 2.0_f32.neg() - | ~~~~~~~ + | ++++ error[E0599]: no method named `fake` found for type `{integer}` in the current scope --> $DIR/macro-backtrace-invalid-internals.rs:23:13 @@ -92,7 +92,7 @@ LL | let _ = real_method_expr!(); help: you must specify a concrete type for this numeric value, like `f32` | LL | 2.0_f32.neg() - | ~~~~~~~ + | ++++ error: aborting due to 8 previous errors diff --git a/tests/ui/match/issue-56685.stderr b/tests/ui/match/issue-56685.stderr index ccf357d4aa00e..6a1d152ed5bb1 100644 --- a/tests/ui/match/issue-56685.stderr +++ b/tests/ui/match/issue-56685.stderr @@ -12,7 +12,7 @@ LL | #![deny(unused_variables)] help: if this is intentional, prefix it with an underscore | LL | E::A(_x) | E::B(_x) => {} - | ~~ ~~ + | + + error: unused variable: `x` --> $DIR/issue-56685.rs:25:14 @@ -23,7 +23,7 @@ LL | F::A(x, y) | F::B(x, y) => { y }, help: if this is intentional, prefix it with an underscore | LL | F::A(_x, y) | F::B(_x, y) => { y }, - | ~~ ~~ + | + + error: unused variable: `a` --> $DIR/issue-56685.rs:27:14 @@ -46,7 +46,7 @@ LL | let _ = if let F::A(x, y) | F::B(x, y) = F::A(1, 2) { help: if this is intentional, prefix it with an underscore | LL | let _ = if let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { - | ~~ ~~ + | + + error: unused variable: `x` --> $DIR/issue-56685.rs:39:20 @@ -57,7 +57,7 @@ LL | while let F::A(x, y) | F::B(x, y) = F::A(1, 2) { help: if this is intentional, prefix it with an underscore | LL | while let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { - | ~~ ~~ + | + + error: aborting due to 6 previous errors diff --git a/tests/ui/methods/issues/issue-90315.stderr b/tests/ui/methods/issues/issue-90315.stderr index 0466bb0a0c997..e495701a3d7bc 100644 --- a/tests/ui/methods/issues/issue-90315.stderr +++ b/tests/ui/methods/issues/issue-90315.stderr @@ -182,7 +182,7 @@ LL | let _res: i32 = ..6.take(2).sum(); help: you must specify a concrete type for this numeric value, like `i32` | LL | let _res: i32 = ..6_i32.take(2).sum(); - | ~~~~~ + | ++++ error: aborting due to 18 previous errors diff --git a/tests/ui/methods/method-on-ambiguous-numeric-type.stderr b/tests/ui/methods/method-on-ambiguous-numeric-type.stderr index 124270402727d..c9a549513077e 100644 --- a/tests/ui/methods/method-on-ambiguous-numeric-type.stderr +++ b/tests/ui/methods/method-on-ambiguous-numeric-type.stderr @@ -7,7 +7,7 @@ LL | let x = 2.0.neg(); help: you must specify a concrete type for this numeric value, like `f32` | LL | let x = 2.0_f32.neg(); - | ~~~~~~~ + | ++++ error[E0689]: can't call method `neg` on ambiguous numeric type `{float}` --> $DIR/method-on-ambiguous-numeric-type.rs:17:15 diff --git a/tests/ui/mir/issue-112269.stderr b/tests/ui/mir/issue-112269.stderr index 80f329e2ce026..fc8bf5d67b559 100644 --- a/tests/ui/mir/issue-112269.stderr +++ b/tests/ui/mir/issue-112269.stderr @@ -12,7 +12,7 @@ LL | let x: i32 = 3; help: introduce a variable instead | LL | let x_var: i32 = 3; - | ~~~~~ + | ++++ error[E0005]: refutable pattern in local binding --> $DIR/issue-112269.rs:7:9 @@ -28,7 +28,7 @@ LL | let y = 4; help: introduce a variable instead | LL | let y_var = 4; - | ~~~~~ + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/mismatched_types/issue-112036.stderr b/tests/ui/mismatched_types/issue-112036.stderr index bd446b3d78cb2..fed6b11a7b292 100644 --- a/tests/ui/mismatched_types/issue-112036.stderr +++ b/tests/ui/mismatched_types/issue-112036.stderr @@ -9,7 +9,7 @@ LL | fn drop(self) {} help: change the self-receiver type to match the trait | LL | fn drop(&mut self) {} - | ~~~~~~~~~ + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr b/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr index 784945dbbaeae..d69e83cce9a7f 100644 --- a/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr +++ b/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr @@ -196,7 +196,7 @@ LL | [t, t]; help: consider further restricting type parameter `T` with trait `Copy` | LL | T:, T: Copy - | ~~~~~~~~~ + | +++++++ error: aborting due to 11 previous errors diff --git a/tests/ui/namespace/namespace-mix.stderr b/tests/ui/namespace/namespace-mix.stderr index b80363fe8f848..412ea4aba30b8 100644 --- a/tests/ui/namespace/namespace-mix.stderr +++ b/tests/ui/namespace/namespace-mix.stderr @@ -11,7 +11,7 @@ LL | check(m1::S); help: a tuple struct with a similar name exists | LL | check(m1::TS); - | ~~ + | + help: consider importing one of these constants instead | LL + use m2::S; @@ -39,7 +39,7 @@ LL | pub struct TS(); help: a tuple struct with a similar name exists | LL | check(xm1::TS); - | ~~ + | + help: consider importing one of these constants instead | LL + use m2::S; @@ -65,7 +65,7 @@ LL | check(m7::V); help: a tuple variant with a similar name exists | LL | check(m7::TV); - | ~~ + | + help: consider importing one of these constants instead | LL + use m8::V; @@ -93,7 +93,7 @@ LL | TV(), help: a tuple variant with a similar name exists | LL | check(xm7::TV); - | ~~ + | + help: consider importing one of these constants instead | LL + use m8::V; diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr index 4f93fb4eaea34..a01b1d5174df4 100644 --- a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -34,7 +34,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) help: consider adding an explicit lifetime bound | LL | T: Iterator, ::Item: 'a - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++ note: external requirements --> $DIR/projection-no-regions-closure.rs:34:23 @@ -96,7 +96,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) help: consider adding an explicit lifetime bound | LL | T: 'b + Iterator, ::Item: 'a - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++ note: external requirements --> $DIR/projection-no-regions-closure.rs:52:23 diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr index da76ac1c474a3..07debd308c204 100644 --- a/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr +++ b/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr @@ -10,7 +10,7 @@ LL | Box::new(x.next()) help: consider adding an explicit lifetime bound | LL | T: Iterator, ::Item: 'a - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++ error[E0309]: the associated type `::Item` may not live long enough --> $DIR/projection-no-regions-fn.rs:28:5 @@ -24,7 +24,7 @@ LL | Box::new(x.next()) help: consider adding an explicit lifetime bound | LL | T: 'b + Iterator, ::Item: 'a - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/object-pointer-types.stderr b/tests/ui/object-pointer-types.stderr index 7d915ebdab657..ac8e069cfd2c8 100644 --- a/tests/ui/object-pointer-types.stderr +++ b/tests/ui/object-pointer-types.stderr @@ -10,7 +10,7 @@ LL | x.owned(); help: there is a method `to_owned` with a similar name | LL | x.to_owned(); - | ~~~~~~~~ + | +++ error[E0599]: no method named `owned` found for mutable reference `&mut dyn Foo` in the current scope --> $DIR/object-pointer-types.rs:17:7 diff --git a/tests/ui/parser/bad-char-literals.stderr b/tests/ui/parser/bad-char-literals.stderr index 1b047aa46193b..b5b05c2c142cd 100644 --- a/tests/ui/parser/bad-char-literals.stderr +++ b/tests/ui/parser/bad-char-literals.stderr @@ -7,7 +7,7 @@ LL | '''; help: escape the character | LL | '\''; - | ~~ + | + error: character constant must be escaped: `\n` --> $DIR/bad-char-literals.rs:10:6 diff --git a/tests/ui/parser/bad-escape-suggest-raw-string.stderr b/tests/ui/parser/bad-escape-suggest-raw-string.stderr index 6dd4ad512a8e3..15e99b3cb32ff 100644 --- a/tests/ui/parser/bad-escape-suggest-raw-string.stderr +++ b/tests/ui/parser/bad-escape-suggest-raw-string.stderr @@ -8,7 +8,7 @@ LL | let bad = "ab\[c"; help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal | LL | let bad = r"ab\[c"; - | ~~~~~~~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/byte-literals.stderr b/tests/ui/parser/byte-literals.stderr index 9e1c2df3e56ef..1c89e8e2864b6 100644 --- a/tests/ui/parser/byte-literals.stderr +++ b/tests/ui/parser/byte-literals.stderr @@ -40,7 +40,7 @@ LL | b'''; help: escape the character | LL | b'\''; - | ~~ + | + error: non-ASCII character in byte literal --> $DIR/byte-literals.rs:10:7 diff --git a/tests/ui/parser/extern-no-fn.stderr b/tests/ui/parser/extern-no-fn.stderr index 03826e4a93b7a..67acbf9b87fc2 100644 --- a/tests/ui/parser/extern-no-fn.stderr +++ b/tests/ui/parser/extern-no-fn.stderr @@ -12,7 +12,7 @@ LL | } help: if you meant to call a macro, try | LL | f!(); - | ~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr b/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr index 7fc2db0fa5591..7146949ca2f8f 100644 --- a/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr +++ b/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr @@ -55,7 +55,7 @@ LL | mut n = 0; help: missing keyword | LL | let mut n = 0; - | ~~~~~~~ + | +++ error: invalid variable declaration --> $DIR/issue-65257-invalid-var-decl-recovery.rs:16:5 @@ -66,7 +66,7 @@ LL | mut var; help: missing keyword | LL | let mut var; - | ~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/issue-65257-invalid-var-decl-recovery.rs:20:33 diff --git a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr index b6e24faf5dabb..a9bad96f9af76 100644 --- a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr +++ b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr @@ -9,7 +9,7 @@ LL | Foo:Bar => {} help: maybe write a path separator here | LL | Foo::Bar => {} - | ~~ + | + error: expected one of `!`, `(`, `...`, `..=`, `..`, `::`, `{`, or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:23:17 @@ -22,7 +22,7 @@ LL | qux::Foo:Bar => {} help: maybe write a path separator here | LL | qux::Foo::Bar => {} - | ~~ + | + error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:29:12 @@ -35,7 +35,7 @@ LL | qux:Foo::Baz => {} help: maybe write a path separator here | LL | qux::Foo::Baz => {} - | ~~ + | + error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:35:12 @@ -61,7 +61,7 @@ LL | if let Foo:Bar = f() { help: maybe write a path separator here | LL | if let Foo::Bar = f() { - | ~~ + | + error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:49:16 @@ -100,7 +100,7 @@ LL | Foo:Bar::Baz => {} help: maybe write a path separator here | LL | Foo::Bar::Baz => {} - | ~~ + | + error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:75:12 @@ -113,7 +113,7 @@ LL | Foo:Bar => {} help: maybe write a path separator here | LL | Foo::Bar => {} - | ~~ + | + warning: irrefutable `if let` pattern --> $DIR/issue-87086-colon-path-sep.rs:40:8 diff --git a/tests/ui/parser/missing-fn-issue-65381-2.stderr b/tests/ui/parser/missing-fn-issue-65381-2.stderr index e13d395d70d7f..17a25bc6671af 100644 --- a/tests/ui/parser/missing-fn-issue-65381-2.stderr +++ b/tests/ui/parser/missing-fn-issue-65381-2.stderr @@ -7,7 +7,7 @@ LL | main(); help: if you meant to call a macro, try | LL | main!(); - | ~~~~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/const.stderr b/tests/ui/parser/misspelled-keywords/const.stderr index 35e4d731db768..59346461ce775 100644 --- a/tests/ui/parser/misspelled-keywords/const.stderr +++ b/tests/ui/parser/misspelled-keywords/const.stderr @@ -7,7 +7,7 @@ LL | cons A: u8 = 10; help: there is a keyword `const` with a similar name | LL | const A: u8 = 10; - | ~~~~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr b/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr index 551b2e3ff09b0..583b98c650f03 100644 --- a/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr +++ b/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr @@ -8,7 +8,7 @@ LL | let x = Tr; help: maybe write a path separator here | LL | let x = Tr; - | ~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/use-colon-as-mod-sep.stderr b/tests/ui/parser/use-colon-as-mod-sep.stderr index 347b271df9900..9b4cc0ca23776 100644 --- a/tests/ui/parser/use-colon-as-mod-sep.stderr +++ b/tests/ui/parser/use-colon-as-mod-sep.stderr @@ -8,7 +8,7 @@ LL | use std::process:Command; help: use double colon | LL | use std::process::Command; - | ~~ + | + error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:5:8 @@ -20,7 +20,7 @@ LL | use std:fs::File; help: use double colon | LL | use std::fs::File; - | ~~ + | + error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:7:8 @@ -32,7 +32,7 @@ LL | use std:collections:HashMap; help: use double colon | LL | use std::collections:HashMap; - | ~~ + | + error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:7:20 @@ -44,7 +44,7 @@ LL | use std:collections:HashMap; help: use double colon | LL | use std:collections::HashMap; - | ~~ + | + error: aborting due to 4 previous errors diff --git a/tests/ui/pattern/pat-tuple-field-count-cross.stderr b/tests/ui/pattern/pat-tuple-field-count-cross.stderr index 931db37c78ef1..e164281826bf1 100644 --- a/tests/ui/pattern/pat-tuple-field-count-cross.stderr +++ b/tests/ui/pattern/pat-tuple-field-count-cross.stderr @@ -122,7 +122,7 @@ LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) } help: use the tuple variant pattern syntax instead | LL | E1::Z1() => {} - | ~~~~~~~~ + | ++ help: a unit variant with a similar name exists | LL - E1::Z1 => {} diff --git a/tests/ui/pattern/pat-tuple-overfield.stderr b/tests/ui/pattern/pat-tuple-overfield.stderr index ea3663ea40e76..b19b9d1934727 100644 --- a/tests/ui/pattern/pat-tuple-overfield.stderr +++ b/tests/ui/pattern/pat-tuple-overfield.stderr @@ -156,7 +156,7 @@ LL | E1::Z1 => {} help: use the tuple variant pattern syntax instead | LL | E1::Z1() => {} - | ~~~~~~~~ + | ++ help: a unit variant with a similar name exists | LL - E1::Z1 => {} diff --git a/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr b/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr index e9c2fccaba284..a6623c6306b5b 100644 --- a/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr +++ b/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr @@ -7,7 +7,7 @@ LL | b.make_ascii_uppercase(); help: consider changing this to be mutable | LL | let &(mut b) = a; - | ~~~~~ + + | ++++ + error: aborting due to 1 previous error diff --git a/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr b/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr index e93b8bbacccdd..7fa65e3d6bda6 100644 --- a/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr +++ b/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr @@ -7,7 +7,7 @@ LL | mutate(&mut x); help: consider changing this to be mutable | LL | fn foo(&(mut x): &i32) { - | ~~~~~ + + | ++++ + error: aborting due to 1 previous error diff --git a/tests/ui/pattern/usefulness/doc-hidden-fields.stderr b/tests/ui/pattern/usefulness/doc-hidden-fields.stderr index 158eac9a1bd14..d7e1b54e7499f 100644 --- a/tests/ui/pattern/usefulness/doc-hidden-fields.stderr +++ b/tests/ui/pattern/usefulness/doc-hidden-fields.stderr @@ -18,15 +18,15 @@ LL | let HiddenStruct { one } = HiddenStruct::default(); help: include the missing field in the pattern and ignore the inaccessible fields | LL | let HiddenStruct { one, two, .. } = HiddenStruct::default(); - | ~~~~~~~~~~~ + | +++++++++ help: if you don't care about this missing field, you can explicitly ignore it | LL | let HiddenStruct { one, two: _, .. } = HiddenStruct::default(); - | ~~~~~~~~~~~~~~ + | ++++++++++++ help: or always ignore missing fields here | LL | let HiddenStruct { one, .. } = HiddenStruct::default(); - | ~~~~~~ + | ++++ error[E0027]: pattern does not mention field `two` --> $DIR/doc-hidden-fields.rs:21:9 @@ -37,15 +37,15 @@ LL | let HiddenStruct { one, hide } = HiddenStruct::default(); help: include the missing field in the pattern | LL | let HiddenStruct { one, hide, two } = HiddenStruct::default(); - | ~~~~~~~ + | +++++ help: if you don't care about this missing field, you can explicitly ignore it | LL | let HiddenStruct { one, hide, two: _ } = HiddenStruct::default(); - | ~~~~~~~~~~ + | ++++++++ help: or always ignore missing fields here | LL | let HiddenStruct { one, hide, .. } = HiddenStruct::default(); - | ~~~~~~ + | ++++ error[E0027]: pattern does not mention field `im_hidden` --> $DIR/doc-hidden-fields.rs:24:9 @@ -56,15 +56,15 @@ LL | let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; help: include the missing field in the pattern | LL | let InCrate { a, b, im_hidden } = InCrate { a: 0, b: false, im_hidden: 0 }; - | ~~~~~~~~~~~~~ + | +++++++++++ help: if you don't care about this missing field, you can explicitly ignore it | LL | let InCrate { a, b, im_hidden: _ } = InCrate { a: 0, b: false, im_hidden: 0 }; - | ~~~~~~~~~~~~~~~~ + | ++++++++++++++ help: or always ignore missing fields here | LL | let InCrate { a, b, .. } = InCrate { a: 0, b: false, im_hidden: 0 }; - | ~~~~~~ + | ++++ error: aborting due to 4 previous errors diff --git a/tests/ui/pattern/usefulness/stable-gated-fields.stderr b/tests/ui/pattern/usefulness/stable-gated-fields.stderr index d6e9bac7c136b..7c30b530d6d21 100644 --- a/tests/ui/pattern/usefulness/stable-gated-fields.stderr +++ b/tests/ui/pattern/usefulness/stable-gated-fields.stderr @@ -7,15 +7,15 @@ LL | let UnstableStruct { stable } = UnstableStruct::default(); help: include the missing field in the pattern and ignore the inaccessible fields | LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default(); - | ~~~~~~~~~~~~~~~ + | +++++++++++++ help: if you don't care about this missing field, you can explicitly ignore it | LL | let UnstableStruct { stable, stable2: _, .. } = UnstableStruct::default(); - | ~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++ help: or always ignore missing fields here | LL | let UnstableStruct { stable, .. } = UnstableStruct::default(); - | ~~~~~~ + | ++++ error: pattern requires `..` due to inaccessible fields --> $DIR/stable-gated-fields.rs:11:9 diff --git a/tests/ui/privacy/suggest-box-new.stderr b/tests/ui/privacy/suggest-box-new.stderr index 80885a8f2f1d7..b651348de29ea 100644 --- a/tests/ui/privacy/suggest-box-new.stderr +++ b/tests/ui/privacy/suggest-box-new.stderr @@ -10,7 +10,7 @@ LL | let _ = std::collections::HashMap(); help: you might have meant to use an associated function to build this type | LL | let _ = std::collections::HashMap::new(); - | ~~~~~~~ + | +++++ LL - let _ = std::collections::HashMap(); LL + let _ = std::collections::HashMap::with_capacity(_); | @@ -23,7 +23,7 @@ LL + let _ = std::collections::HashMap::with_capacity_and_hasher(_, _); help: consider using the `Default` trait | LL | let _ = ::default(); - | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | + ++++++++++++++++++++++++++++++++++ error[E0423]: cannot initialize a tuple struct which contains private fields --> $DIR/suggest-box-new.rs:8:19 diff --git a/tests/ui/pub/pub-ident-fn-or-struct.stderr b/tests/ui/pub/pub-ident-fn-or-struct.stderr index ceadc510c63ef..99c8e5754ef73 100644 --- a/tests/ui/pub/pub-ident-fn-or-struct.stderr +++ b/tests/ui/pub/pub-ident-fn-or-struct.stderr @@ -7,7 +7,7 @@ LL | pub S (foo) bar help: if you meant to call a macro, try | LL | pub S! (foo) bar - | ~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/pub/pub-restricted.stderr b/tests/ui/pub/pub-restricted.stderr index fc177aa2033e1..6c913938bb89a 100644 --- a/tests/ui/pub/pub-restricted.stderr +++ b/tests/ui/pub/pub-restricted.stderr @@ -11,7 +11,7 @@ LL | pub (a) fn afn() {} help: make this visible only to module `a` with `in` | LL | pub (in a) fn afn() {} - | ~~~~ + | ++ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:4:6 @@ -26,7 +26,7 @@ LL | pub (b) fn bfn() {} help: make this visible only to module `b` with `in` | LL | pub (in b) fn bfn() {} - | ~~~~ + | ++ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:5:6 @@ -41,7 +41,7 @@ LL | pub (crate::a) fn cfn() {} help: make this visible only to module `crate::a` with `in` | LL | pub (in crate::a) fn cfn() {} - | ~~~~~~~~~~~ + | ++ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:22:14 @@ -56,7 +56,7 @@ LL | pub (a) invalid: usize, help: make this visible only to module `a` with `in` | LL | pub (in a) invalid: usize, - | ~~~~ + | ++ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:31:6 @@ -71,7 +71,7 @@ LL | pub (xyz) fn xyz() {} help: make this visible only to module `xyz` with `in` | LL | pub (in xyz) fn xyz() {} - | ~~~~~~ + | ++ error[E0742]: visibilities can only be restricted to ancestor modules --> $DIR/pub-restricted.rs:23:17 diff --git a/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr b/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr index b3cc90ff1f501..ef641eb5681bf 100644 --- a/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr +++ b/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr @@ -74,7 +74,7 @@ LL | _ => {} help: you might have meant to pattern match against the value of constant `ARCH` instead of introducing a new catch-all binding | LL | std::env::consts::ARCH => {} - | ~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++ error: aborting due to 5 previous errors diff --git a/tests/ui/resolve/issue-39226.stderr b/tests/ui/resolve/issue-39226.stderr index 84f9ad531f082..1cd2a5fb2216e 100644 --- a/tests/ui/resolve/issue-39226.stderr +++ b/tests/ui/resolve/issue-39226.stderr @@ -10,7 +10,7 @@ LL | handle: Handle help: use struct literal syntax instead | LL | handle: Handle {} - | ~~~~~~~~~ + | ++ help: a local variable with a similar name exists | LL - handle: Handle diff --git a/tests/ui/resolve/issue-55673.stderr b/tests/ui/resolve/issue-55673.stderr index 86dfca068a37c..2695868b77187 100644 --- a/tests/ui/resolve/issue-55673.stderr +++ b/tests/ui/resolve/issue-55673.stderr @@ -19,7 +19,7 @@ LL | T::Baa: std::fmt::Debug, help: consider further restricting type parameter `T` with trait `Foo` | LL | T::Baa: std::fmt::Debug, T: Foo - | ~~~~~~~~ + | ++++++ help: ...and changing the associated type name | LL - T::Baa: std::fmt::Debug, diff --git a/tests/ui/resolve/issue-73427.stderr b/tests/ui/resolve/issue-73427.stderr index 3c49fe3a8de57..fccbfe547cb21 100644 --- a/tests/ui/resolve/issue-73427.stderr +++ b/tests/ui/resolve/issue-73427.stderr @@ -21,7 +21,7 @@ LL - A.foo(); LL + (A::Tuple()).foo(); | LL | A::Unit.foo(); - | ~~~~~~~ + | ++++++ help: alternatively, the following enum variant is available | LL - A.foo(); @@ -61,7 +61,7 @@ LL | | } help: you might have meant to use the following enum variant | LL | C::Unit.foo(); - | ~~~~~~~ + | ++++++ help: alternatively, the following enum variant is available | LL - C.foo(); @@ -85,7 +85,7 @@ LL | | } help: you might have meant to use the following enum variant | LL | D::Unit.foo(); - | ~~~~~~~ + | ++++++ help: alternatively, the following enum variant is available | LL - D.foo(); @@ -142,9 +142,9 @@ LL | | } help: try to match against one of the enum's variants | LL | if let A::Tuple(3) = x { } - | ~~~~~~~~ + | +++++++ LL | if let A::TupleWithFields(3) = x { } - | ~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++ error[E0423]: expected function, tuple struct or tuple variant, found enum `A` --> $DIR/issue-73427.rs:46:13 @@ -167,9 +167,9 @@ LL | | } help: try to construct one of the enum's variants | LL | let x = A::Tuple(3); - | ~~~~~~~~ + | +++++++ LL | let x = A::TupleWithFields(3); - | ~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++ error: aborting due to 7 previous errors diff --git a/tests/ui/resolve/privacy-enum-ctor.stderr b/tests/ui/resolve/privacy-enum-ctor.stderr index fb6787274fac8..f349b9391d15a 100644 --- a/tests/ui/resolve/privacy-enum-ctor.stderr +++ b/tests/ui/resolve/privacy-enum-ctor.stderr @@ -125,7 +125,7 @@ LL | | } help: you might have meant to use the following enum variant | LL | let _: E = E::Unit; - | ~~~~~~~ + | ++++++ help: alternatively, the following enum variant is available | LL - let _: E = E; diff --git a/tests/ui/resolve/resolve-inconsistent-names.stderr b/tests/ui/resolve/resolve-inconsistent-names.stderr index d6240fb8f872c..5fac622eef263 100644 --- a/tests/ui/resolve/resolve-inconsistent-names.stderr +++ b/tests/ui/resolve/resolve-inconsistent-names.stderr @@ -35,7 +35,7 @@ LL | (A, B) | (ref B, c) | (c, A) => () help: if you meant to match on unit variant `E::A`, use the full path in the pattern | LL | (E::A, B) | (ref B, c) | (c, A) => () - | ~~~~ + | +++ error[E0408]: variable `B` is not bound in all patterns --> $DIR/resolve-inconsistent-names.rs:19:31 @@ -65,7 +65,7 @@ LL | (CONST1, _) | (_, Const2) => () help: if you meant to match on constant `m::Const2`, use the full path in the pattern | LL | (CONST1, _) | (_, m::Const2) => () - | ~~~~~~~~~ + | +++ error[E0408]: variable `CONST1` is not bound in all patterns --> $DIR/resolve-inconsistent-names.rs:31:23 diff --git a/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr b/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr index b41fa1818e25a..366bc1bf03cc7 100644 --- a/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr +++ b/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr @@ -12,7 +12,7 @@ LL | const DEFAULT: u32 = 0; help: introduce a variable instead | LL | let DEFAULT_var: u32 = 0; - | ~~~~~~~~~~~ + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr b/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr index 908f5bdd89749..1392eb48f8ccb 100644 --- a/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr +++ b/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr @@ -22,7 +22,7 @@ LL | const DEFAULT: u32 = 0; help: introduce a variable instead | LL | let DEFAULT_var: u32 = 0; - | ~~~~~~~~~~~ + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr index d183f06c5fd4e..5832cb69a3dd8 100644 --- a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr +++ b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr @@ -67,7 +67,7 @@ LL | Self::BAR; help: a constant with a similar name exists | LL | BARR; - | ~~~~ + | + error[E0412]: cannot find type `Baz` in this scope --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:37:18 diff --git a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr index e7651f7704c7c..2d0d0d0f38670 100644 --- a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr +++ b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr @@ -40,7 +40,7 @@ LL | modul::foo(); help: there is a crate or module with a similar name | LL | module::foo(); - | ~~~~~~ + | + error[E0433]: failed to resolve: use of undeclared type `Trai` --> $DIR/typo-suggestion-mistyped-in-path.rs:39:5 diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr index 39b1ef1e078c7..88411f29b16e4 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr @@ -59,7 +59,7 @@ LL | let NormalStruct { first_field, second_field } = ns; help: add `..` at the end of the field list to ignore all other fields | LL | let NormalStruct { first_field, second_field , .. } = ns; - | ~~~~~~ + | ++++ error[E0423]: cannot initialize a tuple struct which contains private fields --> $DIR/struct.rs:20:14 @@ -76,7 +76,7 @@ LL | let TupleStruct { 0: first_field, 1: second_field } = ts; help: add `..` at the end of the field list to ignore all other fields | LL | let TupleStruct { 0: first_field, 1: second_field , .. } = ts; - | ~~~~~~ + | ++++ error[E0638]: `..` required with struct marked as non-exhaustive --> $DIR/struct.rs:35:9 @@ -87,7 +87,7 @@ LL | let UnitStruct { } = us; help: add `..` at the end of the field list to ignore all other fields | LL | let UnitStruct { .. } = us; - | ~~~~ + | ++ error: aborting due to 9 previous errors diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr index 4083f57a9cdf9..dcecd53d38a1e 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr @@ -83,7 +83,7 @@ LL | NonExhaustiveVariants::Struct { field } => "" help: add `..` at the end of the field list to ignore all other fields | LL | NonExhaustiveVariants::Struct { field , .. } => "" - | ~~~~~~ + | ++++ error[E0638]: `..` required with variant marked as non-exhaustive --> $DIR/variant.rs:30:12 @@ -94,7 +94,7 @@ LL | if let NonExhaustiveVariants::Struct { field } = variant_struct { help: add `..` at the end of the field list to ignore all other fields | LL | if let NonExhaustiveVariants::Struct { field , .. } = variant_struct { - | ~~~~~~ + | ++++ error: aborting due to 8 previous errors diff --git a/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr b/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr index d0c084f7bd5d0..38360e06cbe79 100644 --- a/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr +++ b/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr @@ -7,7 +7,7 @@ LL | use alloc; help: consider importing this module instead | LL | use std::alloc; - | ~~~~~~~~~~ + | +++++ error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/trait-import-suggestions.stderr b/tests/ui/rust-2018/trait-import-suggestions.stderr index 8632bca6b1023..488044ee85245 100644 --- a/tests/ui/rust-2018/trait-import-suggestions.stderr +++ b/tests/ui/rust-2018/trait-import-suggestions.stderr @@ -35,7 +35,7 @@ LL + use crate::foo::Bar; help: there is a method `foobar` with a similar name | LL | x.foobar(); - | ~~~~~~ + | +++ error[E0599]: no method named `baz` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:29:7 diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr b/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr index 050834ab67609..34bf1c6c10ac4 100644 --- a/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr @@ -12,7 +12,7 @@ LL | #![deny(stable_features)] help: if you are using features which are still unstable, change to using `const_foobar` | LL | #![feature(const_foobar)] - | ~~~~~~~~~~~~ + | +++ help: if you are using features which are now stable, remove this line | LL - #![feature(const_foo)] diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr b/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr index 50cc14c3b4f65..095c37fd0b680 100644 --- a/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr @@ -12,7 +12,7 @@ LL | #![deny(stable_features)] help: if you are using features which are still unstable, change to using `const_foobar` | LL | #![feature(const_foobar)] - | ~~~~~~~~~~~~ + | +++ help: if you are using features which are now stable, remove this line | LL - #![feature(const_foo)] diff --git a/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr b/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr index d783f1e8e4044..86cb764a4b3e7 100644 --- a/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr +++ b/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr @@ -12,7 +12,7 @@ LL | #![deny(stable_features)] help: if you are using features which are still unstable, change to using `foobar` | LL | #![feature(foobar)] - | ~~~~~~ + | +++ help: if you are using features which are now stable, remove this line | LL - #![feature(foo)] diff --git a/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr b/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr index 4940650fd4261..2537646eb9835 100644 --- a/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr +++ b/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr @@ -12,7 +12,7 @@ LL | #![deny(stable_features)] help: if you are using features which are still unstable, change to using `foobar` | LL | #![feature(foobar)] - | ~~~~~~ + | +++ help: if you are using features which are now stable, remove this line | LL - #![feature(foo)] diff --git a/tests/ui/statics/issue-15261.stderr b/tests/ui/statics/issue-15261.stderr index 4067d151de3d4..7e6aebcbb1f0e 100644 --- a/tests/ui/statics/issue-15261.stderr +++ b/tests/ui/statics/issue-15261.stderr @@ -10,7 +10,7 @@ LL | static n: &'static usize = unsafe { &n_mut }; help: use `&raw const` instead to create a raw pointer | LL | static n: &'static usize = unsafe { &raw const n_mut }; - | ~~~~~~~~~~ + | +++++++++ warning: 1 warning emitted diff --git a/tests/ui/statics/static-mut-shared-parens.stderr b/tests/ui/statics/static-mut-shared-parens.stderr index ad6ad68c3157d..3d4b55909cdee 100644 --- a/tests/ui/statics/static-mut-shared-parens.stderr +++ b/tests/ui/statics/static-mut-shared-parens.stderr @@ -10,7 +10,7 @@ LL | let _ = unsafe { (&TEST) as *const usize }; help: use `&raw const` instead to create a raw pointer | LL | let _ = unsafe { (&raw const TEST) as *const usize }; - | ~~~~~~~~~~ + | +++++++++ warning: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-shared-parens.rs:11:22 diff --git a/tests/ui/statics/static-mut-xc.stderr b/tests/ui/statics/static-mut-xc.stderr index 77ce49b883fce..48cac28a6eb51 100644 --- a/tests/ui/statics/static-mut-xc.stderr +++ b/tests/ui/statics/static-mut-xc.stderr @@ -55,7 +55,7 @@ LL | static_bound(&static_mut_xc::a); help: use `&raw const` instead to create a raw pointer | LL | static_bound(&raw const static_mut_xc::a); - | ~~~~~~~~~~ + | +++++++++ warning: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-xc.rs:35:22 diff --git a/tests/ui/statics/static-recursive.stderr b/tests/ui/statics/static-recursive.stderr index f2dd5b8a6cfe8..039934dfc692d 100644 --- a/tests/ui/statics/static-recursive.stderr +++ b/tests/ui/statics/static-recursive.stderr @@ -10,7 +10,7 @@ LL | static mut S: *const u8 = unsafe { &S as *const *const u8 as *const u8 }; help: use `&raw const` instead to create a raw pointer | LL | static mut S: *const u8 = unsafe { &raw const S as *const *const u8 as *const u8 }; - | ~~~~~~~~~~ + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-recursive.rs:19:20 diff --git a/tests/ui/structs/struct-fields-hints-no-dupe.stderr b/tests/ui/structs/struct-fields-hints-no-dupe.stderr index 2b88d802833c3..aeba7f00b9dc8 100644 --- a/tests/ui/structs/struct-fields-hints-no-dupe.stderr +++ b/tests/ui/structs/struct-fields-hints-no-dupe.stderr @@ -7,7 +7,7 @@ LL | bar : 42, help: a field with a similar name exists | LL | barr : 42, - | ~~~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/structs/struct-pat-derived-error.stderr b/tests/ui/structs/struct-pat-derived-error.stderr index 628a007e7693f..7fceb95cc5d2c 100644 --- a/tests/ui/structs/struct-pat-derived-error.stderr +++ b/tests/ui/structs/struct-pat-derived-error.stderr @@ -25,15 +25,15 @@ LL | let A { x, y } = self.d; help: include the missing fields in the pattern | LL | let A { x, y, b, c } = self.d; - | ~~~~~~~~ + | ++++++ help: if you don't care about these missing fields, you can explicitly ignore them | LL | let A { x, y, b: _, c: _ } = self.d; - | ~~~~~~~~~~~~~~ + | ++++++++++++ help: or always ignore missing fields here | LL | let A { x, y, .. } = self.d; - | ~~~~~~ + | ++++ error: aborting due to 3 previous errors diff --git a/tests/ui/structs/struct-tuple-field-names.stderr b/tests/ui/structs/struct-tuple-field-names.stderr index ef3869dda5355..953f01e1fb6cc 100644 --- a/tests/ui/structs/struct-tuple-field-names.stderr +++ b/tests/ui/structs/struct-tuple-field-names.stderr @@ -31,15 +31,15 @@ LL | if let E::S { 0: a } = x { help: include the missing field in the pattern | LL | if let E::S { 0: a, 1: _ } = x { - | ~~~~~~~~ + | ++++++ help: if you don't care about this missing field, you can explicitly ignore it | LL | if let E::S { 0: a, 1: _ } = x { - | ~~~~~~~~ + | ++++++ help: or always ignore missing fields here | LL | if let E::S { 0: a, .. } = x { - | ~~~~~~ + | ++++ error: aborting due to 3 previous errors diff --git a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr index af530e2b75931..3a828e955773f 100644 --- a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr +++ b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr @@ -16,15 +16,15 @@ LL | Foo::Bar { a, aa: 1, c } => (), help: include the missing field in the pattern | LL | Foo::Bar { a, aa: 1, c, b } => (), - | ~~~~~ + | +++ help: if you don't care about this missing field, you can explicitly ignore it | LL | Foo::Bar { a, aa: 1, c, b: _ } => (), - | ~~~~~~~~ + | ++++++ help: or always ignore missing fields here | LL | Foo::Bar { a, aa: 1, c, .. } => (), - | ~~~~~~ + | ++++ error[E0026]: variant `Foo::Baz` does not have a field named `bb` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:13:20 @@ -44,15 +44,15 @@ LL | Foo::Baz { bb: 1.0 } => (), help: include the missing field in the pattern | LL | Foo::Baz { bb: 1.0, a } => (), - | ~~~~~ + | +++ help: if you don't care about this missing field, you can explicitly ignore it | LL | Foo::Baz { bb: 1.0, a: _ } => (), - | ~~~~~~~~ + | ++++++ help: or always ignore missing fields here | LL | Foo::Baz { bb: 1.0, .. } => (), - | ~~~~~~ + | ++++ error[E0026]: variant `Foo::Bar` does not have a field named `aa` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:20:23 @@ -69,15 +69,15 @@ LL | Foo::Bar { a, aa: "", c } => (), help: include the missing field in the pattern | LL | Foo::Bar { a, aa: "", c, b } => (), - | ~~~~~ + | +++ help: if you don't care about this missing field, you can explicitly ignore it | LL | Foo::Bar { a, aa: "", c, b: _ } => (), - | ~~~~~~~~ + | ++++++ help: or always ignore missing fields here | LL | Foo::Bar { a, aa: "", c, .. } => (), - | ~~~~~~ + | ++++ error[E0026]: variant `Foo::Baz` does not have a field named `bb` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:23:20 @@ -94,15 +94,15 @@ LL | Foo::Baz { bb: "" } => (), help: include the missing field in the pattern | LL | Foo::Baz { bb: "", a } => (), - | ~~~~~ + | +++ help: if you don't care about this missing field, you can explicitly ignore it | LL | Foo::Baz { bb: "", a: _ } => (), - | ~~~~~~~~ + | ++++++ help: or always ignore missing fields here | LL | Foo::Baz { bb: "", .. } => (), - | ~~~~~~ + | ++++ error: aborting due to 8 previous errors diff --git a/tests/ui/suggestions/bound-suggestions.stderr b/tests/ui/suggestions/bound-suggestions.stderr index e30deb11398e6..f23e086afe4e7 100644 --- a/tests/ui/suggestions/bound-suggestions.stderr +++ b/tests/ui/suggestions/bound-suggestions.stderr @@ -44,7 +44,7 @@ LL | println!("{:?} {:?}", x, y); help: consider further restricting type parameter `Y` with trait `Debug` | LL | fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug { - | ~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++ error[E0277]: `X` doesn't implement `Debug` --> $DIR/bound-suggestions.rs:33:22 diff --git a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr index 4f92d3aceefe0..0dc17f2c25c38 100644 --- a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr +++ b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr @@ -13,7 +13,7 @@ LL | const A: i32 = 2; help: introduce a variable instead | LL | let A_var = 3; - | ~~~~~ + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/crate-or-module-typo.stderr b/tests/ui/suggestions/crate-or-module-typo.stderr index cbe765731b46c..2ec4fc7ed6ccf 100644 --- a/tests/ui/suggestions/crate-or-module-typo.stderr +++ b/tests/ui/suggestions/crate-or-module-typo.stderr @@ -7,7 +7,7 @@ LL | use st::cell::Cell; help: there is a crate or module with a similar name | LL | use std::cell::Cell; - | ~~~ + | + error[E0432]: unresolved import `bas` --> $DIR/crate-or-module-typo.rs:11:5 @@ -30,7 +30,7 @@ LL | bar: st::cell::Cell help: there is a crate or module with a similar name | LL | bar: std::cell::Cell - | ~~~ + | + help: consider importing this module | LL + use std::cell; diff --git a/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr b/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr index a58c2a584f75e..c275cdccaa8c1 100644 --- a/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr +++ b/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr @@ -21,7 +21,7 @@ LL | fn foo(&self) where Self: Other, { } help: alternatively, consider constraining `foo` so it does not apply to trait objects | LL | fn foo() where Self: Other, Self: Sized { } - | ~~~~~~~~~~~~~ + | +++++++++++ help: consider changing method `bar`'s `self` parameter to be `&self` | LL - fn bar(self: ()) {} diff --git a/tests/ui/suggestions/field-access.stderr b/tests/ui/suggestions/field-access.stderr index 7d816b5bfdd17..362dae172c78f 100644 --- a/tests/ui/suggestions/field-access.stderr +++ b/tests/ui/suggestions/field-access.stderr @@ -12,7 +12,7 @@ LL | if let B::Fst = a {}; help: you might have meant to use field `b` whose type is `B` | LL | if let B::Fst = a.b {}; - | ~~~ + | ++ error[E0308]: mismatched types --> $DIR/field-access.rs:25:9 @@ -29,7 +29,7 @@ LL | B::Fst => (), help: you might have meant to use field `b` whose type is `B` | LL | match a.b { - | ~~~ + | ++ error[E0308]: mismatched types --> $DIR/field-access.rs:26:9 @@ -46,7 +46,7 @@ LL | B::Snd => (), help: you might have meant to use field `b` whose type is `B` | LL | match a.b { - | ~~~ + | ++ error[E0308]: mismatched types --> $DIR/field-access.rs:32:9 diff --git a/tests/ui/suggestions/imm-ref-trait-object-literal.stderr b/tests/ui/suggestions/imm-ref-trait-object-literal.stderr index 79fa468dc4947..4b770d572c565 100644 --- a/tests/ui/suggestions/imm-ref-trait-object-literal.stderr +++ b/tests/ui/suggestions/imm-ref-trait-object-literal.stderr @@ -15,7 +15,7 @@ LL | fn foo(_: X) {} help: consider changing this borrow's mutability | LL | foo(&mut s); - | ~~~~ + | +++ error[E0277]: the trait bound `S: Trait` is not satisfied --> $DIR/imm-ref-trait-object-literal.rs:13:7 diff --git a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr index 89cda2a56e064..204209179adf3 100644 --- a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr +++ b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr @@ -12,7 +12,7 @@ LL | fn g(mut x: impl Iterator) -> Option<&'static ()> { x.next( help: consider introducing a named lifetime parameter | LL | fn g<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } - | ++++ ~~~ ~~~ + | ++++ ++ ++ help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Iterator) -> Option<&()> { x.next() } @@ -33,7 +33,7 @@ LL | async fn i(mut x: impl Iterator) -> Option<&'static ()> { x help: consider introducing a named lifetime parameter | LL | async fn i<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } - | ++++ ~~~ ~~~ + | ++++ ++ ++ help: alternatively, you might want to return an owned value | LL - async fn i(mut x: impl Iterator) -> Option<&()> { x.next() } @@ -100,7 +100,7 @@ LL | fn g(mut x: impl Foo) -> Option<&'static ()> { x.next() } help: consider introducing a named lifetime parameter | LL | fn g<'a>(mut x: impl Foo) -> Option<&'a ()> { x.next() } - | ++++ ~~~ + | ++++ ++ help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Foo) -> Option<&()> { x.next() } @@ -121,7 +121,7 @@ LL | fn g(mut x: impl Foo<()>) -> Option<&'static ()> { x.next() } help: consider introducing a named lifetime parameter | LL | fn g<'a>(mut x: impl Foo<()>) -> Option<&'a ()> { x.next() } - | ++++ ~~~ + | ++++ ++ help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Foo<()>) -> Option<&()> { x.next() } diff --git a/tests/ui/suggestions/struct-field-type-including-single-colon.stderr b/tests/ui/suggestions/struct-field-type-including-single-colon.stderr index 4dd514480da40..5ffc5b40849b6 100644 --- a/tests/ui/suggestions/struct-field-type-including-single-colon.stderr +++ b/tests/ui/suggestions/struct-field-type-including-single-colon.stderr @@ -7,7 +7,7 @@ LL | a: foo:A, help: write a path separator here | LL | a: foo::A, - | ~~ + | + error: expected `,`, or `}`, found `:` --> $DIR/struct-field-type-including-single-colon.rs:9:11 @@ -26,7 +26,7 @@ LL | b: foo::bar:B, help: write a path separator here | LL | b: foo::bar::B, - | ~~ + | + error: expected `,`, or `}`, found `:` --> $DIR/struct-field-type-including-single-colon.rs:15:16 diff --git a/tests/ui/suggestions/suggest-change-mut.stderr b/tests/ui/suggestions/suggest-change-mut.stderr index 216d1e810fd72..c47ae433ab896 100644 --- a/tests/ui/suggestions/suggest-change-mut.stderr +++ b/tests/ui/suggestions/suggest-change-mut.stderr @@ -20,7 +20,7 @@ LL | fn issue_81421(mut stream: T) where &T: std::io::Read { help: consider changing this borrow's mutability | LL | let mut stream_reader = BufReader::new(&mut stream); - | ~~~~ + | +++ error[E0599]: the method `read_until` exists for struct `BufReader<&T>`, but its trait bounds were not satisfied --> $DIR/suggest-change-mut.rs:16:23 diff --git a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr index 5af2c3fbd9b98..2061b3f122a2f 100644 --- a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr +++ b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr @@ -12,7 +12,7 @@ LL | Some(_) => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match *x { - | ~~ + | + error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:9:9 @@ -28,7 +28,7 @@ LL | None => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match *x { - | ~~ + | + error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:16:9 @@ -78,7 +78,7 @@ LL | Some(_) => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match *y { - | ~~ + | + error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:28:9 @@ -94,7 +94,7 @@ LL | None => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match *y { - | ~~ + | + error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:36:9 @@ -144,7 +144,7 @@ LL | Some(_) => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match &**z_const { - | ~~~~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:48:9 @@ -160,7 +160,7 @@ LL | None => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match &**z_const { - | ~~~~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:57:9 @@ -176,7 +176,7 @@ LL | Some(_) => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match &**z_mut { - | ~~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:59:9 @@ -192,7 +192,7 @@ LL | None => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match &**z_mut { - | ~~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:68:9 @@ -208,7 +208,7 @@ LL | Some(_) => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match &**y_mut { - | ~~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:70:9 @@ -224,7 +224,7 @@ LL | None => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match &**y_mut { - | ~~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:79:9 diff --git a/tests/ui/suggestions/suggest-methods.stderr b/tests/ui/suggestions/suggest-methods.stderr index f9f6e5f86fc96..b6925a4c62637 100644 --- a/tests/ui/suggestions/suggest-methods.stderr +++ b/tests/ui/suggestions/suggest-methods.stderr @@ -46,7 +46,7 @@ LL | let _ = 63u32.count_o(); help: there is a method `count_ones` with a similar name | LL | let _ = 63u32.count_ones(); - | ~~~~~~~~~~ + | +++ error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/suggest-variants.stderr b/tests/ui/suggestions/suggest-variants.stderr index 7d62604e23f1e..50286a9687594 100644 --- a/tests/ui/suggestions/suggest-variants.stderr +++ b/tests/ui/suggestions/suggest-variants.stderr @@ -25,7 +25,7 @@ LL | println!("My shape is {:?}", Shape::Circl { size: 5}); help: there is a variant with a similar name | LL | println!("My shape is {:?}", Shape::Circle { size: 5}); - | ~~~~~~ + | + error[E0599]: no variant named `Rombus` found for enum `Shape` --> $DIR/suggest-variants.rs:14:41 @@ -63,7 +63,7 @@ LL | Shape::Circl; help: there is a variant with a similar name | LL | Shape::Circle { radius: /* value */ }; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++ error[E0599]: no variant or associated item named `Rombus` found for enum `Shape` in the current scope --> $DIR/suggest-variants.rs:17:12 diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr b/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr index ba0682cda3212..0b37bf9a57bb7 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr @@ -8,7 +8,7 @@ LL | let _ = vec![Ok(2)].into_iter().collect:,_>>()?; help: maybe write a path separator here | LL | let _ = vec![Ok(2)].into_iter().collect::,_>>()?; - | ~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr index 56b6a69a283f4..a424bc7e72452 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr @@ -7,7 +7,7 @@ LL | let _: Vec = A::B; help: you might have meant to write a path instead of an associated type bound | LL | let _: Vec = A::B; - | ~~ + | + error[E0107]: struct takes at least 1 generic argument but 0 generic arguments were supplied --> $DIR/type-ascription-instead-of-path-in-type.rs:6:12 diff --git a/tests/ui/suggestions/type-mismatch-byte-literal.stderr b/tests/ui/suggestions/type-mismatch-byte-literal.stderr index 3d27149f0dcf1..7211d77fdcba1 100644 --- a/tests/ui/suggestions/type-mismatch-byte-literal.stderr +++ b/tests/ui/suggestions/type-mismatch-byte-literal.stderr @@ -9,7 +9,7 @@ LL | let _x: u8 = 'X'; help: if you meant to write a byte literal, prefix with `b` | LL | let _x: u8 = b'X'; - | ~~~~ + | + error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:11:9 @@ -27,7 +27,7 @@ LL | fn foo(_t: u8) {} help: if you meant to write a byte literal, prefix with `b` | LL | foo(b'#'); - | ~~~~ + | + error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:15:18 @@ -40,7 +40,7 @@ LL | let _a: u8 = '\x20'; help: if you meant to write a byte literal, prefix with `b` | LL | let _a: u8 = b'\x20'; - | ~~~~~~~ + | + error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:20:9 diff --git a/tests/ui/test-attrs/inaccessible-test-modules.stderr b/tests/ui/test-attrs/inaccessible-test-modules.stderr index 7635f579d66b9..dfb6985730af5 100644 --- a/tests/ui/test-attrs/inaccessible-test-modules.stderr +++ b/tests/ui/test-attrs/inaccessible-test-modules.stderr @@ -13,7 +13,7 @@ LL | use test as y; help: consider importing this module instead | LL | use test::test as y; - | ~~~~~~~~~~~~~~~ + | ++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr index 7985b611a4f60..2288bd1129c43 100644 --- a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr +++ b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr @@ -15,7 +15,7 @@ LL + struct Foo where T: Bar, T: Bar { help: a trait with a similar name exists | LL | struct Foo where T: Bar, ::Baz: ToString { - | ~~~~~~~~ + | ++ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:9:54 @@ -34,7 +34,7 @@ LL + struct Qux<'a, T> where T: Bar, &'a T: Bar { help: a trait with a similar name exists | LL | struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: ToString { - | ~~~~~~~~ + | ++ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:13:45 @@ -53,7 +53,7 @@ LL + fn foo(_: T) where T: Bar { help: a trait with a similar name exists | LL | fn foo(_: T) where ::Baz: ToString { - | ~~~~~~~~ + | ++ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:16:57 @@ -72,7 +72,7 @@ LL + fn qux<'a, T: Bar>(_: &'a T) where &'a T: Bar { help: a trait with a similar name exists | LL | fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: ToString { - | ~~~~~~~~ + | ++ error[E0405]: cannot find trait `Unresolved` in this scope --> $DIR/assoc_type_bound_with_struct.rs:19:31 diff --git a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr index 40e16dde6e4a4..9d54675c260b2 100644 --- a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr +++ b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr @@ -26,7 +26,7 @@ LL | for F: 'a, help: consider adding an explicit lifetime bound | LL | for F: 'a, !1_"F": 'a - | ~~~~~~~~~~~~ + | ++++++++++ error[E0309]: the placeholder type `!1_"F"` may not live long enough --> $DIR/type-match-with-late-bound.rs:11:1 @@ -40,7 +40,7 @@ LL | {} help: consider adding an explicit lifetime bound | LL | for F: 'a, !1_"F": 'a - | ~~~~~~~~~~~~ + | ++++++++++ error[E0309]: the placeholder type `!2_"F"` may not live long enough --> $DIR/type-match-with-late-bound.rs:11:1 @@ -54,7 +54,7 @@ LL | {} help: consider adding an explicit lifetime bound | LL | for F: 'a, !2_"F": 'a - | ~~~~~~~~~~~~ + | ++++++++++ error: aborting due to 3 previous errors; 1 warning emitted diff --git a/tests/ui/transmutability/assoc-bound.stderr b/tests/ui/transmutability/assoc-bound.stderr index b3c7680bf2949..4dff24e2002aa 100644 --- a/tests/ui/transmutability/assoc-bound.stderr +++ b/tests/ui/transmutability/assoc-bound.stderr @@ -13,7 +13,7 @@ LL | type AssocB: std::mem::TransmuteFrom<()>; help: consider further restricting the associated type | LL | T: A, ::AssocA: TransmuteFrom<(), Assume { alignment: false, lifetimes: false, safety: false, validity: false }> - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error[E0277]: `()` cannot be safely transmuted into `<&i32 as A>::AssocA` --> $DIR/assoc-bound.rs:24:19 diff --git a/tests/ui/type/issue-100584.stderr b/tests/ui/type/issue-100584.stderr index e1db14d1f001b..1523bdda7614b 100644 --- a/tests/ui/type/issue-100584.stderr +++ b/tests/ui/type/issue-100584.stderr @@ -20,7 +20,7 @@ LL | let _ = format!("{xyza}"); help: if this is intentional, prefix it with an underscore | LL | fn foo(_xyza: &str) { - | ~~~~~ + | + error: unused variable: `xyza` --> $DIR/issue-100584.rs:7:9 @@ -38,7 +38,7 @@ LL | let _ = format!("aaa{xyza}bbb"); help: if this is intentional, prefix it with an underscore | LL | fn foo3(_xyza: &str) { - | ~~~~~ + | + error: aborting due to 2 previous errors diff --git a/tests/ui/type/pattern_types/pattern_type_mismatch.stderr b/tests/ui/type/pattern_types/pattern_type_mismatch.stderr index 19b0c1059c86f..4af92a89c445a 100644 --- a/tests/ui/type/pattern_types/pattern_type_mismatch.stderr +++ b/tests/ui/type/pattern_types/pattern_type_mismatch.stderr @@ -7,7 +7,7 @@ LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); help: if you meant to write a byte literal, prefix with `b` | LL | const BAD_NESTING4: pattern_type!(u8 is b'a'..='a') = todo!(); - | ~~~~ + | + error[E0308]: mismatched types --> $DIR/pattern_type_mismatch.rs:8:47 @@ -18,7 +18,7 @@ LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); help: if you meant to write a byte literal, prefix with `b` | LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..=b'a') = todo!(); - | ~~~~ + | + error[E0308]: mismatched types --> $DIR/pattern_type_mismatch.rs:12:43 diff --git a/tests/ui/typeck/issue-29181.stderr b/tests/ui/typeck/issue-29181.stderr index 53addf2fe4d09..ca82405966ecd 100644 --- a/tests/ui/typeck/issue-29181.stderr +++ b/tests/ui/typeck/issue-29181.stderr @@ -13,7 +13,7 @@ LL | let _ = |x: f64| x * 2.0.exp(); help: you must specify a concrete type for this numeric value, like `f32` | LL | let _ = |x: f64| x * 2.0_f32.exp(); - | ~~~~~~~ + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/method-chain-gats.stderr b/tests/ui/typeck/method-chain-gats.stderr index 6338379221471..d3a54dbd0f9e2 100644 --- a/tests/ui/typeck/method-chain-gats.stderr +++ b/tests/ui/typeck/method-chain-gats.stderr @@ -20,7 +20,7 @@ LL | Self::Base: Functor; help: consider further restricting the associated type | LL | T::Base: Functor = T::Base>, ::Base: Functor - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/typeck/mismatched-map-under-self.stderr b/tests/ui/typeck/mismatched-map-under-self.stderr index 59de00a58bbea..541de25749e38 100644 --- a/tests/ui/typeck/mismatched-map-under-self.stderr +++ b/tests/ui/typeck/mismatched-map-under-self.stderr @@ -14,7 +14,7 @@ LL | fn values(&self) -> Self::Values; help: change the self-receiver type to match the trait | LL | fn values(&self) -> Self::Values { - | ~~~~~ + | + error[E0631]: type mismatch in function arguments --> $DIR/mismatched-map-under-self.rs:12:18 diff --git a/tests/ui/unresolved/unresolved-candidates.stderr b/tests/ui/unresolved/unresolved-candidates.stderr index 7ef2f6b1a2922..7be1bcd38de59 100644 --- a/tests/ui/unresolved/unresolved-candidates.stderr +++ b/tests/ui/unresolved/unresolved-candidates.stderr @@ -7,7 +7,7 @@ LL | use Trait; help: consider importing this trait instead | LL | use a::Trait; - | ~~~~~~~~ + | +++ error[E0405]: cannot find trait `Trait` in this scope --> $DIR/unresolved-candidates.rs:10:10 From a1a6fd74d248242e3c4c6db195f4070165b743bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Thu, 13 Feb 2025 09:41:23 +0100 Subject: [PATCH 10/19] Add warning about using llvm.ccache and add FIXME note --- src/bootstrap/src/core/config/config.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 0ee476d19c9d3..62625fc3660f9 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -962,6 +962,7 @@ define_config! { tests: Option = "tests", enzyme: Option = "enzyme", plugins: Option = "plugins", + // FIXME: Remove this field at Q2 2025, it has been replaced by build.ccache ccache: Option = "ccache", static_libstdcpp: Option = "static-libstdcpp", libzstd: Option = "libzstd", @@ -2031,6 +2032,10 @@ impl Config { download_ci_llvm, build_config, } = llvm; + if llvm_ccache.is_some() { + eprintln!("Warning: llvm.ccache is deprecated. Use build.ccache instead."); + } + ccache = ccache.or(llvm_ccache); set(&mut config.ninja_in_file, ninja); llvm_tests = tests; From 8ff3639dffe3cd7802d407d8f43eb1788d3de661 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 13 Feb 2025 11:29:55 +0100 Subject: [PATCH 11/19] ci: move `x86_64-gnu-debug` job to the free runner --- src/ci/github-actions/jobs.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index c08104e796b93..48814f7dd8a19 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -294,9 +294,7 @@ auto: <<: *job-linux-4c - name: x86_64-gnu-debug - # This seems to be needed because a full stage 2 build + run-make tests - # overwhelms the storage capacity of the standard 4c runner. - <<: *job-linux-4c-largedisk + <<: *job-linux-4c - name: x86_64-gnu-distcheck <<: *job-linux-8c From bd4f80c44912ce1a78bb3027d0e1711a5c4272ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Thu, 13 Feb 2025 13:35:03 +0100 Subject: [PATCH 12/19] Remove `llvm.ccache` option from `config.example.toml` --- config.example.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/config.example.toml b/config.example.toml index ad79f5d5a80c0..86d40db3ded74 100644 --- a/config.example.toml +++ b/config.example.toml @@ -87,10 +87,6 @@ # Whether to build LLVM with support for it's gpu offload runtime. #offload = false -# Indicates whether ccache is used when building LLVM. Set to `true` to use the first `ccache` in -# PATH, or set an absolute path to use a specific version. -#ccache = false - # When true, link libstdc++ statically into the rustc_llvm. # This is useful if you don't want to use the dynamic version of that # library provided by LLVM. From 0709ba3e7bd2eece4a15d5ed88b9304cb8c2f001 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Thu, 13 Feb 2025 10:40:15 +0300 Subject: [PATCH 13/19] unify LLVM version finding logic Signed-off-by: onur-ozkan --- src/bootstrap/src/core/build_steps/compile.rs | 5 +++-- src/bootstrap/src/core/build_steps/llvm.rs | 17 ++++++++++++----- src/bootstrap/src/core/build_steps/test.rs | 4 ++-- src/bootstrap/src/core/builder/mod.rs | 2 +- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index a2375842bddef..bee0da0eb9048 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -1092,9 +1092,10 @@ pub fn rustc_cargo( // We want to link against registerEnzyme and in the future we want to use additional // functionality from Enzyme core. For that we need to link against Enzyme. - // FIXME(ZuseZ4): Get the LLVM version number automatically instead of hardcoding it. if builder.config.llvm_enzyme { - cargo.rustflag("-l").rustflag("Enzyme-19"); + let llvm_config = builder.llvm_config(builder.config.build).unwrap(); + let llvm_version_major = llvm::get_llvm_version_major(builder, &llvm_config); + cargo.rustflag("-l").rustflag(&format!("Enzyme-{llvm_version_major}")); } // Building with protected visibility reduces the number of dynamic relocations needed, giving diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs index ee60dbef7b98e..18da0e8252b90 100644 --- a/src/bootstrap/src/core/build_steps/llvm.rs +++ b/src/bootstrap/src/core/build_steps/llvm.rs @@ -571,10 +571,7 @@ impl Step for Llvm { // Helper to find the name of LLVM's shared library on darwin and linux. let find_llvm_lib_name = |extension| { - let version = - command(&res.llvm_config).arg("--version").run_capture_stdout(builder).stdout(); - let major = version.split('.').next().unwrap(); - + let major = get_llvm_version_major(builder, &res.llvm_config); match &llvm_version_suffix { Some(version_suffix) => format!("libLLVM-{major}{version_suffix}.{extension}"), None => format!("libLLVM-{major}.{extension}"), @@ -624,12 +621,22 @@ impl Step for Llvm { } } +pub fn get_llvm_version(builder: &Builder<'_>, llvm_config: &Path) -> String { + command(llvm_config).arg("--version").run_capture_stdout(builder).stdout().trim().to_owned() +} + +pub fn get_llvm_version_major(builder: &Builder<'_>, llvm_config: &Path) -> u8 { + let version = get_llvm_version(builder, llvm_config); + let major_str = version.split_once('.').expect("Failed to parse LLVM version").0; + major_str.parse().unwrap() +} + fn check_llvm_version(builder: &Builder<'_>, llvm_config: &Path) { if builder.config.dry_run() { return; } - let version = command(llvm_config).arg("--version").run_capture_stdout(builder).stdout(); + let version = get_llvm_version(builder, llvm_config); let mut parts = version.split('.').take(2).filter_map(|s| s.parse::().ok()); if let (Some(major), Some(_minor)) = (parts.next(), parts.next()) { if major >= 18 { diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 509875a469f1f..fdbb48ca4e65e 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -12,6 +12,7 @@ use clap_complete::shells; use crate::core::build_steps::compile::run_cargo; use crate::core::build_steps::doc::DocumentationFormat; +use crate::core::build_steps::llvm::get_llvm_version; use crate::core::build_steps::synthetic_targets::MirOptPanicAbortSyntheticTarget; use crate::core::build_steps::tool::{self, SourceType, Tool}; use crate::core::build_steps::toolstate::ToolState; @@ -1945,8 +1946,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the let llvm::LlvmResult { llvm_config, .. } = builder.ensure(llvm::Llvm { target: builder.config.build }); if !builder.config.dry_run() { - let llvm_version = - command(&llvm_config).arg("--version").run_capture_stdout(builder).stdout(); + let llvm_version = get_llvm_version(builder, &llvm_config); let llvm_components = command(&llvm_config).arg("--components").run_capture_stdout(builder).stdout(); // Remove trailing newline from llvm-config output. diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs index 8e767a8dcc695..ecec589fc32eb 100644 --- a/src/bootstrap/src/core/builder/mod.rs +++ b/src/bootstrap/src/core/builder/mod.rs @@ -1431,7 +1431,7 @@ impl<'a> Builder<'a> { /// /// Note that this returns `None` if LLVM is disabled, or if we're in a /// check build or dry-run, where there's no need to build all of LLVM. - fn llvm_config(&self, target: TargetSelection) -> Option { + pub fn llvm_config(&self, target: TargetSelection) -> Option { if self.config.llvm_enabled(target) && self.kind != Kind::Check && !self.config.dry_run() { let llvm::LlvmResult { llvm_config, .. } = self.ensure(llvm::Llvm { target }); if llvm_config.is_file() { From f7a03d075fa203eceaee81d730a78913c9ece2d4 Mon Sep 17 00:00:00 2001 From: jyn Date: Thu, 13 Feb 2025 09:57:05 -0500 Subject: [PATCH 14/19] Fix `x test --stage 1 ui-fulldeps` on macOS (until the next beta bump) "stage 1" for fulldeps means "compile with stage 0, link against stage 1". But this code wanted to switch on the compiler that's building, not the compiler that's being tested. Fix the check. Previously, it would fail with a warning about linker-messages: ``` --- stderr ------------------------------- warning[E0602]: unknown lint: `linker_messages` | = note: requested on the command line with `-A linker_messages` = note: `#[warn(unknown_lints)]` on by default ``` --- src/bootstrap/src/core/build_steps/test.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 825e5452f0e6a..f645b0e838625 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -1840,6 +1840,14 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the } } + // FIXME(136096): on macOS, we get linker warnings about duplicate `-lm` flags. + // NOTE: `stage > 1` here because `test --stage 1 ui-fulldeps` is a hack that compiles + // with stage 0, but links the tests against stage 1. + // cfg(bootstrap) - remove only the `stage > 1` check, leave everything else. + if suite == "ui-fulldeps" && compiler.stage > 1 && target.ends_with("darwin") { + flags.push("-Alinker_messages".into()); + } + let mut hostflags = flags.clone(); hostflags.push(format!("-Lnative={}", builder.test_helpers_out(compiler.host).display())); hostflags.extend(linker_flags(builder, compiler.host, LldThreads::No)); @@ -1847,12 +1855,6 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the let mut targetflags = flags; targetflags.push(format!("-Lnative={}", builder.test_helpers_out(target).display())); - // FIXME: on macOS, we get linker warnings about duplicate `-lm` flags. We should investigate why this happens. - if suite == "ui-fulldeps" && target.ends_with("darwin") { - hostflags.push("-Alinker_messages".into()); - targetflags.push("-Alinker_messages".into()); - } - for flag in hostflags { cmd.arg("--host-rustcflags").arg(flag); } From de273e459e4b0cbbcf7be68294a7d1fb25632b29 Mon Sep 17 00:00:00 2001 From: lcnr Date: Tue, 11 Feb 2025 10:37:04 +0100 Subject: [PATCH 15/19] normalizes-to rework rigid alias handling --- .../src/solve/assembly/mod.rs | 31 +++-- .../src/solve/effect_goals.rs | 2 +- .../src/solve/normalizes_to/mod.rs | 108 ++++++------------ .../src/solve/normalizes_to/opaque_types.rs | 28 ++--- .../src/solve/inspect/analyse.rs | 2 - .../rustc_trait_selection/src/solve/select.rs | 3 +- compiler/rustc_type_ir/src/solve/inspect.rs | 2 - 7 files changed, 77 insertions(+), 99 deletions(-) diff --git a/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs b/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs index a3274fb401156..23fe88b16802d 100644 --- a/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs +++ b/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs @@ -797,11 +797,12 @@ where /// treat the alias as rigid. /// /// See trait-system-refactor-initiative#124 for more details. - #[instrument(level = "debug", skip(self), ret)] + #[instrument(level = "debug", skip(self, inject_normalize_to_rigid_candidate), ret)] pub(super) fn merge_candidates( &mut self, proven_via: Option, candidates: Vec>, + inject_normalize_to_rigid_candidate: impl FnOnce(&mut EvalCtxt<'_, D>) -> QueryResult, ) -> QueryResult { let Some(proven_via) = proven_via else { // We don't care about overflow. If proving the trait goal overflowed, then @@ -818,13 +819,27 @@ where // FIXME(const_trait_impl): should this behavior also be used by // constness checking. Doing so is *at least theoretically* breaking, // see github.com/rust-lang/rust/issues/133044#issuecomment-2500709754 - TraitGoalProvenVia::ParamEnv | TraitGoalProvenVia::AliasBound => candidates - .iter() - .filter(|c| { - matches!(c.source, CandidateSource::AliasBound | CandidateSource::ParamEnv(_)) - }) - .map(|c| c.result) - .collect(), + TraitGoalProvenVia::ParamEnv | TraitGoalProvenVia::AliasBound => { + let mut candidates_from_env: Vec<_> = candidates + .iter() + .filter(|c| { + matches!( + c.source, + CandidateSource::AliasBound | CandidateSource::ParamEnv(_) + ) + }) + .map(|c| c.result) + .collect(); + + // If the trait goal has been proven by using the environment, we want to treat + // aliases as rigid if there are no applicable projection bounds in the environment. + if candidates_from_env.is_empty() { + if let Ok(response) = inject_normalize_to_rigid_candidate(self) { + candidates_from_env.push(response); + } + } + candidates_from_env + } TraitGoalProvenVia::Misc => candidates.iter().map(|c| c.result).collect(), }; diff --git a/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs b/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs index eb398e8724d44..0b61c368d8e8d 100644 --- a/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs +++ b/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs @@ -405,6 +405,6 @@ where goal.with(ecx.cx(), goal.predicate.trait_ref); ecx.compute_trait_goal(trait_goal) })?; - self.merge_candidates(proven_via, candidates) + self.merge_candidates(proven_via, candidates, |_ecx| Err(NoSolution)) } } diff --git a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs index 1d0ec7b45ca19..e3d16719e283d 100644 --- a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs +++ b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs @@ -30,75 +30,26 @@ where ) -> QueryResult { self.set_is_normalizes_to_goal(); debug_assert!(self.term_is_fully_unconstrained(goal)); - let normalize_result = self - .probe(|&result| ProbeKind::TryNormalizeNonRigid { result }) - .enter(|this| this.normalize_at_least_one_step(goal)); - - match normalize_result { - Ok(res) => Ok(res), - Err(NoSolution) => { - self.probe(|&result| ProbeKind::RigidAlias { result }).enter(|this| { - let Goal { param_env, predicate: NormalizesTo { alias, term } } = goal; - this.add_rigid_constraints(param_env, alias)?; - this.relate_rigid_alias_non_alias(param_env, alias, ty::Invariant, term)?; - this.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) - }) - } - } - } - - /// Register any obligations that are used to validate that an alias should be - /// treated as rigid. - /// - /// An alias may be considered rigid if it fails normalization, but we also don't - /// want to consider aliases that are not well-formed to be rigid simply because - /// they fail normalization. - /// - /// For example, some `::Assoc` where `T: Trait` does not hold, or an - /// opaque type whose hidden type doesn't actually satisfy the opaque item bounds. - fn add_rigid_constraints( - &mut self, - param_env: I::ParamEnv, - rigid_alias: ty::AliasTerm, - ) -> Result<(), NoSolution> { - let cx = self.cx(); - match rigid_alias.kind(cx) { - // Projections are rigid only if their trait ref holds, - // and the GAT where-clauses hold. - ty::AliasTermKind::ProjectionTy | ty::AliasTermKind::ProjectionConst => { - let trait_ref = rigid_alias.trait_ref(cx); - self.add_goal(GoalSource::AliasWellFormed, Goal::new(cx, param_env, trait_ref)); - Ok(()) - } - ty::AliasTermKind::OpaqueTy => { - if self.opaque_type_is_rigid(rigid_alias.def_id) { - Ok(()) - } else { - Err(NoSolution) - } - } - // FIXME(generic_const_exprs): we would need to support generic consts here - ty::AliasTermKind::UnevaluatedConst => Err(NoSolution), - // Inherent and weak types are never rigid. This type must not be well-formed. - ty::AliasTermKind::WeakTy | ty::AliasTermKind::InherentTy => Err(NoSolution), - } - } - - /// Normalize the given alias by at least one step. If the alias is rigid, this - /// returns `NoSolution`. - #[instrument(level = "trace", skip(self), ret)] - fn normalize_at_least_one_step(&mut self, goal: Goal>) -> QueryResult { let cx = self.cx(); match goal.predicate.alias.kind(cx) { ty::AliasTermKind::ProjectionTy | ty::AliasTermKind::ProjectionConst => { let candidates = self.assemble_and_evaluate_candidates(goal); + let trait_ref = goal.predicate.alias.trait_ref(cx); let (_, proven_via) = self.probe(|_| ProbeKind::ShadowedEnvProbing).enter(|ecx| { - let trait_goal: Goal> = - goal.with(cx, goal.predicate.alias.trait_ref(cx)); + let trait_goal: Goal> = goal.with(cx, trait_ref); ecx.compute_trait_goal(trait_goal) })?; - self.merge_candidates(proven_via, candidates) + self.merge_candidates(proven_via, candidates, |ecx| { + ecx.probe(|&result| ProbeKind::RigidAlias { result }).enter(|this| { + this.structurally_instantiate_normalizes_to_term( + goal, + goal.predicate.alias, + ); + this.add_goal(GoalSource::AliasWellFormed, goal.with(cx, trait_ref)); + this.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) + }) + }) } ty::AliasTermKind::InherentTy => self.normalize_inherent_associated_type(goal), ty::AliasTermKind::OpaqueTy => self.normalize_opaque_type(goal), @@ -120,6 +71,17 @@ where self.eq(goal.param_env, goal.predicate.term, term) .expect("expected goal term to be fully unconstrained"); } + + /// Unlike `instantiate_normalizes_to_term` this instantiates the expected term + /// with a rigid alias. Using this is pretty much always wrong. + pub fn structurally_instantiate_normalizes_to_term( + &mut self, + goal: Goal>, + term: ty::AliasTerm, + ) { + self.relate_rigid_alias_non_alias(goal.param_env, term, ty::Invariant, goal.predicate.term) + .expect("expected goal term to be fully unconstrained"); + } } impl assembly::GoalKind for NormalizesTo @@ -850,12 +812,14 @@ where todo!("discr subgoal...") } - // We do not call `Ty::discriminant_ty` on alias, param, or placeholder - // types, which return `::Discriminant` - // (or ICE in the case of placeholders). Projecting a type to itself - // is never really productive. + // Given an alias, parameter, or placeholder we add an impl candidate normalizing to a rigid + // alias. In case there's a where-bound further constraining this alias it is preferred over + // this impl candidate anyways. It's still a bit scuffed. ty::Alias(_, _) | ty::Param(_) | ty::Placeholder(..) => { - return Err(NoSolution); + return ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc).enter(|ecx| { + ecx.structurally_instantiate_normalizes_to_term(goal, goal.predicate.alias); + ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) + }); } ty::Infer(ty::TyVar(_) | ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) @@ -902,12 +866,14 @@ where todo!() } - // We do not call `Ty::async_destructor_ty` on alias, param, or placeholder - // types, which return `::AsyncDestructor` - // (or ICE in the case of placeholders). Projecting a type to itself - // is never really productive. + // Given an alias, parameter, or placeholder we add an impl candidate normalizing to a rigid + // alias. In case there's a where-bound further constraining this alias it is preferred over + // this impl candidate anyways. It's still a bit scuffed. ty::Alias(_, _) | ty::Param(_) | ty::Placeholder(..) => { - return Err(NoSolution); + return ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc).enter(|ecx| { + ecx.structurally_instantiate_normalizes_to_term(goal, goal.predicate.alias); + ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) + }); } ty::Infer(ty::TyVar(_) | ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) diff --git a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/opaque_types.rs b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/opaque_types.rs index 26a8a22d77ebe..60c20762a30ab 100644 --- a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/opaque_types.rs +++ b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/opaque_types.rs @@ -35,14 +35,15 @@ where self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS) } TypingMode::Analysis { defining_opaque_types } => { - let Some(def_id) = opaque_ty.def_id.as_local() else { - return Err(NoSolution); + let Some(def_id) = opaque_ty + .def_id + .as_local() + .filter(|&def_id| defining_opaque_types.contains(&def_id)) + else { + self.structurally_instantiate_normalizes_to_term(goal, goal.predicate.alias); + return self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes); }; - if !defining_opaque_types.contains(&def_id) { - return Err(NoSolution); - } - // FIXME: This may have issues when the args contain aliases... match uses_unique_placeholders_ignoring_regions(self.cx(), opaque_ty.args) { Err(NotUniqueParam::NotParam(param)) if param.is_non_region_infer() => { @@ -97,15 +98,16 @@ where self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) } TypingMode::PostBorrowckAnalysis { defined_opaque_types } => { - let Some(def_id) = opaque_ty.def_id.as_local() else { - return Err(NoSolution); + let Some(def_id) = opaque_ty + .def_id + .as_local() + .filter(|&def_id| defined_opaque_types.contains(&def_id)) + else { + self.structurally_instantiate_normalizes_to_term(goal, goal.predicate.alias); + return self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes); }; - if !defined_opaque_types.contains(&def_id) { - return Err(NoSolution); - } - - let actual = cx.type_of(opaque_ty.def_id).instantiate(cx, opaque_ty.args); + let actual = cx.type_of(def_id.into()).instantiate(cx, opaque_ty.args); // FIXME: Actually use a proper binder here instead of relying on `ReErased`. // // This is also probably unsound or sth :shrug: diff --git a/compiler/rustc_trait_selection/src/solve/inspect/analyse.rs b/compiler/rustc_trait_selection/src/solve/inspect/analyse.rs index 9f4ee54bd4c66..9fbc1d64d7429 100644 --- a/compiler/rustc_trait_selection/src/solve/inspect/analyse.rs +++ b/compiler/rustc_trait_selection/src/solve/inspect/analyse.rs @@ -300,7 +300,6 @@ impl<'a, 'tcx> InspectGoal<'a, 'tcx> { inspect::ProbeKind::NormalizedSelfTyAssembly | inspect::ProbeKind::UnsizeAssembly | inspect::ProbeKind::Root { .. } - | inspect::ProbeKind::TryNormalizeNonRigid { .. } | inspect::ProbeKind::TraitCandidate { .. } | inspect::ProbeKind::OpaqueTypeStorageLookup { .. } | inspect::ProbeKind::RigidAlias { .. } => { @@ -325,7 +324,6 @@ impl<'a, 'tcx> InspectGoal<'a, 'tcx> { // We add a candidate even for the root evaluation if there // is only one way to prove a given goal, e.g. for `WellFormed`. inspect::ProbeKind::Root { result } - | inspect::ProbeKind::TryNormalizeNonRigid { result } | inspect::ProbeKind::TraitCandidate { source: _, result } | inspect::ProbeKind::OpaqueTypeStorageLookup { result } | inspect::ProbeKind::RigidAlias { result } => { diff --git a/compiler/rustc_trait_selection/src/solve/select.rs b/compiler/rustc_trait_selection/src/solve/select.rs index b0b6274907d0c..4437fc5b0295f 100644 --- a/compiler/rustc_trait_selection/src/solve/select.rs +++ b/compiler/rustc_trait_selection/src/solve/select.rs @@ -175,8 +175,7 @@ fn to_selection<'tcx>( span_bug!(span, "didn't expect to select an unknowable candidate") } }, - ProbeKind::TryNormalizeNonRigid { result: _ } - | ProbeKind::NormalizedSelfTyAssembly + ProbeKind::NormalizedSelfTyAssembly | ProbeKind::UnsizeAssembly | ProbeKind::UpcastProjectionCompatibility | ProbeKind::OpaqueTypeStorageLookup { result: _ } diff --git a/compiler/rustc_type_ir/src/solve/inspect.rs b/compiler/rustc_type_ir/src/solve/inspect.rs index d0e618dc6f96d..18fb71dd290e7 100644 --- a/compiler/rustc_type_ir/src/solve/inspect.rs +++ b/compiler/rustc_type_ir/src/solve/inspect.rs @@ -111,8 +111,6 @@ pub enum ProbeStep { pub enum ProbeKind { /// The root inference context while proving a goal. Root { result: QueryResult }, - /// Trying to normalize an alias by at least one step in `NormalizesTo`. - TryNormalizeNonRigid { result: QueryResult }, /// Probe entered when normalizing the self ty during candidate assembly NormalizedSelfTyAssembly, /// A candidate for proving a trait or alias-relate goal. From 05bd5ced2d9af5f155ed8a72b5c1399838c1d653 Mon Sep 17 00:00:00 2001 From: lcnr Date: Tue, 11 Feb 2025 13:09:15 +0100 Subject: [PATCH 16/19] rework pointee handling for the new rigid alias approach --- .../src/solve/normalizes_to/mod.rs | 146 ++++++++++-------- 1 file changed, 79 insertions(+), 67 deletions(-) diff --git a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs index e3d16719e283d..88002e1a88a87 100644 --- a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs +++ b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs @@ -538,80 +538,92 @@ where let cx = ecx.cx(); let metadata_def_id = cx.require_lang_item(TraitSolverLangItem::Metadata); assert_eq!(metadata_def_id, goal.predicate.def_id()); - ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc).enter(|ecx| { - let metadata_ty = match goal.predicate.self_ty().kind() { - ty::Bool - | ty::Char - | ty::Int(..) - | ty::Uint(..) - | ty::Float(..) - | ty::Array(..) - | ty::Pat(..) - | ty::RawPtr(..) - | ty::Ref(..) - | ty::FnDef(..) - | ty::FnPtr(..) - | ty::Closure(..) - | ty::CoroutineClosure(..) - | ty::Infer(ty::IntVar(..) | ty::FloatVar(..)) - | ty::Coroutine(..) - | ty::CoroutineWitness(..) - | ty::Never - | ty::Foreign(..) - | ty::Dynamic(_, _, ty::DynStar) => Ty::new_unit(cx), - - ty::Error(e) => Ty::new_error(cx, e), - - ty::Str | ty::Slice(_) => Ty::new_usize(cx), - - ty::Dynamic(_, _, ty::Dyn) => { - let dyn_metadata = cx.require_lang_item(TraitSolverLangItem::DynMetadata); - cx.type_of(dyn_metadata) - .instantiate(cx, &[I::GenericArg::from(goal.predicate.self_ty())]) - } + let metadata_ty = match goal.predicate.self_ty().kind() { + ty::Bool + | ty::Char + | ty::Int(..) + | ty::Uint(..) + | ty::Float(..) + | ty::Array(..) + | ty::Pat(..) + | ty::RawPtr(..) + | ty::Ref(..) + | ty::FnDef(..) + | ty::FnPtr(..) + | ty::Closure(..) + | ty::CoroutineClosure(..) + | ty::Infer(ty::IntVar(..) | ty::FloatVar(..)) + | ty::Coroutine(..) + | ty::CoroutineWitness(..) + | ty::Never + | ty::Foreign(..) + | ty::Dynamic(_, _, ty::DynStar) => Ty::new_unit(cx), - ty::Alias(_, _) | ty::Param(_) | ty::Placeholder(..) => { - // This is the "fallback impl" for type parameters, unnormalizable projections - // and opaque types: If the `self_ty` is `Sized`, then the metadata is `()`. - // FIXME(ptr_metadata): This impl overlaps with the other impls and shouldn't - // exist. Instead, `Pointee` should be a supertrait of `Sized`. - let sized_predicate = ty::TraitRef::new( - cx, - cx.require_lang_item(TraitSolverLangItem::Sized), - [I::GenericArg::from(goal.predicate.self_ty())], - ); - // FIXME(-Znext-solver=coinductive): Should this be `GoalSource::ImplWhereBound`? - ecx.add_goal(GoalSource::Misc, goal.with(cx, sized_predicate)); - Ty::new_unit(cx) - } + ty::Error(e) => Ty::new_error(cx, e), - ty::Adt(def, args) if def.is_struct() => match def.struct_tail_ty(cx) { - None => Ty::new_unit(cx), - Some(tail_ty) => { - Ty::new_projection(cx, metadata_def_id, [tail_ty.instantiate(cx, args)]) - } - }, - ty::Adt(_, _) => Ty::new_unit(cx), + ty::Str | ty::Slice(_) => Ty::new_usize(cx), - ty::Tuple(elements) => match elements.last() { - None => Ty::new_unit(cx), - Some(tail_ty) => Ty::new_projection(cx, metadata_def_id, [tail_ty]), - }, + ty::Dynamic(_, _, ty::Dyn) => { + let dyn_metadata = cx.require_lang_item(TraitSolverLangItem::DynMetadata); + cx.type_of(dyn_metadata) + .instantiate(cx, &[I::GenericArg::from(goal.predicate.self_ty())]) + } - ty::UnsafeBinder(_) => { - // FIXME(unsafe_binder): Figure out how to handle pointee for unsafe binders. - todo!() + ty::Alias(_, _) | ty::Param(_) | ty::Placeholder(..) => { + // This is the "fallback impl" for type parameters, unnormalizable projections + // and opaque types: If the `self_ty` is `Sized`, then the metadata is `()`. + // FIXME(ptr_metadata): This impl overlaps with the other impls and shouldn't + // exist. Instead, `Pointee` should be a supertrait of `Sized`. + let alias_bound_result = + ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc).enter(|ecx| { + let sized_predicate = ty::TraitRef::new( + cx, + cx.require_lang_item(TraitSolverLangItem::Sized), + [I::GenericArg::from(goal.predicate.self_ty())], + ); + ecx.add_goal(GoalSource::Misc, goal.with(cx, sized_predicate)); + ecx.instantiate_normalizes_to_term(goal, Ty::new_unit(cx).into()); + ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) + }); + // In case the dummy alias-bound candidate does not apply, we instead treat this projection + // as rigid. + return alias_bound_result.or_else(|NoSolution| { + ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc).enter(|this| { + this.structurally_instantiate_normalizes_to_term( + goal, + goal.predicate.alias, + ); + this.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) + }) + }); + } + + ty::Adt(def, args) if def.is_struct() => match def.struct_tail_ty(cx) { + None => Ty::new_unit(cx), + Some(tail_ty) => { + Ty::new_projection(cx, metadata_def_id, [tail_ty.instantiate(cx, args)]) } + }, + ty::Adt(_, _) => Ty::new_unit(cx), - ty::Infer( - ty::TyVar(_) | ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_), - ) - | ty::Bound(..) => panic!( - "unexpected self ty `{:?}` when normalizing `::Metadata`", - goal.predicate.self_ty() - ), - }; + ty::Tuple(elements) => match elements.last() { + None => Ty::new_unit(cx), + Some(tail_ty) => Ty::new_projection(cx, metadata_def_id, [tail_ty]), + }, + ty::UnsafeBinder(_) => { + // FIXME(unsafe_binder): Figure out how to handle pointee for unsafe binders. + todo!() + } + + ty::Infer(ty::TyVar(_) | ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) + | ty::Bound(..) => panic!( + "unexpected self ty `{:?}` when normalizing `::Metadata`", + goal.predicate.self_ty() + ), + }; + + ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc).enter(|ecx| { ecx.instantiate_normalizes_to_term(goal, metadata_ty.into()); ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) }) From 059288ed442f34c336c759486bfe4373b61288a0 Mon Sep 17 00:00:00 2001 From: lcnr Date: Wed, 12 Feb 2025 11:41:53 +0100 Subject: [PATCH 17/19] adjust derive_error --- .../src/solve/assembly/mod.rs | 20 --- .../traits/fulfillment_errors.rs | 4 + .../src/error_reporting/traits/mod.rs | 2 +- .../src/solve/fulfill/derive_errors.rs | 128 ++++++++++++++---- tests/crashes/134905.rs | 16 --- tests/ui/auto-traits/assoc-ty.next.stderr | 25 ++-- tests/ui/auto-traits/assoc-ty.rs | 4 +- ...nsubstituting-in-region-112823.next.stderr | 14 +- ...-type-whensubstituting-in-region-112823.rs | 8 +- .../fuzzed/fuzzing-ice-134905.rs | 22 +++ .../fuzzed/fuzzing-ice-134905.stderr | 40 ++++++ 11 files changed, 204 insertions(+), 79 deletions(-) delete mode 100644 tests/crashes/134905.rs create mode 100644 tests/ui/specialization/fuzzed/fuzzing-ice-134905.rs create mode 100644 tests/ui/specialization/fuzzed/fuzzing-ice-134905.stderr diff --git a/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs b/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs index 23fe88b16802d..b0f59ed1474c2 100644 --- a/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs +++ b/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs @@ -6,7 +6,6 @@ use derive_where::derive_where; use rustc_type_ir::fold::TypeFoldable; use rustc_type_ir::inherent::*; use rustc_type_ir::lang_items::TraitSolverLangItem; -use rustc_type_ir::solve::inspect; use rustc_type_ir::visit::TypeVisitableExt as _; use rustc_type_ir::{self as ty, Interner, TypingMode, Upcast as _, elaborate}; use tracing::{debug, instrument}; @@ -297,25 +296,6 @@ where let Ok(normalized_self_ty) = self.structurally_normalize_ty(goal.param_env, goal.predicate.self_ty()) else { - // FIXME: We register a fake candidate when normalization fails so that - // we can point at the reason for *why*. I'm tempted to say that this - // is the wrong way to do this, though. - let result = - self.probe(|&result| inspect::ProbeKind::RigidAlias { result }).enter(|this| { - let normalized_ty = this.next_ty_infer(); - let alias_relate_goal = Goal::new( - this.cx(), - goal.param_env, - ty::PredicateKind::AliasRelate( - goal.predicate.self_ty().into(), - normalized_ty.into(), - ty::AliasRelationDirection::Equate, - ), - ); - this.add_goal(GoalSource::AliasWellFormed, alias_relate_goal); - this.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS) - }); - assert_eq!(result, Err(NoSolution)); return vec![]; }; diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs index 1b43820bac0c5..49fa21e50c059 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs @@ -585,6 +585,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(ty)) => { let ty = self.resolve_vars_if_possible(ty); if self.next_trait_solver() { + if let Err(guar) = ty.error_reported() { + return guar; + } + // FIXME: we'll need a better message which takes into account // which bounds actually failed to hold. self.dcx().struct_span_err( diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs index 658fb4009d508..e4f250ca4f540 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs @@ -172,8 +172,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { { 1 } - ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(_)) => 3, ty::PredicateKind::Coerce(_) => 2, + ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(_)) => 3, _ => 0, }); diff --git a/compiler/rustc_trait_selection/src/solve/fulfill/derive_errors.rs b/compiler/rustc_trait_selection/src/solve/fulfill/derive_errors.rs index 7364b4aa34380..982782bc57c18 100644 --- a/compiler/rustc_trait_selection/src/solve/fulfill/derive_errors.rs +++ b/compiler/rustc_trait_selection/src/solve/fulfill/derive_errors.rs @@ -7,7 +7,7 @@ use rustc_infer::traits::{ PredicateObligation, SelectionError, }; use rustc_middle::ty::error::{ExpectedFound, TypeError}; -use rustc_middle::ty::{self, TyCtxt}; +use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_middle::{bug, span_bug}; use rustc_next_trait_solver::solve::{GenerateProofTree, SolverDelegateEvalExt as _}; use rustc_type_ir::solve::{Goal, NoSolution}; @@ -139,6 +139,7 @@ pub(super) fn fulfillment_error_for_overflow<'tcx>( } } +#[instrument(level = "debug", skip(infcx), ret)] fn find_best_leaf_obligation<'tcx>( infcx: &InferCtxt<'tcx>, obligation: &PredicateObligation<'tcx>, @@ -197,6 +198,9 @@ impl<'tcx> BestObligation<'tcx> { candidates.retain(|candidate| candidate.result().is_ok()); } false => { + // We always handle rigid alias candidates separately as we may not add them for + // aliases whose trait bound doesn't hold. + candidates.retain(|c| !matches!(c.kind(), inspect::ProbeKind::RigidAlias { .. })); // If we have >1 candidate, one may still be due to "boring" reasons, like // an alias-relate that failed to hold when deeply evaluated. We really // don't care about reasons like this. @@ -211,23 +215,12 @@ impl<'tcx> BestObligation<'tcx> { | GoalSource::AliasBoundConstCondition | GoalSource::InstantiateHigherRanked | GoalSource::AliasWellFormed - ) && match (self.consider_ambiguities, nested_goal.result()) { - (true, Ok(Certainty::Maybe(MaybeCause::Ambiguity))) - | (false, Err(_)) => true, - _ => false, - } + ) && nested_goal.result().is_err() }, ) }) }); } - - // Prefer a non-rigid candidate if there is one. - if candidates.len() > 1 { - candidates.retain(|candidate| { - !matches!(candidate.kind(), inspect::ProbeKind::RigidAlias { .. }) - }); - } } } @@ -266,6 +259,90 @@ impl<'tcx> BestObligation<'tcx> { ControlFlow::Break(self.obligation.clone()) } + + /// If a normalization of an associated item or a trait goal fails without trying any + /// candidates it's likely that normalizing its self type failed. We manually detect + /// such cases here. + fn detect_error_in_self_ty_normalization( + &mut self, + goal: &inspect::InspectGoal<'_, 'tcx>, + self_ty: Ty<'tcx>, + ) -> ControlFlow> { + assert!(!self.consider_ambiguities); + let tcx = goal.infcx().tcx; + if let ty::Alias(..) = self_ty.kind() { + let infer_term = goal.infcx().next_ty_var(self.obligation.cause.span); + let pred = ty::PredicateKind::AliasRelate( + self_ty.into(), + infer_term.into(), + ty::AliasRelationDirection::Equate, + ); + let obligation = + Obligation::new(tcx, self.obligation.cause.clone(), goal.goal().param_env, pred); + self.with_derived_obligation(obligation, |this| { + goal.infcx().visit_proof_tree_at_depth( + goal.goal().with(tcx, pred), + goal.depth() + 1, + this, + ) + }) + } else { + ControlFlow::Continue(()) + } + } + + /// It is likely that `NormalizesTo` failed without any applicable candidates + /// because the alias is not well-formed. + /// + /// As we only enter `RigidAlias` candidates if the trait bound of the associated type + /// holds, we discard these candidates in `non_trivial_candidates` and always manually + /// check this here. + fn detect_non_well_formed_assoc_item( + &mut self, + goal: &inspect::InspectGoal<'_, 'tcx>, + alias: ty::AliasTerm<'tcx>, + ) -> ControlFlow> { + let tcx = goal.infcx().tcx; + let obligation = Obligation::new( + tcx, + self.obligation.cause.clone(), + goal.goal().param_env, + alias.trait_ref(tcx), + ); + self.with_derived_obligation(obligation, |this| { + goal.infcx().visit_proof_tree_at_depth( + goal.goal().with(tcx, alias.trait_ref(tcx)), + goal.depth() + 1, + this, + ) + }) + } + + /// If we have no candidates, then it's likely that there is a + /// non-well-formed alias in the goal. + fn detect_error_from_empty_candidates( + &mut self, + goal: &inspect::InspectGoal<'_, 'tcx>, + ) -> ControlFlow> { + let tcx = goal.infcx().tcx; + let pred_kind = goal.goal().predicate.kind(); + + match pred_kind.no_bound_vars() { + Some(ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred))) => { + self.detect_error_in_self_ty_normalization(goal, pred.self_ty())?; + } + Some(ty::PredicateKind::NormalizesTo(pred)) + if let ty::AliasTermKind::ProjectionTy | ty::AliasTermKind::ProjectionConst = + pred.alias.kind(tcx) => + { + self.detect_error_in_self_ty_normalization(goal, pred.alias.self_ty())?; + self.detect_non_well_formed_assoc_item(goal, pred.alias)?; + } + Some(_) | None => {} + } + + ControlFlow::Break(self.obligation.clone()) + } } impl<'tcx> ProofTreeVisitor<'tcx> for BestObligation<'tcx> { @@ -277,11 +354,19 @@ impl<'tcx> ProofTreeVisitor<'tcx> for BestObligation<'tcx> { #[instrument(level = "trace", skip(self, goal), fields(goal = ?goal.goal()))] fn visit_goal(&mut self, goal: &inspect::InspectGoal<'_, 'tcx>) -> Self::Result { - let candidates = self.non_trivial_candidates(goal); - trace!(candidates = ?candidates.iter().map(|c| c.kind()).collect::>()); + let tcx = goal.infcx().tcx; + // Skip goals that aren't the *reason* for our goal's failure. + match (self.consider_ambiguities, goal.result()) { + (true, Ok(Certainty::Maybe(MaybeCause::Ambiguity))) | (false, Err(_)) => {} + _ => return ControlFlow::Continue(()), + } + let pred_kind = goal.goal().predicate.kind(); - let [candidate] = candidates.as_slice() else { - return ControlFlow::Break(self.obligation.clone()); + let candidates = self.non_trivial_candidates(goal); + let candidate = match candidates.as_slice() { + [candidate] => candidate, + [] => return self.detect_error_from_empty_candidates(goal), + _ => return ControlFlow::Break(self.obligation.clone()), }; // Don't walk into impls that have `do_not_recommend`. @@ -291,13 +376,12 @@ impl<'tcx> ProofTreeVisitor<'tcx> for BestObligation<'tcx> { } = candidate.kind() && goal.infcx().tcx.do_not_recommend_impl(impl_def_id) { + trace!("#[do_not_recommend] -> exit"); return ControlFlow::Break(self.obligation.clone()); } - let tcx = goal.infcx().tcx; // FIXME: Also, what about considering >1 layer up the stack? May be necessary // for normalizes-to. - let pred_kind = goal.goal().predicate.kind(); let child_mode = match pred_kind.skip_binder() { ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred)) => { ChildMode::Trait(pred_kind.rebind(pred)) @@ -390,12 +474,6 @@ impl<'tcx> ProofTreeVisitor<'tcx> for BestObligation<'tcx> { } } - // Skip nested goals that aren't the *reason* for our goal's failure. - match (self.consider_ambiguities, nested_goal.result()) { - (true, Ok(Certainty::Maybe(MaybeCause::Ambiguity))) | (false, Err(_)) => {} - _ => continue, - } - self.with_derived_obligation(obligation, |this| nested_goal.visit_with(this))?; } diff --git a/tests/crashes/134905.rs b/tests/crashes/134905.rs deleted file mode 100644 index 9f0f0f4b3f227..0000000000000 --- a/tests/crashes/134905.rs +++ /dev/null @@ -1,16 +0,0 @@ -//@ known-bug: #134905 - -trait Iterate<'a> { - type Ty: Valid; -} -impl<'a, T> Iterate<'a> for T -where - T: Check, -{ - default type Ty = (); -} - -trait Check {} -impl<'a, T> Eq for T where >::Ty: Valid {} - -trait Valid {} diff --git a/tests/ui/auto-traits/assoc-ty.next.stderr b/tests/ui/auto-traits/assoc-ty.next.stderr index b9f56d6c99c4c..4ce00d1747564 100644 --- a/tests/ui/auto-traits/assoc-ty.next.stderr +++ b/tests/ui/auto-traits/assoc-ty.next.stderr @@ -21,20 +21,21 @@ LL | | } = help: add `#![feature(auto_traits)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0308]: mismatched types - --> $DIR/assoc-ty.rs:15:36 +error[E0271]: type mismatch resolving `<() as Trait>::Output normalizes-to _` + --> $DIR/assoc-ty.rs:15:12 | LL | let _: <() as Trait>::Output = (); - | --------------------- ^^ types differ - | | - | expected due to this + | ^^^^^^^^^^^^^^^^^^^^^ types differ + +error[E0271]: type mismatch resolving `<() as Trait>::Output normalizes-to _` + --> $DIR/assoc-ty.rs:15:12 + | +LL | let _: <() as Trait>::Output = (); + | ^^^^^^^^^^^^^^^^^^^^^ types differ | - = note: expected associated type `<() as Trait>::Output` - found unit type `()` - = help: consider constraining the associated type `<() as Trait>::Output` to `()` or calling a method that returns `<() as Trait>::Output` - = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0308, E0380, E0658. -For more information about an error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0271, E0380, E0658. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/auto-traits/assoc-ty.rs b/tests/ui/auto-traits/assoc-ty.rs index ada75147f6ea6..efbfead9cd037 100644 --- a/tests/ui/auto-traits/assoc-ty.rs +++ b/tests/ui/auto-traits/assoc-ty.rs @@ -13,5 +13,7 @@ auto trait Trait { fn main() { let _: <() as Trait>::Output = (); - //~^ ERROR mismatched types + //[current]~^ ERROR mismatched types + //[next]~^^ ERROR type mismatch resolving `<() as Trait>::Output normalizes-to _` + //[next]~| ERROR type mismatch resolving `<() as Trait>::Output normalizes-to _` } diff --git a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.next.stderr b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.next.stderr index 3c24eb9adbee7..ce64a022214ea 100644 --- a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.next.stderr +++ b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.next.stderr @@ -23,7 +23,19 @@ error[E0271]: type mismatch resolving `::LineStreamFut<'a, Repr> == ()` LL | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ -error: aborting due to 3 previous errors +error[E0271]: type mismatch resolving `::LineStreamFut<'a, Repr> normalizes-to _` + --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:28:73 + | +LL | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {} + | ^^ types differ + +error[E0271]: type mismatch resolving `::LineStreamFut<'a, Repr> normalizes-to _` + --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:28:5 + | +LL | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ + +error: aborting due to 5 previous errors Some errors have detailed explanations: E0049, E0271, E0407. For more information about an error, try `rustc --explain E0049`. diff --git a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs index c97bd1799436f..cb32723b22dd1 100644 --- a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs +++ b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs @@ -26,9 +26,11 @@ impl X for Y { //~^ ERROR type `LineStream` has 0 type parameters but its trait declaration has 1 type parameter type LineStreamFut<'a, Repr> = impl Future>; fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {} - //[current]~^ ERROR `()` is not a future - //[next]~^^ ERROR type mismatch resolving `::LineStreamFut<'a, Repr> == ()` - //~^^^ method `line_stream` is not a member of trait `X` + //~^ method `line_stream` is not a member of trait `X` + //[current]~^^ ERROR `()` is not a future + //[next]~^^^ ERROR type mismatch resolving `::LineStreamFut<'a, Repr> == ()` + //[next]~| ERROR type mismatch resolving `::LineStreamFut<'a, Repr> normalizes-to _` + //[next]~| ERROR type mismatch resolving `::LineStreamFut<'a, Repr> normalizes-to _` } pub fn main() {} diff --git a/tests/ui/specialization/fuzzed/fuzzing-ice-134905.rs b/tests/ui/specialization/fuzzed/fuzzing-ice-134905.rs new file mode 100644 index 0000000000000..559c23455275b --- /dev/null +++ b/tests/ui/specialization/fuzzed/fuzzing-ice-134905.rs @@ -0,0 +1,22 @@ +// This test previously tried to use a tainted `EvalCtxt` when emitting +// an error during coherence. +#![feature(specialization)] +//~^ WARN the feature `specialization` is incomplete +trait Iterate<'a> { + type Ty: Valid; +} +impl<'a, T> Iterate<'a> for T +where + T: Check, +{ + default type Ty = (); + //~^ ERROR the trait bound `(): Valid` is not satisfied +} + +trait Check {} +impl<'a, T> Eq for T where >::Ty: Valid {} +//~^ ERROR type parameter `T` must be used as the type parameter for some local type + +trait Valid {} + +fn main() {} diff --git a/tests/ui/specialization/fuzzed/fuzzing-ice-134905.stderr b/tests/ui/specialization/fuzzed/fuzzing-ice-134905.stderr new file mode 100644 index 0000000000000..611fef1df66bf --- /dev/null +++ b/tests/ui/specialization/fuzzed/fuzzing-ice-134905.stderr @@ -0,0 +1,40 @@ +warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/fuzzing-ice-134905.rs:3:12 + | +LL | #![feature(specialization)] + | ^^^^^^^^^^^^^^ + | + = note: see issue #31844 for more information + = help: consider using `min_specialization` instead, which is more stable and complete + = note: `#[warn(incomplete_features)]` on by default + +error[E0277]: the trait bound `(): Valid` is not satisfied + --> $DIR/fuzzing-ice-134905.rs:12:23 + | +LL | default type Ty = (); + | ^^ the trait `Valid` is not implemented for `()` + | +help: this trait has no implementations, consider adding one + --> $DIR/fuzzing-ice-134905.rs:20:1 + | +LL | trait Valid {} + | ^^^^^^^^^^^ +note: required by a bound in `Iterate::Ty` + --> $DIR/fuzzing-ice-134905.rs:6:14 + | +LL | type Ty: Valid; + | ^^^^^ required by this bound in `Iterate::Ty` + +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/fuzzing-ice-134905.rs:17:10 + | +LL | impl<'a, T> Eq for T where >::Ty: Valid {} + | ^ type parameter `T` must be used as the type parameter for some local type + | + = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to 2 previous errors; 1 warning emitted + +Some errors have detailed explanations: E0210, E0277. +For more information about an error, try `rustc --explain E0210`. From 81c6d5ec9ba239ebe892fc974a8c66094242f08d Mon Sep 17 00:00:00 2001 From: lcnr Date: Wed, 12 Feb 2025 15:52:02 +0100 Subject: [PATCH 18/19] eagerly prove WF when resolving fully qualified paths --- .../rustc_hir_typeck/src/fn_ctxt/_impl.rs | 33 ++++------------ .../method/path_lookup_wf_constraints.rs | 39 +++++++++++++++++++ 2 files changed, 47 insertions(+), 25 deletions(-) create mode 100644 tests/ui/traits/next-solver/method/path_lookup_wf_constraints.rs diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs index e74ffeff343a2..1113f7f70953b 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs @@ -798,13 +798,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { bug!("`resolve_ty_and_res_fully_qualified_call` called on `LangItem`") } }; + + self.register_wf_obligation( + ty.raw.into(), + qself.span, + ObligationCauseCode::WellFormed(None), + ); + self.select_obligations_where_possible(|_| {}); + if let Some(&cached_result) = self.typeck_results.borrow().type_dependent_defs().get(hir_id) { - self.register_wf_obligation( - ty.raw.into(), - qself.span, - ObligationCauseCode::WellFormed(None), - ); // Return directly on cache hit. This is useful to avoid doubly reporting // errors with default match binding modes. See #44614. let def = cached_result.map_or(Res::Err, |(kind, def_id)| Res::Def(kind, def_id)); @@ -824,18 +827,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let trait_missing_method = matches!(error, method::MethodError::NoMatch(_)) && ty.normalized.is_trait(); - // If we have a path like `MyTrait::missing_method`, then don't register - // a WF obligation for `dyn MyTrait` when method lookup fails. Otherwise, - // register a WF obligation so that we can detect any additional - // errors in the self type. - if !trait_missing_method { - self.register_wf_obligation( - ty.raw.into(), - qself.span, - ObligationCauseCode::WellFormed(None), - ); - } - if item_name.name != kw::Empty { self.report_method_error( hir_id, @@ -849,14 +840,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { result }); - if result.is_ok() { - self.register_wf_obligation( - ty.raw.into(), - qself.span, - ObligationCauseCode::WellFormed(None), - ); - } - // Write back the new resolution. self.write_resolution(hir_id, result); ( diff --git a/tests/ui/traits/next-solver/method/path_lookup_wf_constraints.rs b/tests/ui/traits/next-solver/method/path_lookup_wf_constraints.rs new file mode 100644 index 0000000000000..fbe170b1990e7 --- /dev/null +++ b/tests/ui/traits/next-solver/method/path_lookup_wf_constraints.rs @@ -0,0 +1,39 @@ +//@ compile-flags: -Znext-solver +//@ check-pass + +// A regression test for trait-system-refactor-initiative#161 + +trait Constrain { + type Assoc; +} +impl Constrain for () { + type Assoc = (); +} +struct Foo>::Assoc>(T, U); + +impl Foo { + fn foo() {} +} +struct B; +impl Foo { + fn foo() {} +} + +type Alias = Foo; +fn via_guidance() +where + (): Constrain, +{ + // Method selection on `Foo>::Assoc>` is ambiguous. + // only by unnecessarily constraining `?t` to `T` when proving `(): Constrain` + // are we able to select the first impl. + // + // This happens in the old solver when normalizing `Alias`. The new solver doesn't try + // to eagerly normalize `<() as Constrain>::Assoc` so we instead always prove that the + // self type is well-formed before method lookup. + Alias::foo(); +} + +fn main() { + via_guidance::<()>(); +} From 83a02619d582349fd8d39233263c916033053c0a Mon Sep 17 00:00:00 2001 From: lcnr Date: Wed, 12 Feb 2025 15:52:15 +0100 Subject: [PATCH 19/19] fallout :skull_emoji: --- .../associated-const-in-trait.rs | 1 + .../associated-const-in-trait.stderr | 18 ++++- ...tion-self-ty-invalid-bivariant-arg2.stderr | 24 +++---- .../hr-associated-type-bound-object.rs | 1 + .../hr-associated-type-bound-object.stderr | 21 +++++- .../hr-associated-type-bound-param-2.rs | 1 + .../hr-associated-type-bound-param-2.stderr | 22 ++++++- .../defaults/doesnt_infer.stderr | 24 +++---- .../generic_arg_infer/issue-91614.stderr | 8 +-- .../issue-62504.full.stderr | 24 +++---- .../issue-62504.min.stderr | 24 +++---- .../generic_const_exprs/issue-80742.stderr | 2 +- .../const-needs_drop-monomorphic.stderr | 18 ++--- ...y_owner_parent_found_in_diagnostics.stderr | 18 ++--- .../assoc_type_bounds_sized_used.stderr | 28 ++++---- tests/ui/impl-trait/issues/issue-62742.stderr | 42 ++++++------ .../need_type_info/type-alias.stderr | 4 +- tests/ui/issues/issue-58734.rs | 1 + tests/ui/issues/issue-58734.stderr | 30 ++++++++- .../ui/methods/inherent-bound-in-probe.stderr | 13 ++-- tests/ui/traits/item-privacy.rs | 9 ++- tests/ui/traits/item-privacy.stderr | 66 ++++++++++++++++--- .../constrain_in_projection.current.stderr | 11 +++- .../constrain_in_projection.rs | 1 + .../constrain_in_projection2.current.stderr | 12 +++- .../constrain_in_projection2.rs | 1 + 26 files changed, 291 insertions(+), 133 deletions(-) diff --git a/tests/ui/associated-consts/associated-const-in-trait.rs b/tests/ui/associated-consts/associated-const-in-trait.rs index 90ad596b23ee1..4d88f4ff53161 100644 --- a/tests/ui/associated-consts/associated-const-in-trait.rs +++ b/tests/ui/associated-consts/associated-const-in-trait.rs @@ -8,6 +8,7 @@ impl dyn Trait { //~^ ERROR the trait `Trait` is not dyn compatible [E0038] const fn n() -> usize { Self::N } //~^ ERROR the trait `Trait` is not dyn compatible [E0038] + //~| ERROR the trait `Trait` is not dyn compatible } fn main() {} diff --git a/tests/ui/associated-consts/associated-const-in-trait.stderr b/tests/ui/associated-consts/associated-const-in-trait.stderr index 5aaa6f6be057e..fba7f53c097f2 100644 --- a/tests/ui/associated-consts/associated-const-in-trait.stderr +++ b/tests/ui/associated-consts/associated-const-in-trait.stderr @@ -30,6 +30,22 @@ LL | const N: usize; | ^ ...because it contains this associated `const` = help: consider moving `N` to another trait -error: aborting due to 2 previous errors +error[E0038]: the trait `Trait` is not dyn compatible + --> $DIR/associated-const-in-trait.rs:9:29 + | +LL | const fn n() -> usize { Self::N } + | ^^^^^^^ `Trait` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit + --> $DIR/associated-const-in-trait.rs:4:11 + | +LL | trait Trait { + | ----- this trait is not dyn compatible... +LL | const N: usize; + | ^ ...because it contains this associated `const` + = help: consider moving `N` to another trait + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg2.stderr b/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg2.stderr index 18d458aea809b..165e89010b687 100644 --- a/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg2.stderr +++ b/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg2.stderr @@ -1,15 +1,3 @@ -error[E0599]: no associated item named `C` found for struct `Fail` in the current scope - --> $DIR/wrong-projection-self-ty-invalid-bivariant-arg2.rs:15:23 - | -LL | struct Fail, U>(T); - | ---------------------------------- associated item `C` not found for this struct -... -LL | Fail::::C - | ^ associated item not found in `Fail` - | - = note: the associated item was found for - - `Fail` - error[E0271]: type mismatch resolving `::Assoc == u32` --> $DIR/wrong-projection-self-ty-invalid-bivariant-arg2.rs:15:5 | @@ -27,6 +15,18 @@ note: required by a bound in `Fail` LL | struct Fail, U>(T); | ^^^^^^^^^ required by this bound in `Fail` +error[E0599]: no associated item named `C` found for struct `Fail` in the current scope + --> $DIR/wrong-projection-self-ty-invalid-bivariant-arg2.rs:15:23 + | +LL | struct Fail, U>(T); + | ---------------------------------- associated item `C` not found for this struct +... +LL | Fail::::C + | ^ associated item not found in `Fail` + | + = note: the associated item was found for + - `Fail` + error: aborting due to 2 previous errors Some errors have detailed explanations: E0271, E0599. diff --git a/tests/ui/associated-types/hr-associated-type-bound-object.rs b/tests/ui/associated-types/hr-associated-type-bound-object.rs index fec253f9289ac..825e129dbbda1 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-object.rs +++ b/tests/ui/associated-types/hr-associated-type-bound-object.rs @@ -9,6 +9,7 @@ fn f<'a, T: X<'a> + ?Sized>(x: &>::U) { <>::U>::clone(x); //~^ ERROR the trait bound `for<'b> >::U: Clone` is not satisfied //~| ERROR the trait bound `for<'b> >::U: Clone` is not satisfied + //~| ERROR the trait bound `for<'b> >::U: Clone` is not satisfied //~| ERROR the trait bound `>::U: Clone` is not satisfied } diff --git a/tests/ui/associated-types/hr-associated-type-bound-object.stderr b/tests/ui/associated-types/hr-associated-type-bound-object.stderr index 322d6e7b947c8..5144cfe6d3e7d 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-object.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-object.stderr @@ -47,6 +47,25 @@ help: consider further restricting the associated type LL | fn f<'a, T: X<'a> + ?Sized>(x: &>::U) where >::U: Clone { | ++++++++++++++++++++++++++++ +error[E0277]: the trait bound `for<'b> >::U: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-object.rs:9:5 + | +LL | <>::U>::clone(x); + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'b> Clone` is not implemented for `>::U` + | +note: required by a bound in `X` + --> $DIR/hr-associated-type-bound-object.rs:3:33 + | +LL | trait X<'a> + | - required by a bound in this trait +LL | where +LL | for<'b> >::U: Clone, + | ^^^^^ required by this bound in `X` +help: consider further restricting the associated type + | +LL | fn f<'a, T: X<'a> + ?Sized>(x: &>::U) where for<'b> >::U: Clone { + | ++++++++++++++++++++++++++++++++++++ + error[E0277]: the trait bound `for<'b> >::U: Clone` is not satisfied --> $DIR/hr-associated-type-bound-object.rs:9:5 | @@ -66,6 +85,6 @@ help: consider further restricting the associated type LL | fn f<'a, T: X<'a> + ?Sized>(x: &>::U) where for<'b> >::U: Clone { | ++++++++++++++++++++++++++++++++++++ -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-2.rs b/tests/ui/associated-types/hr-associated-type-bound-param-2.rs index b1a6fe871594b..673f02c7cd0e5 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-2.rs +++ b/tests/ui/associated-types/hr-associated-type-bound-param-2.rs @@ -10,6 +10,7 @@ where ::clone(x); //~^ the trait bound `str: Clone` is not satisfied //~| the trait bound `str: Clone` is not satisfied + //~| the trait bound `str: Clone` is not satisfied } } diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr index 74cc2083d26fe..8997832ab52a4 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr @@ -15,7 +15,7 @@ LL | for<'b> >::W: Clone, | ^^^^^ required by this bound in `Z` error[E0277]: the trait bound `str: Clone` is not satisfied - --> $DIR/hr-associated-type-bound-param-2.rs:17:14 + --> $DIR/hr-associated-type-bound-param-2.rs:18:14 | LL | type W = str; | ^^^ the trait `Clone` is not implemented for `str` @@ -63,6 +63,22 @@ LL | { LL | type W: ?Sized; | - required by a bound in this associated type +error[E0277]: the trait bound `str: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-param-2.rs:10:9 + | +LL | ::clone(x); + | ^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str` + | + = help: the trait `Clone` is implemented for `String` +note: required by a bound in `Z` + --> $DIR/hr-associated-type-bound-param-2.rs:6:35 + | +LL | trait Z<'a, T: ?Sized> + | - required by a bound in this trait +... +LL | for<'b> >::W: Clone, + | ^^^^^ required by this bound in `Z` + error[E0277]: the trait bound `str: Clone` is not satisfied --> $DIR/hr-associated-type-bound-param-2.rs:10:9 | @@ -80,7 +96,7 @@ LL | for<'b> >::W: Clone, | ^^^^^ required by this bound in `Z` error[E0277]: the trait bound `str: Clone` is not satisfied - --> $DIR/hr-associated-type-bound-param-2.rs:22:10 + --> $DIR/hr-associated-type-bound-param-2.rs:23:10 | LL | 1u16.h("abc"); | ^ the trait `Clone` is not implemented for `str` @@ -95,6 +111,6 @@ LL | for<'b> >::W: Clone, LL | fn h(&self, x: &T::W) { | - required by a bound in this associated function -error: aborting due to 6 previous errors +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/const-generics/defaults/doesnt_infer.stderr b/tests/ui/const-generics/defaults/doesnt_infer.stderr index c17f57f36bc5f..ef39cef70cbc2 100644 --- a/tests/ui/const-generics/defaults/doesnt_infer.stderr +++ b/tests/ui/const-generics/defaults/doesnt_infer.stderr @@ -2,15 +2,13 @@ error[E0284]: type annotations needed for `Foo<_>` --> $DIR/doesnt_infer.rs:13:9 | LL | let foo = Foo::foo(); - | ^^^ ---------- type must be known at this point + | ^^^ --- type must be known at this point | -note: required by a const generic parameter in `Foo::::foo` - --> $DIR/doesnt_infer.rs:5:6 +note: required by a const generic parameter in `Foo` + --> $DIR/doesnt_infer.rs:3:12 | -LL | impl Foo { - | ^^^^^^^^^^^^ required by this const generic parameter in `Foo::::foo` -LL | fn foo() -> Self { - | --- required by a bound in this associated function +LL | struct Foo; + | ^^^^^^^^^^^^^^^^ required by this const generic parameter in `Foo` help: consider giving `foo` an explicit type, where the value of const parameter `N` is specified | LL | let foo: Foo = Foo::foo(); @@ -20,13 +18,15 @@ error[E0284]: type annotations needed for `Foo<_>` --> $DIR/doesnt_infer.rs:13:9 | LL | let foo = Foo::foo(); - | ^^^ --- type must be known at this point + | ^^^ ---------- type must be known at this point | -note: required by a const generic parameter in `Foo` - --> $DIR/doesnt_infer.rs:3:12 +note: required by a const generic parameter in `Foo::::foo` + --> $DIR/doesnt_infer.rs:5:6 | -LL | struct Foo; - | ^^^^^^^^^^^^^^^^ required by this const generic parameter in `Foo` +LL | impl Foo { + | ^^^^^^^^^^^^ required by this const generic parameter in `Foo::::foo` +LL | fn foo() -> Self { + | --- required by a bound in this associated function help: consider giving `foo` an explicit type, where the value of const parameter `N` is specified | LL | let foo: Foo = Foo::foo(); diff --git a/tests/ui/const-generics/generic_arg_infer/issue-91614.stderr b/tests/ui/const-generics/generic_arg_infer/issue-91614.stderr index b88fe966b77ce..b07e1f29d0d90 100644 --- a/tests/ui/const-generics/generic_arg_infer/issue-91614.stderr +++ b/tests/ui/const-generics/generic_arg_infer/issue-91614.stderr @@ -2,9 +2,9 @@ error[E0284]: type annotations needed for `Mask<_, _>` --> $DIR/issue-91614.rs:6:9 | LL | let y = Mask::<_, _>::splat(false); - | ^ -------------------------- type must be known at this point + | ^ ------------ type must be known at this point | -note: required by a const generic parameter in `Mask::::splat` +note: required by a const generic parameter in `Mask` --> $SRC_DIR/core/src/../../portable-simd/crates/core_simd/src/masks.rs:LL:COL help: consider giving `y` an explicit type, where the value of const parameter `N` is specified | @@ -15,9 +15,9 @@ error[E0284]: type annotations needed for `Mask<_, _>` --> $DIR/issue-91614.rs:6:9 | LL | let y = Mask::<_, _>::splat(false); - | ^ ------------ type must be known at this point + | ^ -------------------------- type must be known at this point | -note: required by a const generic parameter in `Mask` +note: required by a const generic parameter in `Mask::::splat` --> $SRC_DIR/core/src/../../portable-simd/crates/core_simd/src/masks.rs:LL:COL help: consider giving `y` an explicit type, where the value of const parameter `N` is specified | diff --git a/tests/ui/const-generics/generic_const_exprs/issue-62504.full.stderr b/tests/ui/const-generics/generic_const_exprs/issue-62504.full.stderr index 3739637c27951..6b79b32d13e3b 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-62504.full.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-62504.full.stderr @@ -22,15 +22,13 @@ error[E0284]: type annotations needed for `ArrayHolder<_>` --> $DIR/issue-62504.rs:26:9 | LL | let mut array = ArrayHolder::new(); - | ^^^^^^^^^ ------------------ type must be known at this point + | ^^^^^^^^^ ----------- type must be known at this point | -note: required by a const generic parameter in `ArrayHolder::::new` - --> $DIR/issue-62504.rs:16:6 +note: required by a const generic parameter in `ArrayHolder` + --> $DIR/issue-62504.rs:14:20 | -LL | impl ArrayHolder { - | ^^^^^^^^^^^^^^ required by this const generic parameter in `ArrayHolder::::new` -LL | pub const fn new() -> Self { - | --- required by a bound in this associated function +LL | struct ArrayHolder([u32; X]); + | ^^^^^^^^^^^^^^ required by this const generic parameter in `ArrayHolder` help: consider giving `array` an explicit type, where the value of const parameter `X` is specified | LL | let mut array: ArrayHolder = ArrayHolder::new(); @@ -40,13 +38,15 @@ error[E0284]: type annotations needed for `ArrayHolder<_>` --> $DIR/issue-62504.rs:26:9 | LL | let mut array = ArrayHolder::new(); - | ^^^^^^^^^ ----------- type must be known at this point + | ^^^^^^^^^ ------------------ type must be known at this point | -note: required by a const generic parameter in `ArrayHolder` - --> $DIR/issue-62504.rs:14:20 +note: required by a const generic parameter in `ArrayHolder::::new` + --> $DIR/issue-62504.rs:16:6 | -LL | struct ArrayHolder([u32; X]); - | ^^^^^^^^^^^^^^ required by this const generic parameter in `ArrayHolder` +LL | impl ArrayHolder { + | ^^^^^^^^^^^^^^ required by this const generic parameter in `ArrayHolder::::new` +LL | pub const fn new() -> Self { + | --- required by a bound in this associated function help: consider giving `array` an explicit type, where the value of const parameter `X` is specified | LL | let mut array: ArrayHolder = ArrayHolder::new(); diff --git a/tests/ui/const-generics/generic_const_exprs/issue-62504.min.stderr b/tests/ui/const-generics/generic_const_exprs/issue-62504.min.stderr index 8efd433fd1fe9..c53a6598d34ed 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-62504.min.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-62504.min.stderr @@ -24,15 +24,13 @@ error[E0284]: type annotations needed for `ArrayHolder<_>` --> $DIR/issue-62504.rs:26:9 | LL | let mut array = ArrayHolder::new(); - | ^^^^^^^^^ ------------------ type must be known at this point + | ^^^^^^^^^ ----------- type must be known at this point | -note: required by a const generic parameter in `ArrayHolder::::new` - --> $DIR/issue-62504.rs:16:6 +note: required by a const generic parameter in `ArrayHolder` + --> $DIR/issue-62504.rs:14:20 | -LL | impl ArrayHolder { - | ^^^^^^^^^^^^^^ required by this const generic parameter in `ArrayHolder::::new` -LL | pub const fn new() -> Self { - | --- required by a bound in this associated function +LL | struct ArrayHolder([u32; X]); + | ^^^^^^^^^^^^^^ required by this const generic parameter in `ArrayHolder` help: consider giving `array` an explicit type, where the value of const parameter `X` is specified | LL | let mut array: ArrayHolder = ArrayHolder::new(); @@ -42,13 +40,15 @@ error[E0284]: type annotations needed for `ArrayHolder<_>` --> $DIR/issue-62504.rs:26:9 | LL | let mut array = ArrayHolder::new(); - | ^^^^^^^^^ ----------- type must be known at this point + | ^^^^^^^^^ ------------------ type must be known at this point | -note: required by a const generic parameter in `ArrayHolder` - --> $DIR/issue-62504.rs:14:20 +note: required by a const generic parameter in `ArrayHolder::::new` + --> $DIR/issue-62504.rs:16:6 | -LL | struct ArrayHolder([u32; X]); - | ^^^^^^^^^^^^^^ required by this const generic parameter in `ArrayHolder` +LL | impl ArrayHolder { + | ^^^^^^^^^^^^^^ required by this const generic parameter in `ArrayHolder::::new` +LL | pub const fn new() -> Self { + | --- required by a bound in this associated function help: consider giving `array` an explicit type, where the value of const parameter `X` is specified | LL | let mut array: ArrayHolder = ArrayHolder::new(); diff --git a/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr b/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr index d90380396c1f3..07fd231cb7ae9 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr @@ -4,7 +4,7 @@ error: internal compiler error: compiler/rustc_const_eval/src/interpret/operator Box query stack during panic: -#0 [eval_to_allocation_raw] const-evaluating + checking `::{constant#0}` +#0 [eval_to_allocation_raw] const-evaluating + checking `Inline::{constant#0}` #1 [eval_to_valtree] evaluating type-level constant ... and 2 other queries... use `env RUST_BACKTRACE=1` to see the full query stack error: aborting due to 1 previous error diff --git a/tests/ui/consts/const-needs_drop-monomorphic.stderr b/tests/ui/consts/const-needs_drop-monomorphic.stderr index 446d34810c59c..17f197cdd5d2b 100644 --- a/tests/ui/consts/const-needs_drop-monomorphic.stderr +++ b/tests/ui/consts/const-needs_drop-monomorphic.stderr @@ -1,12 +1,3 @@ -error[E0599]: no function or associated item named `assert` found for struct `Bool<{ std::mem::needs_drop::() }>` in the current scope - --> $DIR/const-needs_drop-monomorphic.rs:11:46 - | -LL | struct Bool {} - | -------------------------- function or associated item `assert` not found for this struct -... -LL | Bool::<{ std::mem::needs_drop::() }>::assert(); - | ^^^^^^ function or associated item cannot be called on `Bool<{ std::mem::needs_drop::() }>` due to unsatisfied trait bounds - error: unconstrained generic constant --> $DIR/const-needs_drop-monomorphic.rs:11:5 | @@ -18,6 +9,15 @@ help: try adding a `where` bound LL | fn f() where [(); { std::mem::needs_drop::() } as usize]: { | +++++++++++++++++++++++++++++++++++++++++++++++++++++ +error[E0599]: no function or associated item named `assert` found for struct `Bool<{ std::mem::needs_drop::() }>` in the current scope + --> $DIR/const-needs_drop-monomorphic.rs:11:46 + | +LL | struct Bool {} + | -------------------------- function or associated item `assert` not found for this struct +... +LL | Bool::<{ std::mem::needs_drop::() }>::assert(); + | ^^^^^^ function or associated item cannot be called on `Bool<{ std::mem::needs_drop::() }>` due to unsatisfied trait bounds + error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.stderr b/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.stderr index 2ce3b388073c4..61e2a8f64dd52 100644 --- a/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.stderr +++ b/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.stderr @@ -52,6 +52,14 @@ LL | pub struct InvariantRef<'a, T: ?Sized>(&'a T, PhantomData<&'a mut &'a T>); LL | pub const NEW: Self = InvariantRef::new(&()); | ^^^ function or associated item not found in `InvariantRef<'_, _>` +error[E0277]: the trait bound `u8: Trait` is not satisfied + --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:22:12 + | +LL | reuse ::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW } } + | ^^ the trait `Trait` is not implemented for `u8` + | + = help: the trait `Trait` is implemented for `Z` + error[E0308]: mismatched types --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:22:53 | @@ -68,6 +76,7 @@ LL | reuse ::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW | ^^ the trait `Trait` is not implemented for `u8` | = help: the trait `Trait` is implemented for `Z` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0308]: mismatched types --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:22:53 @@ -98,15 +107,6 @@ LL | reuse ::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW found struct `InvariantRef<'_, ()>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0277]: the trait bound `u8: Trait` is not satisfied - --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:22:12 - | -LL | reuse ::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW } } - | ^^ the trait `Trait` is not implemented for `u8` - | - = help: the trait `Trait` is implemented for `Z` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - error: aborting due to 10 previous errors Some errors have detailed explanations: E0261, E0277, E0308, E0599. diff --git a/tests/ui/dyn-compatibility/assoc_type_bounds_sized_used.stderr b/tests/ui/dyn-compatibility/assoc_type_bounds_sized_used.stderr index b67a1244eceab..7b152adea4925 100644 --- a/tests/ui/dyn-compatibility/assoc_type_bounds_sized_used.stderr +++ b/tests/ui/dyn-compatibility/assoc_type_bounds_sized_used.stderr @@ -1,17 +1,3 @@ -error[E0599]: the function or associated item `default` exists for associated type `::Bar`, but its trait bounds were not satisfied - --> $DIR/assoc_type_bounds_sized_used.rs:11:30 - | -LL | let _ = ::Bar::default(); - | ^^^^^^^ function or associated item cannot be called on `::Bar` due to unsatisfied trait bounds - | - = note: the following trait bounds were not satisfied: - `T: Sized` - which is required by `::Bar: Default` -help: consider restricting the type parameter to satisfy the trait bound - | -LL | fn bop() where T: Sized { - | ++++++++++++++ - error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/assoc_type_bounds_sized_used.rs:11:14 | @@ -38,6 +24,20 @@ help: consider relaxing the implicit `Sized` restriction LL | type Bar: Default + ?Sized | ++++++++ +error[E0599]: the function or associated item `default` exists for associated type `::Bar`, but its trait bounds were not satisfied + --> $DIR/assoc_type_bounds_sized_used.rs:11:30 + | +LL | let _ = ::Bar::default(); + | ^^^^^^^ function or associated item cannot be called on `::Bar` due to unsatisfied trait bounds + | + = note: the following trait bounds were not satisfied: + `T: Sized` + which is required by `::Bar: Default` +help: consider restricting the type parameter to satisfy the trait bound + | +LL | fn bop() where T: Sized { + | ++++++++++++++ + error: aborting due to 2 previous errors Some errors have detailed explanations: E0277, E0599. diff --git a/tests/ui/impl-trait/issues/issue-62742.stderr b/tests/ui/impl-trait/issues/issue-62742.stderr index 98d17b02536cc..ee4eb98f4eaf5 100644 --- a/tests/ui/impl-trait/issues/issue-62742.stderr +++ b/tests/ui/impl-trait/issues/issue-62742.stderr @@ -1,3 +1,17 @@ +error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied + --> $DIR/issue-62742.rs:4:5 + | +LL | WrongImpl::foo(0i32); + | ^^^^^^^^^ the trait `Raw<_>` is not implemented for `RawImpl<_>` + | + = help: the trait `Raw<_>` is not implemented for `RawImpl<_>` + but trait `Raw<[_]>` is implemented for it +note: required by a bound in `SafeImpl` + --> $DIR/issue-62742.rs:33:35 + | +LL | pub struct SafeImpl>(PhantomData<(A, T)>); + | ^^^^^^ required by this bound in `SafeImpl` + error[E0599]: the function or associated item `foo` exists for struct `SafeImpl<_, RawImpl<_>>`, but its trait bounds were not satisfied --> $DIR/issue-62742.rs:4:16 | @@ -23,14 +37,15 @@ note: the trait `Raw` must be implemented LL | pub trait Raw { | ^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied - --> $DIR/issue-62742.rs:4:5 +error[E0277]: the trait bound `RawImpl<()>: Raw<()>` is not satisfied + --> $DIR/issue-62742.rs:10:5 | -LL | WrongImpl::foo(0i32); - | ^^^^^^^^^ the trait `Raw<_>` is not implemented for `RawImpl<_>` +LL | WrongImpl::<()>::foo(0i32); + | ^^^^^^^^^^^^^^^ the trait `Raw<()>` is not implemented for `RawImpl<()>` | - = help: the trait `Raw<_>` is not implemented for `RawImpl<_>` - but trait `Raw<[_]>` is implemented for it + = help: the trait `Raw<()>` is not implemented for `RawImpl<()>` + but trait `Raw<[()]>` is implemented for it + = help: for that trait implementation, expected `[()]`, found `()` note: required by a bound in `SafeImpl` --> $DIR/issue-62742.rs:33:35 | @@ -62,21 +77,6 @@ note: the trait `Raw` must be implemented LL | pub trait Raw { | ^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0277]: the trait bound `RawImpl<()>: Raw<()>` is not satisfied - --> $DIR/issue-62742.rs:10:5 - | -LL | WrongImpl::<()>::foo(0i32); - | ^^^^^^^^^^^^^^^ the trait `Raw<()>` is not implemented for `RawImpl<()>` - | - = help: the trait `Raw<()>` is not implemented for `RawImpl<()>` - but trait `Raw<[()]>` is implemented for it - = help: for that trait implementation, expected `[()]`, found `()` -note: required by a bound in `SafeImpl` - --> $DIR/issue-62742.rs:33:35 - | -LL | pub struct SafeImpl>(PhantomData<(A, T)>); - | ^^^^^^ required by this bound in `SafeImpl` - error: aborting due to 4 previous errors Some errors have detailed explanations: E0277, E0599. diff --git a/tests/ui/inference/need_type_info/type-alias.stderr b/tests/ui/inference/need_type_info/type-alias.stderr index 2c39a3f56466f..47393557828fd 100644 --- a/tests/ui/inference/need_type_info/type-alias.stderr +++ b/tests/ui/inference/need_type_info/type-alias.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed --> $DIR/type-alias.rs:12:5 | LL | DirectAlias::new() - | ^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `T` + | ^^^^^^^^^^^ cannot infer type for type parameter `T` declared on the type alias `DirectAlias` error[E0282]: type annotations needed --> $DIR/type-alias.rs:18:5 @@ -14,7 +14,7 @@ error[E0282]: type annotations needed --> $DIR/type-alias.rs:32:5 | LL | DirectButWithDefaultAlias::new(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `T` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `T` declared on the type alias `DirectButWithDefaultAlias` error: aborting due to 3 previous errors diff --git a/tests/ui/issues/issue-58734.rs b/tests/ui/issues/issue-58734.rs index 9b630666baf85..ee23be87b6b79 100644 --- a/tests/ui/issues/issue-58734.rs +++ b/tests/ui/issues/issue-58734.rs @@ -21,4 +21,5 @@ fn main() { //~^ ERROR no function or associated item named `nonexistent` found //~| WARN trait objects without an explicit `dyn` are deprecated //~| WARN this is accepted in the current edition + //~| ERROR the trait `Trait` is not dyn compatible } diff --git a/tests/ui/issues/issue-58734.stderr b/tests/ui/issues/issue-58734.stderr index a2acd9dcf8189..c4624cecc621c 100644 --- a/tests/ui/issues/issue-58734.stderr +++ b/tests/ui/issues/issue-58734.stderr @@ -12,12 +12,38 @@ help: if this is a dyn-compatible trait, use `dyn` LL | ::nonexistent(()); | ++++ + +error[E0038]: the trait `Trait` is not dyn compatible + --> $DIR/issue-58734.rs:20:5 + | +LL | Trait::nonexistent(()); + | ^^^^^ `Trait` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit + --> $DIR/issue-58734.rs:4:8 + | +LL | trait Trait { + | ----- this trait is not dyn compatible... +... +LL | fn dyn_incompatible() -> Self; + | ^^^^^^^^^^^^^^^^ ...because associated function `dyn_incompatible` has no `self` parameter + = help: only type `()` implements `Trait`; consider using it directly instead. +help: consider turning `dyn_incompatible` into a method by giving it a `&self` argument + | +LL | fn dyn_incompatible(&self) -> Self; + | +++++ +help: alternatively, consider constraining `dyn_incompatible` so it does not apply to trait objects + | +LL | fn dyn_incompatible() -> Self where Self: Sized; + | +++++++++++++++++ + error[E0599]: no function or associated item named `nonexistent` found for trait object `dyn Trait` in the current scope --> $DIR/issue-58734.rs:20:12 | LL | Trait::nonexistent(()); | ^^^^^^^^^^^ function or associated item not found in `dyn Trait` -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 2 previous errors; 1 warning emitted -For more information about this error, try `rustc --explain E0599`. +Some errors have detailed explanations: E0038, E0599. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/methods/inherent-bound-in-probe.stderr b/tests/ui/methods/inherent-bound-in-probe.stderr index 8d7cc462280d6..433ef02a2aa4c 100644 --- a/tests/ui/methods/inherent-bound-in-probe.stderr +++ b/tests/ui/methods/inherent-bound-in-probe.stderr @@ -9,10 +9,10 @@ note: required by a bound in `std::iter::IntoIterator::IntoIter` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL error[E0275]: overflow evaluating the requirement `&_: IntoIterator` - --> $DIR/inherent-bound-in-probe.rs:44:17 + --> $DIR/inherent-bound-in-probe.rs:44:9 | LL | Helper::new(&self.0) - | ^^^ + | ^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_bound_in_probe`) note: required for `&BitReaderWrapper<_>` to implement `IntoIterator` @@ -25,11 +25,14 @@ LL | &'a T: IntoIterator, | ------------- unsatisfied trait bound introduced here = note: 126 redundant requirements hidden = note: required for `&BitReaderWrapper>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `IntoIterator` -note: required by a bound in `Helper<'a, T>` - --> $DIR/inherent-bound-in-probe.rs:25:25 +note: required by a bound in `Helper` + --> $DIR/inherent-bound-in-probe.rs:18:12 | +LL | struct Helper<'a, T> + | ------ required by a bound in this struct +LL | where LL | &'a T: IntoIterator, - | ^^^^^^^^^^^^^ required by this bound in `Helper<'a, T>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Helper` error: aborting due to 2 previous errors diff --git a/tests/ui/traits/item-privacy.rs b/tests/ui/traits/item-privacy.rs index f5c741ccaa514..cdfd667a6f12e 100644 --- a/tests/ui/traits/item-privacy.rs +++ b/tests/ui/traits/item-privacy.rs @@ -98,9 +98,12 @@ fn check_assoc_const() { S::B; //~ ERROR no associated item named `B` found S::C; // OK // A, B, C are resolved as inherent items, their traits don't need to be in scope - ::A; //~ ERROR associated constant `A` is private - //~^ ERROR the trait `assoc_const::C` is not dyn compatible - ::B; // ERROR the trait `assoc_const::C` is not dyn compatible + ::A; + //~^ ERROR associated constant `A` is private + //~| ERROR the trait `assoc_const::C` is not dyn compatible + //~| ERROR the trait `assoc_const::C` is not dyn compatible + ::B; + //~^ ERROR the trait `assoc_const::C` is not dyn compatible C::C; // OK } diff --git a/tests/ui/traits/item-privacy.stderr b/tests/ui/traits/item-privacy.stderr index ddead3fdfd366..4fd9ef9119257 100644 --- a/tests/ui/traits/item-privacy.stderr +++ b/tests/ui/traits/item-privacy.stderr @@ -130,6 +130,31 @@ help: trait `B` which provides `B` is implemented but not in scope; perhaps you LL + use assoc_const::B; | +error[E0038]: the trait `assoc_const::C` is not dyn compatible + --> $DIR/item-privacy.rs:101:6 + | +LL | ::A; + | ^^^^^ `assoc_const::C` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit + --> $DIR/item-privacy.rs:25:15 + | +LL | const A: u8 = 0; + | ^ ...because it contains this associated `const` +... +LL | const B: u8 = 0; + | ^ ...because it contains this associated `const` +... +LL | pub trait C: A + B { + | - this trait is not dyn compatible... +LL | const C: u8 = 0; + | ^ ...because it contains this associated `const` + = help: consider moving `C` to another trait + = help: consider moving `A` to another trait + = help: consider moving `B` to another trait + = help: only type `S` implements `assoc_const::C`; consider using it directly instead. + error[E0624]: associated constant `A` is private --> $DIR/item-privacy.rs:101:14 | @@ -140,10 +165,35 @@ LL | ::A; | ^ private associated constant error[E0038]: the trait `assoc_const::C` is not dyn compatible - --> $DIR/item-privacy.rs:101:6 + --> $DIR/item-privacy.rs:101:5 | LL | ::A; - | ^^^^^ `assoc_const::C` is not dyn compatible + | ^^^^^^^^^^ `assoc_const::C` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit + --> $DIR/item-privacy.rs:25:15 + | +LL | const A: u8 = 0; + | ^ ...because it contains this associated `const` +... +LL | const B: u8 = 0; + | ^ ...because it contains this associated `const` +... +LL | pub trait C: A + B { + | - this trait is not dyn compatible... +LL | const C: u8 = 0; + | ^ ...because it contains this associated `const` + = help: consider moving `C` to another trait + = help: consider moving `A` to another trait + = help: consider moving `B` to another trait + = help: only type `S` implements `assoc_const::C`; consider using it directly instead. + +error[E0038]: the trait `assoc_const::C` is not dyn compatible + --> $DIR/item-privacy.rs:105:5 + | +LL | ::B; + | ^^^^^^^^^^ `assoc_const::C` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit @@ -165,7 +215,7 @@ LL | const C: u8 = 0; = help: only type `S` implements `assoc_const::C`; consider using it directly instead. error[E0223]: ambiguous associated type - --> $DIR/item-privacy.rs:115:12 + --> $DIR/item-privacy.rs:118:12 | LL | let _: S::A; | ^^^^ @@ -177,19 +227,19 @@ LL + let _: ::A; | error[E0223]: ambiguous associated type - --> $DIR/item-privacy.rs:116:12 + --> $DIR/item-privacy.rs:119:12 | LL | let _: S::B; | ^^^^ help: use fully-qualified syntax: `::B` error[E0223]: ambiguous associated type - --> $DIR/item-privacy.rs:117:12 + --> $DIR/item-privacy.rs:120:12 | LL | let _: S::C; | ^^^^ help: use fully-qualified syntax: `::C` error[E0624]: associated type `A` is private - --> $DIR/item-privacy.rs:119:12 + --> $DIR/item-privacy.rs:122:12 | LL | type A = u8; | ------ the associated type is defined here @@ -198,7 +248,7 @@ LL | let _: T::A; | ^^^^ private associated type error[E0624]: associated type `A` is private - --> $DIR/item-privacy.rs:128:9 + --> $DIR/item-privacy.rs:131:9 | LL | type A = u8; | ------ the associated type is defined here @@ -206,7 +256,7 @@ LL | type A = u8; LL | A = u8, | ^^^^^^ private associated type -error: aborting due to 15 previous errors +error: aborting due to 17 previous errors Some errors have detailed explanations: E0038, E0223, E0599, E0624. For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/type-alias-impl-trait/constrain_in_projection.current.stderr b/tests/ui/type-alias-impl-trait/constrain_in_projection.current.stderr index d96c86a2e6f16..580258bbb28e4 100644 --- a/tests/ui/type-alias-impl-trait/constrain_in_projection.current.stderr +++ b/tests/ui/type-alias-impl-trait/constrain_in_projection.current.stderr @@ -7,6 +7,15 @@ LL | let x = >::Assoc::default(); = help: the trait `Trait` is not implemented for `Foo` but trait `Trait<()>` is implemented for it -error: aborting due to 1 previous error +error[E0277]: the trait bound `Foo: Trait` is not satisfied + --> $DIR/constrain_in_projection.rs:24:13 + | +LL | let x = >::Assoc::default(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `Foo` + | + = help: the trait `Trait` is not implemented for `Foo` + but trait `Trait<()>` is implemented for it + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/type-alias-impl-trait/constrain_in_projection.rs b/tests/ui/type-alias-impl-trait/constrain_in_projection.rs index 7d7d16361ae6d..355c0e1692b2a 100644 --- a/tests/ui/type-alias-impl-trait/constrain_in_projection.rs +++ b/tests/ui/type-alias-impl-trait/constrain_in_projection.rs @@ -23,6 +23,7 @@ impl Trait<()> for Foo { fn bop(_: Bar) { let x = >::Assoc::default(); //[current]~^ `Foo: Trait` is not satisfied + //[current]~| `Foo: Trait` is not satisfied } fn main() {} diff --git a/tests/ui/type-alias-impl-trait/constrain_in_projection2.current.stderr b/tests/ui/type-alias-impl-trait/constrain_in_projection2.current.stderr index 909f1f6d61cbe..777fe1e2788ce 100644 --- a/tests/ui/type-alias-impl-trait/constrain_in_projection2.current.stderr +++ b/tests/ui/type-alias-impl-trait/constrain_in_projection2.current.stderr @@ -8,6 +8,16 @@ LL | let x = >::Assoc::default(); `Foo` implements `Trait<()>` `Foo` implements `Trait` -error: aborting due to 1 previous error +error[E0277]: the trait bound `Foo: Trait` is not satisfied + --> $DIR/constrain_in_projection2.rs:27:13 + | +LL | let x = >::Assoc::default(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `Foo` + | + = help: the following other types implement trait `Trait`: + `Foo` implements `Trait<()>` + `Foo` implements `Trait` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/type-alias-impl-trait/constrain_in_projection2.rs b/tests/ui/type-alias-impl-trait/constrain_in_projection2.rs index af222f6c15347..16b1329b52f3d 100644 --- a/tests/ui/type-alias-impl-trait/constrain_in_projection2.rs +++ b/tests/ui/type-alias-impl-trait/constrain_in_projection2.rs @@ -27,6 +27,7 @@ fn bop(_: Bar) { let x = >::Assoc::default(); //[next]~^ ERROR: cannot satisfy `Foo: Trait` //[current]~^^ ERROR: `Foo: Trait` is not satisfied + //[current]~| ERROR: `Foo: Trait` is not satisfied } fn main() {}