From 55806e565503f8d9e519f3c958f3c51836304cd2 Mon Sep 17 00:00:00 2001 From: Orion Gonzalez Date: Tue, 10 Dec 2024 23:19:45 +0100 Subject: document check_expr_field --- compiler/rustc_errors/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler/rustc_errors') diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 6232c875ee8..fc44340851c 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1291,7 +1291,7 @@ impl<'a> DiagCtxtHandle<'a> { Diag::::new(self, DelayedBug, msg.into()).emit() } - /// Ensures that an error is printed. See `Level::DelayedBug`. + /// Ensures that an error is printed. See [`Level::DelayedBug`]. /// /// Note: this function used to be called `delay_span_bug`. It was renamed /// to match similar functions like `span_err`, `span_warn`, etc. -- cgit 1.4.1-3-g733a5 From 014363e89e4347332c50daede2efa66af3c2c243 Mon Sep 17 00:00:00 2001 From: Orion Gonzalez Date: Wed, 11 Dec 2024 00:53:07 +0100 Subject: Don't emit "field expressions may not have generic arguments" if it's a method call without () --- compiler/rustc_errors/src/lib.rs | 4 ++++ compiler/rustc_hir_typeck/src/expr.rs | 3 ++- compiler/rustc_parse/src/parser/expr.rs | 7 +++++-- tests/ui/parser/bad-name.stderr | 12 ++++++------ tests/ui/suggestions/method-missing-parentheses.rs | 1 - tests/ui/suggestions/method-missing-parentheses.stderr | 8 +------- 6 files changed, 18 insertions(+), 17 deletions(-) (limited to 'compiler/rustc_errors') diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 6232c875ee8..95b40b6a906 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -576,6 +576,10 @@ pub enum StashKey { UndeterminedMacroResolution, /// Used by `Parser::maybe_recover_trailing_expr` ExprInPat, + /// If in the parser we detect a field expr with turbofish generic params it's possible that + /// it's a method call without parens. If later on in `hir_typeck` we find out that this is + /// the case we suppress this message and we give a better suggestion. + GenericInFieldExpr, } fn default_track_diagnostic(diag: DiagInner, f: &mut dyn FnMut(DiagInner) -> R) -> R { diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index 0e079b03769..12257c449e7 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -3055,7 +3055,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.help("methods are immutable and cannot be assigned to"); } - err.emit() + // See `StashKey::GenericInFieldExpr` for more info + self.dcx().try_steal_replace_and_emit_err(field.span, StashKey::GenericInFieldExpr, err) } fn point_at_param_definition(&self, err: &mut Diag<'_>, param: ty::ParamTy) { diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index eeb83a85e59..0904a42d8a4 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1369,11 +1369,14 @@ impl<'a> Parser<'a> { )) } else { // Field access `expr.f` + let span = lo.to(self.prev_token.span); if let Some(args) = seg.args { - self.dcx().emit_err(errors::FieldExpressionWithGeneric(args.span())); + // See `StashKey::GenericInFieldExpr` for more info on why we stash this. + self.dcx() + .create_err(errors::FieldExpressionWithGeneric(args.span())) + .stash(seg.ident.span, StashKey::GenericInFieldExpr); } - let span = lo.to(self.prev_token.span); Ok(self.mk_expr(span, ExprKind::Field(self_arg, seg.ident))) } } diff --git a/tests/ui/parser/bad-name.stderr b/tests/ui/parser/bad-name.stderr index a336923f4fd..112fdcad336 100644 --- a/tests/ui/parser/bad-name.stderr +++ b/tests/ui/parser/bad-name.stderr @@ -1,9 +1,3 @@ -error: field expressions cannot have generic arguments - --> $DIR/bad-name.rs:2:12 - | -LL | let x.y::.z foo; - | ^^^^^^^ - error: expected a pattern, found an expression --> $DIR/bad-name.rs:2:7 | @@ -18,5 +12,11 @@ error: expected one of `(`, `.`, `::`, `:`, `;`, `=`, `?`, `|`, or an operator, LL | let x.y::.z foo; | ^^^ expected one of 9 possible tokens +error: field expressions cannot have generic arguments + --> $DIR/bad-name.rs:2:12 + | +LL | let x.y::.z foo; + | ^^^^^^^ + error: aborting due to 3 previous errors diff --git a/tests/ui/suggestions/method-missing-parentheses.rs b/tests/ui/suggestions/method-missing-parentheses.rs index f10bfb56d2e..bc576b71f0d 100644 --- a/tests/ui/suggestions/method-missing-parentheses.rs +++ b/tests/ui/suggestions/method-missing-parentheses.rs @@ -1,5 +1,4 @@ fn main() { let _ = vec![].into_iter().collect::; //~^ ERROR attempted to take value of method `collect` on type `std::vec::IntoIter<_>` - //~| ERROR field expressions cannot have generic arguments } diff --git a/tests/ui/suggestions/method-missing-parentheses.stderr b/tests/ui/suggestions/method-missing-parentheses.stderr index 1bfff56a6a9..f0ff1f0334a 100644 --- a/tests/ui/suggestions/method-missing-parentheses.stderr +++ b/tests/ui/suggestions/method-missing-parentheses.stderr @@ -1,9 +1,3 @@ -error: field expressions cannot have generic arguments - --> $DIR/method-missing-parentheses.rs:2:41 - | -LL | let _ = vec![].into_iter().collect::; - | ^^^^^^^ - error[E0615]: attempted to take value of method `collect` on type `std::vec::IntoIter<_>` --> $DIR/method-missing-parentheses.rs:2:32 | @@ -15,6 +9,6 @@ help: use parentheses to call the method LL | let _ = vec![].into_iter().collect::(); | ++ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0615`. -- cgit 1.4.1-3-g733a5 From 40c964510c3d6f6c05ceee305e128bd924baf1d6 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 12 Dec 2024 11:31:10 +1100 Subject: Remove `PErr`. It's just a synonym for `Diag` that adds no value and is only used in a few places. --- compiler/rustc_errors/src/lib.rs | 3 +-- compiler/rustc_parse/src/lexer/tokentrees.rs | 14 +++++++------- compiler/rustc_parse/src/parser/diagnostics.rs | 6 +++--- 3 files changed, 11 insertions(+), 12 deletions(-) (limited to 'compiler/rustc_errors') diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 6232c875ee8..f77f53a1310 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -94,8 +94,7 @@ mod styled_buffer; mod tests; pub mod translation; -pub type PErr<'a> = Diag<'a>; -pub type PResult<'a, T> = Result>; +pub type PResult<'a, T> = Result>; rustc_fluent_macro::fluent_messages! { "../messages.ftl" } diff --git a/compiler/rustc_parse/src/lexer/tokentrees.rs b/compiler/rustc_parse/src/lexer/tokentrees.rs index c6c9eb3b0b2..ee38f16d4ec 100644 --- a/compiler/rustc_parse/src/lexer/tokentrees.rs +++ b/compiler/rustc_parse/src/lexer/tokentrees.rs @@ -1,7 +1,7 @@ use rustc_ast::token::{self, Delimiter, Token}; use rustc_ast::tokenstream::{DelimSpacing, DelimSpan, Spacing, TokenStream, TokenTree}; use rustc_ast_pretty::pprust::token_to_string; -use rustc_errors::{Applicability, PErr}; +use rustc_errors::{Applicability, Diag}; use rustc_span::symbol::kw; use super::diagnostics::{report_suspicious_mismatch_block, same_indentation_level}; @@ -14,7 +14,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> { pub(super) fn lex_token_trees( &mut self, is_delimited: bool, - ) -> (Spacing, TokenStream, Result<(), Vec>>) { + ) -> (Spacing, TokenStream, Result<(), Vec>>) { // Move past the opening delimiter. let open_spacing = self.bump_minimal(); @@ -56,7 +56,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> { } } - fn eof_err(&mut self) -> PErr<'psess> { + fn eof_err(&mut self) -> Diag<'psess> { let msg = "this file contains an unclosed delimiter"; let mut err = self.dcx().struct_span_err(self.token.span, msg); @@ -98,7 +98,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> { fn lex_token_tree_open_delim( &mut self, open_delim: Delimiter, - ) -> Result>> { + ) -> Result>> { // The span for beginning of the delimited section. let pre_span = self.token.span; @@ -250,8 +250,8 @@ impl<'psess, 'src> Lexer<'psess, 'src> { fn unclosed_delim_err( &mut self, tts: TokenStream, - mut errs: Vec>, - ) -> Vec> { + mut errs: Vec>, + ) -> Vec> { // If there are unclosed delims, see if there are diff markers and if so, point them // out instead of complaining about the unclosed delims. let mut parser = Parser::new(self.psess, tts, None); @@ -308,7 +308,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> { errs } - fn close_delim_err(&mut self, delim: Delimiter) -> PErr<'psess> { + fn close_delim_err(&mut self, delim: Delimiter) -> Diag<'psess> { // An unexpected closing delimiter (i.e., there is no matching opening delimiter). let token_str = token_to_string(&self.token); let msg = format!("unexpected closing delimiter: `{token_str}`"); diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 34131e3af6e..e5edf605d82 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -16,7 +16,7 @@ use rustc_ast_pretty::pprust; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::sync::Lrc; use rustc_errors::{ - Applicability, Diag, DiagCtxtHandle, ErrorGuaranteed, FatalError, PErr, PResult, Subdiagnostic, + Applicability, Diag, DiagCtxtHandle, ErrorGuaranteed, FatalError, PResult, Subdiagnostic, Suggestions, pluralize, }; use rustc_session::errors::ExprParenthesesNeeded; @@ -2132,7 +2132,7 @@ impl<'a> Parser<'a> { &mut self, delim: Delimiter, lo: Span, - err: PErr<'a>, + err: Diag<'a>, ) -> P { let guar = err.emit(); // Recover from parse error, callers expect the closing delim to be consumed. @@ -3014,7 +3014,7 @@ impl<'a> Parser<'a> { } /// Check for exclusive ranges written as `..<` - pub(crate) fn maybe_err_dotdotlt_syntax(&self, maybe_lt: Token, mut err: PErr<'a>) -> PErr<'a> { + pub(crate) fn maybe_err_dotdotlt_syntax(&self, maybe_lt: Token, mut err: Diag<'a>) -> Diag<'a> { if maybe_lt == token::Lt && (self.expected_tokens.contains(&TokenType::Token(token::Gt)) || matches!(self.token.kind, token::Literal(..))) -- cgit 1.4.1-3-g733a5 From 65a54a7f277b30ebeeacb5b303804fa8ffb5c922 Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Wed, 11 Dec 2024 21:17:33 +0000 Subject: Tweak multispan rendering Consider comments and bare delimiters the same as an "empty line" for purposes of hiding rendered code output of long multispans. This results in more aggressive shortening of rendered output without losing too much context, specially in `*.stderr` tests that have "hidden" comments. --- compiler/rustc_errors/src/emitter.rs | 8 ++- .../excessive_nesting/excessive_nesting.stderr | 3 +- .../clippy/tests/ui/async_yields_async.stderr | 1 - .../branches_sharing_code/shared_at_bottom.stderr | 6 +- .../clippy/tests/ui/collapsible_else_if.stderr | 5 -- src/tools/clippy/tests/ui/crashes/ice-360.stderr | 6 -- .../tests/ui/crate_level_checks/no_std_swap.stderr | 3 +- .../clippy/tests/ui/doc/unbalanced_ticks.stderr | 4 +- .../tests/ui/empty_line_after/doc_comments.stderr | 5 +- .../ui/empty_line_after/outer_attribute.stderr | 3 +- src/tools/clippy/tests/ui/enum_variants.stderr | 2 - src/tools/clippy/tests/ui/infinite_loops.stderr | 7 +- .../clippy/tests/ui/manual_find_fixable.stderr | 36 ++++------ .../clippy/tests/ui/map_flatten_fixable.stderr | 3 - src/tools/clippy/tests/ui/match_bool.stderr | 3 - .../tests/ui/match_expr_like_matches_macro.stderr | 3 +- .../tests/ui/missing_doc_crate_missing.stderr | 4 +- src/tools/clippy/tests/ui/needless_doc_main.stderr | 14 ++-- src/tools/clippy/tests/ui/needless_if.stderr | 1 - src/tools/clippy/tests/ui/never_loop.stderr | 3 - .../clippy/tests/ui/option_if_let_else.stderr | 3 +- src/tools/clippy/tests/ui/question_mark.stderr | 3 +- .../tests/ui/significant_drop_tightening.stderr | 3 +- src/tools/clippy/tests/ui/single_match.stderr | 5 +- .../ui/suspicious_doc_comments_unfixable.stderr | 9 +-- .../clippy/tests/ui/temporary_assignment.stderr | 3 +- .../ui/too_long_first_doc_paragraph-fix.stderr | 4 +- .../tests/ui/too_long_first_doc_paragraph.stderr | 7 +- .../clippy/tests/ui/unnecessary_lazy_eval.stderr | 3 - .../clippy/tests/ui/vec_init_then_push.stderr | 3 +- .../custom_code_classes_in_docs-warning3.stderr | 6 -- tests/rustdoc-ui/doctest/check-attr-test.stderr | 48 ++++--------- .../doctest/private-item-doc-test.stderr | 4 +- .../doctest/private-public-item-doc-test.stderr | 4 +- .../doctest/standalone-warning-2024.stderr | 10 +-- tests/rustdoc-ui/invalid-syntax.stderr | 7 +- .../issues/ice-generic-type-alias-105742.stderr | 5 -- tests/rustdoc-ui/lints/check-attr.stderr | 51 +------------- tests/rustdoc-ui/lints/check-fail.stderr | 8 +-- tests/rustdoc-ui/lints/lint-group.stderr | 4 +- tests/rustdoc-ui/unescaped_backticks.stderr | 12 ---- .../alloc-error-handler-bad-signature-1.stderr | 6 +- .../associated-types/associated-types-eq-2.stderr | 6 +- tests/ui/associated-types/issue-59324.stderr | 3 +- tests/ui/async-await/issue-84841.stderr | 3 +- tests/ui/async-await/issues/issue-72312.stderr | 5 +- .../track-caller/async-closure-gate.afn.stderr | 3 +- .../track-caller/async-closure-gate.nofeat.stderr | 3 +- .../issue-109271-pass-self-into-closure.stderr | 2 - .../2229_closure_analysis/issue-88476.stderr | 12 ---- .../2229_closure_analysis/wild_patterns.stderr | 18 ----- .../huge_multispan_highlight.ascii.svg | 78 +++++++++++----------- .../huge_multispan_highlight.unicode.svg | 78 +++++++++++----------- tests/ui/coercion/coerce-loop-issue-122561.stderr | 3 +- .../const_arg_trivial_macro_expansion-2.stderr | 5 +- .../issues/issue-67945-2.full.stderr | 3 +- tests/ui/const-generics/issues/issue-71202.stderr | 1 - .../const-eval/infinite_loop.eval_limit.stderr | 1 - .../consts/const-eval/infinite_loop.no_ice.stderr | 1 - .../stable-metric/ctfe-simple-loop.allow.stderr | 5 +- .../stable-metric/ctfe-simple-loop.warn.stderr | 15 +---- .../evade-deduplication-issue-118612.stderr | 15 ----- .../drop-tracking-parent-expression.stderr | 6 -- tests/ui/coroutine/parent-expression.stderr | 6 -- .../too-live-local-in-immovable-gen.stderr | 3 - tests/ui/coroutine/yield-in-initializer.stderr | 2 - tests/ui/coverage-attr/name-value.stderr | 2 - tests/ui/coverage-attr/word-only.stderr | 2 - tests/ui/drop/lint-tail-expr-drop-order.stderr | 36 ---------- ...ssue-89280-emitter-overflow-splice-lines.stderr | 3 +- tests/ui/expr/if/if-let-arm-types.stderr | 3 +- tests/ui/extern/issue-116203.stderr | 3 +- ...ssue-43106-gating-of-builtin-attrs-error.stderr | 5 -- .../issue-43106-gating-of-builtin-attrs.stderr | 1 - .../issue-43106-gating-of-derive.stderr | 2 - tests/ui/for/for-else-err.stderr | 3 +- tests/ui/for/for-else-let-else-err.stderr | 3 +- .../collectivity-regression.stderr | 5 +- ...itive-predicate-entailment-error.current.stderr | 9 --- tests/ui/issues/issue-18611.stderr | 3 +- tests/ui/issues/issue-51714.stderr | 14 +--- .../ui/lifetimes/issue-76168-hr-outlives-3.stderr | 9 --- tests/ui/lifetimes/issue-97194.stderr | 5 +- tests/ui/lint/non-local-defs/consts.stderr | 1 - tests/ui/lint/non-local-defs/weird-exprs.stderr | 5 -- tests/ui/loops/dont-suggest-break-thru-item.stderr | 6 +- tests/ui/loops/loop-else-err.stderr | 3 +- tests/ui/loops/loop-else-let-else-err.stderr | 3 +- tests/ui/lub-glb/old-lub-glb-hr-noteq1.leak.stderr | 3 +- tests/ui/macros/issue-112342-1.stderr | 3 +- tests/ui/match/match-type-err-first-arm.stderr | 3 +- ...-approximated-shorter-to-static-no-bound.stderr | 5 +- ...proximated-shorter-to-static-wrong-bound.stderr | 5 +- tests/ui/nll/snocat-regression.stderr | 5 +- tests/ui/parser/fn-arg-doc-comment.stderr | 8 +-- .../issue-86188-return-not-in-fn-body.stderr | 6 +- tests/ui/return/return-match-array-const.stderr | 10 +-- .../ui/return/tail-expr-as-potential-return.stderr | 9 +-- ...fe-on-unadorned-extern-block.edition2024.stderr | 3 +- .../min_specialization/issue-79224.stderr | 5 +- .../missing-stability-attr-at-top-level.stderr | 3 +- tests/ui/static/issue-24446.stderr | 10 +-- tests/ui/suggestions/if-then-neeing-semi.stderr | 12 ++-- .../suggestions/match-prev-arm-needing-semi.stderr | 9 +-- .../try-operator-dont-suggest-semicolon.stderr | 3 +- .../ice-120503-async-const-method.stderr | 6 -- .../const_generic_type.no_infer.stderr | 5 +- .../hidden_type_mismatch.stderr | 3 +- .../ui/type-alias-impl-trait/hkl_forbidden4.stderr | 6 +- tests/ui/while/while-else-err.stderr | 3 +- tests/ui/while/while-else-let-else-err.stderr | 3 +- 111 files changed, 206 insertions(+), 653 deletions(-) (limited to 'compiler/rustc_errors') diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 1b6c6edcc61..9595790d574 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -3048,11 +3048,15 @@ impl FileWithAnnotatedLines { // working correctly. let middle = min(ann.line_start + 4, ann.line_end); // We'll show up to 4 lines past the beginning of the multispan start. - // We will *not* include the tail of lines that are only whitespace. + // We will *not* include the tail of lines that are only whitespace, a comment or + // a bare delimiter. let until = (ann.line_start..middle) .rev() .filter_map(|line| file.get_line(line - 1).map(|s| (line + 1, s))) - .find(|(_, s)| !s.trim().is_empty()) + .find(|(_, s)| { + let s = s.trim(); + !["", "{", "}", "(", ")", "[", "]"].contains(&s) && !s.starts_with("//") + }) .map(|(line, _)| line) .unwrap_or(ann.line_start); for line in ann.line_start + 1..until { diff --git a/src/tools/clippy/tests/ui-toml/excessive_nesting/excessive_nesting.stderr b/src/tools/clippy/tests/ui-toml/excessive_nesting/excessive_nesting.stderr index ccdaecdd481..9cf6fc66757 100644 --- a/src/tools/clippy/tests/ui-toml/excessive_nesting/excessive_nesting.stderr +++ b/src/tools/clippy/tests/ui-toml/excessive_nesting/excessive_nesting.stderr @@ -66,8 +66,7 @@ error: this block is too nested LL | if true { | _________________________^ LL | | if true { -LL | | -LL | | } +... | LL | | } | |_________________^ | diff --git a/src/tools/clippy/tests/ui/async_yields_async.stderr b/src/tools/clippy/tests/ui/async_yields_async.stderr index 861c3f2ce4a..54baa69a035 100644 --- a/src/tools/clippy/tests/ui/async_yields_async.stderr +++ b/src/tools/clippy/tests/ui/async_yields_async.stderr @@ -80,7 +80,6 @@ error: an async construct yields a type which is itself awaitable LL | let _m = async || { | _______________________- LL | | println!("I'm bored"); -LL | | // Some more stuff ... | LL | | CustomFutureType | | ^^^^^^^^^^^^^^^^ diff --git a/src/tools/clippy/tests/ui/branches_sharing_code/shared_at_bottom.stderr b/src/tools/clippy/tests/ui/branches_sharing_code/shared_at_bottom.stderr index 68ebb6ad781..36b17773973 100644 --- a/src/tools/clippy/tests/ui/branches_sharing_code/shared_at_bottom.stderr +++ b/src/tools/clippy/tests/ui/branches_sharing_code/shared_at_bottom.stderr @@ -115,8 +115,7 @@ error: all if blocks contain the same code at the end --> tests/ui/branches_sharing_code/shared_at_bottom.rs:183:5 | LL | / x << 2 -LL | | -LL | | +... | LL | | }; | |_____^ | @@ -131,8 +130,7 @@ error: all if blocks contain the same code at the end --> tests/ui/branches_sharing_code/shared_at_bottom.rs:192:5 | LL | / x * 4 -LL | | -LL | | +... | LL | | } | |_____^ | diff --git a/src/tools/clippy/tests/ui/collapsible_else_if.stderr b/src/tools/clippy/tests/ui/collapsible_else_if.stderr index 395c2dcf68d..c27a2967f3c 100644 --- a/src/tools/clippy/tests/ui/collapsible_else_if.stderr +++ b/src/tools/clippy/tests/ui/collapsible_else_if.stderr @@ -43,7 +43,6 @@ LL | } else { | ____________^ LL | | if y == "world" { LL | | println!("world") -LL | | } ... | LL | | } LL | | } @@ -66,7 +65,6 @@ LL | } else { | ____________^ LL | | if let Some(42) = Some(42) { LL | | println!("world") -LL | | } ... | LL | | } LL | | } @@ -89,7 +87,6 @@ LL | } else { | ____________^ LL | | if let Some(42) = Some(42) { LL | | println!("world") -LL | | } ... | LL | | } LL | | } @@ -112,7 +109,6 @@ LL | } else { | ____________^ LL | | if x == "hello" { LL | | println!("world") -LL | | } ... | LL | | } LL | | } @@ -135,7 +131,6 @@ LL | } else { | ____________^ LL | | if let Some(42) = Some(42) { LL | | println!("world") -LL | | } ... | LL | | } LL | | } diff --git a/src/tools/clippy/tests/ui/crashes/ice-360.stderr b/src/tools/clippy/tests/ui/crashes/ice-360.stderr index 50b245c65cd..d37e0216edf 100644 --- a/src/tools/clippy/tests/ui/crashes/ice-360.stderr +++ b/src/tools/clippy/tests/ui/crashes/ice-360.stderr @@ -2,9 +2,6 @@ error: this loop never actually loops --> tests/ui/crashes/ice-360.rs:5:5 | LL | / loop { -LL | | -LL | | -LL | | ... | LL | | LL | | } @@ -16,9 +13,6 @@ error: this loop could be written as a `while let` loop --> tests/ui/crashes/ice-360.rs:5:5 | LL | / loop { -LL | | -LL | | -LL | | ... | LL | | LL | | } diff --git a/src/tools/clippy/tests/ui/crate_level_checks/no_std_swap.stderr b/src/tools/clippy/tests/ui/crate_level_checks/no_std_swap.stderr index 7d7922ae8ca..bcc8684f7c2 100644 --- a/src/tools/clippy/tests/ui/crate_level_checks/no_std_swap.stderr +++ b/src/tools/clippy/tests/ui/crate_level_checks/no_std_swap.stderr @@ -2,8 +2,7 @@ error: this looks like you are trying to swap `a` and `b` --> tests/ui/crate_level_checks/no_std_swap.rs:12:5 | LL | / a = b; -LL | | -LL | | +... | LL | | b = a; | |_________^ help: try: `core::mem::swap(&mut a, &mut b)` | diff --git a/src/tools/clippy/tests/ui/doc/unbalanced_ticks.stderr b/src/tools/clippy/tests/ui/doc/unbalanced_ticks.stderr index 50324010e97..3bcf65c4595 100644 --- a/src/tools/clippy/tests/ui/doc/unbalanced_ticks.stderr +++ b/src/tools/clippy/tests/ui/doc/unbalanced_ticks.stderr @@ -3,9 +3,7 @@ error: backticks are unbalanced | LL | /// This is a doc comment with `unbalanced_tick marks and several words that | _____^ -LL | | -LL | | /// should be `encompassed_by` tick marks because they `contain_underscores`. -LL | | /// Because of the initial `unbalanced_tick` pair, the error message is +... | LL | | /// very `confusing_and_misleading`. | |____________________________________^ | diff --git a/src/tools/clippy/tests/ui/empty_line_after/doc_comments.stderr b/src/tools/clippy/tests/ui/empty_line_after/doc_comments.stderr index 2852e26680f..475a817eff9 100644 --- a/src/tools/clippy/tests/ui/empty_line_after/doc_comments.stderr +++ b/src/tools/clippy/tests/ui/empty_line_after/doc_comments.stderr @@ -96,10 +96,7 @@ error: empty lines after doc comment --> tests/ui/empty_line_after/doc_comments.rs:63:5 | LL | / /// for OldA -LL | | // struct OldA; -LL | | -LL | | /// Docs -LL | | /// for OldB +... | LL | | // struct OldB; LL | | | |_^ diff --git a/src/tools/clippy/tests/ui/empty_line_after/outer_attribute.stderr b/src/tools/clippy/tests/ui/empty_line_after/outer_attribute.stderr index 75fc23e9e7e..a95306e2fa3 100644 --- a/src/tools/clippy/tests/ui/empty_line_after/outer_attribute.stderr +++ b/src/tools/clippy/tests/ui/empty_line_after/outer_attribute.stderr @@ -103,8 +103,7 @@ error: empty lines after outer attribute --> tests/ui/empty_line_after/outer_attribute.rs:64:1 | LL | / #[allow(unused)] -LL | | -LL | | // This comment is isolated +... | LL | | | |_^ LL | pub fn isolated_comment() {} diff --git a/src/tools/clippy/tests/ui/enum_variants.stderr b/src/tools/clippy/tests/ui/enum_variants.stderr index aaac3cbb82d..c118ac80a92 100644 --- a/src/tools/clippy/tests/ui/enum_variants.stderr +++ b/src/tools/clippy/tests/ui/enum_variants.stderr @@ -13,7 +13,6 @@ error: all variants have the same prefix: `c` LL | / enum Foo { LL | | LL | | cFoo, -LL | | ... | LL | | cBaz, LL | | } @@ -45,7 +44,6 @@ error: all variants have the same prefix: `Food` LL | / enum Food { LL | | LL | | FoodGood, -LL | | ... | LL | | LL | | } diff --git a/src/tools/clippy/tests/ui/infinite_loops.stderr b/src/tools/clippy/tests/ui/infinite_loops.stderr index 3a3ed7d0fe8..5b5cd78108e 100644 --- a/src/tools/clippy/tests/ui/infinite_loops.stderr +++ b/src/tools/clippy/tests/ui/infinite_loops.stderr @@ -20,7 +20,6 @@ error: infinite loop detected LL | / loop { LL | | LL | | loop { -LL | | ... | LL | | do_something(); LL | | } @@ -37,8 +36,7 @@ error: infinite loop detected LL | / loop { LL | | LL | | loop { -LL | | -LL | | do_something(); +... | LL | | } LL | | } | |_________^ @@ -79,8 +77,7 @@ error: infinite loop detected LL | / loop { LL | | fn inner_fn() -> ! { LL | | std::process::exit(0); -LL | | } -LL | | do_something(); +... | LL | | } | |_____^ | diff --git a/src/tools/clippy/tests/ui/manual_find_fixable.stderr b/src/tools/clippy/tests/ui/manual_find_fixable.stderr index c3f48fb9f98..5ed8be1b3ee 100644 --- a/src/tools/clippy/tests/ui/manual_find_fixable.stderr +++ b/src/tools/clippy/tests/ui/manual_find_fixable.stderr @@ -4,8 +4,7 @@ error: manual implementation of `Iterator::find` LL | / for &v in ARRAY { LL | | if v == n { LL | | return Some(v); -LL | | } -LL | | } +... | LL | | None | |________^ help: replace with an iterator: `ARRAY.iter().find(|&&v| v == n).copied()` | @@ -18,8 +17,7 @@ error: manual implementation of `Iterator::find` LL | / for (a, _) in arr { LL | | if a % 2 == 0 { LL | | return Some(a); -LL | | } -LL | | } +... | LL | | None | |________^ help: replace with an iterator: `arr.into_iter().map(|(a, _)| a).find(|&a| a % 2 == 0)` @@ -29,8 +27,7 @@ error: manual implementation of `Iterator::find` LL | / for el in arr { LL | | if el.name.len() == 10 { LL | | return Some(el); -LL | | } -LL | | } +... | LL | | None | |________^ help: replace with an iterator: `arr.into_iter().find(|el| el.name.len() == 10)` | @@ -42,8 +39,7 @@ error: manual implementation of `Iterator::find` LL | / for Tuple(a, _) in arr { LL | | if a >= 3 { LL | | return Some(a); -LL | | } -LL | | } +... | LL | | None | |________^ help: replace with an iterator: `arr.into_iter().map(|Tuple(a, _)| a).find(|&a| a >= 3)` @@ -53,8 +49,7 @@ error: manual implementation of `Iterator::find` LL | / for el in arr { LL | | if el.should_keep() { LL | | return Some(el); -LL | | } -LL | | } +... | LL | | None | |________^ help: replace with an iterator: `arr.into_iter().find(|el| el.should_keep())` | @@ -66,8 +61,7 @@ error: manual implementation of `Iterator::find` LL | / for el in arr { LL | | if f(el) == 20 { LL | | return Some(el); -LL | | } -LL | | } +... | LL | | None | |________^ help: replace with an iterator: `arr.into_iter().find(|&el| f(el) == 20)` @@ -77,8 +71,7 @@ error: manual implementation of `Iterator::find` LL | / for &el in arr.values() { LL | | if f(el) { LL | | return Some(el); -LL | | } -LL | | } +... | LL | | None | |________^ help: replace with an iterator: `arr.values().find(|&&el| f(el)).copied()` @@ -88,8 +81,7 @@ error: manual implementation of `Iterator::find` LL | / for el in arr { LL | | if el.is_true { LL | | return Some(el); -LL | | } -LL | | } +... | LL | | None | |________^ help: replace with an iterator: `arr.into_iter().find(|el| el.is_true)` | @@ -101,8 +93,7 @@ error: manual implementation of `Iterator::find` LL | / for (_, &x) in v { LL | | if x > 10 { LL | | return Some(x); -LL | | } -LL | | } +... | LL | | None | |________^ help: replace with an iterator: `v.into_iter().map(|(_, &x)| x).find(|&x| x > 10)` @@ -112,8 +103,7 @@ error: manual implementation of `Iterator::find` LL | / for &(_, &x) in v { LL | | if x > 10 { LL | | return Some(x); -LL | | } -LL | | } +... | LL | | None | |________^ help: replace with an iterator: `v.iter().map(|&(_, &x)| x).find(|&x| x > 10)` @@ -123,8 +113,7 @@ error: manual implementation of `Iterator::find` LL | / for x in arr { LL | | if x >= 5 { LL | | return Some(x); -LL | | } -LL | | } +... | LL | | return None; | |________________^ help: replace with an iterator: `arr.into_iter().find(|&x| x >= 5)` @@ -134,8 +123,7 @@ error: manual implementation of `Iterator::find` LL | / for x in arr { LL | | if x < 1 { LL | | return Some(x); -LL | | } -LL | | } +... | LL | | None | |____________^ help: replace with an iterator: `arr.into_iter().find(|&x| x < 1)` diff --git a/src/tools/clippy/tests/ui/map_flatten_fixable.stderr b/src/tools/clippy/tests/ui/map_flatten_fixable.stderr index 128c95146aa..095bee52d6d 100644 --- a/src/tools/clippy/tests/ui/map_flatten_fixable.stderr +++ b/src/tools/clippy/tests/ui/map_flatten_fixable.stderr @@ -77,9 +77,6 @@ error: called `map(..).flatten()` on `Option` | LL | .map(|_| { | __________^ -LL | | // we need some newlines -LL | | // so that the span is big enough -LL | | // for a split output of the diagnostic ... | LL | | }) LL | | .flatten(); diff --git a/src/tools/clippy/tests/ui/match_bool.stderr b/src/tools/clippy/tests/ui/match_bool.stderr index 1303e082daf..fb24e67ecee 100644 --- a/src/tools/clippy/tests/ui/match_bool.stderr +++ b/src/tools/clippy/tests/ui/match_bool.stderr @@ -75,9 +75,6 @@ error: you seem to be trying to match on a boolean expression --> tests/ui/match_bool.rs:36:5 | LL | / match test && test { -LL | | -LL | | -LL | | ... | LL | | _ => (), LL | | }; diff --git a/src/tools/clippy/tests/ui/match_expr_like_matches_macro.stderr b/src/tools/clippy/tests/ui/match_expr_like_matches_macro.stderr index 201b977e558..ffe5772ece9 100644 --- a/src/tools/clippy/tests/ui/match_expr_like_matches_macro.stderr +++ b/src/tools/clippy/tests/ui/match_expr_like_matches_macro.stderr @@ -68,8 +68,7 @@ LL | let _ans = match x { | ____________________^ LL | | E::A(_) => { LL | | true -LL | | } -LL | | E::B(_) => true, +... | LL | | _ => false, LL | | }; | |_________^ help: try: `matches!(x, E::A(_) | E::B(_))` diff --git a/src/tools/clippy/tests/ui/missing_doc_crate_missing.stderr b/src/tools/clippy/tests/ui/missing_doc_crate_missing.stderr index a421fb986d3..d6a4342c503 100644 --- a/src/tools/clippy/tests/ui/missing_doc_crate_missing.stderr +++ b/src/tools/clippy/tests/ui/missing_doc_crate_missing.stderr @@ -2,9 +2,7 @@ error: missing documentation for the crate --> tests/ui/missing_doc_crate_missing.rs:1:1 | LL | / #![warn(clippy::missing_docs_in_private_items)] -LL | | -LL | | -LL | | +... | LL | | fn main() {} | |____________^ | diff --git a/src/tools/clippy/tests/ui/needless_doc_main.stderr b/src/tools/clippy/tests/ui/needless_doc_main.stderr index 7e362cf377c..cfb389801db 100644 --- a/src/tools/clippy/tests/ui/needless_doc_main.stderr +++ b/src/tools/clippy/tests/ui/needless_doc_main.stderr @@ -3,9 +3,7 @@ error: needless `fn main` in doctest | LL | /// fn main() { | _____^ -LL | | -LL | | -LL | | /// unimplemented!(); +... | LL | | /// } | |_____^ | @@ -17,8 +15,7 @@ error: needless `fn main` in doctest | LL | /// fn main() -> () { | _____^ -LL | | -LL | | /// unimplemented!(); +... | LL | | /// } | |_____^ @@ -27,8 +24,7 @@ error: needless `fn main` in doctest | LL | /// fn main() { | _____^ -LL | | -LL | | /// unimplemented!(); +... | LL | | /// } | |_____^ @@ -37,9 +33,7 @@ error: needless `fn main` in doctest | LL | /// // the fn is not always the first line | _____^ -LL | | -LL | | /// fn main() { -LL | | /// unimplemented!(); +... | LL | | /// } | |_____^ diff --git a/src/tools/clippy/tests/ui/needless_if.stderr b/src/tools/clippy/tests/ui/needless_if.stderr index 9beae596ee3..cbfeb979d2f 100644 --- a/src/tools/clippy/tests/ui/needless_if.stderr +++ b/src/tools/clippy/tests/ui/needless_if.stderr @@ -34,7 +34,6 @@ error: this `if` branch is empty LL | / if { LL | | if let true = true LL | | && true -LL | | { ... | LL | | } && true LL | | {} diff --git a/src/tools/clippy/tests/ui/never_loop.stderr b/src/tools/clippy/tests/ui/never_loop.stderr index 440a2b5aaba..bd9bdc4addb 100644 --- a/src/tools/clippy/tests/ui/never_loop.stderr +++ b/src/tools/clippy/tests/ui/never_loop.stderr @@ -2,9 +2,6 @@ error: this loop never actually loops --> tests/ui/never_loop.rs:12:5 | LL | / loop { -LL | | -LL | | -LL | | // clippy::never_loop ... | LL | | break; LL | | } diff --git a/src/tools/clippy/tests/ui/option_if_let_else.stderr b/src/tools/clippy/tests/ui/option_if_let_else.stderr index 37ef791edb0..32ff2276323 100644 --- a/src/tools/clippy/tests/ui/option_if_let_else.stderr +++ b/src/tools/clippy/tests/ui/option_if_let_else.stderr @@ -115,8 +115,7 @@ LL | let _ = if let Some(x) = arg { | _____________^ LL | | x LL | | } else { -LL | | // map_or_else must be suggested -LL | | side_effect() +... | LL | | }; | |_____^ help: try: `arg.map_or_else(side_effect, |x| x)` diff --git a/src/tools/clippy/tests/ui/question_mark.stderr b/src/tools/clippy/tests/ui/question_mark.stderr index 0a48c4e80cb..06a8bd0de34 100644 --- a/src/tools/clippy/tests/ui/question_mark.stderr +++ b/src/tools/clippy/tests/ui/question_mark.stderr @@ -183,8 +183,7 @@ error: this block may be rewritten with the `?` operator | LL | / if a.is_none() { LL | | return None; -LL | | // do lint here, the outer `try` is not relevant here -LL | | // https://github.com/rust-lang/rust-clippy/pull/11001#issuecomment-1610636867 +... | LL | | } | |_____________^ help: replace it with: `a?;` diff --git a/src/tools/clippy/tests/ui/significant_drop_tightening.stderr b/src/tools/clippy/tests/ui/significant_drop_tightening.stderr index 2d7da4f394d..7d7e3ac7d0a 100644 --- a/src/tools/clippy/tests/ui/significant_drop_tightening.stderr +++ b/src/tools/clippy/tests/ui/significant_drop_tightening.stderr @@ -5,8 +5,7 @@ LL | pub fn complex_return_triggers_the_lint() -> i32 { | __________________________________________________- LL | | fn foo() -> i32 { LL | | 1 -LL | | } -LL | | let mutex = Mutex::new(1); +... | LL | | let lock = mutex.lock().unwrap(); | | ^^^^ ... | diff --git a/src/tools/clippy/tests/ui/single_match.stderr b/src/tools/clippy/tests/ui/single_match.stderr index 9240b09c50a..dd03737279a 100644 --- a/src/tools/clippy/tests/ui/single_match.stderr +++ b/src/tools/clippy/tests/ui/single_match.stderr @@ -22,10 +22,7 @@ error: you seem to be trying to use `match` for destructuring a single pattern. --> tests/ui/single_match.rs:23:5 | LL | / match x { -LL | | // Note the missing block braces. -LL | | // We suggest `if let Some(y) = x { .. }` because the macro -LL | | // is expanded before we can do anything. -LL | | Some(y) => println!("{:?}", y), +... | LL | | _ => (), LL | | } | |_____^ help: try: `if let Some(y) = x { println!("{:?}", y) }` diff --git a/src/tools/clippy/tests/ui/suspicious_doc_comments_unfixable.stderr b/src/tools/clippy/tests/ui/suspicious_doc_comments_unfixable.stderr index d15f16f7c50..2209a63d2c0 100644 --- a/src/tools/clippy/tests/ui/suspicious_doc_comments_unfixable.stderr +++ b/src/tools/clippy/tests/ui/suspicious_doc_comments_unfixable.stderr @@ -2,10 +2,7 @@ error: this is an outer doc comment and does not apply to the parent module or c --> tests/ui/suspicious_doc_comments_unfixable.rs:4:1 | LL | / ///! a -LL | | -LL | | -LL | | ///! b -LL | | /// c +... | LL | | ///! d | |______^ | @@ -25,9 +22,7 @@ error: this is an outer doc comment and does not apply to the parent module or c --> tests/ui/suspicious_doc_comments_unfixable.rs:12:1 | LL | / ///! a -LL | | -LL | | ///! b -LL | | /// c +... | LL | | ///! d | |______^ | diff --git a/src/tools/clippy/tests/ui/temporary_assignment.stderr b/src/tools/clippy/tests/ui/temporary_assignment.stderr index 8c284594075..7e6529cb213 100644 --- a/src/tools/clippy/tests/ui/temporary_assignment.stderr +++ b/src/tools/clippy/tests/ui/temporary_assignment.stderr @@ -13,8 +13,7 @@ error: assignment to temporary LL | / MultiStruct { LL | | LL | | structure: Struct { field: 0 }, -LL | | } -LL | | .structure +... | LL | | .field = 1; | |______________^ diff --git a/src/tools/clippy/tests/ui/too_long_first_doc_paragraph-fix.stderr b/src/tools/clippy/tests/ui/too_long_first_doc_paragraph-fix.stderr index 6ef333f0cfd..5925d2f902a 100644 --- a/src/tools/clippy/tests/ui/too_long_first_doc_paragraph-fix.stderr +++ b/src/tools/clippy/tests/ui/too_long_first_doc_paragraph-fix.stderr @@ -2,9 +2,7 @@ error: first doc comment paragraph is too long --> tests/ui/too_long_first_doc_paragraph-fix.rs:3:1 | LL | / /// A very short summary. -LL | | /// A much longer explanation that goes into a lot more detail about -LL | | /// how the thing works, possibly with doclinks and so one, -LL | | /// and probably spanning a many rows. Blablabla, it needs to be over +... | LL | | /// 200 characters so I needed to write something longeeeeeeer. | |_^ | diff --git a/src/tools/clippy/tests/ui/too_long_first_doc_paragraph.stderr b/src/tools/clippy/tests/ui/too_long_first_doc_paragraph.stderr index 95f42349b9b..c40ee2fcb48 100644 --- a/src/tools/clippy/tests/ui/too_long_first_doc_paragraph.stderr +++ b/src/tools/clippy/tests/ui/too_long_first_doc_paragraph.stderr @@ -2,9 +2,7 @@ error: first doc comment paragraph is too long --> tests/ui/too_long_first_doc_paragraph.rs:8:5 | LL | / //! A very short summary. -LL | | //! A much longer explanation that goes into a lot more detail about -LL | | //! how the thing works, possibly with doclinks and so one, -LL | | //! and probably spanning a many rows. Blablabla, it needs to be over +... | LL | | //! 200 characters so I needed to write something longeeeeeeer. | |____^ | @@ -29,8 +27,7 @@ error: first doc comment paragraph is too long --> tests/ui/too_long_first_doc_paragraph.rs:36:1 | LL | / /// Lorem -LL | | /// ipsum dolor sit amet, consectetur adipiscing elit. Nunc turpis nunc, lacinia -LL | | /// a dolor in, pellentesque aliquet enim. Cras nec maximus sem. Mauris arcu libero, +... | LL | | /// gravida non lacinia at, rhoncus eu lacus. | |_^ diff --git a/src/tools/clippy/tests/ui/unnecessary_lazy_eval.stderr b/src/tools/clippy/tests/ui/unnecessary_lazy_eval.stderr index bcdf65b217e..27c064b8b7f 100644 --- a/src/tools/clippy/tests/ui/unnecessary_lazy_eval.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_lazy_eval.stderr @@ -434,9 +434,6 @@ error: unnecessary closure used to substitute value for `Result::Err` | LL | let _: Result = res. | ___________________________________^ -LL | | // some lines -LL | | // some lines -LL | | // some lines ... | LL | | // some lines LL | | or_else(|_| Ok(ext_str.some_field)); diff --git a/src/tools/clippy/tests/ui/vec_init_then_push.stderr b/src/tools/clippy/tests/ui/vec_init_then_push.stderr index 58720c9a181..f35625c9b08 100644 --- a/src/tools/clippy/tests/ui/vec_init_then_push.stderr +++ b/src/tools/clippy/tests/ui/vec_init_then_push.stderr @@ -2,8 +2,7 @@ error: calls to `push` immediately after creation --> tests/ui/vec_init_then_push.rs:5:5 | LL | / let mut def_err: Vec = Default::default(); -LL | | -LL | | +... | LL | | def_err.push(0); | |____________________^ help: consider using the `vec![]` macro: `let def_err: Vec = vec![..];` | diff --git a/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr b/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr index fc47404734e..829be4805a5 100644 --- a/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr +++ b/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr @@ -2,9 +2,6 @@ error: unclosed quote string `"` --> $DIR/custom_code_classes_in_docs-warning3.rs:8:1 | LL | / /// ```{class="} -LL | | /// main; -LL | | /// ``` -LL | | ... | LL | | /// main; LL | | /// ``` @@ -21,9 +18,6 @@ error: unclosed quote string `"` --> $DIR/custom_code_classes_in_docs-warning3.rs:8:1 | LL | / /// ```{class="} -LL | | /// main; -LL | | /// ``` -LL | | ... | LL | | /// main; LL | | /// ``` diff --git a/tests/rustdoc-ui/doctest/check-attr-test.stderr b/tests/rustdoc-ui/doctest/check-attr-test.stderr index 257136d1633..2703885b184 100644 --- a/tests/rustdoc-ui/doctest/check-attr-test.stderr +++ b/tests/rustdoc-ui/doctest/check-attr-test.stderr @@ -2,9 +2,7 @@ error: unknown attribute `compile-fail` --> $DIR/check-attr-test.rs:5:1 | 5 | / /// foo -6 | | /// -7 | | /// ```compile-fail,compilefail,comPile_fail -8 | | /// boo +... | 9 | | /// ``` | |_______^ | @@ -20,9 +18,7 @@ error: unknown attribute `compilefail` --> $DIR/check-attr-test.rs:5:1 | 5 | / /// foo -6 | | /// -7 | | /// ```compile-fail,compilefail,comPile_fail -8 | | /// boo +... | 9 | | /// ``` | |_______^ | @@ -33,9 +29,7 @@ error: unknown attribute `comPile_fail` --> $DIR/check-attr-test.rs:5:1 | 5 | / /// foo -6 | | /// -7 | | /// ```compile-fail,compilefail,comPile_fail -8 | | /// boo +... | 9 | | /// ``` | |_______^ | @@ -46,9 +40,7 @@ error: unknown attribute `should-panic` --> $DIR/check-attr-test.rs:12:1 | 12 | / /// bar -13 | | /// -14 | | /// ```should-panic,shouldpanic,shOuld_panic -15 | | /// boo +... | 16 | | /// ``` | |_______^ | @@ -59,9 +51,7 @@ error: unknown attribute `shouldpanic` --> $DIR/check-attr-test.rs:12:1 | 12 | / /// bar -13 | | /// -14 | | /// ```should-panic,shouldpanic,shOuld_panic -15 | | /// boo +... | 16 | | /// ``` | |_______^ | @@ -72,9 +62,7 @@ error: unknown attribute `shOuld_panic` --> $DIR/check-attr-test.rs:12:1 | 12 | / /// bar -13 | | /// -14 | | /// ```should-panic,shouldpanic,shOuld_panic -15 | | /// boo +... | 16 | | /// ``` | |_______^ | @@ -85,9 +73,7 @@ error: unknown attribute `no-run` --> $DIR/check-attr-test.rs:19:1 | 19 | / /// foobar -20 | | /// -21 | | /// ```no-run,norun,nO_run -22 | | /// boo +... | 23 | | /// ``` | |_______^ | @@ -98,9 +84,7 @@ error: unknown attribute `norun` --> $DIR/check-attr-test.rs:19:1 | 19 | / /// foobar -20 | | /// -21 | | /// ```no-run,norun,nO_run -22 | | /// boo +... | 23 | | /// ``` | |_______^ | @@ -111,9 +95,7 @@ error: unknown attribute `nO_run` --> $DIR/check-attr-test.rs:19:1 | 19 | / /// foobar -20 | | /// -21 | | /// ```no-run,norun,nO_run -22 | | /// boo +... | 23 | | /// ``` | |_______^ | @@ -124,9 +106,7 @@ error: unknown attribute `test-harness` --> $DIR/check-attr-test.rs:26:1 | 26 | / /// b -27 | | /// -28 | | /// ```test-harness,testharness,tesT_harness -29 | | /// boo +... | 30 | | /// ``` | |_______^ | @@ -137,9 +117,7 @@ error: unknown attribute `testharness` --> $DIR/check-attr-test.rs:26:1 | 26 | / /// b -27 | | /// -28 | | /// ```test-harness,testharness,tesT_harness -29 | | /// boo +... | 30 | | /// ``` | |_______^ | @@ -150,9 +128,7 @@ error: unknown attribute `tesT_harness` --> $DIR/check-attr-test.rs:26:1 | 26 | / /// b -27 | | /// -28 | | /// ```test-harness,testharness,tesT_harness -29 | | /// boo +... | 30 | | /// ``` | |_______^ | diff --git a/tests/rustdoc-ui/doctest/private-item-doc-test.stderr b/tests/rustdoc-ui/doctest/private-item-doc-test.stderr index 5177057c728..7ce1f031499 100644 --- a/tests/rustdoc-ui/doctest/private-item-doc-test.stderr +++ b/tests/rustdoc-ui/doctest/private-item-doc-test.stderr @@ -2,9 +2,7 @@ error: documentation test in private item --> $DIR/private-item-doc-test.rs:4:5 | LL | / /// private doc test -LL | | /// -LL | | /// ``` -LL | | /// assert!(false); +... | LL | | /// ``` | |___________^ | diff --git a/tests/rustdoc-ui/doctest/private-public-item-doc-test.stderr b/tests/rustdoc-ui/doctest/private-public-item-doc-test.stderr index 38b8dd652d3..aa01f39314c 100644 --- a/tests/rustdoc-ui/doctest/private-public-item-doc-test.stderr +++ b/tests/rustdoc-ui/doctest/private-public-item-doc-test.stderr @@ -2,9 +2,7 @@ error: documentation test in private item --> $DIR/private-public-item-doc-test.rs:4:5 | LL | / /// private doc test -LL | | /// -LL | | /// ``` -LL | | /// assert!(false); +... | LL | | /// ``` | |___________^ | diff --git a/tests/rustdoc-ui/doctest/standalone-warning-2024.stderr b/tests/rustdoc-ui/doctest/standalone-warning-2024.stderr index bfc1e919404..02b6c6ee43c 100644 --- a/tests/rustdoc-ui/doctest/standalone-warning-2024.stderr +++ b/tests/rustdoc-ui/doctest/standalone-warning-2024.stderr @@ -2,10 +2,7 @@ error: unknown attribute `standalone` --> $DIR/standalone-warning-2024.rs:11:1 | 11 | / //! ```standalone -12 | | //! bla -13 | | //! ``` -14 | | //! -15 | | //! ```standalone-crate +... | 16 | | //! bla 17 | | //! ``` | |_______^ @@ -23,10 +20,7 @@ error: unknown attribute `standalone-crate` --> $DIR/standalone-warning-2024.rs:11:1 | 11 | / //! ```standalone -12 | | //! bla -13 | | //! ``` -14 | | //! -15 | | //! ```standalone-crate +... | 16 | | //! bla 17 | | //! ``` | |_______^ diff --git a/tests/rustdoc-ui/invalid-syntax.stderr b/tests/rustdoc-ui/invalid-syntax.stderr index c6e1f6fd413..f30660017d9 100644 --- a/tests/rustdoc-ui/invalid-syntax.stderr +++ b/tests/rustdoc-ui/invalid-syntax.stderr @@ -21,9 +21,7 @@ warning: could not parse code block as Rust code | LL | /// ``` | _____^ -LL | | /// | -LL | | /// LL | use foobar::Baz; -LL | | /// | ^^^^^^ did you mean `baz::foobar`? +... | LL | | /// ``` | |_______^ | @@ -114,8 +112,7 @@ warning: Rust code block is empty | LL | /// ``` | _____^ -LL | | /// -LL | | /// +... | LL | | /// ``` | |_______^ | diff --git a/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr index 06a1cf6b118..5a718f46d95 100644 --- a/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr +++ b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr @@ -308,13 +308,8 @@ LL | pub trait SVec: Index< | | | | | this trait cannot be made into an object... LL | | ::Item, -LL | | -LL | | ... | LL | |/ Output = ::Item, -LL | || -LL | || -LL | || ... || LL | || LL | || Output = ::Item> as SVec>::Item, diff --git a/tests/rustdoc-ui/lints/check-attr.stderr b/tests/rustdoc-ui/lints/check-attr.stderr index e23806e0bab..c45e94d9566 100644 --- a/tests/rustdoc-ui/lints/check-attr.stderr +++ b/tests/rustdoc-ui/lints/check-attr.stderr @@ -2,9 +2,6 @@ error: unknown attribute `compile-fail` --> $DIR/check-attr.rs:3:1 | LL | / /// foo -LL | | -LL | | -LL | | ... | LL | | /// boo LL | | /// ``` @@ -22,9 +19,6 @@ error: unknown attribute `compilefail` --> $DIR/check-attr.rs:3:1 | LL | / /// foo -LL | | -LL | | -LL | | ... | LL | | /// boo LL | | /// ``` @@ -37,9 +31,6 @@ error: unknown attribute `comPile_fail` --> $DIR/check-attr.rs:3:1 | LL | / /// foo -LL | | -LL | | -LL | | ... | LL | | /// boo LL | | /// ``` @@ -52,9 +43,6 @@ error: unknown attribute `should-panic` --> $DIR/check-attr.rs:13:1 | LL | / /// bar -LL | | -LL | | -LL | | ... | LL | | /// boo LL | | /// ``` @@ -67,9 +55,6 @@ error: unknown attribute `shouldpanic` --> $DIR/check-attr.rs:13:1 | LL | / /// bar -LL | | -LL | | -LL | | ... | LL | | /// boo LL | | /// ``` @@ -82,9 +67,6 @@ error: unknown attribute `sHould_panic` --> $DIR/check-attr.rs:13:1 | LL | / /// bar -LL | | -LL | | -LL | | ... | LL | | /// boo LL | | /// ``` @@ -97,9 +79,6 @@ error: unknown attribute `no-run` --> $DIR/check-attr.rs:23:1 | LL | / /// foobar -LL | | -LL | | -LL | | ... | LL | | /// boo LL | | /// ``` @@ -112,9 +91,6 @@ error: unknown attribute `norun` --> $DIR/check-attr.rs:23:1 | LL | / /// foobar -LL | | -LL | | -LL | | ... | LL | | /// boo LL | | /// ``` @@ -127,9 +103,6 @@ error: unknown attribute `no_Run` --> $DIR/check-attr.rs:23:1 | LL | / /// foobar -LL | | -LL | | -LL | | ... | LL | | /// boo LL | | /// ``` @@ -142,9 +115,6 @@ error: unknown attribute `test-harness` --> $DIR/check-attr.rs:33:1 | LL | / /// b -LL | | -LL | | -LL | | ... | LL | | /// boo LL | | /// ``` @@ -157,9 +127,6 @@ error: unknown attribute `testharness` --> $DIR/check-attr.rs:33:1 | LL | / /// b -LL | | -LL | | -LL | | ... | LL | | /// boo LL | | /// ``` @@ -172,9 +139,6 @@ error: unknown attribute `teSt_harness` --> $DIR/check-attr.rs:33:1 | LL | / /// b -LL | | -LL | | -LL | | ... | LL | | /// boo LL | | /// ``` @@ -187,10 +151,7 @@ error: unknown attribute `rust2018` --> $DIR/check-attr.rs:43:1 | LL | / /// b -LL | | -LL | | /// -LL | | /// ```rust2018 -LL | | /// boo +... | LL | | /// ``` | |_______^ | @@ -200,10 +161,7 @@ error: unknown attribute `rust2018` --> $DIR/check-attr.rs:51:1 | LL | / /// b -LL | | -LL | | -LL | | /// -LL | | /// ```rust2018 shouldpanic +... | LL | | /// boo LL | | /// ``` | |_______^ @@ -214,10 +172,7 @@ error: unknown attribute `shouldpanic` --> $DIR/check-attr.rs:51:1 | LL | / /// b -LL | | -LL | | -LL | | /// -LL | | /// ```rust2018 shouldpanic +... | LL | | /// boo LL | | /// ``` | |_______^ diff --git a/tests/rustdoc-ui/lints/check-fail.stderr b/tests/rustdoc-ui/lints/check-fail.stderr index 2eb9496e5dc..f021f0c42e5 100644 --- a/tests/rustdoc-ui/lints/check-fail.stderr +++ b/tests/rustdoc-ui/lints/check-fail.stderr @@ -26,8 +26,7 @@ error: unknown attribute `testharness` --> $DIR/check-fail.rs:8:1 | LL | / //! ```rust,testharness -LL | | -LL | | //! let x = 12; +... | LL | | //! ``` | |_______^ | @@ -44,10 +43,7 @@ error: unknown attribute `testharness` --> $DIR/check-fail.rs:17:1 | LL | / /// hello -LL | | -LL | | /// -LL | | /// ```rust,testharness -LL | | /// let x = 12; +... | LL | | /// ``` | |_______^ | diff --git a/tests/rustdoc-ui/lints/lint-group.stderr b/tests/rustdoc-ui/lints/lint-group.stderr index 7ff09fcc45a..4b5b64c4378 100644 --- a/tests/rustdoc-ui/lints/lint-group.stderr +++ b/tests/rustdoc-ui/lints/lint-group.stderr @@ -14,9 +14,7 @@ error: documentation test in private item --> $DIR/lint-group.rs:22:1 | LL | / /// wait, this *does* have a doctest? -LL | | /// -LL | | /// ``` -LL | | /// println!("sup"); +... | LL | | /// ``` | |_______^ | diff --git a/tests/rustdoc-ui/unescaped_backticks.stderr b/tests/rustdoc-ui/unescaped_backticks.stderr index 1e2b3528d4a..d93aaf5f3ca 100644 --- a/tests/rustdoc-ui/unescaped_backticks.stderr +++ b/tests/rustdoc-ui/unescaped_backticks.stderr @@ -271,9 +271,6 @@ error: unescaped backtick --> $DIR/unescaped_backticks.rs:323:5 | LL | / /// The Subscriber` may be accessed by calling [`WeakDispatch::upgrade`], -LL | | -LL | | -LL | | ... | LL | | /// [`rebuild_interest_cache`][rebuild] is called after the value of the max LL | | /// level changes. @@ -290,9 +287,6 @@ error: unescaped backtick --> $DIR/unescaped_backticks.rs:323:5 | LL | / /// The Subscriber` may be accessed by calling [`WeakDispatch::upgrade`], -LL | | -LL | | -LL | | ... | LL | | /// [`rebuild_interest_cache`][rebuild] is called after the value of the max LL | | /// level changes. @@ -307,9 +301,6 @@ error: unescaped backtick --> $DIR/unescaped_backticks.rs:323:5 | LL | / /// The Subscriber` may be accessed by calling [`WeakDispatch::upgrade`], -LL | | -LL | | -LL | | ... | LL | | /// [`rebuild_interest_cache`][rebuild] is called after the value of the max LL | | /// level changes. @@ -326,9 +317,6 @@ error: unescaped backtick --> $DIR/unescaped_backticks.rs:323:5 | LL | / /// The Subscriber` may be accessed by calling [`WeakDispatch::upgrade`], -LL | | -LL | | -LL | | ... | LL | | /// [`rebuild_interest_cache`][rebuild] is called after the value of the max LL | | /// level changes. diff --git a/tests/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr b/tests/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr index de92841d7f1..80ff10e13d8 100644 --- a/tests/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr +++ b/tests/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr @@ -7,8 +7,7 @@ LL | // fn oom( LL | || info: &Layout, LL | || ) -> () | ||_______- arguments to this function are incorrect -LL | | { -LL | | loop {} +... | LL | | } | |__^ expected `&Layout`, found `Layout` | @@ -30,8 +29,7 @@ LL | // fn oom( LL | || info: &Layout, LL | || ) -> () | ||_______^ expected `!`, found `()` -LL | | { -LL | | loop {} +... | LL | | } | |__- expected `!` because of return type | diff --git a/tests/ui/associated-types/associated-types-eq-2.stderr b/tests/ui/associated-types/associated-types-eq-2.stderr index e5013a35d45..ccd13123d70 100644 --- a/tests/ui/associated-types/associated-types-eq-2.stderr +++ b/tests/ui/associated-types/associated-types-eq-2.stderr @@ -3,8 +3,7 @@ error[E0658]: associated const equality is incomplete | LL | impl Tr3 for Bar { | |____^ | @@ -198,8 +197,7 @@ error[E0229]: associated item constraints are not allowed here | LL | impl Tr3 for Bar { | |____^ associated item constraint not allowed here | diff --git a/tests/ui/associated-types/issue-59324.stderr b/tests/ui/associated-types/issue-59324.stderr index ec2890cc8e7..51379d678f1 100644 --- a/tests/ui/associated-types/issue-59324.stderr +++ b/tests/ui/associated-types/issue-59324.stderr @@ -2,8 +2,7 @@ error[E0277]: the trait bound `Bug: Foo` is not satisfied --> $DIR/issue-59324.rs:11:1 | LL | / pub trait ThriftService: -LL | | -LL | | +... | LL | | Service::OnlyFoo> | |______________________________________________^ the trait `Foo` is not implemented for `Bug` | diff --git a/tests/ui/async-await/issue-84841.stderr b/tests/ui/async-await/issue-84841.stderr index 1e22373ba6e..69c1c882d60 100644 --- a/tests/ui/async-await/issue-84841.stderr +++ b/tests/ui/async-await/issue-84841.stderr @@ -14,8 +14,7 @@ LL | async fn foo() { LL | | // Adding an .await here avoids the ICE LL | | test()?; | | ^ cannot use the `?` operator in an async function that returns `()` -LL | | -LL | | +... | LL | | } | |_- this function should return `Result` or `Option` to accept `?` | diff --git a/tests/ui/async-await/issues/issue-72312.stderr b/tests/ui/async-await/issues/issue-72312.stderr index cd93f8a3c55..8e6fb138a1f 100644 --- a/tests/ui/async-await/issues/issue-72312.stderr +++ b/tests/ui/async-await/issues/issue-72312.stderr @@ -8,10 +8,7 @@ LL | pub async fn start(&self) { | let's call the lifetime of this reference `'1` ... LL | / require_static(async move { -LL | | -LL | | -LL | | -LL | | &self; +... | LL | | }); | | ^ | | | diff --git a/tests/ui/async-await/track-caller/async-closure-gate.afn.stderr b/tests/ui/async-await/track-caller/async-closure-gate.afn.stderr index 8344b7a07dc..6887a904211 100644 --- a/tests/ui/async-await/track-caller/async-closure-gate.afn.stderr +++ b/tests/ui/async-await/track-caller/async-closure-gate.afn.stderr @@ -66,8 +66,7 @@ LL | fn foo3() { LL | / async { LL | | LL | | let _ = #[track_caller] || { -LL | | -LL | | }; +... | LL | | } | |_____^ expected `()`, found `async` block | diff --git a/tests/ui/async-await/track-caller/async-closure-gate.nofeat.stderr b/tests/ui/async-await/track-caller/async-closure-gate.nofeat.stderr index 8344b7a07dc..6887a904211 100644 --- a/tests/ui/async-await/track-caller/async-closure-gate.nofeat.stderr +++ b/tests/ui/async-await/track-caller/async-closure-gate.nofeat.stderr @@ -66,8 +66,7 @@ LL | fn foo3() { LL | / async { LL | | LL | | let _ = #[track_caller] || { -LL | | -LL | | }; +... | LL | | } | |_____^ expected `()`, found `async` block | diff --git a/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr b/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr index a66281a188d..aa4e5fb2f69 100644 --- a/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr +++ b/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr @@ -40,8 +40,6 @@ LL | v.call(|(), this: &mut S| { | | | | _____| first borrow later used by call | | -LL | | -LL | | ... | LL | | v.set(); | | - first borrow occurs due to use of `v` in closure diff --git a/tests/ui/closures/2229_closure_analysis/issue-88476.stderr b/tests/ui/closures/2229_closure_analysis/issue-88476.stderr index 1c0e254dbf7..69b83f21a95 100644 --- a/tests/ui/closures/2229_closure_analysis/issue-88476.stderr +++ b/tests/ui/closures/2229_closure_analysis/issue-88476.stderr @@ -23,9 +23,6 @@ error: First Pass analysis includes: | LL | let x = #[rustc_capture_analysis] move || { | _______________________________________^ -LL | | -LL | | -LL | | ... | LL | | LL | | }; @@ -42,9 +39,6 @@ error: Min Capture analysis includes: | LL | let x = #[rustc_capture_analysis] move || { | _______________________________________^ -LL | | -LL | | -LL | | ... | LL | | LL | | }; @@ -61,9 +55,6 @@ error: First Pass analysis includes: | LL | let c = #[rustc_capture_analysis] move || { | _______________________________________^ -LL | | -LL | | -LL | | ... | LL | | LL | | }; @@ -80,9 +71,6 @@ error: Min Capture analysis includes: | LL | let c = #[rustc_capture_analysis] move || { | _______________________________________^ -LL | | -LL | | -LL | | ... | LL | | LL | | }; diff --git a/tests/ui/closures/2229_closure_analysis/wild_patterns.stderr b/tests/ui/closures/2229_closure_analysis/wild_patterns.stderr index 4d6d85649da..0b54b00ab30 100644 --- a/tests/ui/closures/2229_closure_analysis/wild_patterns.stderr +++ b/tests/ui/closures/2229_closure_analysis/wild_patterns.stderr @@ -32,9 +32,6 @@ error: First Pass analysis includes: --> $DIR/wild_patterns.rs:26:5 | LL | / || { -LL | | -LL | | -LL | | // FIXME(arora-aman): Change `_x` to `_` ... | LL | | LL | | }; @@ -50,9 +47,6 @@ error: Min Capture analysis includes: --> $DIR/wild_patterns.rs:26:5 | LL | / || { -LL | | -LL | | -LL | | // FIXME(arora-aman): Change `_x` to `_` ... | LL | | LL | | }; @@ -68,9 +62,6 @@ error: First Pass analysis includes: --> $DIR/wild_patterns.rs:45:5 | LL | / || { -LL | | -LL | | -LL | | // FIXME(arora-aman): Change `_x` to `_` ... | LL | | LL | | }; @@ -86,9 +77,6 @@ error: Min Capture analysis includes: --> $DIR/wild_patterns.rs:45:5 | LL | / || { -LL | | -LL | | -LL | | // FIXME(arora-aman): Change `_x` to `_` ... | LL | | LL | | }; @@ -104,9 +92,6 @@ error: First Pass analysis includes: --> $DIR/wild_patterns.rs:64:5 | LL | / || { -LL | | -LL | | -LL | | // FIXME(arora-aman): Change `_x` to `_` ... | LL | | LL | | }; @@ -122,9 +107,6 @@ error: Min Capture analysis includes: --> $DIR/wild_patterns.rs:64:5 | LL | / || { -LL | | -LL | | -LL | | // FIXME(arora-aman): Change `_x` to `_` ... | LL | | LL | | }; diff --git a/tests/ui/codemap_tests/huge_multispan_highlight.ascii.svg b/tests/ui/codemap_tests/huge_multispan_highlight.ascii.svg index 6f46df0101e..fe1eb753430 100644 --- a/tests/ui/codemap_tests/huge_multispan_highlight.ascii.svg +++ b/tests/ui/codemap_tests/huge_multispan_highlight.ascii.svg @@ -1,4 +1,4 @@ - +