diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index 539e33702aa67..3a33a9debaadb 100644 --- a/compiler/rustc_ast_lowering/src/expr.rs +++ b/compiler/rustc_ast_lowering/src/expr.rs @@ -1168,7 +1168,7 @@ impl<'hir> LoweringContext<'_, 'hir> { .span_suggestion( e.span, "consider removing the trailing pattern", - String::new(), + "", rustc_errors::Applicability::MachineApplicable, ) .emit(); diff --git a/compiler/rustc_ast_lowering/src/pat.rs b/compiler/rustc_ast_lowering/src/pat.rs index e27bc7a0f472f..95bf947854faf 100644 --- a/compiler/rustc_ast_lowering/src/pat.rs +++ b/compiler/rustc_ast_lowering/src/pat.rs @@ -139,7 +139,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { .span_suggestion_verbose( sp, &format!("if you don't need to use the contents of {}, discard the tuple's remaining fields", ident), - "..".to_string(), + "..", Applicability::MaybeIncorrect, ) .emit(); diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index 21db7d0eebcc0..503bdbad25828 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -488,7 +488,7 @@ impl<'a> AstValidator<'a> { .span_suggestion( replace_span, &format!("provide a definition for the {}", ctx), - sugg.to_string(), + sugg, Applicability::HasPlaceholders, ) .emit(); @@ -522,7 +522,7 @@ impl<'a> AstValidator<'a> { .span_suggestion( span, &format!("remove the {}", remove_descr), - String::new(), + "", Applicability::MaybeIncorrect, ) .span_label(self.current_extern_span(), "`extern` block begins here") @@ -570,7 +570,7 @@ impl<'a> AstValidator<'a> { .span_suggestion( body.span, "remove the invalid body", - ";".to_string(), + ";", Applicability::MaybeIncorrect, ) .help( @@ -599,7 +599,7 @@ impl<'a> AstValidator<'a> { .span_suggestion_verbose( span.until(ident.span.shrink_to_lo()), "remove the qualifiers", - "fn ".to_string(), + "fn ", Applicability::MaybeIncorrect, ) .emit(); @@ -703,7 +703,7 @@ impl<'a> AstValidator<'a> { .span_suggestion( generics.span, "remove the parameters", - String::new(), + "", Applicability::MachineApplicable, ) .emit(); @@ -721,7 +721,7 @@ impl<'a> AstValidator<'a> { .span_suggestion( span, "remove the super traits or lifetime bounds", - String::new(), + "", Applicability::MachineApplicable, ) .emit(); @@ -753,7 +753,7 @@ impl<'a> AstValidator<'a> { .span_suggestion( total_span, "remove these associated items", - String::new(), + "", Applicability::MachineApplicable, ) .span_label(ident_span, "auto trait cannot have associated items") @@ -993,7 +993,7 @@ fn validate_generic_param_order( err.span_suggestion( span, "reorder the parameters: lifetimes, then consts and types", - ordered_params.clone(), + &ordered_params, Applicability::MachineApplicable, ); err.emit(); diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 77dd4ccd64ef2..6db9c46dcef89 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -823,7 +823,7 @@ fn maybe_stage_features(sess: &Session, krate: &ast::Crate) { err.span_suggestion( attr.span, "remove the attribute", - String::new(), + "", Applicability::MachineApplicable, ); } diff --git a/compiler/rustc_attr/src/builtin.rs b/compiler/rustc_attr/src/builtin.rs index c8f1e1dbb0151..bdf86825f0d8f 100644 --- a/compiler/rustc_attr/src/builtin.rs +++ b/compiler/rustc_attr/src/builtin.rs @@ -59,7 +59,7 @@ fn handle_errors(sess: &ParseSess, span: Span, error: AttrError) { err.span_suggestion( span, "consider removing the prefix", - lint_str[1..].to_string(), + &lint_str[1..], Applicability::MaybeIncorrect, ); } @@ -942,7 +942,7 @@ pub fn parse_repr_attr(sess: &Session, attr: &Attribute) -> Vec { err.span_suggestion( item.span(), "supply an argument here", - "align(...)".to_string(), + "align(...)", Applicability::HasPlaceholders, ); err.emit(); diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index 191574d7a8fb9..73c0bf16a1f99 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -225,7 +225,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { .map(|n| format!("`{}`", n)) .unwrap_or_else(|| "the value".to_string()) ), - "ref ".to_string(), + "ref ", Applicability::MachineApplicable, ); in_pattern = true; @@ -276,7 +276,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { .map(|n| format!("`{}`", n)) .unwrap_or_else(|| "the mutable reference".to_string()), ), - "&mut *".to_string(), + "&mut *", Applicability::MachineApplicable, ); } @@ -1519,15 +1519,15 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { Ok(string) => { if string.starts_with("async ") { let pos = args_span.lo() + BytePos(6); - (args_span.with_lo(pos).with_hi(pos), "move ".to_string()) + (args_span.with_lo(pos).with_hi(pos), "move ") } else if string.starts_with("async|") { let pos = args_span.lo() + BytePos(5); - (args_span.with_lo(pos).with_hi(pos), " move".to_string()) + (args_span.with_lo(pos).with_hi(pos), " move") } else { - (args_span.shrink_to_lo(), "move ".to_string()) + (args_span.shrink_to_lo(), "move ") } } - Err(_) => (args_span, "move || ".to_string()), + Err(_) => (args_span, "move || "), }; let kind = match use_span.generator_kind() { Some(generator_kind) => match generator_kind { diff --git a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs index 5d9e5907dffb0..230ccf5199066 100644 --- a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs +++ b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs @@ -212,7 +212,7 @@ impl<'tcx> BorrowExplanation<'tcx> { "consider adding semicolon after the expression so its \ temporaries are dropped sooner, before the local variables \ declared by the block are dropped", - ";".to_string(), + ";", Applicability::MaybeIncorrect, ); } diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs index 9581bb652362f..97e49cb472f61 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mod.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs @@ -1023,7 +1023,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { avoid moving into the `for` loop", ty, ), - "&".to_string(), + "&", Applicability::MaybeIncorrect, ); } @@ -1049,7 +1049,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { .map(|n| format!("`{}`", n)) .unwrap_or_else(|| "the mutable reference".to_string()), ), - "&mut *".to_string(), + "&mut *", Applicability::MachineApplicable, ); } @@ -1067,7 +1067,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { err.span_suggestion_verbose( fn_call_span.shrink_to_lo(), "consider calling `.as_ref()` to borrow the type's contents", - "as_ref().".to_string(), + "as_ref().", Applicability::MachineApplicable, ); } diff --git a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs index e7fd89c140fc7..eb5e61fa064bd 100644 --- a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs @@ -417,7 +417,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { err.span_suggestion_verbose( span.shrink_to_hi(), &format!("consider borrowing the `{}`'s content", diag_name.unwrap()), - ".as_ref()".to_string(), + ".as_ref()", Applicability::MaybeIncorrect, ); } else if let Some(use_spans) = use_spans { diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs index fe5e3c5a81b61..861c5e973f1f1 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs @@ -295,7 +295,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { err.span_suggestion_verbose( source_info.span.with_hi(source_info.span.lo() + BytePos(5)), "try removing `&mut` here", - String::new(), + "", Applicability::MachineApplicable, ); } else { @@ -316,7 +316,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { err.span_suggestion_verbose( decl.source_info.span.shrink_to_lo(), "consider making the binding mutable", - "mut ".to_string(), + "mut ", Applicability::MachineApplicable, ); } @@ -402,7 +402,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { err.span_suggestion( span, "try removing `&mut` here", - String::new(), + "", Applicability::MaybeIncorrect, ); } diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs index 35f805ce76e1c..e0f8da1c872d3 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs @@ -860,7 +860,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { err.span_suggestion_verbose( span.shrink_to_hi(), "consider relaxing the implicit `'static` requirement", - " + '_".to_string(), + " + '_", Applicability::MaybeIncorrect, ); suggested = true; diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index bf38ca19484c9..8ef2974c37232 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -426,7 +426,7 @@ fn do_mir_borrowck<'a, 'tcx>( .span_suggestion_short( mut_span, "remove this `mut`", - String::new(), + "", Applicability::MachineApplicable, ) .emit(); diff --git a/compiler/rustc_builtin_macros/src/asm.rs b/compiler/rustc_builtin_macros/src/asm.rs index c95d7147176bd..42bddd1b6edde 100644 --- a/compiler/rustc_builtin_macros/src/asm.rs +++ b/compiler/rustc_builtin_macros/src/asm.rs @@ -363,7 +363,7 @@ fn err_duplicate_option<'a>(p: &mut Parser<'a>, symbol: Symbol, span: Span) { err.tool_only_span_suggestion( full_span, "remove this option", - String::new(), + "", Applicability::MachineApplicable, ); diff --git a/compiler/rustc_builtin_macros/src/assert.rs b/compiler/rustc_builtin_macros/src/assert.rs index 0c75187193c38..925c36edb5166 100644 --- a/compiler/rustc_builtin_macros/src/assert.rs +++ b/compiler/rustc_builtin_macros/src/assert.rs @@ -132,7 +132,7 @@ fn parse_assert<'a>(cx: &mut ExtCtxt<'a>, sp: Span, stream: TokenStream) -> PRes err.span_suggestion( parser.token.span, "try removing semicolon", - String::new(), + "", Applicability::MaybeIncorrect, ); err.emit(); @@ -153,7 +153,7 @@ fn parse_assert<'a>(cx: &mut ExtCtxt<'a>, sp: Span, stream: TokenStream) -> PRes err.span_suggestion_short( comma_span, "try adding a comma", - ", ".to_string(), + ", ", Applicability::MaybeIncorrect, ); err.emit(); diff --git a/compiler/rustc_builtin_macros/src/derive.rs b/compiler/rustc_builtin_macros/src/derive.rs index 7f25b23734b3e..d3de10ca4a2e9 100644 --- a/compiler/rustc_builtin_macros/src/derive.rs +++ b/compiler/rustc_builtin_macros/src/derive.rs @@ -142,7 +142,7 @@ fn report_path_args(sess: &Session, meta: &ast::MetaItem) { let report_error = |title, action| { let span = meta.span.with_lo(meta.path.span.hi()); sess.struct_span_err(span, title) - .span_suggestion(span, action, String::new(), Applicability::MachineApplicable) + .span_suggestion(span, action, "", Applicability::MachineApplicable) .emit(); }; match meta.kind { diff --git a/compiler/rustc_builtin_macros/src/format.rs b/compiler/rustc_builtin_macros/src/format.rs index 60b96399b5e7e..10348c4967c7c 100644 --- a/compiler/rustc_builtin_macros/src/format.rs +++ b/compiler/rustc_builtin_macros/src/format.rs @@ -330,7 +330,7 @@ impl<'a, 'b> Context<'a, 'b> { err.tool_only_span_suggestion( sp, &format!("use the `{}` trait", name), - (*fmt).to_string(), + *fmt, Applicability::MaybeIncorrect, ); } diff --git a/compiler/rustc_builtin_macros/src/test.rs b/compiler/rustc_builtin_macros/src/test.rs index 0c2d20b8f2dc8..e20375689f3d1 100644 --- a/compiler/rustc_builtin_macros/src/test.rs +++ b/compiler/rustc_builtin_macros/src/test.rs @@ -118,7 +118,7 @@ pub fn expand_test_or_bench( }; err.span_label(attr_sp, "the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions") .span_label(item.span, format!("expected a non-associated function, found {} {}", item.kind.article(), item.kind.descr())) - .span_suggestion(attr_sp, "replace with conditional compilation to make the item only exist when tests are being run", String::from("#[cfg(test)]"), Applicability::MaybeIncorrect) + .span_suggestion(attr_sp, "replace with conditional compilation to make the item only exist when tests are being run", "#[cfg(test)]", Applicability::MaybeIncorrect) .emit(); return vec![Annotatable::Item(item)]; diff --git a/compiler/rustc_const_eval/src/interpret/intrinsics.rs b/compiler/rustc_const_eval/src/interpret/intrinsics.rs index c5770f505262e..e51c51cf45e5e 100644 --- a/compiler/rustc_const_eval/src/interpret/intrinsics.rs +++ b/compiler/rustc_const_eval/src/interpret/intrinsics.rs @@ -313,78 +313,82 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { let a = self.read_pointer(&args[0])?; let b = self.read_pointer(&args[1])?; - // Special case: if both scalars are *equal integers* - // and not null, we pretend there is an allocation of size 0 right there, - // and their offset is 0. (There's never a valid object at null, making it an - // exception from the exception.) - // This is the dual to the special exception for offset-by-0 - // in the inbounds pointer offset operation (see `ptr_offset_inbounds` below). - match (self.ptr_try_get_alloc_id(a), self.ptr_try_get_alloc_id(b)) { - (Err(a), Err(b)) if a == b && a != 0 => { - // Both are the same non-null integer. - self.write_scalar(Scalar::from_machine_isize(0, self), dest)?; - } - (Err(offset), _) | (_, Err(offset)) => { - throw_ub!(DanglingIntPointer(offset, CheckInAllocMsg::OffsetFromTest)); - } - (Ok((a_alloc_id, a_offset, _)), Ok((b_alloc_id, b_offset, _))) => { - // Both are pointers. They must be into the same allocation. - if a_alloc_id != b_alloc_id { - throw_ub_format!( - "{} cannot compute offset of pointers into different allocations.", - intrinsic_name, - ); + let usize_layout = self.layout_of(self.tcx.types.usize)?; + let isize_layout = self.layout_of(self.tcx.types.isize)?; + + // Get offsets for both that are at least relative to the same base. + let (a_offset, b_offset) = + match (self.ptr_try_get_alloc_id(a), self.ptr_try_get_alloc_id(b)) { + (Err(a), Err(b)) => { + // Neither poiner points to an allocation. + // If these are inequal or null, this *will* fail the deref check below. + (a, b) } - // And they must both be valid for zero-sized accesses ("in-bounds or one past the end"). - self.check_ptr_access_align( - a, - Size::ZERO, - Align::ONE, - CheckInAllocMsg::OffsetFromTest, - )?; - self.check_ptr_access_align( - b, - Size::ZERO, - Align::ONE, - CheckInAllocMsg::OffsetFromTest, - )?; - - if intrinsic_name == sym::ptr_offset_from_unsigned && a_offset < b_offset { + (Err(_), _) | (_, Err(_)) => { + // We managed to find a valid allocation for one pointer, but not the other. + // That means they are definitely not pointing to the same allocation. throw_ub_format!( - "{} cannot compute a negative offset, but {} < {}", - intrinsic_name, - a_offset.bytes(), - b_offset.bytes(), + "{} called on pointers into different allocations", + intrinsic_name ); } - - // Compute offset. - let usize_layout = self.layout_of(self.tcx.types.usize)?; - let isize_layout = self.layout_of(self.tcx.types.isize)?; - let ret_layout = if intrinsic_name == sym::ptr_offset_from { - isize_layout - } else { - usize_layout - }; - - // The subtraction is always done in `isize` to enforce - // the "no more than `isize::MAX` apart" requirement. - let a_offset = ImmTy::from_uint(a_offset.bytes(), isize_layout); - let b_offset = ImmTy::from_uint(b_offset.bytes(), isize_layout); - let (val, overflowed, _ty) = - self.overflowing_binary_op(BinOp::Sub, &a_offset, &b_offset)?; - if overflowed { - throw_ub_format!("Pointers were too far apart for {}", intrinsic_name); + (Ok((a_alloc_id, a_offset, _)), Ok((b_alloc_id, b_offset, _))) => { + // Found allocation for both. They must be into the same allocation. + if a_alloc_id != b_alloc_id { + throw_ub_format!( + "{} called on pointers into different allocations", + intrinsic_name + ); + } + // Use these offsets for distance calculation. + (a_offset.bytes(), b_offset.bytes()) } - - let pointee_layout = self.layout_of(substs.type_at(0))?; - // This re-interprets an isize at ret_layout, but we already checked - // that if ret_layout is usize, then the result must be non-negative. - let val = ImmTy::from_scalar(val, ret_layout); - let size = ImmTy::from_int(pointee_layout.size.bytes(), ret_layout); - self.exact_div(&val, &size, dest)?; + }; + + // Compute distance. + let distance = { + // The subtraction is always done in `isize` to enforce + // the "no more than `isize::MAX` apart" requirement. + let a_offset = ImmTy::from_uint(a_offset, isize_layout); + let b_offset = ImmTy::from_uint(b_offset, isize_layout); + let (val, overflowed, _ty) = + self.overflowing_binary_op(BinOp::Sub, &a_offset, &b_offset)?; + if overflowed { + throw_ub_format!("pointers were too far apart for {}", intrinsic_name); } + val.to_machine_isize(self)? + }; + + // Check that the range between them is dereferenceable ("in-bounds or one past the + // end of the same allocation"). This is like the check in ptr_offset_inbounds. + let min_ptr = if distance >= 0 { b } else { a }; + self.check_ptr_access_align( + min_ptr, + Size::from_bytes(distance.unsigned_abs()), + Align::ONE, + CheckInAllocMsg::OffsetFromTest, + )?; + + if intrinsic_name == sym::ptr_offset_from_unsigned && distance < 0 { + throw_ub_format!( + "{} called when first pointer has smaller offset than second: {} < {}", + intrinsic_name, + a_offset, + b_offset, + ); } + + // Perform division by size to compute return value. + let ret_layout = if intrinsic_name == sym::ptr_offset_from_unsigned { + usize_layout + } else { + isize_layout + }; + let pointee_layout = self.layout_of(substs.type_at(0))?; + // If ret_layout is unsigned, we checked that so is the distance, so we are good. + let val = ImmTy::from_int(distance, ret_layout); + let size = ImmTy::from_int(pointee_layout.size.bytes(), ret_layout); + self.exact_div(&val, &size, dest)?; } sym::transmute => { @@ -575,11 +579,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { // memory between these pointers must be accessible. Note that we do not require the // pointers to be properly aligned (unlike a read/write operation). let min_ptr = if offset_bytes >= 0 { ptr } else { offset_ptr }; - let size = offset_bytes.unsigned_abs(); // This call handles checking for integer/null pointers. self.check_ptr_access_align( min_ptr, - Size::from_bytes(size), + Size::from_bytes(offset_bytes.unsigned_abs()), Align::ONE, CheckInAllocMsg::PointerArithmeticTest, )?; diff --git a/compiler/rustc_const_eval/src/transform/check_consts/check.rs b/compiler/rustc_const_eval/src/transform/check_consts/check.rs index 4b98e19376dda..b8a14e37a0990 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs @@ -1035,7 +1035,7 @@ fn emit_unstable_in_stable_error(ccx: &ConstCx<'_, '_>, span: Span, gate: Symbol .span_suggestion( attr_span, "if it is not part of the public API, make this function unstably const", - concat!(r#"#[rustc_const_unstable(feature = "...", issue = "...")]"#, '\n').to_owned(), + concat!(r#"#[rustc_const_unstable(feature = "...", issue = "...")]"#, '\n'), Applicability::HasPlaceholders, ) .span_suggestion( diff --git a/compiler/rustc_error_messages/src/lib.rs b/compiler/rustc_error_messages/src/lib.rs index 02d076c95ca52..fd4b2daae9c13 100644 --- a/compiler/rustc_error_messages/src/lib.rs +++ b/compiler/rustc_error_messages/src/lib.rs @@ -1,6 +1,7 @@ #![feature(let_chains)] #![feature(once_cell)] #![feature(path_try_exists)] +#![feature(rustc_attrs)] #![feature(type_alias_impl_trait)] use fluent_bundle::FluentResource; @@ -241,6 +242,7 @@ type FluentId = Cow<'static, str>; /// message so messages of this type must be combined with a `DiagnosticMessage` (using /// `DiagnosticMessage::with_subdiagnostic_message`) before rendering. However, subdiagnostics from /// the `SessionSubdiagnostic` derive refer to Fluent identifiers directly. +#[rustc_diagnostic_item = "SubdiagnosticMessage"] pub enum SubdiagnosticMessage { /// Non-translatable diagnostic message. // FIXME(davidtwco): can a `Cow<'static, str>` be used here? @@ -281,6 +283,7 @@ impl> From for SubdiagnosticMessage { /// /// Intended to be removed once diagnostics are entirely translatable. #[derive(Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable)] +#[rustc_diagnostic_item = "DiagnosticMessage"] pub enum DiagnosticMessage { /// Non-translatable diagnostic message. // FIXME(davidtwco): can a `Cow<'static, str>` be used here? diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index eaceecc166778..00c0ff8bcaf9c 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -80,6 +80,7 @@ impl<'source> Into> for DiagnosticArgValue<'source> { /// Trait implemented by error types. This should not be implemented manually. Instead, use /// `#[derive(SessionSubdiagnostic)]` -- see [rustc_macros::SessionSubdiagnostic]. +#[rustc_diagnostic_item = "AddSubdiagnostic"] pub trait AddSubdiagnostic { /// Add a subdiagnostic to an existing diagnostic. fn add_to_diagnostic(self, diag: &mut Diagnostic); @@ -283,6 +284,7 @@ impl Diagnostic { /// /// This span is *not* considered a ["primary span"][`MultiSpan`]; only /// the `Span` supplied when creating the diagnostic is primary. + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn span_label(&mut self, span: Span, label: impl Into) -> &mut Self { self.span.push_span_label(span, self.subdiagnostic_message_to_diagnostic_message(label)); self @@ -401,6 +403,7 @@ impl Diagnostic { } /// Add a note attached to this diagnostic. + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn note(&mut self, msg: impl Into) -> &mut Self { self.sub(Level::Note, msg, MultiSpan::new(), None); self @@ -423,6 +426,7 @@ impl Diagnostic { /// Prints the span with a note above it. /// This is like [`Diagnostic::note()`], but it gets its own span. + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn span_note>( &mut self, sp: S, @@ -444,6 +448,7 @@ impl Diagnostic { } /// Add a warning attached to this diagnostic. + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn warn(&mut self, msg: impl Into) -> &mut Self { self.sub(Level::Warning, msg, MultiSpan::new(), None); self @@ -451,6 +456,7 @@ impl Diagnostic { /// Prints the span with a warning above it. /// This is like [`Diagnostic::warn()`], but it gets its own span. + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn span_warn>( &mut self, sp: S, @@ -461,6 +467,7 @@ impl Diagnostic { } /// Add a help message attached to this diagnostic. + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn help(&mut self, msg: impl Into) -> &mut Self { self.sub(Level::Help, msg, MultiSpan::new(), None); self @@ -474,6 +481,7 @@ impl Diagnostic { /// Prints the span with some help above it. /// This is like [`Diagnostic::help()`], but it gets its own span. + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn span_help>( &mut self, sp: S, diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index e9e7065ec03cc..ec48efa9bce2f 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -771,8 +771,12 @@ impl EmitterWriter { self } - fn maybe_anonymized(&self, line_num: usize) -> String { - if self.ui_testing { ANONYMIZED_LINE_NUM.to_string() } else { line_num.to_string() } + fn maybe_anonymized(&self, line_num: usize) -> Cow<'static, str> { + if self.ui_testing { + Cow::Borrowed(ANONYMIZED_LINE_NUM) + } else { + Cow::Owned(line_num.to_string()) + } } fn draw_line( @@ -819,7 +823,7 @@ impl EmitterWriter { } buffer.puts(line_offset, 0, &self.maybe_anonymized(line_index), Style::LineNumber); - draw_col_separator(buffer, line_offset, width_offset - 2); + draw_col_separator_no_space(buffer, line_offset, width_offset - 2); } fn render_source_line( @@ -1920,7 +1924,7 @@ impl EmitterWriter { // Only show an underline in the suggestions if the suggestion is not the // entirety of the code being shown and the displayed code is not multiline. if let DisplaySuggestion::Diff | DisplaySuggestion::Underline = show_code_change { - draw_col_separator(&mut buffer, row_num, max_line_num_len + 1); + draw_col_separator_no_space(&mut buffer, row_num, max_line_num_len + 1); for part in parts { let span_start_pos = sm.lookup_char_pos(part.span.lo()).col_display; let span_end_pos = sm.lookup_char_pos(part.span.hi()).col_display; diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 83fe2a2df892f..8b6eba122f8f0 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -9,6 +9,7 @@ #![feature(let_else)] #![feature(never_type)] #![feature(adt_const_params)] +#![feature(rustc_attrs)] #![allow(incomplete_features)] #![allow(rustc::potential_query_instability)] @@ -648,6 +649,7 @@ impl Handler { /// Attempting to `.emit()` the builder will only emit if either: /// * `can_emit_warnings` is `true` /// * `is_force_warn` was set in `DiagnosticId::Lint` + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn struct_span_warn( &self, span: impl Into, @@ -659,6 +661,7 @@ impl Handler { } /// Construct a builder at the `Allow` level at the given `span` and with the `msg`. + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn struct_span_allow( &self, span: impl Into, @@ -671,6 +674,7 @@ impl Handler { /// Construct a builder at the `Warning` level at the given `span` and with the `msg`. /// Also include a code. + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn struct_span_warn_with_code( &self, span: impl Into, @@ -687,16 +691,19 @@ impl Handler { /// Attempting to `.emit()` the builder will only emit if either: /// * `can_emit_warnings` is `true` /// * `is_force_warn` was set in `DiagnosticId::Lint` + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn struct_warn(&self, msg: impl Into) -> DiagnosticBuilder<'_, ()> { DiagnosticBuilder::new(self, Level::Warning, msg) } /// Construct a builder at the `Allow` level with the `msg`. + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn struct_allow(&self, msg: impl Into) -> DiagnosticBuilder<'_, ()> { DiagnosticBuilder::new(self, Level::Allow, msg) } /// Construct a builder at the `Expect` level with the `msg`. + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn struct_expect( &self, msg: impl Into, @@ -706,6 +713,7 @@ impl Handler { } /// Construct a builder at the `Error` level at the given `span` and with the `msg`. + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn struct_span_err( &self, span: impl Into, @@ -717,6 +725,7 @@ impl Handler { } /// Construct a builder at the `Error` level at the given `span`, with the `msg`, and `code`. + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn struct_span_err_with_code( &self, span: impl Into, @@ -730,6 +739,7 @@ impl Handler { /// Construct a builder at the `Error` level with the `msg`. // FIXME: This method should be removed (every error should have an associated error code). + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn struct_err( &self, msg: impl Into, @@ -744,6 +754,7 @@ impl Handler { } /// Construct a builder at the `Error` level with the `msg` and the `code`. + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn struct_err_with_code( &self, msg: impl Into, @@ -755,6 +766,7 @@ impl Handler { } /// Construct a builder at the `Warn` level with the `msg` and the `code`. + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn struct_warn_with_code( &self, msg: impl Into, @@ -766,6 +778,7 @@ impl Handler { } /// Construct a builder at the `Fatal` level at the given `span` and with the `msg`. + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn struct_span_fatal( &self, span: impl Into, @@ -777,6 +790,7 @@ impl Handler { } /// Construct a builder at the `Fatal` level at the given `span`, with the `msg`, and `code`. + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn struct_span_fatal_with_code( &self, span: impl Into, @@ -789,16 +803,19 @@ impl Handler { } /// Construct a builder at the `Error` level with the `msg`. + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn struct_fatal(&self, msg: impl Into) -> DiagnosticBuilder<'_, !> { DiagnosticBuilder::new_fatal(self, msg) } /// Construct a builder at the `Help` level with the `msg`. + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn struct_help(&self, msg: impl Into) -> DiagnosticBuilder<'_, ()> { DiagnosticBuilder::new(self, Level::Help, msg) } /// Construct a builder at the `Note` level with the `msg`. + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn struct_note_without_error( &self, msg: impl Into, @@ -806,11 +823,13 @@ impl Handler { DiagnosticBuilder::new(self, Level::Note, msg) } + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn span_fatal(&self, span: impl Into, msg: impl Into) -> ! { self.emit_diag_at_span(Diagnostic::new(Fatal, msg), span); FatalError.raise() } + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn span_fatal_with_code( &self, span: impl Into, @@ -821,6 +840,7 @@ impl Handler { FatalError.raise() } + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn span_err( &self, span: impl Into, @@ -829,6 +849,7 @@ impl Handler { self.emit_diag_at_span(Diagnostic::new(Error { lint: false }, msg), span).unwrap() } + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn span_err_with_code( &self, span: impl Into, @@ -841,10 +862,12 @@ impl Handler { ); } + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn span_warn(&self, span: impl Into, msg: impl Into) { self.emit_diag_at_span(Diagnostic::new(Warning, msg), span); } + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn span_warn_with_code( &self, span: impl Into, diff --git a/compiler/rustc_expand/src/base.rs b/compiler/rustc_expand/src/base.rs index bb671b8705eb3..75b6b1cc9195b 100644 --- a/compiler/rustc_expand/src/base.rs +++ b/compiler/rustc_expand/src/base.rs @@ -1194,7 +1194,7 @@ pub fn expr_to_spanned_string<'a>( err.span_suggestion( expr.span.shrink_to_lo(), "consider removing the leading `b`", - String::new(), + "", Applicability::MaybeIncorrect, ); Some((err, true)) diff --git a/compiler/rustc_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs index 5af6b777abee1..978f87b1d136e 100644 --- a/compiler/rustc_expand/src/expand.rs +++ b/compiler/rustc_expand/src/expand.rs @@ -945,7 +945,7 @@ pub fn ensure_complete_parse<'a>( err.span_suggestion( semi_span, "you might be missing a semicolon here", - ";".to_owned(), + ";", Applicability::MaybeIncorrect, ); } diff --git a/compiler/rustc_expand/src/mbe/macro_rules.rs b/compiler/rustc_expand/src/mbe/macro_rules.rs index a66d36aaf72ee..f40c365cbcc18 100644 --- a/compiler/rustc_expand/src/mbe/macro_rules.rs +++ b/compiler/rustc_expand/src/mbe/macro_rules.rs @@ -102,7 +102,7 @@ fn emit_frag_parse_err( e.span_suggestion_verbose( site_span.shrink_to_hi(), "add `;` to interpret the expansion as a statement", - ";".to_string(), + ";", Applicability::MaybeIncorrect, ); } @@ -357,7 +357,7 @@ fn expand_macro<'cx>( err.span_suggestion_short( comma_span, "missing comma here", - ", ".to_string(), + ", ", Applicability::MachineApplicable, ); } diff --git a/compiler/rustc_expand/src/mbe/metavar_expr.rs b/compiler/rustc_expand/src/mbe/metavar_expr.rs index ccc1c2b2ca05b..45c462bc42504 100644 --- a/compiler/rustc_expand/src/mbe/metavar_expr.rs +++ b/compiler/rustc_expand/src/mbe/metavar_expr.rs @@ -52,7 +52,7 @@ impl MetaVarExpr { err.span_suggestion( ident.span, "supported expressions are count, ignore, index and length", - String::new(), + "", Applicability::MachineApplicable, ); return Err(err); @@ -142,7 +142,7 @@ fn parse_ident<'sess>( err.span_suggestion( token.span, &format!("try removing `{}`", &token_str), - String::new(), + "", Applicability::MaybeIncorrect, ); return Err(err); diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index 35473b6e97abe..3dbaf0ddf6417 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -523,7 +523,7 @@ declare_features! ( (active, type_ascription, "1.6.0", Some(23416), None), /// Allows creation of instances of a struct by moving fields that have /// not changed from prior instances of the same struct (RFC #2528) - (incomplete, type_changing_struct_update, "1.58.0", Some(86555), None), + (active, type_changing_struct_update, "1.58.0", Some(86555), None), /// Allows unsized fn parameters. (active, unsized_fn_params, "1.49.0", Some(48055), None), /// Allows unsized rvalues at arguments and parameters. diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 5eb2be97f8b92..34c53597dde6b 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -615,6 +615,9 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // Used by the `rustc::potential_query_instability` lint to warn methods which // might not be stable during incremental compilation. rustc_attr!(rustc_lint_query_instability, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE), + // Used by the `rustc::untranslatable_diagnostic` and `rustc::diagnostic_outside_of_impl` lints + // to assist in changes to diagnostic APIs. + rustc_attr!(rustc_lint_diagnostics, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE), // ========================================================================== // Internal attributes, Const related: diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index 3eeea7fdb13e2..b94d205488d01 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -670,7 +670,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { err.span_suggestion( source_map.end_point(cause.span), "try removing this `?`", - "".to_string(), + "", Applicability::MachineApplicable, ); } @@ -726,14 +726,14 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { err.span_suggestion_short( sp, "consider removing this semicolon and boxing the expressions", - String::new(), + "", Applicability::MachineApplicable, ); } else { err.span_suggestion_short( sp, "consider removing this semicolon", - String::new(), + "", Applicability::MachineApplicable, ); } @@ -776,7 +776,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { err.span_suggestion_short( sp, "consider removing this semicolon", - String::new(), + "", Applicability::MachineApplicable, ); } @@ -1935,7 +1935,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { diag.span_suggestion_verbose( exp_span.shrink_to_hi(), "consider `await`ing on the `Future`", - ".await".to_string(), + ".await", Applicability::MaybeIncorrect, ); } @@ -1945,7 +1945,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { diag.span_suggestion_verbose( span.shrink_to_hi(), "consider `await`ing on the `Future`", - ".await".to_string(), + ".await", Applicability::MaybeIncorrect, ); } diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/mismatched_static_lifetime.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/mismatched_static_lifetime.rs index 80500f3fe65ba..43d5c9fdf33a6 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/mismatched_static_lifetime.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/mismatched_static_lifetime.rs @@ -85,7 +85,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { err.span_suggestion_verbose( span.shrink_to_hi(), "consider relaxing the implicit `'static` requirement", - " + '_".to_string(), + " + '_", Applicability::MaybeIncorrect, ); } diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/named_anon_conflict.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/named_anon_conflict.rs index 375ad8d3736dc..76cb76d9ff4e5 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/named_anon_conflict.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/named_anon_conflict.rs @@ -107,7 +107,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { diag.span_suggestion( new_ty_span, &format!("add explicit lifetime `{}` to {}", named, span_label_var), - new_ty.to_string(), + new_ty, Applicability::Unspecified, ); diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs index b856198cf3f7b..6935ce9710b6e 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs @@ -328,7 +328,7 @@ pub fn suggest_new_region_bound( err.span_suggestion_verbose( span, &format!("{} `impl Trait`'s {}", consider, explicit_static), - lifetime_name.clone(), + &lifetime_name, Applicability::MaybeIncorrect, ); } @@ -363,7 +363,7 @@ pub fn suggest_new_region_bound( captures = captures, explicit = explicit, ), - plus_lt.clone(), + &plus_lt, Applicability::MaybeIncorrect, ); } @@ -378,7 +378,7 @@ pub fn suggest_new_region_bound( captures = captures, explicit = explicit, ), - plus_lt.clone(), + &plus_lt, Applicability::MaybeIncorrect, ); } @@ -391,7 +391,7 @@ pub fn suggest_new_region_bound( err.span_suggestion_verbose( lt.span, &format!("{} trait object's {}", consider, explicit_static), - lifetime_name.clone(), + &lifetime_name, Applicability::MaybeIncorrect, ); } @@ -535,7 +535,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { err.span_suggestion_verbose( span.shrink_to_hi(), "consider relaxing the implicit `'static` requirement", - " + '_".to_string(), + " + '_", Applicability::MaybeIncorrect, ); suggested = true; diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index 3c867e308c40e..389e6483f30ff 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -449,7 +449,7 @@ pub fn configure_and_expand( .span_suggestion( first_span, "try using their name instead", - "ferris".to_string(), + "ferris", Applicability::MaybeIncorrect, ) .emit(); diff --git a/compiler/rustc_lint/src/array_into_iter.rs b/compiler/rustc_lint/src/array_into_iter.rs index dff2e31c6070c..b33ab40eb39cb 100644 --- a/compiler/rustc_lint/src/array_into_iter.rs +++ b/compiler/rustc_lint/src/array_into_iter.rs @@ -136,7 +136,7 @@ impl<'tcx> LateLintPass<'tcx> for ArrayIntoIter { diag.span_suggestion( receiver_arg.span.shrink_to_hi().to(expr.span.shrink_to_hi()), "or remove `.into_iter()` to iterate by value", - String::new(), + "", Applicability::MaybeIncorrect, ); } else if receiver_ty.is_array() { diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 205ca72aae8a8..5ef4463cb6425 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -993,7 +993,7 @@ fn lint_deprecated_attr( .span_suggestion_short( attr.span, suggestion.unwrap_or("remove this attribute"), - String::new(), + "", Applicability::MachineApplicable, ) .emit(); @@ -1182,7 +1182,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidNoMangleItems { .span_suggestion_short( no_mangle_attr.span, "remove this attribute", - String::new(), + "", // Use of `#[no_mangle]` suggests FFI intent; correct // fix may be to monomorphize source by hand Applicability::MaybeIncorrect, @@ -1221,7 +1221,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidNoMangleItems { err.span_suggestion( const_span, "try a static value", - "pub static".to_owned(), + "pub static", Applicability::MachineApplicable, ); err.emit(); @@ -1405,7 +1405,7 @@ impl UnreachablePub { err.span_suggestion( vis_span, "consider restricting its visibility", - "pub(crate)".to_owned(), + "pub(crate)", applicability, ); if exportable { @@ -1566,7 +1566,7 @@ impl<'tcx> LateLintPass<'tcx> for TypeAliasBounds { err.span_suggestion( type_alias_generics.where_clause_span, "the clause will not be checked when the type alias is used, and should be removed", - String::new(), + "", Applicability::MachineApplicable, ); if !suggested_changing_assoc_types { @@ -1830,7 +1830,7 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns { }); } } else { - let replace = "..=".to_owned(); + let replace = "..="; if join.edition() >= Edition::Edition2021 { let mut err = rustc_errors::struct_span_err!(cx.sess(), pat.span, E0783, "{}", msg,); diff --git a/compiler/rustc_lint/src/context.rs b/compiler/rustc_lint/src/context.rs index 2c6bdef361aab..2084494f7719e 100644 --- a/compiler/rustc_lint/src/context.rs +++ b/compiler/rustc_lint/src/context.rs @@ -718,7 +718,7 @@ pub trait LintContext: Sized { the macro must produce the documentation as part of its expansion"); } BuiltinLintDiagnostics::PatternsInFnsWithoutBody(span, ident) => { - db.span_suggestion(span, "remove `mut` from the parameter", ident.to_string(), Applicability::MachineApplicable); + db.span_suggestion(span, "remove `mut` from the parameter", ident, Applicability::MachineApplicable); } BuiltinLintDiagnostics::MissingAbi(span, default_abi) => { db.span_label(span, "ABI should be specified here"); @@ -778,7 +778,7 @@ pub trait LintContext: Sized { // Suggest the most probable if we found one if let Some(best_match) = find_best_match_for_name(&possibilities, name, None) { - db.span_suggestion(name_span, "did you mean", format!("{best_match}"), Applicability::MaybeIncorrect); + db.span_suggestion(name_span, "did you mean", best_match, Applicability::MaybeIncorrect); } }, BuiltinLintDiagnostics::UnexpectedCfg((name, name_span), Some((value, value_span))) => { @@ -805,7 +805,7 @@ pub trait LintContext: Sized { } else { db.note(&format!("no expected value for `{name}`")); if name != sym::feature { - db.span_suggestion(name_span.shrink_to_hi().to(value_span), "remove the value", String::new(), Applicability::MaybeIncorrect); + db.span_suggestion(name_span.shrink_to_hi().to(value_span), "remove the value", "", Applicability::MaybeIncorrect); } } }, @@ -852,7 +852,7 @@ pub trait LintContext: Sized { db.span_suggestion( deletion_span, "elide the unused lifetime", - String::new(), + "", Applicability::MachineApplicable, ); }, diff --git a/compiler/rustc_lint/src/internal.rs b/compiler/rustc_lint/src/internal.rs index b83d63e0da086..fadb1c8793398 100644 --- a/compiler/rustc_lint/src/internal.rs +++ b/compiler/rustc_lint/src/internal.rs @@ -5,12 +5,14 @@ use crate::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext} use rustc_ast as ast; use rustc_errors::Applicability; use rustc_hir::def::Res; -use rustc_hir::{Expr, ExprKind, GenericArg, PatKind, Path, PathSegment, QPath}; -use rustc_hir::{HirId, Item, ItemKind, Node, Pat, Ty, TyKind}; +use rustc_hir::{def_id::DefId, Expr, ExprKind, GenericArg, PatKind, Path, PathSegment, QPath}; +use rustc_hir::{HirId, Impl, Item, ItemKind, Node, Pat, Ty, TyKind}; use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::hygiene::{ExpnKind, MacroKind}; use rustc_span::symbol::{kw, sym, Symbol}; +use rustc_span::Span; +use tracing::debug; declare_tool_lint! { pub rustc::DEFAULT_HASH_TYPES, @@ -46,6 +48,41 @@ impl LateLintPass<'_> for DefaultHashTypes { } } +/// Helper function for lints that check for expressions with calls and use typeck results to +/// get the `DefId` and `SubstsRef` of the function. +fn typeck_results_of_method_fn<'tcx>( + cx: &LateContext<'tcx>, + expr: &Expr<'_>, +) -> Option<(Span, DefId, ty::subst::SubstsRef<'tcx>)> { + // FIXME(rustdoc): Lints which use this function use typecheck results which can cause + // `rustdoc` to error if there are resolution failures. + // + // As internal lints are currently always run if there are `unstable_options`, they are added + // to the lint store of rustdoc. Internal lints are also not used via the `lint_mod` query. + // Crate lints run outside of a query so rustdoc currently doesn't disable them. + // + // Instead of relying on this, either change crate lints to a query disabled by rustdoc, only + // run internal lints if the user is explicitly opting in or figure out a different way to + // avoid running lints for rustdoc. + if cx.tcx.sess.opts.actually_rustdoc { + return None; + } + + match expr.kind { + ExprKind::MethodCall(segment, _, _) + if let Some(def_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id) => + { + Some((segment.ident.span, def_id, cx.typeck_results().node_substs(expr.hir_id))) + }, + _ => { + match cx.typeck_results().node_type(expr.hir_id).kind() { + &ty::FnDef(def_id, substs) => Some((expr.span, def_id, substs)), + _ => None, + } + } + } +} + declare_tool_lint! { pub rustc::POTENTIAL_QUERY_INSTABILITY, Allow, @@ -57,35 +94,7 @@ declare_lint_pass!(QueryStability => [POTENTIAL_QUERY_INSTABILITY]); impl LateLintPass<'_> for QueryStability { fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { - // FIXME(rustdoc): This lint uses typecheck results, causing rustdoc to - // error if there are resolution failures. - // - // As internal lints are currently always run if there are `unstable_options`, - // they are added to the lint store of rustdoc. Internal lints are also - // not used via the `lint_mod` query. Crate lints run outside of a query - // so rustdoc currently doesn't disable them. - // - // Instead of relying on this, either change crate lints to a query disabled by - // rustdoc, only run internal lints if the user is explicitly opting in - // or figure out a different way to avoid running lints for rustdoc. - if cx.tcx.sess.opts.actually_rustdoc { - return; - } - - let (span, def_id, substs) = match expr.kind { - ExprKind::MethodCall(segment, _, _) - if let Some(def_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id) => - { - (segment.ident.span, def_id, cx.typeck_results().node_substs(expr.hir_id)) - }, - _ => { - let &ty::FnDef(def_id, substs) = - cx.typeck_results() - .node_type(expr.hir_id) - .kind() else { return }; - (expr.span, def_id, substs) - } - }; + let Some((span, def_id, substs)) = typeck_results_of_method_fn(cx, expr) else { return }; if let Ok(Some(instance)) = ty::Instance::resolve(cx.tcx, cx.param_env, def_id, substs) { let def_id = instance.def_id(); if cx.tcx.has_attr(def_id, sym::rustc_lint_query_instability) { @@ -141,7 +150,7 @@ impl<'tcx> LateLintPass<'tcx> for TyTyKind { .span_suggestion( span, "try using `ty::` directly", - "ty".to_string(), + "ty", Applicability::MaybeIncorrect, // ty maybe needs an import ) .emit(); @@ -170,7 +179,7 @@ impl<'tcx> LateLintPass<'tcx> for TyTyKind { .span_suggestion( path.span, "try using `ty::` directly", - "ty".to_string(), + "ty", Applicability::MaybeIncorrect, // ty maybe needs an import ) .emit(); @@ -188,7 +197,7 @@ impl<'tcx> LateLintPass<'tcx> for TyTyKind { .span_suggestion( path.span, "try using `ty::` directly", - "ty".to_string(), + "ty", Applicability::MaybeIncorrect, // ty maybe needs an import ) .emit(); @@ -208,7 +217,7 @@ impl<'tcx> LateLintPass<'tcx> for TyTyKind { .span_suggestion( path.span, "try using `ty::` directly", - "ty".to_string(), + "ty", Applicability::MaybeIncorrect, // ty maybe needs an import ) .emit(); @@ -376,3 +385,70 @@ impl<'tcx> LateLintPass<'tcx> for ExistingDocKeyword { } } } + +declare_tool_lint! { + pub rustc::UNTRANSLATABLE_DIAGNOSTIC, + Allow, + "prevent creation of diagnostics which cannot be translated", + report_in_external_macro: true +} + +declare_tool_lint! { + pub rustc::DIAGNOSTIC_OUTSIDE_OF_IMPL, + Allow, + "prevent creation of diagnostics outside of `SessionDiagnostic`/`AddSubdiagnostic` impls", + report_in_external_macro: true +} + +declare_lint_pass!(Diagnostics => [ UNTRANSLATABLE_DIAGNOSTIC, DIAGNOSTIC_OUTSIDE_OF_IMPL ]); + +impl LateLintPass<'_> for Diagnostics { + fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { + let Some((span, def_id, substs)) = typeck_results_of_method_fn(cx, expr) else { return }; + debug!(?span, ?def_id, ?substs); + if let Ok(Some(instance)) = ty::Instance::resolve(cx.tcx, cx.param_env, def_id, substs) && + !cx.tcx.has_attr(instance.def_id(), sym::rustc_lint_diagnostics) + { + return; + } + + let mut found_impl = false; + for (_, parent) in cx.tcx.hir().parent_iter(expr.hir_id) { + debug!(?parent); + if let Node::Item(Item { kind: ItemKind::Impl(impl_), .. }) = parent && + let Impl { of_trait: Some(of_trait), .. } = impl_ && + let Some(def_id) = of_trait.trait_def_id() && + let Some(name) = cx.tcx.get_diagnostic_name(def_id) && + matches!(name, sym::SessionDiagnostic | sym::AddSubdiagnostic) + { + found_impl = true; + break; + } + } + debug!(?found_impl); + if !found_impl { + cx.struct_span_lint(DIAGNOSTIC_OUTSIDE_OF_IMPL, span, |lint| { + lint.build("diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls") + .emit(); + }) + } + + let mut found_diagnostic_message = false; + for ty in substs.types() { + debug!(?ty); + if let Some(adt_def) = ty.ty_adt_def() && + let Some(name) = cx.tcx.get_diagnostic_name(adt_def.did()) && + matches!(name, sym::DiagnosticMessage | sym::SubdiagnosticMessage) + { + found_diagnostic_message = true; + break; + } + } + debug!(?found_diagnostic_message); + if !found_diagnostic_message { + cx.struct_span_lint(UNTRANSLATABLE_DIAGNOSTIC, span, |lint| { + lint.build("diagnostics should be created using translatable messages").emit(); + }) + } + } +} diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index 54f2c72527924..7faac5b5296d4 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -443,7 +443,7 @@ impl<'s> LintLevelsBuilder<'s> { .span_suggestion( sp, "change it to", - new_lint_name.to_string(), + new_lint_name, Applicability::MachineApplicable, ) .emit(); @@ -516,7 +516,7 @@ impl<'s> LintLevelsBuilder<'s> { err.span_suggestion( sp, "use the new name", - new_name.to_string(), + new_name, Applicability::MachineApplicable, ); } @@ -543,7 +543,7 @@ impl<'s> LintLevelsBuilder<'s> { db.span_suggestion( sp, "did you mean", - suggestion.to_string(), + suggestion, Applicability::MachineApplicable, ); } diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index ff4ed94fab339..f0182883d2b46 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -508,6 +508,8 @@ fn register_internals(store: &mut LintStore) { store.register_late_pass(|| Box::new(ExistingDocKeyword)); store.register_lints(&TyTyKind::get_lints()); store.register_late_pass(|| Box::new(TyTyKind)); + store.register_lints(&Diagnostics::get_lints()); + store.register_late_pass(|| Box::new(Diagnostics)); store.register_lints(&PassByValue::get_lints()); store.register_late_pass(|| Box::new(PassByValue)); store.register_group( diff --git a/compiler/rustc_lint/src/redundant_semicolon.rs b/compiler/rustc_lint/src/redundant_semicolon.rs index 0fe6564880f01..f06a8b8f4b0c3 100644 --- a/compiler/rustc_lint/src/redundant_semicolon.rs +++ b/compiler/rustc_lint/src/redundant_semicolon.rs @@ -54,9 +54,7 @@ fn maybe_lint_redundant_semis(cx: &EarlyContext<'_>, seq: &mut Option<(Span, boo } else { ("unnecessary trailing semicolon", "remove this semicolon") }; - lint.build(msg) - .span_suggestion(span, rem, String::new(), Applicability::MaybeIncorrect) - .emit(); + lint.build(msg).span_suggestion(span, rem, "", Applicability::MaybeIncorrect).emit(); }); } } diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs index 8cae95f46dc37..73f353e62c177 100644 --- a/compiler/rustc_lint/src/unused.rs +++ b/compiler/rustc_lint/src/unused.rs @@ -160,7 +160,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults { lint.span_suggestion_verbose( expr.span.shrink_to_lo(), "use `let _ = ...` to ignore the resulting value", - "let _ = ".to_string(), + "let _ = ", Applicability::MachineApplicable, ); lint.emit(); diff --git a/compiler/rustc_middle/src/middle/stability.rs b/compiler/rustc_middle/src/middle/stability.rs index 62e0fec06615e..d23707a9d316e 100644 --- a/compiler/rustc_middle/src/middle/stability.rs +++ b/compiler/rustc_middle/src/middle/stability.rs @@ -153,7 +153,7 @@ pub fn deprecation_suggestion( diag.span_suggestion( span, &format!("replace the use of the deprecated {}", kind), - suggestion.to_string(), + suggestion, Applicability::MachineApplicable, ); } diff --git a/compiler/rustc_middle/src/traits/mod.rs b/compiler/rustc_middle/src/traits/mod.rs index 4006b2fcf177a..912b09eeca861 100644 --- a/compiler/rustc_middle/src/traits/mod.rs +++ b/compiler/rustc_middle/src/traits/mod.rs @@ -933,7 +933,7 @@ impl ObjectSafetyViolation { trait objects", name ), - sugg.to_string(), + sugg, Applicability::MaybeIncorrect, ); } @@ -957,7 +957,7 @@ impl ObjectSafetyViolation { "consider changing method `{}`'s `self` parameter to be `&self`", name ), - "&Self".to_string(), + "&Self", Applicability::MachineApplicable, ); } diff --git a/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs b/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs index bec4561928cc2..273827864f1a4 100644 --- a/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs +++ b/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs @@ -105,7 +105,7 @@ pub(crate) fn emit_unescape_error( handler.span_suggestion( span, "consider removing the non-printing characters", - ch.to_string(), + ch, Applicability::MaybeIncorrect, ); } @@ -141,7 +141,7 @@ pub(crate) fn emit_unescape_error( .span_suggestion( char_span, "escape the character", - c.escape_default().to_string(), + c.escape_default(), Applicability::MachineApplicable, ) .emit(); @@ -157,7 +157,7 @@ pub(crate) fn emit_unescape_error( .span_suggestion( span, "escape the character", - "\\r".to_string(), + "\\r", Applicability::MachineApplicable, ) .emit(); @@ -299,7 +299,7 @@ pub(crate) fn emit_unescape_error( .span_suggestion_verbose( span.shrink_to_hi(), "terminate the unicode escape", - "}".to_string(), + "}", Applicability::MaybeIncorrect, ) .emit(); diff --git a/compiler/rustc_parse/src/lexer/unicode_chars.rs b/compiler/rustc_parse/src/lexer/unicode_chars.rs index faa686c3e57a3..2c68cc5895c6e 100644 --- a/compiler/rustc_parse/src/lexer/unicode_chars.rs +++ b/compiler/rustc_parse/src/lexer/unicode_chars.rs @@ -369,7 +369,7 @@ pub(super) fn check_for_substitution<'a>( "Unicode character '{}' ({}) looks like '{}' ({}), but it is not", ch, u_name, ascii_char, ascii_name ); - err.span_suggestion(span, &msg, ascii_char.to_string(), Applicability::MaybeIncorrect); + err.span_suggestion(span, &msg, ascii_char, Applicability::MaybeIncorrect); } token.clone() } diff --git a/compiler/rustc_parse/src/lib.rs b/compiler/rustc_parse/src/lib.rs index df1765952ceac..f3bdd63ee6dd4 100644 --- a/compiler/rustc_parse/src/lib.rs +++ b/compiler/rustc_parse/src/lib.rs @@ -282,7 +282,7 @@ fn error_malformed_cfg_attr_missing(span: Span, parse_sess: &ParseSess) { .span_suggestion( span, "missing condition and attribute", - CFG_ATTR_GRAMMAR_HELP.to_string(), + CFG_ATTR_GRAMMAR_HELP, Applicability::HasPlaceholders, ) .note(CFG_ATTR_NOTE_REF) diff --git a/compiler/rustc_parse/src/parser/attr.rs b/compiler/rustc_parse/src/parser/attr.rs index 3ae8bb07cd070..acdbddf4099e6 100644 --- a/compiler/rustc_parse/src/parser/attr.rs +++ b/compiler/rustc_parse/src/parser/attr.rs @@ -78,7 +78,7 @@ impl<'a> Parser<'a> { err.span_suggestion_verbose( replacement_span, "you might have meant to write a regular comment", - String::new(), + "", rustc_errors::Applicability::MachineApplicable, ); } @@ -200,12 +200,11 @@ impl<'a> Parser<'a> { item.kind.descr(), attr_name ), - (match attr_type { + match attr_type { OuterAttributeType::Attribute => "", OuterAttributeType::DocBlockComment => "*", OuterAttributeType::DocComment => "/", - }) - .to_string(), + }, rustc_errors::Applicability::MachineApplicable, ); return None; diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 6a44f5d6653ef..7bc8175195f40 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -431,7 +431,7 @@ impl<'a> Parser<'a> { err.span_suggestion_verbose( ident.span.shrink_to_lo(), &format!("escape `{}` to use it as an identifier", ident.name), - "r#".to_owned(), + "r#", Applicability::MaybeIncorrect, ); } @@ -445,7 +445,7 @@ impl<'a> Parser<'a> { err.span_suggestion( self.token.span, "remove this comma", - String::new(), + "", Applicability::MachineApplicable, ); } @@ -518,7 +518,7 @@ impl<'a> Parser<'a> { self.bump(); let sp = self.prev_token.span; self.struct_span_err(sp, &msg) - .span_suggestion_short(sp, "change this to `;`", ";".to_string(), appl) + .span_suggestion_short(sp, "change this to `;`", ";", appl) .emit(); return Ok(true); } else if self.look_ahead(0, |t| { @@ -537,7 +537,7 @@ impl<'a> Parser<'a> { let sp = self.prev_token.span.shrink_to_hi(); self.struct_span_err(sp, &msg) .span_label(self.token.span, "unexpected token") - .span_suggestion_short(sp, "add `;` here", ";".to_string(), appl) + .span_suggestion_short(sp, "add `;` here", ";", appl) .emit(); return Ok(true); } @@ -664,7 +664,7 @@ impl<'a> Parser<'a> { err.span_suggestion( span, &format!("remove the extra `#`{}", pluralize!(count)), - String::new(), + "", Applicability::MachineApplicable, ); err.span_label( @@ -761,7 +761,7 @@ impl<'a> Parser<'a> { err.span_suggestion( sp, "maybe write a path separator here", - "::".to_string(), + "::", if allow_unstable { Applicability::MaybeIncorrect } else { @@ -773,7 +773,7 @@ impl<'a> Parser<'a> { err.span_suggestion( sp, "try using a semicolon", - ";".to_string(), + ";", Applicability::MaybeIncorrect, ); } else if allow_unstable { @@ -917,7 +917,7 @@ impl<'a> Parser<'a> { .span_suggestion( span, &format!("remove extra angle bracket{}", pluralize!(total_num_of_gt)), - String::new(), + "", Applicability::MachineApplicable, ) .emit(); @@ -999,7 +999,7 @@ impl<'a> Parser<'a> { e.span_suggestion_verbose( binop.span.shrink_to_lo(), TURBOFISH_SUGGESTION_STR, - "::".to_string(), + "::", Applicability::MaybeIncorrect, ) .emit(); @@ -1158,7 +1158,7 @@ impl<'a> Parser<'a> { err.span_suggestion_verbose( op.span.shrink_to_lo(), TURBOFISH_SUGGESTION_STR, - "::".to_string(), + "::", Applicability::MaybeIncorrect, ); }; @@ -1701,7 +1701,7 @@ impl<'a> Parser<'a> { Applicability::MachineApplicable, ); } - err.span_suggestion(lo.shrink_to_lo(), &format!("{prefix}you can still access the deprecated `try!()` macro using the \"raw identifier\" syntax"), "r#".to_string(), Applicability::MachineApplicable); + err.span_suggestion(lo.shrink_to_lo(), &format!("{prefix}you can still access the deprecated `try!()` macro using the \"raw identifier\" syntax"), "r#", Applicability::MachineApplicable); err.emit(); Ok(self.mk_expr_err(lo.to(hi))) } else { @@ -1997,7 +1997,7 @@ impl<'a> Parser<'a> { err.span_suggestion( span, "declare the type after the parameter binding", - String::from(": "), + ": ", Applicability::HasPlaceholders, ); return Some(ident); @@ -2102,7 +2102,7 @@ impl<'a> Parser<'a> { .span_suggestion_short( pat.span, "give this argument a name or use an underscore to ignore it", - "_".to_owned(), + "_", Applicability::MachineApplicable, ) .emit(); @@ -2336,7 +2336,7 @@ impl<'a> Parser<'a> { err.span_suggestion_verbose( start.until(self.token.span), "the `const` keyword is only needed in the definition of the type", - String::new(), + "", Applicability::MaybeIncorrect, ); err.emit(); @@ -2394,7 +2394,7 @@ impl<'a> Parser<'a> { err.span_suggestion( snapshot.token.span, "if you meant to use an associated type binding, replace `==` with `=`", - "=".to_string(), + "=", Applicability::MaybeIncorrect, ); let value = self.mk_expr_err(start.to(expr.span)); @@ -2408,7 +2408,7 @@ impl<'a> Parser<'a> { err.span_suggestion( snapshot.token.span, "write a path separator here", - "::".to_string(), + "::", Applicability::MaybeIncorrect, ); err.emit(); @@ -2461,7 +2461,7 @@ impl<'a> Parser<'a> { err.span_suggestion_verbose( move_async_span, "try switching the order", - "async move".to_owned(), + "async move", Applicability::MaybeIncorrect, ); err @@ -2566,7 +2566,7 @@ impl<'a> Parser<'a> { err.span_suggestion( span, "maybe write a path separator here", - "::".to_string(), + "::", Applicability::MaybeIncorrect, ); } else { @@ -2596,7 +2596,7 @@ impl<'a> Parser<'a> { err.tool_only_span_suggestion( label.ident.span.until(self.token.span), "remove this block label", - String::new(), + "", Applicability::MachineApplicable, ); err.emit(); @@ -2669,7 +2669,7 @@ impl<'a> Parser<'a> { err.span_suggestion( between_span, "use single colon", - ": ".to_owned(), + ": ", Applicability::MachineApplicable, ); return Err(err); diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 324e04b198101..236ccef1d0335 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -230,7 +230,7 @@ impl<'a> Parser<'a> { .span_suggestion_short( sp, &format!("`{s}=` is not a valid comparison operator, use `{s}`", s = sugg), - sugg.to_string(), + sugg, Applicability::MachineApplicable, ) .emit(); @@ -247,7 +247,7 @@ impl<'a> Parser<'a> { .span_suggestion_short( sp, "`<>` is not a valid comparison operator, use `!=`", - "!=".to_string(), + "!=", Applicability::MachineApplicable, ) .emit(); @@ -459,7 +459,7 @@ impl<'a> Parser<'a> { .span_suggestion_short( self.token.span, &format!("use `{good}` to perform logical {english}"), - good.to_string(), + good, Applicability::MachineApplicable, ) .note("unlike in e.g., python and PHP, `&&` and `||` are used for logical operators") @@ -584,7 +584,7 @@ impl<'a> Parser<'a> { err.span_suggestion_verbose( lo, "try removing the `+`", - "".to_string(), + "", Applicability::MachineApplicable, ); } @@ -634,7 +634,7 @@ impl<'a> Parser<'a> { .span_suggestion_short( lo, "use `!` to perform bitwise not", - "!".to_owned(), + "!", Applicability::MachineApplicable, ) .emit(); @@ -673,7 +673,7 @@ impl<'a> Parser<'a> { // trailing whitespace after the `!` in our suggestion self.sess.source_map().span_until_non_whitespace(lo.to(not_token.span)), "use `!` to perform logical negation", - "!".to_owned(), + "!", Applicability::MachineApplicable, ) .emit(); @@ -744,7 +744,7 @@ impl<'a> Parser<'a> { .span_suggestion( label.ident.span, "use the correct loop label format", - label.ident.to_string(), + label.ident, Applicability::MachineApplicable, ) .emit(); @@ -885,7 +885,7 @@ impl<'a> Parser<'a> { "{}remove the type ascription", if is_nightly { "alternatively, " } else { "" } ), - String::new(), + "", if is_nightly { Applicability::MaybeIncorrect } else { @@ -929,7 +929,7 @@ impl<'a> Parser<'a> { .span_suggestion( lt_span, "remove the lifetime annotation", - String::new(), + "", Applicability::MachineApplicable, ) .emit(); @@ -1626,7 +1626,7 @@ impl<'a> Parser<'a> { .span_suggestion_short( lo.shrink_to_hi(), "add `:` after the label", - ": ".to_string(), + ": ", Applicability::MachineApplicable, ) .note("labels are used before loops and blocks, allowing e.g., `break 'label` to them") @@ -1645,7 +1645,7 @@ impl<'a> Parser<'a> { .span_suggestion( span_dc, "replace with the new syntax", - "try".to_string(), + "try", Applicability::MachineApplicable, ) .note("following RFC #2388, the new non-placeholder syntax is `try`") @@ -2088,7 +2088,7 @@ impl<'a> Parser<'a> { .span_suggestion( span_for, "remove the parameters", - String::new(), + "", Applicability::MachineApplicable, ) .emit(); @@ -2352,7 +2352,7 @@ impl<'a> Parser<'a> { .span_suggestion( cond.span.shrink_to_lo(), "add an `if` if this is the condition of a chained `else if` statement", - "if ".to_string(), + "if ", Applicability::MaybeIncorrect, ) .emit(); @@ -2388,12 +2388,7 @@ impl<'a> Parser<'a> { self.struct_span_err(last, "outer attributes are not allowed on `if` and `else` branches") .span_label(branch_span, "the attributes are attached to this branch") .span_label(ctx_span, format!("the branch belongs to this `{ctx}`")) - .span_suggestion( - span, - "remove the attributes", - String::new(), - Applicability::MachineApplicable, - ) + .span_suggestion(span, "remove the attributes", "", Applicability::MachineApplicable) .emit(); } @@ -2502,7 +2497,7 @@ impl<'a> Parser<'a> { e.span_suggestion_short( match_span, "try removing this `match`", - String::new(), + "", Applicability::MaybeIncorrect, // speculative ); } @@ -2578,7 +2573,7 @@ impl<'a> Parser<'a> { err.span_suggestion( semi_sp, "use a comma to end a `match` arm expression", - ",".to_string(), + ",", Applicability::MachineApplicable, ); } @@ -2679,7 +2674,7 @@ impl<'a> Parser<'a> { err.span_suggestion( this.token.span, "try using a fat arrow here", - "=>".to_string(), + "=>", Applicability::MaybeIncorrect, ); err.emit(); @@ -2739,7 +2734,7 @@ impl<'a> Parser<'a> { err.span_suggestion_short( arm_start_span.shrink_to_hi(), "missing a comma here to end this `match` arm", - ",".to_owned(), + ",", Applicability::MachineApplicable, ); return Err(err); @@ -2768,7 +2763,7 @@ impl<'a> Parser<'a> { .span_suggestion( hi.shrink_to_hi(), "missing a comma here to end this `match` arm", - ",".to_owned(), + ",", Applicability::MachineApplicable, ) .emit(); @@ -3049,7 +3044,7 @@ impl<'a> Parser<'a> { .span_suggestion_short( self.token.span, "remove this comma", - String::new(), + "", Applicability::MachineApplicable, ) .note("the base struct must always be the last field") @@ -3103,7 +3098,7 @@ impl<'a> Parser<'a> { .span_suggestion( field_name.span.shrink_to_hi().to(self.token.span), "replace equals symbol with a colon", - ":".to_string(), + ":", Applicability::MachineApplicable, ) .emit(); @@ -3114,13 +3109,13 @@ impl<'a> Parser<'a> { .span_suggestion( span, "use `..` for an exclusive range", - "..".to_owned(), + "..", Applicability::MaybeIncorrect, ) .span_suggestion( span, "or `..=` for an inclusive range", - "..=".to_owned(), + "..=", Applicability::MaybeIncorrect, ) .emit(); @@ -3132,7 +3127,7 @@ impl<'a> Parser<'a> { span, "if you meant to write a comparison against a negative value, add a \ space in between `<` and `-`", - "< -".to_string(), + "< -", Applicability::MaybeIncorrect, ) .emit(); diff --git a/compiler/rustc_parse/src/parser/generics.rs b/compiler/rustc_parse/src/parser/generics.rs index 1930dec8c3b22..1acfd93d86faf 100644 --- a/compiler/rustc_parse/src/parser/generics.rs +++ b/compiler/rustc_parse/src/parser/generics.rs @@ -271,7 +271,7 @@ impl<'a> Parser<'a> { err.span_suggestion_verbose( prev_token.shrink_to_hi().to(self.prev_token.span), "consider joining the two `where` clauses into one", - ",".to_owned(), + ",", Applicability::MaybeIncorrect, ); err.emit(); diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 48c3c467becc8..1d50ce767afb1 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -298,7 +298,7 @@ impl<'a> Parser<'a> { .span_suggestion_short( span, "items are imported using the `use` keyword", - "use".to_owned(), + "use", Applicability::MachineApplicable, ) .emit(); @@ -458,7 +458,7 @@ impl<'a> Parser<'a> { err.span_suggestion( path.span, "perhaps you meant to define a macro", - "macro_rules".to_string(), + "macro_rules", Applicability::MachineApplicable, ); } @@ -486,7 +486,7 @@ impl<'a> Parser<'a> { err.span_suggestion_verbose( self.token.span, "consider removing this semicolon", - String::new(), + "", Applicability::MaybeIncorrect, ); } @@ -606,7 +606,7 @@ impl<'a> Parser<'a> { .span_suggestion_short( missing_for_span, "add `for` here", - " for ".to_string(), + " for ", Applicability::MachineApplicable, ) .emit(); @@ -1082,7 +1082,7 @@ impl<'a> Parser<'a> { .span_suggestion( span.with_hi(ident.span.lo()), "try using a static value", - "static ".to_string(), + "static ", Applicability::MachineApplicable, ) .note("for more information, visit https://doc.rust-lang.org/std/keyword.extern.html") @@ -1121,7 +1121,7 @@ impl<'a> Parser<'a> { .span_suggestion( const_span, "you might want to declare a static instead", - "static".to_owned(), + "static", Applicability::MaybeIncorrect, ) .emit(); @@ -1555,7 +1555,7 @@ impl<'a> Parser<'a> { err.span_suggestion_short( self.prev_token.span, "field names and their types are separated with `:`", - ":".to_string(), + ":", Applicability::MachineApplicable, ); err.emit(); @@ -1582,7 +1582,7 @@ impl<'a> Parser<'a> { .span_suggestion_verbose( self.token.span, "write a path separator here", - "::".to_string(), + "::", Applicability::MaybeIncorrect, ) .emit(); @@ -1595,7 +1595,7 @@ impl<'a> Parser<'a> { .span_suggestion( sp, "remove this unsupported default value", - String::new(), + "", Applicability::MachineApplicable, ) .emit(); @@ -1691,7 +1691,7 @@ impl<'a> Parser<'a> { .span_suggestion( macro_rules_span, "add a `!`", - "macro_rules!".to_owned(), + "macro_rules!", Applicability::MachineApplicable, ) .emit(); @@ -1720,12 +1720,7 @@ impl<'a> Parser<'a> { // Handle macro_rules! foo! let span = self.prev_token.span; self.struct_span_err(span, "macro names aren't followed by a `!`") - .span_suggestion( - span, - "remove the `!`", - "".to_owned(), - Applicability::MachineApplicable, - ) + .span_suggestion(span, "remove the `!`", "", Applicability::MachineApplicable) .emit(); } @@ -1751,7 +1746,7 @@ impl<'a> Parser<'a> { .span_suggestion( vis.span, "try exporting the macro", - "#[macro_export]".to_owned(), + "#[macro_export]", Applicability::MaybeIncorrect, // speculative ) .emit(); @@ -1760,7 +1755,7 @@ impl<'a> Parser<'a> { .span_suggestion( vis.span, "remove the visibility", - String::new(), + "", Applicability::MachineApplicable, ) .help(&format!("try adjusting the macro to put `{vstr}` inside the invocation")) @@ -1794,14 +1789,14 @@ impl<'a> Parser<'a> { err.span_suggestion( span, "change the delimiters to curly braces", - " { /* items */ }".to_string(), + " { /* items */ }", Applicability::HasPlaceholders, ); } err.span_suggestion( span.shrink_to_hi(), "add a semicolon", - ';'.to_string(), + ';', Applicability::MaybeIncorrect, ); err.emit(); @@ -1826,7 +1821,7 @@ impl<'a> Parser<'a> { .span_suggestion( item.unwrap().span, &format!("consider creating a new `{kw_str}` definition instead of nesting"), - String::new(), + "", Applicability::MaybeIncorrect, ) .emit(); @@ -2086,7 +2081,7 @@ impl<'a> Parser<'a> { err.span_suggestion( self.token.uninterpolated_span(), &format!("`{original_kw}` already used earlier, remove this one"), - "".to_string(), + "", Applicability::MachineApplicable, ) .span_note(original_sp, &format!("`{original_kw}` first seen here")); @@ -2134,7 +2129,7 @@ impl<'a> Parser<'a> { err.span_suggestion( current_vis.span, "there is already a visibility modifier, remove one", - "".to_string(), + "", Applicability::MachineApplicable, ) .span_note(orig_vis.span, "explicit visibility first seen here"); diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 6e6c1ffe74737..4df9ad26a587b 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -1350,7 +1350,7 @@ impl<'a> Parser<'a> { .span_suggestion( lit.span, "specify the ABI with a string literal", - "\"C\"".to_string(), + "\"C\"", Applicability::MaybeIncorrect, ) .emit(); diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index ca7915ed17a50..ba77a39584093 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -218,12 +218,7 @@ impl<'a> Parser<'a> { if let token::OrOr = self.token.kind { let span = self.token.span; let mut err = self.struct_span_err(span, "unexpected `||` before function parameter"); - err.span_suggestion( - span, - "remove the `||`", - String::new(), - Applicability::MachineApplicable, - ); + err.span_suggestion(span, "remove the `||`", "", Applicability::MachineApplicable); err.note("alternatives in or-patterns are separated with `|`, not `||`"); err.emit(); self.bump(); @@ -287,7 +282,7 @@ impl<'a> Parser<'a> { err.span_suggestion( self.token.span, "use a single `|` to separate multiple alternative patterns", - "|".to_owned(), + "|", Applicability::MachineApplicable, ); if let Some(lo) = lo { @@ -303,7 +298,7 @@ impl<'a> Parser<'a> { err.span_suggestion( span, &format!("remove the `{}`", pprust::token_to_string(&self.token)), - String::new(), + "", Applicability::MachineApplicable, ); if let Some(lo) = lo { @@ -433,7 +428,7 @@ impl<'a> Parser<'a> { .span_suggestion_short( lo, "for a rest pattern, use `..` instead of `...`", - "..".to_owned(), + "..", Applicability::MachineApplicable, ) .emit(); @@ -537,12 +532,7 @@ impl<'a> Parser<'a> { let span = self.prev_token.span; self.struct_span_err(span, &format!("unexpected lifetime `{}` in pattern", name)) - .span_suggestion( - span, - "remove the lifetime", - String::new(), - Applicability::MachineApplicable, - ) + .span_suggestion(span, "remove the lifetime", "", Applicability::MachineApplicable) .emit(); } } @@ -665,7 +655,7 @@ impl<'a> Parser<'a> { .span_suggestion( span, "remove the additional `mut`s", - String::new(), + "", Applicability::MachineApplicable, ) .emit(); @@ -759,24 +749,14 @@ impl<'a> Parser<'a> { fn error_inclusive_range_with_extra_equals(&self, span: Span) { self.struct_span_err(span, "unexpected `=` after inclusive range") - .span_suggestion_short( - span, - "use `..=` instead", - "..=".to_string(), - Applicability::MaybeIncorrect, - ) + .span_suggestion_short(span, "use `..=` instead", "..=", Applicability::MaybeIncorrect) .note("inclusive ranges end with a single equals sign (`..=`)") .emit(); } fn error_inclusive_range_with_no_end(&self, span: Span) { struct_span_err!(self.sess.span_diagnostic, span, E0586, "inclusive range with no end") - .span_suggestion_short( - span, - "use `..` instead", - "..".to_string(), - Applicability::MachineApplicable, - ) + .span_suggestion_short(span, "use `..` instead", "..", Applicability::MachineApplicable) .note("inclusive ranges must be bounded at the end (`..=b` or `a..=b`)") .emit(); } @@ -794,7 +774,7 @@ impl<'a> Parser<'a> { .span_suggestion_short( re.span, "use `..=` instead", - "..=".to_string(), + "..=", Applicability::MachineApplicable, ) .emit(); @@ -1035,7 +1015,7 @@ impl<'a> Parser<'a> { err.span_suggestion_short( sp, "remove this comma", - String::new(), + "", Applicability::MachineApplicable, ); } @@ -1107,7 +1087,7 @@ impl<'a> Parser<'a> { .span_suggestion( self.token.span, "to omit remaining fields, use one fewer `.`", - "..".to_owned(), + "..", Applicability::MachineApplicable, ) .emit(); diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs index 5c6fb376cd41a..da46af60f727e 100644 --- a/compiler/rustc_parse/src/parser/path.rs +++ b/compiler/rustc_parse/src/parser/path.rs @@ -112,7 +112,7 @@ impl<'a> Parser<'a> { .span_suggestion( self.prev_token.span, "use double colon", - "::".to_string(), + "::", Applicability::MachineApplicable, ) .emit(); @@ -283,7 +283,7 @@ impl<'a> Parser<'a> { err.span_suggestion_verbose( arg.span().shrink_to_hi(), "you might have meant to end the type parameters here", - ">".to_string(), + ">", Applicability::MaybeIncorrect, ); } @@ -455,7 +455,7 @@ impl<'a> Parser<'a> { "remove extra angle bracket{}", pluralize!(snapshot.unmatched_angle_bracket_count) ), - String::new(), + "", Applicability::MachineApplicable, ) .emit(); @@ -489,7 +489,7 @@ impl<'a> Parser<'a> { err.span_suggestion_verbose( self.prev_token.span.until(self.token.span), "use a comma to separate type parameters", - ", ".to_string(), + ", ", Applicability::MachineApplicable, ); err.emit(); @@ -592,13 +592,13 @@ impl<'a> Parser<'a> { err.span_suggestion( self.sess.source_map().next_point(eq).to(before_next), "to constrain the associated type, add a type after `=`", - " TheType".to_string(), + " TheType", Applicability::HasPlaceholders, ); err.span_suggestion( eq.to(before_next), &format!("remove the `=` if `{}` is a type", ident), - String::new(), + "", Applicability::MaybeIncorrect, ) } else { diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs index 7907ec44e98e9..ad0128cd9ed12 100644 --- a/compiler/rustc_parse/src/parser/stmt.rs +++ b/compiler/rustc_parse/src/parser/stmt.rs @@ -209,7 +209,7 @@ impl<'a> Parser<'a> { ) -> PResult<'a, Stmt> { let stmt = self.recover_local_after_let(lo, attrs)?; self.struct_span_err(lo, "invalid variable declaration") - .span_suggestion(lo, msg, sugg.to_string(), Applicability::MachineApplicable) + .span_suggestion(lo, msg, sugg, Applicability::MachineApplicable) .emit(); Ok(stmt) } @@ -287,7 +287,7 @@ impl<'a> Parser<'a> { err.span_suggestion_short( colon_sp, "use `=` if you meant to assign", - " =".to_string(), + " =", Applicability::MachineApplicable, ); err.emit(); @@ -391,7 +391,7 @@ impl<'a> Parser<'a> { .span_suggestion_short( self.token.span, "initialize the variable", - "=".to_string(), + "=", Applicability::MaybeIncorrect, ) .help("if you meant to overwrite, remove the `let` binding") diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index dee025cfd3c8a..31b40a83e6052 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -216,7 +216,7 @@ impl<'a> Parser<'a> { .span_suggestion_short( self.prev_token.span, "use `->` instead", - "->".to_string(), + "->", Applicability::MachineApplicable, ) .emit(); @@ -479,7 +479,7 @@ impl<'a> Parser<'a> { err.span_suggestion( span, "place `mut` before `dyn`", - "&mut dyn".to_string(), + "&mut dyn", Applicability::MachineApplicable, ); err.emit(); @@ -548,7 +548,7 @@ impl<'a> Parser<'a> { .span_suggestion_short( qual_span, &format!("remove the `{}` qualifier", qual), - String::new(), + "", Applicability::MaybeIncorrect, ) .emit(); @@ -648,7 +648,7 @@ impl<'a> Parser<'a> { .span_suggestion( self.token.span, "remove this keyword", - String::new(), + "", Applicability::MachineApplicable, ) .emit(); diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 5cc97d326d3d8..5c3e7918aa3ff 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -118,6 +118,9 @@ impl CheckAttrVisitor<'_> { sym::rustc_lint_query_instability => { self.check_rustc_lint_query_instability(&attr, span, target) } + sym::rustc_lint_diagnostics => { + self.check_rustc_lint_diagnostics(&attr, span, target) + } sym::rustc_clean | sym::rustc_dirty | sym::rustc_if_this_changed @@ -918,7 +921,7 @@ impl CheckAttrVisitor<'_> { .span_suggestion( replacement_span, "remove this attribute", - String::new(), + "", Applicability::MachineApplicable, ) .emit(); @@ -1158,7 +1161,7 @@ impl CheckAttrVisitor<'_> { diag.span_suggestion_short( i_meta.span, "use `notable_trait` instead", - String::from("notable_trait"), + "notable_trait", Applicability::MachineApplicable, ); diag.note("`doc(spotlight)` is now a no-op"); @@ -1624,12 +1627,9 @@ impl CheckAttrVisitor<'_> { } } - fn check_rustc_lint_query_instability( - &self, - attr: &Attribute, - span: Span, - target: Target, - ) -> bool { + /// Helper function for checking that the provided attribute is only applied to a function or + /// method. + fn check_applied_to_fn_or_method(&self, attr: &Attribute, span: Span, target: Target) -> bool { let is_function = matches!(target, Target::Fn | Target::Method(..)); if !is_function { self.tcx @@ -1643,6 +1643,23 @@ impl CheckAttrVisitor<'_> { } } + /// Checks that the `#[rustc_lint_query_instability]` attribute is only applied to a function + /// or method. + fn check_rustc_lint_query_instability( + &self, + attr: &Attribute, + span: Span, + target: Target, + ) -> bool { + self.check_applied_to_fn_or_method(attr, span, target) + } + + /// Checks that the `#[rustc_lint_diagnostics]` attribute is only applied to a function or + /// method. + fn check_rustc_lint_diagnostics(&self, attr: &Attribute, span: Span, target: Target) -> bool { + self.check_applied_to_fn_or_method(attr, span, target) + } + /// Checks that the dep-graph debugging attributes are only present when the query-dep-graph /// option is passed to the compiler. fn check_rustc_dirty_clean(&self, attr: &Attribute) -> bool { @@ -1720,7 +1737,7 @@ impl CheckAttrVisitor<'_> { .span_suggestion( attr.span, "remove this attribute", - String::new(), + "", Applicability::MachineApplicable, ) .emit(); @@ -2259,7 +2276,7 @@ impl CheckAttrVisitor<'_> { .span_suggestion( attr.span, "remove this attribute", - String::new(), + "", Applicability::MachineApplicable, ) .note(¬e) @@ -2487,7 +2504,7 @@ fn check_duplicates( db.span_note(other, "attribute also specified here").span_suggestion( this, "remove this attribute", - String::new(), + "", Applicability::MachineApplicable, ); if matches!(duplicates, FutureWarnFollowing | FutureWarnPreceding) { @@ -2522,7 +2539,7 @@ fn check_duplicates( .span_suggestion( this, "remove this attribute", - String::new(), + "", Applicability::MachineApplicable, ) .emit(); diff --git a/compiler/rustc_passes/src/loops.rs b/compiler/rustc_passes/src/loops.rs index e0dac09870df7..79a6e51801128 100644 --- a/compiler/rustc_passes/src/loops.rs +++ b/compiler/rustc_passes/src/loops.rs @@ -166,7 +166,7 @@ impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> { break_expr.span, "alternatively, you might have meant to use the \ available loop label", - label.ident.to_string(), + label.ident, Applicability::MaybeIncorrect, ); } diff --git a/compiler/rustc_passes/src/naked_functions.rs b/compiler/rustc_passes/src/naked_functions.rs index 83f728d407667..c0c696a117581 100644 --- a/compiler/rustc_passes/src/naked_functions.rs +++ b/compiler/rustc_passes/src/naked_functions.rs @@ -308,7 +308,7 @@ impl<'tcx> CheckInlineAssembly<'tcx> { last_span, "consider specifying that the asm block is responsible \ for returning from the function", - String::from(", options(noreturn)"), + ", options(noreturn)", Applicability::MachineApplicable, ) .emit(); diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index 144a60faad265..9eaefc8b8aa8f 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -125,7 +125,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> { .span_suggestion_short( *span, "remove the unnecessary deprecation attribute", - String::new(), + "", rustc_errors::Applicability::MachineApplicable, ) .emit(); diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index b1fe418f687b4..3b70b90c87182 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -271,7 +271,7 @@ impl<'a> Resolver<'a> { err.tool_only_span_suggestion( import.use_span_with_attributes, "remove unnecessary import", - String::new(), + "", Applicability::MaybeIncorrect, ); } @@ -396,19 +396,14 @@ impl<'a> Resolver<'a> { // previous imports. if found_closing_brace { if let Some(span) = extend_span_to_previous_binding(self.session, span) { - err.tool_only_span_suggestion( - span, - message, - String::new(), - Applicability::MaybeIncorrect, - ); + err.tool_only_span_suggestion(span, message, "", Applicability::MaybeIncorrect); } else { // Remove the entire line if we cannot extend the span back, this indicates an // `issue_52891::{self}` case. err.span_suggestion( import.use_span_with_attributes, message, - String::new(), + "", Applicability::MaybeIncorrect, ); } @@ -416,7 +411,7 @@ impl<'a> Resolver<'a> { return; } - err.span_suggestion(span, message, String::new(), Applicability::MachineApplicable); + err.span_suggestion(span, message, "", Applicability::MachineApplicable); } pub(crate) fn lint_if_path_starts_with_module( @@ -763,7 +758,7 @@ impl<'a> Resolver<'a> { err.span_suggestion( span, "try using similarly named label", - ident.name.to_string(), + ident.name, Applicability::MaybeIncorrect, ); } @@ -796,7 +791,7 @@ impl<'a> Resolver<'a> { err.span_suggestion( span, "consider importing the module directly", - "".to_string(), + "", Applicability::MachineApplicable, ); @@ -1007,7 +1002,7 @@ impl<'a> Resolver<'a> { err.span_suggestion( span, "try using similarly named label", - ident.name.to_string(), + ident.name, Applicability::MaybeIncorrect, ); } @@ -1618,12 +1613,7 @@ impl<'a> Resolver<'a> { format!("maybe you meant this {}", suggestion.res.descr()) } }; - err.span_suggestion( - span, - &msg, - suggestion.candidate.to_string(), - Applicability::MaybeIncorrect, - ); + err.span_suggestion(span, &msg, suggestion.candidate, Applicability::MaybeIncorrect); true } @@ -2535,7 +2525,7 @@ fn show_candidates( err.span_suggestion_verbose( first.ident.span.until(last.ident.span), &format!("if you import `{}`, refer to it directly", last.ident), - String::new(), + "", Applicability::Unspecified, ); } diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 68ddc37c3a82b..d2306254e3142 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -280,7 +280,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { err.span_suggestion_verbose( expr_span.shrink_to_lo(), "you might have meant to use pattern matching", - "let ".to_string(), + "let ", Applicability::MaybeIncorrect, ); } @@ -294,7 +294,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { err.span_suggestion_short( span, "you might have meant to use `self` here instead", - "self".to_string(), + "self", Applicability::MaybeIncorrect, ); if !self.self_value_is_available(path[0].ident.span) { @@ -317,7 +317,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { span, "if you meant to use `self`, you are also missing a `self` receiver \ argument", - sugg.to_string(), + sugg, Applicability::MaybeIncorrect, ); } @@ -376,7 +376,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { err.span_suggestion_verbose( span, "add a `self` receiver parameter to make the associated `fn` a method", - sugg.to_string(), + sugg, Applicability::MaybeIncorrect, ); "doesn't" @@ -612,7 +612,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { err.span_suggestion_short( pat_sp.between(ty_sp), "use `=` if you meant to assign", - " = ".to_string(), + " = ", Applicability::MaybeIncorrect, ); } @@ -642,7 +642,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { err.span_suggestion( span, "use the similarly named label", - label_ident.name.to_string(), + label_ident.name, Applicability::MaybeIncorrect, ); // Do not lint against unused label when we suggest them. @@ -656,7 +656,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { err.span_suggestion( span, "perhaps you intended to use this type", - correct.to_string(), + correct, Applicability::MaybeIncorrect, ); } @@ -687,7 +687,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { err.span_suggestion_verbose( constraint.ident.span.between(trait_ref.span), "you might have meant to write a path instead of an associated type bound", - "::".to_string(), + "::", Applicability::MachineApplicable, ); } @@ -1079,7 +1079,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { err.span_suggestion_verbose( span.shrink_to_hi(), "use `!` to invoke the macro", - "!".to_string(), + "!", Applicability::MaybeIncorrect, ); if path_str == "try" && span.rust_2015() { @@ -1228,7 +1228,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { err.span_suggestion( span, "use this syntax instead", - path_str.to_string(), + path_str, Applicability::MaybeIncorrect, ); } @@ -1507,7 +1507,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { err.span_suggestion_short( colon_sp, "maybe you meant to write `;` here", - ";".to_string(), + ";", Applicability::MaybeIncorrect, ); } else { @@ -1518,7 +1518,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { err.span_suggestion( colon_sp, "maybe you meant to write a path separator here", - "::".to_string(), + "::", Applicability::MaybeIncorrect, ); show_label = false; diff --git a/compiler/rustc_session/src/lib.rs b/compiler/rustc_session/src/lib.rs index 59b4981dd0120..044be906b5507 100644 --- a/compiler/rustc_session/src/lib.rs +++ b/compiler/rustc_session/src/lib.rs @@ -5,6 +5,7 @@ #![feature(never_type)] #![feature(once_cell)] #![feature(option_get_or_insert_default)] +#![feature(rustc_attrs)] #![recursion_limit = "256"] #![allow(rustc::potential_query_instability)] diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs index 6fb87e15a3303..a5ccae047fcc3 100644 --- a/compiler/rustc_session/src/parse.rs +++ b/compiler/rustc_session/src/parse.rs @@ -311,6 +311,7 @@ impl ParseSess { self.create_warning(warning).emit() } + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn struct_err( &self, msg: impl Into, @@ -318,6 +319,7 @@ impl ParseSess { self.span_diagnostic.struct_err(msg) } + #[cfg_attr(not(bootstrap), rustc_lint_diagnostics)] pub fn struct_warn(&self, msg: impl Into) -> DiagnosticBuilder<'_, ()> { self.span_diagnostic.struct_warn(msg) } diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index b2c23cda6aae5..b1d1f9e7a6ce0 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -209,6 +209,7 @@ pub struct PerfStats { /// Trait implemented by error types. This should not be implemented manually. Instead, use /// `#[derive(SessionDiagnostic)]` -- see [rustc_macros::SessionDiagnostic]. +#[rustc_diagnostic_item = "SessionDiagnostic"] pub trait SessionDiagnostic<'a, T: EmissionGuarantee = ErrorGuaranteed> { /// Write out as a diagnostic out of `sess`. #[must_use] diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 7b0fa65e8086b..6547ec493c862 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -125,6 +125,7 @@ symbols! { Symbols { AcqRel, Acquire, + AddSubdiagnostic, Alignment, Any, Arc, @@ -169,6 +170,7 @@ symbols! { Decoder, Default, Deref, + DiagnosticMessage, DirBuilder, Display, DoubleEndedIterator, @@ -253,11 +255,13 @@ symbols! { RustcEncodable, Send, SeqCst, + SessionDiagnostic, SliceIndex, Some, String, StructuralEq, StructuralPartialEq, + SubdiagnosticMessage, Sync, Target, ToOwned, @@ -1205,6 +1209,7 @@ symbols! { rustc_layout_scalar_valid_range_end, rustc_layout_scalar_valid_range_start, rustc_legacy_const_generics, + rustc_lint_diagnostics, rustc_lint_query_instability, rustc_macro_transparency, rustc_main, diff --git a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs index 0dea2c3d8bfe8..c005541ae1459 100644 --- a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs +++ b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs @@ -144,7 +144,7 @@ pub fn is_const_evaluatable<'cx, 'tcx>( .span_suggestion_verbose( rustc_span::DUMMY_SP, "consider enabling this feature", - "#![feature(generic_const_exprs)]\n".to_string(), + "#![feature(generic_const_exprs)]\n", rustc_errors::Applicability::MaybeIncorrect, ) .emit() diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index 2e7067fa71076..35daf764fff13 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -417,7 +417,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { span.shrink_to_lo(), "consider converting the `Option` into a `Result` \ using `Option::ok_or` or `Option::ok_or_else`", - ".ok_or_else(|| /* error value */)".to_string(), + ".ok_or_else(|| /* error value */)", Applicability::HasPlaceholders, ); } else if should_convert_result_to_option { @@ -425,7 +425,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { span.shrink_to_lo(), "consider converting the `Result` into an `Option` \ using `Result::ok`", - ".ok()".to_string(), + ".ok()", Applicability::MachineApplicable, ); } diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 353547a2fb8cb..74e980b682d5d 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -701,7 +701,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { err.span_suggestion_verbose( span.shrink_to_lo(), "consider dereferencing here", - "*".to_string(), + "*", Applicability::MachineApplicable, ); return true; @@ -1002,7 +1002,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { &format!( "consider borrowing the value, since `&{self_ty}` can be coerced into `{object_ty}`" ), - "&".to_string(), + "&", Applicability::MaybeIncorrect, ); } @@ -1059,12 +1059,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { format!("consider removing {} leading `&`-references", remove_refs) }; - err.span_suggestion_short( - sp, - &msg, - String::new(), - Applicability::MachineApplicable, - ); + err.span_suggestion_short(sp, &msg, "", Applicability::MachineApplicable); suggested = true; break; } @@ -1087,7 +1082,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { err.span_suggestion_verbose( expr.span.shrink_to_hi().with_hi(span.hi()), "remove the `.await`", - String::new(), + "", Applicability::MachineApplicable, ); // FIXME: account for associated `async fn`s. @@ -1115,14 +1110,14 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { err.span_suggestion_verbose( span.shrink_to_lo(), &msg, - "async ".to_string(), + "async ", Applicability::MaybeIncorrect, ); } else { err.span_suggestion_verbose( vis_span.shrink_to_hi(), &msg, - " async".to_string(), + " async", Applicability::MaybeIncorrect, ); } @@ -1190,7 +1185,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { err.span_suggestion_verbose( sp, "consider changing this borrow's mutability", - "&mut ".to_string(), + "&mut ", Applicability::MachineApplicable, ); } else { @@ -1241,7 +1236,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { err.span_suggestion( self.tcx.sess.source_map().end_point(stmt.span), "remove this semicolon", - String::new(), + "", Applicability::MachineApplicable ); return true; @@ -2275,7 +2270,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { err.span_suggestion_verbose( span.shrink_to_lo(), "consider borrowing here", - "&".to_owned(), + "&", Applicability::MachineApplicable, ); err.note("all local variables must have a statically known size"); @@ -2285,7 +2280,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { param.ty_span.shrink_to_lo(), "function arguments must have a statically known size, borrowed types \ always have a known size", - "&".to_owned(), + "&", Applicability::MachineApplicable, ); } @@ -2303,7 +2298,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { span.shrink_to_lo(), "function arguments must have a statically known size, borrowed types \ always have a known size", - "&".to_string(), + "&", Applicability::MachineApplicable, ); } else { @@ -2358,7 +2353,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { err.span_suggestion( span.shrink_to_lo(), "borrowed types always have a statically known size", - "&".to_string(), + "&", Applicability::MachineApplicable, ); err.multipart_suggestion( @@ -2759,7 +2754,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { err.span_suggestion_verbose( span.with_hi(span.hi() - BytePos(1)).shrink_to_hi(), "consider `await`ing on the `Future`", - ".await".to_string(), + ".await", Applicability::MaybeIncorrect, ); } @@ -2785,7 +2780,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { err.span_suggestion_verbose( rhs_span.shrink_to_hi(), "consider using a floating-point literal by writing it with `.0`", - String::from(".0"), + ".0", Applicability::MaybeIncorrect, ); } @@ -2965,7 +2960,7 @@ fn suggest_trait_object_return_type_alternatives( ret_ty, "use some type `T` that is `T: Sized` as the return type if all return paths have the \ same type", - "T".to_string(), + "T", Applicability::MaybeIncorrect, ); err.span_suggestion( diff --git a/compiler/rustc_typeck/src/astconv/errors.rs b/compiler/rustc_typeck/src/astconv/errors.rs index 8fe89c66389c2..d111008e82c83 100644 --- a/compiler/rustc_typeck/src/astconv/errors.rs +++ b/compiler/rustc_typeck/src/astconv/errors.rs @@ -161,7 +161,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { err.span_suggestion( assoc_name.span, "there is an associated type with a similar name", - suggested_name.to_string(), + suggested_name, Applicability::MaybeIncorrect, ); } else { diff --git a/compiler/rustc_typeck/src/astconv/mod.rs b/compiler/rustc_typeck/src/astconv/mod.rs index b5025b794bb0d..32bbfd7e33232 100644 --- a/compiler/rustc_typeck/src/astconv/mod.rs +++ b/compiler/rustc_typeck/src/astconv/mod.rs @@ -1589,7 +1589,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { err.span_suggestion( span.shrink_to_lo(), "you are looking for the module in `std`, not the primitive type", - "std::".to_string(), + "std::", Applicability::MachineApplicable, ); } else { @@ -1820,7 +1820,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { err.span_suggestion_verbose( args_span, &format!("{type_name} doesn't have generic parameters"), - String::new(), + "", Applicability::MachineApplicable, ); return; @@ -1946,7 +1946,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { err.span_suggestion( assoc_ident.span, "there is a variant with a similar name", - suggested_name.to_string(), + suggested_name, Applicability::MaybeIncorrect, ); } else { @@ -2422,7 +2422,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { err.span_suggestion_verbose( ident.span.shrink_to_hi().to(args.span_ext), "the `Self` type doesn't accept type parameters", - String::new(), + "", Applicability::MaybeIncorrect, ); } @@ -2473,7 +2473,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { err.span_suggestion_verbose( segment.ident.span.shrink_to_hi().to(args.span_ext), "the `Self` type doesn't accept type parameters", - String::new(), + "", Applicability::MachineApplicable, ); return; @@ -2549,7 +2549,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { err.span_suggestion_verbose( segment.ident.span.shrink_to_hi().to(args.span_ext), &format!("primitive type `{name}` doesn't have generic parameters"), - String::new(), + "", Applicability::MaybeIncorrect, ); } diff --git a/compiler/rustc_typeck/src/check/_match.rs b/compiler/rustc_typeck/src/check/_match.rs index 3632e14385fe9..bbdf1dae4a904 100644 --- a/compiler/rustc_typeck/src/check/_match.rs +++ b/compiler/rustc_typeck/src/check/_match.rs @@ -174,7 +174,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.tool_only_span_suggestion( semi_span, "remove this semicolon", - String::new(), + "", Applicability::MaybeIncorrect, ); }), diff --git a/compiler/rustc_typeck/src/check/callee.rs b/compiler/rustc_typeck/src/check/callee.rs index af1288b6523be..65b8b0b97ee46 100644 --- a/compiler/rustc_typeck/src/check/callee.rs +++ b/compiler/rustc_typeck/src/check/callee.rs @@ -319,7 +319,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion( start, "consider separating array elements with a comma", - ",".to_string(), + ",", Applicability::MaybeIncorrect, ); return true; @@ -406,7 +406,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { &format!( "`{path}` is a unit variant, you need to write it without the parentheses", ), - String::new(), + "", Applicability::MachineApplicable, ); } @@ -426,7 +426,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion( callee_expr.span.shrink_to_hi(), "consider using a semicolon here", - ";".to_owned(), + ";", Applicability::MaybeIncorrect, ); } diff --git a/compiler/rustc_typeck/src/check/compare_method.rs b/compiler/rustc_typeck/src/check/compare_method.rs index d4e17f27c92bb..974f5ffcbcc52 100644 --- a/compiler/rustc_typeck/src/check/compare_method.rs +++ b/compiler/rustc_typeck/src/check/compare_method.rs @@ -354,7 +354,7 @@ fn compare_predicate_entailment<'tcx>( diag.span_suggestion_verbose(sp, msg, sugg, ap); } hir::FnRetTy::Return(hir_ty) => { - let sugg = trait_sig.output().to_string(); + let sugg = trait_sig.output(); diag.span_suggestion(hir_ty.span, msg, sugg, ap); } }; @@ -365,7 +365,7 @@ fn compare_predicate_entailment<'tcx>( diag.span_suggestion( impl_err_span, "change the parameter type to match the trait", - trait_ty.to_string(), + trait_ty, Applicability::MachineApplicable, ); } diff --git a/compiler/rustc_typeck/src/check/expr.rs b/compiler/rustc_typeck/src/check/expr.rs index bf5bd744f6298..0f5b774210e30 100644 --- a/compiler/rustc_typeck/src/check/expr.rs +++ b/compiler/rustc_typeck/src/check/expr.rs @@ -864,7 +864,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion_verbose( expr.span.shrink_to_lo(), "you might have meant to use pattern destructuring", - "let ".to_string(), + "let ", Applicability::MachineApplicable, ); }); @@ -1042,7 +1042,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion_verbose( expr.span.shrink_to_lo(), "you might have meant to use pattern matching", - "let ".to_string(), + "let ", applicability, ); }; @@ -1051,7 +1051,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion_verbose( span, "you might have meant to compare for equality", - "==".to_string(), + "==", applicability, ); } @@ -1086,7 +1086,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion_verbose( lhs.span.shrink_to_lo(), "consider dereferencing here to assign to the mutably borrowed value", - "*".to_string(), + "*", Applicability::MachineApplicable, ); } @@ -1790,7 +1790,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion( range_start.span.shrink_to_hi(), &format!("to set the remaining fields{instead}, separate the last named field with a comma"), - ",".to_string(), + ",", Applicability::MaybeIncorrect, ); } @@ -1912,7 +1912,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion( field.ident.span, "a field with a similar name exists", - field_name.to_string(), + field_name, Applicability::MaybeIncorrect, ); } else { @@ -2158,7 +2158,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion_verbose( base.span.shrink_to_hi(), "consider `await`ing on the `Future` and access the field of its `Output`", - ".await".to_string(), + ".await", Applicability::MaybeIncorrect, ); } @@ -2358,7 +2358,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion( field.span, "a field with a similar name exists", - suggested_field_name.to_string(), + suggested_field_name, Applicability::MaybeIncorrect, ); } else { diff --git a/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs b/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs index c28c041e78dff..ea7ebdf91d012 100644 --- a/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs +++ b/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs @@ -1310,7 +1310,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion( span, "use curly brackets", - String::from("Self { /* fields */ }"), + "Self { /* fields */ }", Applicability::HasPlaceholders, ); } diff --git a/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs b/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs index 0d0cc9298394e..b9077059133a0 100644 --- a/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs +++ b/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs @@ -1458,14 +1458,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion_verbose( span_semi, "consider removing this semicolon and boxing the expression", - String::new(), + "", Applicability::HasPlaceholders, ); } else { err.span_suggestion_short( span_semi, "remove this semicolon", - String::new(), + "", Applicability::MachineApplicable, ); } diff --git a/compiler/rustc_typeck/src/check/fn_ctxt/suggestions.rs b/compiler/rustc_typeck/src/check/fn_ctxt/suggestions.rs index 99c766d54c8aa..b01d663f605d7 100644 --- a/compiler/rustc_typeck/src/check/fn_ctxt/suggestions.rs +++ b/compiler/rustc_typeck/src/check/fn_ctxt/suggestions.rs @@ -27,7 +27,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion_short( span.shrink_to_hi(), "consider using a semicolon here", - ";".to_string(), + ";", Applicability::MachineApplicable, ); } @@ -444,7 +444,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion( fn_name.span, "use `Box::pin` to pin and box this expression", - "Box::pin".to_string(), + "Box::pin", Applicability::MachineApplicable, ); true @@ -507,7 +507,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion( expression.span.shrink_to_hi(), "consider using a semicolon here", - ";".to_string(), + ";", Applicability::MachineApplicable, ); } diff --git a/compiler/rustc_typeck/src/check/method/suggest.rs b/compiler/rustc_typeck/src/check/method/suggest.rs index 5f6ddc1e1c94a..8880049371e58 100644 --- a/compiler/rustc_typeck/src/check/method/suggest.rs +++ b/compiler/rustc_typeck/src/check/method/suggest.rs @@ -330,7 +330,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion( span.shrink_to_lo(), "you are looking for the module in `std`, not the primitive type", - "std::".to_string(), + "std::", Applicability::MachineApplicable, ); } @@ -453,7 +453,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion_short( span, msg, - String::from("len"), + "len", Applicability::MachineApplicable, ); } else { @@ -893,7 +893,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { item_name.span, "because of the in-memory representation of `&str`, to obtain \ an `Iterator` over each of its codepoint use method `chars`", - String::from("chars"), + "chars", Applicability::MachineApplicable, ); } @@ -1006,7 +1006,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion( span, "there is a variant with a similar name", - suggestion.to_string(), + suggestion, Applicability::MaybeIncorrect, ); } @@ -1019,12 +1019,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let call_expr = self.tcx.hir().expect_expr(self.tcx.hir().get_parent_node(expr.hir_id)); if let Some(span) = call_expr.span.trim_start(expr.span) { - err.span_suggestion( - span, - msg, - String::new(), - Applicability::MachineApplicable, - ); + err.span_suggestion(span, msg, "", Applicability::MachineApplicable); fallback_span = false; } } @@ -1043,7 +1038,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { def_kind.article(), def_kind.descr(lev_candidate.def_id), ), - lev_candidate.name.to_string(), + lev_candidate.name, Applicability::MaybeIncorrect, ); } @@ -1164,7 +1159,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion( span, "remove the arguments", - String::new(), + "", Applicability::MaybeIncorrect, ); } @@ -1418,7 +1413,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { "use the `?` operator to extract the `{self_ty}` value, propagating \ {article} `{kind}::{variant}` value to the caller" ), - "?".to_owned(), + "?", Applicability::MachineApplicable, ); } else { @@ -1428,7 +1423,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { "consider using `{kind}::expect` to unwrap the `{self_ty}` value, \ panicking if the value is {article} `{kind}::{variant}`" ), - ".expect(\"REASON\")".to_owned(), + ".expect(\"REASON\")", Applicability::HasPlaceholders, ); } @@ -1632,7 +1627,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion_verbose( span.shrink_to_lo(), "consider `await`ing on the `Future` and calling the method on its `Output`", - "await.".to_string(), + "await.", Applicability::MaybeIncorrect, ); } diff --git a/compiler/rustc_typeck/src/check/op.rs b/compiler/rustc_typeck/src/check/op.rs index 17a1f619ee160..c2f97a5051c96 100644 --- a/compiler/rustc_typeck/src/check/op.rs +++ b/compiler/rustc_typeck/src/check/op.rs @@ -446,7 +446,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion_verbose( lhs_expr.span.shrink_to_lo(), msg, - "*".to_string(), + "*", rustc_errors::Applicability::MachineApplicable, ); } @@ -621,14 +621,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion_verbose( lhs_expr.span.until(lhs_inner_expr.span), rm_borrow_msg, - "".to_owned(), + "", Applicability::MachineApplicable ); } else { err.span_suggestion_verbose( lhs_expr.span.shrink_to_hi(), to_owned_msg, - ".to_owned()".to_owned(), + ".to_owned()", Applicability::MachineApplicable ); } diff --git a/compiler/rustc_typeck/src/check/pat.rs b/compiler/rustc_typeck/src/check/pat.rs index 5eba95b495dd7..649558e1f662a 100644 --- a/compiler/rustc_typeck/src/check/pat.rs +++ b/compiler/rustc_typeck/src/check/pat.rs @@ -1150,14 +1150,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion_verbose( all_fields_span, "use `..` to ignore all fields", - String::from(".."), + "..", Applicability::MaybeIncorrect, ); } else { err.span_suggestion_verbose( tail_span, "use `..` to ignore the rest of the fields", - String::from(", .."), + ", ..", Applicability::MaybeIncorrect, ); } @@ -1428,7 +1428,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion_verbose( sp_comma, "add `..` at the end of the field list to ignore all other fields", - sugg.to_string(), + sugg, Applicability::MachineApplicable, ); err.emit(); @@ -1502,7 +1502,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion( pat_field.ident.span, "a field with a similar name exists", - suggested_name.to_string(), + suggested_name, Applicability::MaybeIncorrect, ); @@ -1655,7 +1655,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion_verbose( field.span.shrink_to_hi(), "ignore the inaccessible and unused fields", - ", ..".to_string(), + ", ..", Applicability::MachineApplicable, ); } else { @@ -1670,7 +1670,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion_verbose( span, "ignore the inaccessible and unused fields", - " { .. }".to_string(), + " { .. }", Applicability::MachineApplicable, ); } diff --git a/compiler/rustc_typeck/src/check_unused.rs b/compiler/rustc_typeck/src/check_unused.rs index f28184c74d355..4a3cfa1ca376a 100644 --- a/compiler/rustc_typeck/src/check_unused.rs +++ b/compiler/rustc_typeck/src/check_unused.rs @@ -122,7 +122,7 @@ fn unused_crates_lint(tcx: TyCtxt<'_>) { .span_suggestion_short( span_with_attrs, "remove it", - String::new(), + "", Applicability::MachineApplicable, ) .emit(); diff --git a/compiler/rustc_typeck/src/collect.rs b/compiler/rustc_typeck/src/collect.rs index 5a70dc1e594a3..82f2adda3b043 100644 --- a/compiler/rustc_typeck/src/collect.rs +++ b/compiler/rustc_typeck/src/collect.rs @@ -1930,7 +1930,7 @@ fn infer_return_ty_for_fn_sig<'tcx>( diag.span_suggestion( ty.span, "replace with the correct return type", - ret_ty.to_string(), + ret_ty, Applicability::MachineApplicable, ); } else if matches!(ret_ty.kind(), ty::FnDef(..)) { @@ -1939,7 +1939,7 @@ fn infer_return_ty_for_fn_sig<'tcx>( diag.span_suggestion( ty.span, "replace with the correct return type", - fn_sig.to_string(), + fn_sig, Applicability::MachineApplicable, ); } @@ -2584,7 +2584,7 @@ fn from_target_feature( let Some(list) = attr.meta_item_list() else { return }; let bad_item = |span| { let msg = "malformed `target_feature` attribute input"; - let code = "enable = \"..\"".to_owned(); + let code = "enable = \"..\""; tcx.sess .struct_span_err(span, msg) .span_suggestion(span, "must be of the form", code, Applicability::HasPlaceholders) diff --git a/compiler/rustc_typeck/src/collect/type_of.rs b/compiler/rustc_typeck/src/collect/type_of.rs index 451a953691bae..d125b14feda7b 100644 --- a/compiler/rustc_typeck/src/collect/type_of.rs +++ b/compiler/rustc_typeck/src/collect/type_of.rs @@ -756,7 +756,7 @@ fn infer_placeholder_type<'a>( diag.span_suggestion( span, "replace with the correct type", - sugg_ty.to_string(), + sugg_ty, Applicability::MaybeIncorrect, ); } else { diff --git a/compiler/rustc_typeck/src/structured_errors/wrong_number_of_generic_args.rs b/compiler/rustc_typeck/src/structured_errors/wrong_number_of_generic_args.rs index c440e93fe0af1..3224864e9b1fe 100644 --- a/compiler/rustc_typeck/src/structured_errors/wrong_number_of_generic_args.rs +++ b/compiler/rustc_typeck/src/structured_errors/wrong_number_of_generic_args.rs @@ -715,7 +715,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { err.span_suggestion( span_redundant_lt_args, &msg_lifetimes, - String::new(), + "", Applicability::MaybeIncorrect, ); }; @@ -757,7 +757,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { err.span_suggestion( span_redundant_type_or_const_args, &msg_types_or_consts, - String::new(), + "", Applicability::MaybeIncorrect, ); }; @@ -797,7 +797,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { if self.gen_args.parenthesized { "parenthetical " } else { "" }, ); - err.span_suggestion(span, &msg, String::new(), Applicability::MaybeIncorrect); + err.span_suggestion(span, &msg, "", Applicability::MaybeIncorrect); } else if redundant_lifetime_args && redundant_type_or_const_args { remove_lifetime_args(err); remove_type_or_const_args(err); diff --git a/src/librustdoc/passes/check_code_block_syntax.rs b/src/librustdoc/passes/check_code_block_syntax.rs index 9cc006b10ffc4..e3b349af661a1 100644 --- a/src/librustdoc/passes/check_code_block_syntax.rs +++ b/src/librustdoc/passes/check_code_block_syntax.rs @@ -122,7 +122,7 @@ impl<'a, 'tcx> SyntaxChecker<'a, 'tcx> { diag.span_suggestion( sp.from_inner(InnerSpan::new(0, 3)).shrink_to_hi(), explanation, - String::from("text"), + "text", Applicability::MachineApplicable, ); } diff --git a/src/test/rustdoc-ui/intra-doc/disambiguator-mismatch.stderr b/src/test/rustdoc-ui/intra-doc/disambiguator-mismatch.stderr index ad9102c506f7f..ee35749ce7f43 100644 --- a/src/test/rustdoc-ui/intra-doc/disambiguator-mismatch.stderr +++ b/src/test/rustdoc-ui/intra-doc/disambiguator-mismatch.stderr @@ -68,7 +68,7 @@ help: to link to the macro, add an exclamation mark | LL - /// Link to [derive@m] LL + /// Link to [m!] - | + | error: unresolved link to `m` --> $DIR/disambiguator-mismatch.rs:46:14 @@ -124,7 +124,7 @@ help: to link to the constant, prefix with `const@` | LL - /// Link to [c()] LL + /// Link to [const@c] - | + | error: incompatible link kind for `f` --> $DIR/disambiguator-mismatch.rs:72:14 @@ -136,7 +136,7 @@ help: to link to the function, add parentheses | LL - /// Link to [const@f] LL + /// Link to [f()] - | + | error: unresolved link to `std` --> $DIR/disambiguator-mismatch.rs:77:14 diff --git a/src/test/rustdoc-ui/intra-doc/errors.stderr b/src/test/rustdoc-ui/intra-doc/errors.stderr index e1ff3740bf685..9a1896fb0cd63 100644 --- a/src/test/rustdoc-ui/intra-doc/errors.stderr +++ b/src/test/rustdoc-ui/intra-doc/errors.stderr @@ -98,7 +98,7 @@ help: to link to the associated function, add parentheses | LL - /// [type@Vec::into_iter] LL + /// [Vec::into_iter()] - | + | error: unresolved link to `S` --> $DIR/errors.rs:68:6 @@ -110,7 +110,7 @@ help: to link to the struct, prefix with `struct@` | LL - /// [S!] LL + /// [struct@S] - | + | error: unresolved link to `S::h` --> $DIR/errors.rs:78:6 @@ -122,7 +122,7 @@ help: to link to the associated function, add parentheses | LL - /// [type@S::h] LL + /// [S::h()] - | + | error: unresolved link to `T::g` --> $DIR/errors.rs:86:6 @@ -134,7 +134,7 @@ help: to link to the associated function, add parentheses | LL - /// [type@T::g] LL + /// [T::g()] - | + | error: unresolved link to `T::h` --> $DIR/errors.rs:91:6 diff --git a/src/test/rustdoc-ui/test-compile-fail1.stderr b/src/test/rustdoc-ui/test-compile-fail1.stderr index 2b38ba9e973d1..72915e46becd3 100644 --- a/src/test/rustdoc-ui/test-compile-fail1.stderr +++ b/src/test/rustdoc-ui/test-compile-fail1.stderr @@ -3,7 +3,7 @@ error[E0428]: the name `f` is defined multiple times | 6 | pub fn f() {} | ---------- previous definition of the value `f` here -7 | +7 | 8 | pub fn f() {} | ^^^^^^^^^^ `f` redefined here | diff --git a/src/test/ui-fulldeps/internal-lints/diagnostics.rs b/src/test/ui-fulldeps/internal-lints/diagnostics.rs new file mode 100644 index 0000000000000..817d8531da905 --- /dev/null +++ b/src/test/ui-fulldeps/internal-lints/diagnostics.rs @@ -0,0 +1,73 @@ +// compile-flags: -Z unstable-options + +#![crate_type = "lib"] +#![feature(rustc_private)] +#![deny(rustc::untranslatable_diagnostic)] +#![deny(rustc::diagnostic_outside_of_impl)] + +extern crate rustc_errors; +extern crate rustc_macros; +extern crate rustc_session; +extern crate rustc_span; + +use rustc_errors::{AddSubdiagnostic, Diagnostic, DiagnosticBuilder, ErrorGuaranteed, fluent}; +use rustc_macros::{SessionDiagnostic, SessionSubdiagnostic}; +use rustc_session::{parse::ParseSess, SessionDiagnostic}; +use rustc_span::Span; + +#[derive(SessionDiagnostic)] +#[error(slug = "parser-expect-path")] +struct DeriveSessionDiagnostic { + #[primary_span] + span: Span, +} + +#[derive(SessionSubdiagnostic)] +#[note(slug = "note")] +struct Note { + #[primary_span] + span: Span, +} + +pub struct UntranslatableInSessionDiagnostic; + +impl<'a> SessionDiagnostic<'a, ErrorGuaranteed> for UntranslatableInSessionDiagnostic { + fn into_diagnostic(self, sess: &'a ParseSess) -> DiagnosticBuilder<'a, ErrorGuaranteed> { + sess.struct_err("untranslatable diagnostic") + //~^ ERROR diagnostics should be created using translatable messages + } +} + +pub struct TranslatableInSessionDiagnostic; + +impl<'a> SessionDiagnostic<'a, ErrorGuaranteed> for TranslatableInSessionDiagnostic { + fn into_diagnostic(self, sess: &'a ParseSess) -> DiagnosticBuilder<'a, ErrorGuaranteed> { + sess.struct_err(fluent::parser::expect_path) + } +} + +pub struct UntranslatableInAddSubdiagnostic; + +impl AddSubdiagnostic for UntranslatableInAddSubdiagnostic { + fn add_to_diagnostic(self, diag: &mut Diagnostic) { + diag.note("untranslatable diagnostic"); + //~^ ERROR diagnostics should be created using translatable messages + } +} + +pub struct TranslatableInAddSubdiagnostic; + +impl AddSubdiagnostic for TranslatableInAddSubdiagnostic { + fn add_to_diagnostic(self, diag: &mut Diagnostic) { + diag.note(fluent::typeck::note); + } +} + +pub fn make_diagnostics<'a>(sess: &'a ParseSess) { + let _diag = sess.struct_err(fluent::parser::expect_path); + //~^ ERROR diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls + + let _diag = sess.struct_err("untranslatable diagnostic"); + //~^ ERROR diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls + //~^^ ERROR diagnostics should be created using translatable messages +} diff --git a/src/test/ui-fulldeps/internal-lints/diagnostics.stderr b/src/test/ui-fulldeps/internal-lints/diagnostics.stderr new file mode 100644 index 0000000000000..bae78ffdc021b --- /dev/null +++ b/src/test/ui-fulldeps/internal-lints/diagnostics.stderr @@ -0,0 +1,44 @@ +error: diagnostics should be created using translatable messages + --> $DIR/diagnostics.rs:36:14 + | +LL | sess.struct_err("untranslatable diagnostic") + | ^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/diagnostics.rs:5:9 + | +LL | #![deny(rustc::untranslatable_diagnostic)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: diagnostics should be created using translatable messages + --> $DIR/diagnostics.rs:53:14 + | +LL | diag.note("untranslatable diagnostic"); + | ^^^^ + +error: diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls + --> $DIR/diagnostics.rs:67:22 + | +LL | let _diag = sess.struct_err(fluent::parser::expect_path); + | ^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/diagnostics.rs:6:9 + | +LL | #![deny(rustc::diagnostic_outside_of_impl)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls + --> $DIR/diagnostics.rs:70:22 + | +LL | let _diag = sess.struct_err("untranslatable diagnostic"); + | ^^^^^^^^^^ + +error: diagnostics should be created using translatable messages + --> $DIR/diagnostics.rs:70:22 + | +LL | let _diag = sess.struct_err("untranslatable diagnostic"); + | ^^^^^^^^^^ + +error: aborting due to 5 previous errors + diff --git a/src/test/ui-fulldeps/internal-lints/diagnostics_incorrect.rs b/src/test/ui-fulldeps/internal-lints/diagnostics_incorrect.rs new file mode 100644 index 0000000000000..99f99ffcd3597 --- /dev/null +++ b/src/test/ui-fulldeps/internal-lints/diagnostics_incorrect.rs @@ -0,0 +1,15 @@ +// compile-flags: -Z unstable-options + +#![feature(rustc_attrs)] + +#[rustc_lint_diagnostics] +//~^ ERROR attribute should be applied to a function +struct Foo; + +impl Foo { + #[rustc_lint_diagnostics(a)] + //~^ ERROR malformed `rustc_lint_diagnostics` + fn bar() {} +} + +fn main() {} diff --git a/src/test/ui-fulldeps/internal-lints/diagnostics_incorrect.stderr b/src/test/ui-fulldeps/internal-lints/diagnostics_incorrect.stderr new file mode 100644 index 0000000000000..46c206f3bf9fb --- /dev/null +++ b/src/test/ui-fulldeps/internal-lints/diagnostics_incorrect.stderr @@ -0,0 +1,17 @@ +error: malformed `rustc_lint_diagnostics` attribute input + --> $DIR/diagnostics_incorrect.rs:10:5 + | +LL | #[rustc_lint_diagnostics(a)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_lint_diagnostics]` + +error: attribute should be applied to a function + --> $DIR/diagnostics_incorrect.rs:5:1 + | +LL | #[rustc_lint_diagnostics] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | struct Foo; + | ----------- not a function + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/argument-suggestions/issue-97484.stderr b/src/test/ui/argument-suggestions/issue-97484.stderr index 4c461633121bf..62ddabea0d72d 100644 --- a/src/test/ui/argument-suggestions/issue-97484.stderr +++ b/src/test/ui/argument-suggestions/issue-97484.stderr @@ -16,7 +16,7 @@ help: consider removing the `` | LL - foo(&&A, B, C, D, E, F, G); LL + foo(&&A, B, C, D, E, F, G); - | + | help: remove the extra arguments | LL | foo(&&A, D, {&E}, G); diff --git a/src/test/ui/asm/type-check-1.stderr b/src/test/ui/asm/type-check-1.stderr index 52d814ce6829c..5a997b47d73eb 100644 --- a/src/test/ui/asm/type-check-1.stderr +++ b/src/test/ui/asm/type-check-1.stderr @@ -58,7 +58,7 @@ help: consider removing the borrow | LL - asm!("{}", const &0); LL + asm!("{}", const 0); - | + | error: invalid asm output --> $DIR/type-check-1.rs:15:29 diff --git a/src/test/ui/associated-type-bounds/type-alias.stderr b/src/test/ui/associated-type-bounds/type-alias.stderr index 6bde9d1a50df4..c22b80b889edc 100644 --- a/src/test/ui/associated-type-bounds/type-alias.stderr +++ b/src/test/ui/associated-type-bounds/type-alias.stderr @@ -9,7 +9,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - type _TaWhere1 where T: Iterator = T; LL + type _TaWhere1 = T; - | + | warning: where clauses are not enforced in type aliases --> $DIR/type-alias.rs:6:25 @@ -21,7 +21,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - type _TaWhere2 where T: Iterator = T; LL + type _TaWhere2 = T; - | + | warning: where clauses are not enforced in type aliases --> $DIR/type-alias.rs:7:25 @@ -33,7 +33,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - type _TaWhere3 where T: Iterator = T; LL + type _TaWhere3 = T; - | + | warning: where clauses are not enforced in type aliases --> $DIR/type-alias.rs:8:25 @@ -45,7 +45,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - type _TaWhere4 where T: Iterator = T; LL + type _TaWhere4 = T; - | + | warning: where clauses are not enforced in type aliases --> $DIR/type-alias.rs:9:25 @@ -57,7 +57,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - type _TaWhere5 where T: Iterator Into<&'a u8>> = T; LL + type _TaWhere5 = T; - | + | warning: where clauses are not enforced in type aliases --> $DIR/type-alias.rs:10:25 @@ -69,7 +69,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - type _TaWhere6 where T: Iterator> = T; LL + type _TaWhere6 = T; - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias.rs:12:20 @@ -81,7 +81,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type _TaInline1> = T; LL + type _TaInline1 = T; - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias.rs:13:20 @@ -93,7 +93,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type _TaInline2> = T; LL + type _TaInline2 = T; - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias.rs:14:20 @@ -105,7 +105,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type _TaInline3> = T; LL + type _TaInline3 = T; - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias.rs:15:20 @@ -117,7 +117,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type _TaInline4> = T; LL + type _TaInline4 = T; - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias.rs:16:20 @@ -129,7 +129,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type _TaInline5 Into<&'a u8>>> = T; LL + type _TaInline5 = T; - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias.rs:17:20 @@ -141,7 +141,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type _TaInline6>> = T; LL + type _TaInline6 = T; - | + | warning: 12 warnings emitted diff --git a/src/test/ui/associated-types/defaults-specialization.stderr b/src/test/ui/associated-types/defaults-specialization.stderr index aa8841fbaae08..2d61b2a647bfd 100644 --- a/src/test/ui/associated-types/defaults-specialization.stderr +++ b/src/test/ui/associated-types/defaults-specialization.stderr @@ -30,7 +30,7 @@ error[E0053]: method `make` has an incompatible type for trait | LL | default type Ty = bool; | ----------------------- expected this associated type -LL | +LL | LL | fn make() -> bool { true } | ^^^^ | | @@ -50,7 +50,7 @@ error[E0308]: mismatched types | LL | type Ty = u8; | ------------- associated type defaults can't be assumed inside the trait defining them -LL | +LL | LL | fn make() -> Self::Ty { | -------- expected `::Ty` because of return type LL | 0u8 @@ -77,7 +77,7 @@ error[E0308]: mismatched types | LL | default type Ty = bool; | ----------------------- expected this associated type -LL | +LL | LL | fn make() -> Self::Ty { true } | -------- ^^^^ expected associated type, found `bool` | | diff --git a/src/test/ui/associated-types/issue-22560.stderr b/src/test/ui/associated-types/issue-22560.stderr index c5c70f226fdf6..71655d54baa2c 100644 --- a/src/test/ui/associated-types/issue-22560.stderr +++ b/src/test/ui/associated-types/issue-22560.stderr @@ -5,7 +5,7 @@ LL | / trait Sub { LL | | type Output; LL | | } | |_- type parameter `Rhs` must be specified for this -LL | +LL | LL | type Test = dyn Add + Sub; | ^^^ help: set the type parameter to the desired type: `Sub` | diff --git a/src/test/ui/associated-types/issue-36499.stderr b/src/test/ui/associated-types/issue-36499.stderr index 610798d880f0a..80e42b61d2057 100644 --- a/src/test/ui/associated-types/issue-36499.stderr +++ b/src/test/ui/associated-types/issue-36499.stderr @@ -8,7 +8,7 @@ help: try removing the `+` | LL - 2 + +2; LL + 2 + 2; - | + | error: aborting due to previous error diff --git a/src/test/ui/async-await/issue-67765-async-diagnostic.stderr b/src/test/ui/async-await/issue-67765-async-diagnostic.stderr index 832b736ad8642..492e06fbbc06c 100644 --- a/src/test/ui/async-await/issue-67765-async-diagnostic.stderr +++ b/src/test/ui/async-await/issue-67765-async-diagnostic.stderr @@ -3,7 +3,7 @@ error[E0515]: cannot return value referencing local variable `s` | LL | let b = &s[..]; | - `s` is borrowed here -LL | +LL | LL | Err(b)?; | ^^^^^^^ returns a value referencing data owned by the current function diff --git a/src/test/ui/async-await/issue-70594.stderr b/src/test/ui/async-await/issue-70594.stderr index a159edd51187f..a88bce6cc99a9 100644 --- a/src/test/ui/async-await/issue-70594.stderr +++ b/src/test/ui/async-await/issue-70594.stderr @@ -31,7 +31,7 @@ help: remove the `.await` | LL - [1; ().await]; LL + [1; ()]; - | + | error: aborting due to 4 previous errors diff --git a/src/test/ui/async-await/issues/issue-54752-async-block.stderr b/src/test/ui/async-await/issues/issue-54752-async-block.stderr index e3ed0b53356d4..8cc849dd98544 100644 --- a/src/test/ui/async-await/issues/issue-54752-async-block.stderr +++ b/src/test/ui/async-await/issues/issue-54752-async-block.stderr @@ -9,7 +9,7 @@ help: remove these parentheses | LL - fn main() { let _a = (async { }); } LL + fn main() { let _a = async { }; } - | + | warning: 1 warning emitted diff --git a/src/test/ui/async-await/issues/issue-62009-1.stderr b/src/test/ui/async-await/issues/issue-62009-1.stderr index 3d80c34942c1b..ccdd9c57a0f55 100644 --- a/src/test/ui/async-await/issues/issue-62009-1.stderr +++ b/src/test/ui/async-await/issues/issue-62009-1.stderr @@ -37,7 +37,7 @@ help: remove the `.await` | LL - (|_| 2333).await; LL + (|_| 2333); - | + | error: aborting due to 4 previous errors diff --git a/src/test/ui/async-await/unnecessary-await.stderr b/src/test/ui/async-await/unnecessary-await.stderr index c3d2a6e7b1e1b..e7e61c2baaf04 100644 --- a/src/test/ui/async-await/unnecessary-await.stderr +++ b/src/test/ui/async-await/unnecessary-await.stderr @@ -13,7 +13,7 @@ help: remove the `.await` | LL - boo().await; LL + boo(); - | + | help: alternatively, consider making `fn boo` asynchronous | LL | async fn boo() {} diff --git a/src/test/ui/blind/blind-item-item-shadow.stderr b/src/test/ui/blind/blind-item-item-shadow.stderr index 12b583ea3e9c0..7f9e800892918 100644 --- a/src/test/ui/blind/blind-item-item-shadow.stderr +++ b/src/test/ui/blind/blind-item-item-shadow.stderr @@ -3,7 +3,7 @@ error[E0255]: the name `foo` is defined multiple times | LL | mod foo { pub mod foo { } } | ------- previous definition of the module `foo` here -LL | +LL | LL | use foo::foo; | ^^^^^^^^ `foo` reimported here | diff --git a/src/test/ui/block-result/issue-5500.stderr b/src/test/ui/block-result/issue-5500.stderr index 7081b5106ff96..211a6052864e8 100644 --- a/src/test/ui/block-result/issue-5500.stderr +++ b/src/test/ui/block-result/issue-5500.stderr @@ -12,7 +12,7 @@ help: consider removing the borrow | LL - &panic!() LL + panic!() - | + | error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrow-raw-address-of-borrowed.stderr b/src/test/ui/borrowck/borrow-raw-address-of-borrowed.stderr index ff461b748be88..6f7b7e08070bf 100644 --- a/src/test/ui/borrowck/borrow-raw-address-of-borrowed.stderr +++ b/src/test/ui/borrowck/borrow-raw-address-of-borrowed.stderr @@ -3,10 +3,10 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta | LL | let y = &x; | -- immutable borrow occurs here -LL | +LL | LL | let q = &raw mut x; | ^^^^^^^^^^ mutable borrow occurs here -LL | +LL | LL | drop(y); | - immutable borrow later used here @@ -15,7 +15,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta | LL | let y = &mut x; | ------ mutable borrow occurs here -LL | +LL | LL | let p = &raw const x; | ^^^^^^^^^^^^ immutable borrow occurs here ... @@ -30,7 +30,7 @@ LL | let y = &mut x; ... LL | let q = &raw mut x; | ^^^^^^^^^^ second mutable borrow occurs here -LL | +LL | LL | drop(y); | - first borrow later used here diff --git a/src/test/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr b/src/test/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr index 31af38507c7d7..5963dab9f4aab 100644 --- a/src/test/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr +++ b/src/test/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | LL | let x = &0; | -- help: consider changing this to be a mutable reference: `&mut 0` -LL | +LL | LL | let q = &raw mut *x; | ^^^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable @@ -12,7 +12,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer | LL | let x = &0 as *const i32; | -- help: consider changing this to be a mutable pointer: `&mut 0` -LL | +LL | LL | let q = &raw mut *x; | ^^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable diff --git a/src/test/ui/borrowck/borrow-tuple-fields.stderr b/src/test/ui/borrowck/borrow-tuple-fields.stderr index ad628abcbfc2e..befa751a6007b 100644 --- a/src/test/ui/borrowck/borrow-tuple-fields.stderr +++ b/src/test/ui/borrowck/borrow-tuple-fields.stderr @@ -5,7 +5,7 @@ LL | let r = &x.0; | ---- borrow of `x.0` occurs here LL | let y = x; | ^ move out of `x` occurs here -LL | +LL | LL | r.use_ref(); | ----------- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr b/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr index 93f1d8c525863..b80174ae6872e 100644 --- a/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr +++ b/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr @@ -3,10 +3,10 @@ error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immuta | LL | let q: &isize = &p[0]; | - immutable borrow occurs here -LL | +LL | LL | p[0] = 5; | ^ mutable borrow occurs here -LL | +LL | LL | println!("{}", *q); | -- immutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr index 1d8d04c9181c2..24cc4933ef1b0 100644 --- a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr +++ b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `p` because it was mutably borrowed | LL | let q = &mut p; | ------ borrow of `p` occurs here -LL | +LL | LL | p + 3; | ^ use of borrowed `p` ... @@ -18,7 +18,7 @@ LL | let q = &mut p; ... LL | p.times(3); | ^^^^^^^^^^ immutable borrow occurs here -LL | +LL | LL | *q + 3; // OK to use the new alias `q` | -- mutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr.stderr index 74cad575d276a..1d6bd4e2ec8d8 100644 --- a/src/test/ui/borrowck/borrowck-loan-rcvr.stderr +++ b/src/test/ui/borrowck/borrowck-loan-rcvr.stderr @@ -18,7 +18,7 @@ LL | let l = &mut p; | ------ mutable borrow occurs here LL | p.impurem(); | ^^^^^^^^^^^ immutable borrow occurs here -LL | +LL | LL | l.x += 1; | -------- mutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr index b305e3c0a163a..f833abcc02acf 100644 --- a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr +++ b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `*a` because it is borrowed | LL | let b = &a; | -- borrow of `a` occurs here -LL | +LL | LL | let z = *a; | ^^ move out of `*a` occurs here LL | b.use_ref(); diff --git a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.stderr b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.stderr index edd597fe30bd2..9509ebb7cde9a 100644 --- a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.stderr +++ b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `t` | LL | let t: Box<_> = Box::new(3); | - move occurs because `t` has type `Box`, which does not implement the `Copy` trait -LL | +LL | LL | call_f(move|| { *t + 1 }); | ------ -- variable moved due to use in closure | | diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-index.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.stderr index bacad399ebeb5..e01c26adcfc2d 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-move-index.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `s` because it is borrowed | LL | let rs = &mut s; | ------ borrow of `s` occurs here -LL | +LL | LL | println!("{}", f[s]); | ^ move out of `s` occurs here ... diff --git a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr index 0432aaf51d29f..b8ac7a3a4469d 100644 --- a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr +++ b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr @@ -23,7 +23,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im | LL | let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s; | ------------- immutable borrow occurs here -LL | +LL | LL | let [_, _, ref mut from_begin2, ..] = *s; | ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[from_begin2, from_end1, from_end3, from_end4]); @@ -45,7 +45,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im | LL | let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s; | --------------- immutable borrow occurs here -LL | +LL | LL | let [.., ref mut from_end3, _, _] = *s; | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[from_begin0, from_begin1, from_begin3, from_end3]); diff --git a/src/test/ui/borrowck/borrowck-union-borrow.stderr b/src/test/ui/borrowck/borrowck-union-borrow.stderr index 395cd0b4855ab..090c7b6b51a31 100644 --- a/src/test/ui/borrowck/borrowck-union-borrow.stderr +++ b/src/test/ui/borrowck/borrowck-union-borrow.stderr @@ -99,7 +99,7 @@ LL | let ra = &mut u.a; | -------- borrow of `u.a` occurs here LL | let b = u.b; | ^^^ use of borrowed `u.a` -LL | +LL | LL | drop(ra); | -- borrow later used here diff --git a/src/test/ui/borrowck/copy-suggestion-region-vid.stderr b/src/test/ui/borrowck/copy-suggestion-region-vid.stderr index f03cdd84d75f8..1685acf87184b 100644 --- a/src/test/ui/borrowck/copy-suggestion-region-vid.stderr +++ b/src/test/ui/borrowck/copy-suggestion-region-vid.stderr @@ -3,7 +3,7 @@ error[E0382]: borrow of moved value: `helpers` | LL | let helpers = [vec![], vec![]]; | ------- move occurs because `helpers` has type `[Vec<&i64>; 2]`, which does not implement the `Copy` trait -LL | +LL | LL | HelperStruct { helpers, is_empty: helpers[0].is_empty() } | ------- ^^^^^^^^^^^^^^^^^^^^^ value borrowed here after move | | diff --git a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.stderr b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.stderr index 9b1d6fa7d3575..57803247ba8d0 100644 --- a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.stderr +++ b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.stderr @@ -5,7 +5,7 @@ LL | let res = (|| (|| &greeting)())(); | -- -------- borrow occurs due to use in closure | | | borrow of `greeting` occurs here -LL | +LL | LL | greeting = "DEALLOCATED".to_string(); | ^^^^^^^^ assignment to borrowed `greeting` occurs here ... diff --git a/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr b/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr index 2ffe7ff64133d..7782047574ce8 100644 --- a/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr +++ b/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr @@ -13,7 +13,7 @@ help: try removing `&mut` here | LL - h(&mut b); LL + h(b); - | + | error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable --> $DIR/mut-borrow-of-mut-ref.rs:11:12 @@ -30,7 +30,7 @@ help: try removing `&mut` here | LL - g(&mut &mut b); LL + g(&mut b); - | + | error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable --> $DIR/mut-borrow-of-mut-ref.rs:18:12 @@ -47,7 +47,7 @@ help: try removing `&mut` here | LL - h(&mut &mut b); LL + h(&mut b); - | + | error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable --> $DIR/mut-borrow-of-mut-ref.rs:35:5 diff --git a/src/test/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr b/src/test/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr index a6c65421d91ba..a57ceb8473945 100644 --- a/src/test/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr +++ b/src/test/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `i` because it was mutably borrowed | LL | /*1*/ let p = &mut i; // (reservation of `i` starts here) | ------ borrow of `i` occurs here -LL | +LL | LL | /*2*/ let j = i; // OK: `i` is only reserved here | ^ use of borrowed `i` ... diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr index e4dc4dc5999e2..9e0f68b654338 100644 --- a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr +++ b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immuta | LL | let shared = &v; | -- immutable borrow occurs here -LL | +LL | LL | v.extend(shared); | ^^------^^^^^^^^ | | | diff --git a/src/test/ui/borrowck/two-phase-sneaky.stderr b/src/test/ui/borrowck/two-phase-sneaky.stderr index 0dbed98b8414b..117d7ceaeefe0 100644 --- a/src/test/ui/borrowck/two-phase-sneaky.stderr +++ b/src/test/ui/borrowck/two-phase-sneaky.stderr @@ -5,7 +5,7 @@ LL | v[0].push_str({ | - -------- first borrow later used by call | | | first mutable borrow occurs here -LL | +LL | LL | v.push(format!("foo")); | ^^^^^^^^^^^^^^^^^^^^^^ second mutable borrow occurs here diff --git a/src/test/ui/cast/issue-89497.stderr b/src/test/ui/cast/issue-89497.stderr index 3726f8a41015e..bf3c3537fade1 100644 --- a/src/test/ui/cast/issue-89497.stderr +++ b/src/test/ui/cast/issue-89497.stderr @@ -8,7 +8,7 @@ help: consider borrowing the value | LL - let _reference: &'static i32 = unsafe { pointer as *const i32 as &'static i32 }; LL + let _reference: &'static i32 = unsafe { &*(pointer as *const i32) }; - | + | error: aborting due to previous error diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/mut_ref.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/mut_ref.stderr index dbf8523a3bae1..481d7e58529ee 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/mut_ref.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/mut_ref.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `**ref_mref_x` as mutable, as it is behind a `&` ref | LL | let ref_mref_x = &mref_x; | ------- help: consider changing this to be a mutable reference: `&mut mref_x` -LL | +LL | LL | let c = || { | ^^ `ref_mref_x` is a `&` reference, so the data it refers to cannot be borrowed as mutable LL | diff --git a/src/test/ui/closures/issue-6801.stderr b/src/test/ui/closures/issue-6801.stderr index 48c6acd1f49e4..6a40db0d51d4b 100644 --- a/src/test/ui/closures/issue-6801.stderr +++ b/src/test/ui/closures/issue-6801.stderr @@ -5,7 +5,7 @@ LL | let sq = || { *x * *x }; | -- -- borrow occurs due to use in closure | | | borrow of `x` occurs here -LL | +LL | LL | twice(x); | ^ move out of `x` occurs here LL | invoke(sq); diff --git a/src/test/ui/closures/issue-82438-mut-without-upvar.stderr b/src/test/ui/closures/issue-82438-mut-without-upvar.stderr index 06e2b5d0c1bce..802284b265821 100644 --- a/src/test/ui/closures/issue-82438-mut-without-upvar.stderr +++ b/src/test/ui/closures/issue-82438-mut-without-upvar.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `c` as mutable, as it is not declared as mutable | LL | let c = |a, b, c, d| {}; | - help: consider changing this to be mutable: `mut c` -LL | +LL | LL | A.f(participant_name, &mut c); | ^^^^^^ cannot borrow as mutable diff --git a/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr index 5295170cd8bf3..1110197734f7a 100644 --- a/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr +++ b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr @@ -3,7 +3,7 @@ error[E0751]: found both positive and negative implementation of trait `std::mar | LL | unsafe impl Send for TestType {} | ------------------------------------------------------ positive implementation here -LL | +LL | LL | impl !Send for TestType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ negative implementation here diff --git a/src/test/ui/coherence/coherence-fn-implied-bounds.stderr b/src/test/ui/coherence/coherence-fn-implied-bounds.stderr index c8accc9974791..8612ce60d1875 100644 --- a/src/test/ui/coherence/coherence-fn-implied-bounds.stderr +++ b/src/test/ui/coherence/coherence-fn-implied-bounds.stderr @@ -3,7 +3,7 @@ error: conflicting implementations of trait `Trait` for type `for<'a, 'b> fn(&'a | LL | impl Trait for for<'a, 'b> fn(&'a &'b u32, &'b &'a u32) -> &'b u32 {} | ------------------------------------------------------------------ first implementation here -LL | +LL | LL | impl Trait for for<'c> fn(&'c &'c u32, &'c &'c u32) -> &'c u32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a &'b u32, &'b &'a u32) -> &'b u32` | diff --git a/src/test/ui/coherence/coherence-free-vs-bound-region.stderr b/src/test/ui/coherence/coherence-free-vs-bound-region.stderr index c249fa43c3b60..af18655b06fcd 100644 --- a/src/test/ui/coherence/coherence-free-vs-bound-region.stderr +++ b/src/test/ui/coherence/coherence-free-vs-bound-region.stderr @@ -3,7 +3,7 @@ error: conflicting implementations of trait `TheTrait` for type `fn(&u8)` | LL | impl<'a> TheTrait for fn(&'a u8) {} | -------------------------------- first implementation here -LL | +LL | LL | impl TheTrait for fn(&u8) { | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `fn(&u8)` | diff --git a/src/test/ui/coherence/coherence-projection-conflict-orphan.stderr b/src/test/ui/coherence/coherence-projection-conflict-orphan.stderr index 9efb5dc75f4f0..8e7d4589e6140 100644 --- a/src/test/ui/coherence/coherence-projection-conflict-orphan.stderr +++ b/src/test/ui/coherence/coherence-projection-conflict-orphan.stderr @@ -3,7 +3,7 @@ error[E0119]: conflicting implementations of trait `Foo` for type `i32` | LL | impl Foo for i32 { } | --------------------- first implementation here -LL | +LL | LL | impl Foo for A { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` | diff --git a/src/test/ui/coherence/coherence-projection-conflict-ty-param.stderr b/src/test/ui/coherence/coherence-projection-conflict-ty-param.stderr index 85d3d358f83cf..6492747bb261d 100644 --- a/src/test/ui/coherence/coherence-projection-conflict-ty-param.stderr +++ b/src/test/ui/coherence/coherence-projection-conflict-ty-param.stderr @@ -3,7 +3,7 @@ error[E0119]: conflicting implementations of trait `Foo<_>` for type `std::optio | LL | impl > Foo

for Option {} | ---------------------------------------- first implementation here -LL | +LL | LL | impl Foo for Option { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::option::Option<_>` diff --git a/src/test/ui/coherence/coherence-projection-conflict.stderr b/src/test/ui/coherence/coherence-projection-conflict.stderr index e7d1fb2934661..7d2c584c37067 100644 --- a/src/test/ui/coherence/coherence-projection-conflict.stderr +++ b/src/test/ui/coherence/coherence-projection-conflict.stderr @@ -3,7 +3,7 @@ error[E0119]: conflicting implementations of trait `Foo` for type `i32` | LL | impl Foo for i32 { } | --------------------- first implementation here -LL | +LL | LL | impl Foo for A { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` diff --git a/src/test/ui/coherence/coherence-subtyping.stderr b/src/test/ui/coherence/coherence-subtyping.stderr index 6f95f0a06b5fa..25d8c875653d0 100644 --- a/src/test/ui/coherence/coherence-subtyping.stderr +++ b/src/test/ui/coherence/coherence-subtyping.stderr @@ -3,7 +3,7 @@ warning: conflicting implementations of trait `TheTrait` for type `for<'a, 'b> f | LL | impl TheTrait for for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8 {} | ---------------------------------------------------------- first implementation here -LL | +LL | LL | impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` | diff --git a/src/test/ui/const-generics/const-argument-if-length.full.stderr b/src/test/ui/const-generics/const-argument-if-length.full.stderr index 8c5c3b17b5c47..2ceba59cf05c7 100644 --- a/src/test/ui/const-generics/const-argument-if-length.full.stderr +++ b/src/test/ui/const-generics/const-argument-if-length.full.stderr @@ -12,7 +12,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - pub struct AtLeastByte { LL + pub struct AtLeastByte { - | + | help: borrowed types always have a statically known size | LL | value: &T, diff --git a/src/test/ui/const-generics/const-argument-if-length.min.stderr b/src/test/ui/const-generics/const-argument-if-length.min.stderr index b123036bf2506..f85e60f63fb3b 100644 --- a/src/test/ui/const-generics/const-argument-if-length.min.stderr +++ b/src/test/ui/const-generics/const-argument-if-length.min.stderr @@ -21,7 +21,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - pub struct AtLeastByte { LL + pub struct AtLeastByte { - | + | help: borrowed types always have a statically known size | LL | value: &T, diff --git a/src/test/ui/const-generics/parser-error-recovery/issue-89013-no-assoc.stderr b/src/test/ui/const-generics/parser-error-recovery/issue-89013-no-assoc.stderr index ddddd86ab9c06..1de24bff4692e 100644 --- a/src/test/ui/const-generics/parser-error-recovery/issue-89013-no-assoc.stderr +++ b/src/test/ui/const-generics/parser-error-recovery/issue-89013-no-assoc.stderr @@ -8,7 +8,7 @@ help: the `const` keyword is only needed in the definition of the type | LL - impl Foo for Bar { LL + impl Foo<3> for Bar { - | + | error: aborting due to previous error diff --git a/src/test/ui/const-generics/parser-error-recovery/issue-89013.stderr b/src/test/ui/const-generics/parser-error-recovery/issue-89013.stderr index d2d58c496df2c..583749a85734e 100644 --- a/src/test/ui/const-generics/parser-error-recovery/issue-89013.stderr +++ b/src/test/ui/const-generics/parser-error-recovery/issue-89013.stderr @@ -8,7 +8,7 @@ help: the `const` keyword is only needed in the definition of the type | LL - impl Foo for Bar { LL + impl Foo for Bar { - | + | error[E0658]: associated const equality is incomplete --> $DIR/issue-89013.rs:9:10 diff --git a/src/test/ui/const-generics/unused_braces.stderr b/src/test/ui/const-generics/unused_braces.stderr index 533fcabd41822..553a3a0f88eba 100644 --- a/src/test/ui/const-generics/unused_braces.stderr +++ b/src/test/ui/const-generics/unused_braces.stderr @@ -13,7 +13,7 @@ help: remove these braces | LL - let _: A<{ 7 }>; LL + let _: A<7>; - | + | warning: 1 warning emitted diff --git a/src/test/ui/const-ptr/forbidden_slices.32bit.stderr b/src/test/ui/const-ptr/forbidden_slices.32bit.stderr index 5b0b9aa9666e5..023d5ea34d871 100644 --- a/src/test/ui/const-ptr/forbidden_slices.32bit.stderr +++ b/src/test/ui/const-ptr/forbidden_slices.32bit.stderr @@ -243,7 +243,7 @@ error[E0080]: could not evaluate static initializer LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | ptr_offset_from_unsigned cannot compute offset of pointers into different allocations. + | ptr_offset_from_unsigned called on pointers into different allocations | inside `ptr::const_ptr::::sub_ptr` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | ::: $SRC_DIR/core/src/slice/raw.rs:LL:COL @@ -262,7 +262,7 @@ error[E0080]: could not evaluate static initializer LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | ptr_offset_from_unsigned cannot compute offset of pointers into different allocations. + | ptr_offset_from_unsigned called on pointers into different allocations | inside `ptr::const_ptr::::sub_ptr` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | ::: $SRC_DIR/core/src/slice/raw.rs:LL:COL diff --git a/src/test/ui/const-ptr/forbidden_slices.64bit.stderr b/src/test/ui/const-ptr/forbidden_slices.64bit.stderr index b75e6c5024667..ed89c253d532c 100644 --- a/src/test/ui/const-ptr/forbidden_slices.64bit.stderr +++ b/src/test/ui/const-ptr/forbidden_slices.64bit.stderr @@ -243,7 +243,7 @@ error[E0080]: could not evaluate static initializer LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | ptr_offset_from_unsigned cannot compute offset of pointers into different allocations. + | ptr_offset_from_unsigned called on pointers into different allocations | inside `ptr::const_ptr::::sub_ptr` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | ::: $SRC_DIR/core/src/slice/raw.rs:LL:COL @@ -262,7 +262,7 @@ error[E0080]: could not evaluate static initializer LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | ptr_offset_from_unsigned cannot compute offset of pointers into different allocations. + | ptr_offset_from_unsigned called on pointers into different allocations | inside `ptr::const_ptr::::sub_ptr` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | ::: $SRC_DIR/core/src/slice/raw.rs:LL:COL diff --git a/src/test/ui/consts/offset_from_ub.rs b/src/test/ui/consts/offset_from_ub.rs index f604f57e39d98..10e368ba13396 100644 --- a/src/test/ui/consts/offset_from_ub.rs +++ b/src/test/ui/consts/offset_from_ub.rs @@ -15,7 +15,7 @@ pub const DIFFERENT_ALLOC: usize = { let uninit2 = std::mem::MaybeUninit::::uninit(); let field_ptr: *const Struct = &uninit2 as *const _ as *const Struct; let offset = unsafe { ptr_offset_from(field_ptr, base_ptr) }; //~ERROR evaluation of constant value failed - //~| ptr_offset_from cannot compute offset of pointers into different allocations. + //~| pointers into different allocations offset as usize }; @@ -41,7 +41,7 @@ pub const DIFFERENT_INT: isize = { // offset_from with two different integers: l let ptr1 = 8 as *const u8; let ptr2 = 16 as *const u8; unsafe { ptr_offset_from(ptr2, ptr1) } //~ERROR evaluation of constant value failed - //~| 0x10 is not a valid pointer + //~| 0x8 is not a valid pointer }; const OUT_OF_BOUNDS_1: isize = { @@ -50,7 +50,7 @@ const OUT_OF_BOUNDS_1: isize = { let end_ptr = (start_ptr).wrapping_add(length); // First ptr is out of bounds unsafe { ptr_offset_from(end_ptr, start_ptr) } //~ERROR evaluation of constant value failed - //~| pointer at offset 10 is out-of-bounds + //~| pointer to 10 bytes starting at offset 0 is out-of-bounds }; const OUT_OF_BOUNDS_2: isize = { @@ -59,7 +59,7 @@ const OUT_OF_BOUNDS_2: isize = { let end_ptr = (start_ptr).wrapping_add(length); // Second ptr is out of bounds unsafe { ptr_offset_from(start_ptr, end_ptr) } //~ERROR evaluation of constant value failed - //~| pointer at offset 10 is out-of-bounds + //~| pointer to 10 bytes starting at offset 0 is out-of-bounds }; const OUT_OF_BOUNDS_SAME: isize = { @@ -76,7 +76,7 @@ pub const DIFFERENT_ALLOC_UNSIGNED: usize = { let uninit2 = std::mem::MaybeUninit::::uninit(); let field_ptr: *const Struct = &uninit2 as *const _ as *const Struct; let offset = unsafe { ptr_offset_from_unsigned(field_ptr, base_ptr) }; //~ERROR evaluation of constant value failed - //~| ptr_offset_from_unsigned cannot compute offset of pointers into different allocations. + //~| pointers into different allocations offset as usize }; @@ -84,7 +84,7 @@ const WRONG_ORDER_UNSIGNED: usize = { let a = ['a', 'b', 'c']; let p = a.as_ptr(); unsafe { ptr_offset_from_unsigned(p, p.add(2) ) } //~ERROR evaluation of constant value failed - //~| cannot compute a negative offset, but 0 < 8 + //~| first pointer has smaller offset than second: 0 < 8 }; fn main() {} diff --git a/src/test/ui/consts/offset_from_ub.stderr b/src/test/ui/consts/offset_from_ub.stderr index 4c98fd72cacc3..eb7f1d7a6b252 100644 --- a/src/test/ui/consts/offset_from_ub.stderr +++ b/src/test/ui/consts/offset_from_ub.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/offset_from_ub.rs:17:27 | LL | let offset = unsafe { ptr_offset_from(field_ptr, base_ptr) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptr_offset_from cannot compute offset of pointers into different allocations. + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptr_offset_from called on pointers into different allocations error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL @@ -10,7 +10,7 @@ error[E0080]: evaluation of constant value failed LL | unsafe { intrinsics::ptr_offset_from(self, origin) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | out-of-bounds offset_from: 0x2a is not a valid pointer + | ptr_offset_from called on pointers into different allocations | inside `ptr::const_ptr::::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | ::: $DIR/offset_from_ub.rs:23:14 @@ -34,19 +34,19 @@ error[E0080]: evaluation of constant value failed --> $DIR/offset_from_ub.rs:43:14 | LL | unsafe { ptr_offset_from(ptr2, ptr1) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: 0x10 is not a valid pointer + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: 0x8 is not a valid pointer error[E0080]: evaluation of constant value failed --> $DIR/offset_from_ub.rs:52:14 | LL | unsafe { ptr_offset_from(end_ptr, start_ptr) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc20 has size 4, so pointer at offset 10 is out-of-bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc20 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds error[E0080]: evaluation of constant value failed --> $DIR/offset_from_ub.rs:61:14 | LL | unsafe { ptr_offset_from(start_ptr, end_ptr) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc23 has size 4, so pointer at offset 10 is out-of-bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc23 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds error[E0080]: evaluation of constant value failed --> $DIR/offset_from_ub.rs:69:14 @@ -58,13 +58,13 @@ error[E0080]: evaluation of constant value failed --> $DIR/offset_from_ub.rs:78:27 | LL | let offset = unsafe { ptr_offset_from_unsigned(field_ptr, base_ptr) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptr_offset_from_unsigned cannot compute offset of pointers into different allocations. + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptr_offset_from_unsigned called on pointers into different allocations error[E0080]: evaluation of constant value failed --> $DIR/offset_from_ub.rs:86:14 | LL | unsafe { ptr_offset_from_unsigned(p, p.add(2) ) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptr_offset_from_unsigned cannot compute a negative offset, but 0 < 8 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptr_offset_from_unsigned called when first pointer has smaller offset than second: 0 < 8 error: aborting due to 10 previous errors diff --git a/src/test/ui/deprecation/try-macro-suggestion.stderr b/src/test/ui/deprecation/try-macro-suggestion.stderr index c7dde7eeac33e..63c8a6eef7f29 100644 --- a/src/test/ui/deprecation/try-macro-suggestion.stderr +++ b/src/test/ui/deprecation/try-macro-suggestion.stderr @@ -21,7 +21,7 @@ help: you can use the `?` operator instead | LL - Ok(try!(Ok(()))) LL + Ok(Ok(())?) - | + | help: alternatively, you can still access the deprecated `try!()` macro using the "raw identifier" syntax | LL | Ok(r#try!(Ok(()))) diff --git a/src/test/ui/derives/issue-91550.stderr b/src/test/ui/derives/issue-91550.stderr index 1b26d7549844b..c94d566f5df22 100644 --- a/src/test/ui/derives/issue-91550.stderr +++ b/src/test/ui/derives/issue-91550.stderr @@ -23,7 +23,7 @@ error[E0599]: the method `use_eq` exists for struct `Object`, but its | LL | pub struct NoDerives; | --------------------- doesn't satisfy `NoDerives: Eq` -LL | +LL | LL | struct Object(T); | -------------------- method `use_eq` not found for this ... @@ -42,7 +42,7 @@ error[E0599]: the method `use_ord` exists for struct `Object`, but it | LL | pub struct NoDerives; | --------------------- doesn't satisfy `NoDerives: Ord` -LL | +LL | LL | struct Object(T); | -------------------- method `use_ord` not found for this ... @@ -64,7 +64,7 @@ LL | pub struct NoDerives; | | | doesn't satisfy `NoDerives: Ord` | doesn't satisfy `NoDerives: PartialOrd` -LL | +LL | LL | struct Object(T); | -------------------- method `use_ord_and_partial_ord` not found for this ... diff --git a/src/test/ui/did_you_mean/compatible-variants.stderr b/src/test/ui/did_you_mean/compatible-variants.stderr index a8cb5d6d3e849..a16cdee44623a 100644 --- a/src/test/ui/did_you_mean/compatible-variants.stderr +++ b/src/test/ui/did_you_mean/compatible-variants.stderr @@ -71,7 +71,7 @@ help: try removing this `?` | LL - c()? LL + c() - | + | help: try adding an expression at the end of the block | LL ~ c()?; diff --git a/src/test/ui/did_you_mean/issue-34126.stderr b/src/test/ui/did_you_mean/issue-34126.stderr index 0503fac4a6680..5343acea4adc9 100644 --- a/src/test/ui/did_you_mean/issue-34126.stderr +++ b/src/test/ui/did_you_mean/issue-34126.stderr @@ -13,7 +13,7 @@ help: try removing `&mut` here | LL - self.run(&mut self); LL + self.run(self); - | + | error[E0502]: cannot borrow `self` as mutable because it is also borrowed as immutable --> $DIR/issue-34126.rs:6:18 diff --git a/src/test/ui/dst/dst-object-from-unsized-type.stderr b/src/test/ui/dst/dst-object-from-unsized-type.stderr index b7824c027ec11..5bd47736626da 100644 --- a/src/test/ui/dst/dst-object-from-unsized-type.stderr +++ b/src/test/ui/dst/dst-object-from-unsized-type.stderr @@ -11,7 +11,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn test1(t: &T) { LL + fn test1(t: &T) { - | + | error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/dst-object-from-unsized-type.rs:13:23 @@ -26,7 +26,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn test2(t: &T) { LL + fn test2(t: &T) { - | + | error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/dst-object-from-unsized-type.rs:18:28 diff --git a/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr b/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr index b8e4942dfefb2..34699bb26582e 100644 --- a/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr +++ b/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr @@ -15,7 +15,7 @@ help: use `dyn` | LL - fn function(x: &SomeTrait, y: Box) { LL + fn function(x: &dyn SomeTrait, y: Box) { - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/dyn-2018-edition-lint.rs:4:35 @@ -29,7 +29,7 @@ help: use `dyn` | LL - fn function(x: &SomeTrait, y: Box) { LL + fn function(x: &SomeTrait, y: Box) { - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/dyn-2018-edition-lint.rs:17:14 @@ -43,7 +43,7 @@ help: use `dyn` | LL - let _x: &SomeTrait = todo!(); LL + let _x: &dyn SomeTrait = todo!(); - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/dyn-2018-edition-lint.rs:4:17 @@ -57,7 +57,7 @@ help: use `dyn` | LL - fn function(x: &SomeTrait, y: Box) { LL + fn function(x: &dyn SomeTrait, y: Box) { - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/dyn-2018-edition-lint.rs:4:17 @@ -71,7 +71,7 @@ help: use `dyn` | LL - fn function(x: &SomeTrait, y: Box) { LL + fn function(x: &dyn SomeTrait, y: Box) { - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/dyn-2018-edition-lint.rs:4:35 @@ -85,7 +85,7 @@ help: use `dyn` | LL - fn function(x: &SomeTrait, y: Box) { LL + fn function(x: &SomeTrait, y: Box) { - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/dyn-2018-edition-lint.rs:4:35 @@ -99,7 +99,7 @@ help: use `dyn` | LL - fn function(x: &SomeTrait, y: Box) { LL + fn function(x: &SomeTrait, y: Box) { - | + | error: aborting due to 7 previous errors diff --git a/src/test/ui/dyn-keyword/dyn-2021-edition-error.stderr b/src/test/ui/dyn-keyword/dyn-2021-edition-error.stderr index b5bc359d7166d..9e212c77dc77c 100644 --- a/src/test/ui/dyn-keyword/dyn-2021-edition-error.stderr +++ b/src/test/ui/dyn-keyword/dyn-2021-edition-error.stderr @@ -8,7 +8,7 @@ help: add `dyn` keyword before this trait | LL - fn function(x: &SomeTrait, y: Box) { LL + fn function(x: &dyn SomeTrait, y: Box) { - | + | error[E0782]: trait objects must include the `dyn` keyword --> $DIR/dyn-2021-edition-error.rs:3:35 @@ -20,7 +20,7 @@ help: add `dyn` keyword before this trait | LL - fn function(x: &SomeTrait, y: Box) { LL + fn function(x: &SomeTrait, y: Box) { - | + | error: aborting due to 2 previous errors diff --git a/src/test/ui/dyn-keyword/dyn-angle-brackets.stderr b/src/test/ui/dyn-keyword/dyn-angle-brackets.stderr index fd4030e96226b..9bc603fba5466 100644 --- a/src/test/ui/dyn-keyword/dyn-angle-brackets.stderr +++ b/src/test/ui/dyn-keyword/dyn-angle-brackets.stderr @@ -15,7 +15,7 @@ help: use `dyn` | LL - ::fmt(self, f) LL + ::fmt(self, f) - | + | error: aborting due to previous error diff --git a/src/test/ui/empty/empty-struct-unit-expr.stderr b/src/test/ui/empty/empty-struct-unit-expr.stderr index 81651c5bf6f40..c15253ba9cd78 100644 --- a/src/test/ui/empty/empty-struct-unit-expr.stderr +++ b/src/test/ui/empty/empty-struct-unit-expr.stderr @@ -24,7 +24,7 @@ help: `E::Empty4` is a unit variant, you need to write it without the parenthese | LL - let e4 = E::Empty4(); LL + let e4 = E::Empty4; - | + | error[E0618]: expected function, found `empty_struct::XEmpty2` --> $DIR/empty-struct-unit-expr.rs:18:15 @@ -46,7 +46,7 @@ help: `XE::XEmpty4` is a unit variant, you need to write it without the parenthe | LL - let xe4 = XE::XEmpty4(); LL + let xe4 = XE::XEmpty4; - | + | error: aborting due to 4 previous errors diff --git a/src/test/ui/error-codes/E0109.stderr b/src/test/ui/error-codes/E0109.stderr index e0e437e18ae8c..7858a9e3028f0 100644 --- a/src/test/ui/error-codes/E0109.stderr +++ b/src/test/ui/error-codes/E0109.stderr @@ -10,7 +10,7 @@ help: primitive type `u32` doesn't have generic parameters | LL - type X = u32; LL + type X = u32; - | + | error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0110.stderr b/src/test/ui/error-codes/E0110.stderr index 15e1b959193fa..68f98b6f17dac 100644 --- a/src/test/ui/error-codes/E0110.stderr +++ b/src/test/ui/error-codes/E0110.stderr @@ -10,7 +10,7 @@ help: primitive type `u32` doesn't have generic parameters | LL - type X = u32<'static>; LL + type X = u32; - | + | error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0255.stderr b/src/test/ui/error-codes/E0255.stderr index b5c09499276b1..352c5ba5be095 100644 --- a/src/test/ui/error-codes/E0255.stderr +++ b/src/test/ui/error-codes/E0255.stderr @@ -3,7 +3,7 @@ error[E0255]: the name `foo` is defined multiple times | LL | use bar::foo; | -------- previous import of the value `foo` here -LL | +LL | LL | fn foo() {} | ^^^^^^^^ `foo` redefined here | diff --git a/src/test/ui/error-codes/E0259.stderr b/src/test/ui/error-codes/E0259.stderr index 4a48a4d554167..06cbc5b4fb5f2 100644 --- a/src/test/ui/error-codes/E0259.stderr +++ b/src/test/ui/error-codes/E0259.stderr @@ -3,7 +3,7 @@ error[E0259]: the name `alloc` is defined multiple times | LL | extern crate alloc; | ------------------- previous import of the extern crate `alloc` here -LL | +LL | LL | extern crate libc as alloc; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `alloc` reimported here | diff --git a/src/test/ui/error-codes/E0260.stderr b/src/test/ui/error-codes/E0260.stderr index 737b20b91ec25..2d3305bd15b0c 100644 --- a/src/test/ui/error-codes/E0260.stderr +++ b/src/test/ui/error-codes/E0260.stderr @@ -3,7 +3,7 @@ error[E0260]: the name `alloc` is defined multiple times | LL | extern crate alloc; | ------------------- previous import of the extern crate `alloc` here -LL | +LL | LL | mod alloc { | ^^^^^^^^^ `alloc` redefined here | diff --git a/src/test/ui/error-codes/E0393.stderr b/src/test/ui/error-codes/E0393.stderr index 7771bacc9ed93..8aadf5c8b4712 100644 --- a/src/test/ui/error-codes/E0393.stderr +++ b/src/test/ui/error-codes/E0393.stderr @@ -3,7 +3,7 @@ error[E0393]: the type parameter `T` must be explicitly specified | LL | trait A {} | ------------------ type parameter `T` must be specified for this -LL | +LL | LL | fn together_we_will_rule_the_galaxy(son: &dyn A) {} | ^ help: set the type parameter to the desired type: `A` | diff --git a/src/test/ui/error-codes/E0423.stderr b/src/test/ui/error-codes/E0423.stderr index 5f251527e7716..8f2ef8c8e6b3e 100644 --- a/src/test/ui/error-codes/E0423.stderr +++ b/src/test/ui/error-codes/E0423.stderr @@ -31,7 +31,7 @@ error[E0423]: expected function, tuple struct or tuple variant, found struct `Fo | LL | struct Foo { a: bool }; | ---------------------- `Foo` defined here -LL | +LL | LL | let f = Foo(); | ^^^^^ ... diff --git a/src/test/ui/error-codes/E0429.stderr b/src/test/ui/error-codes/E0429.stderr index 0b786ab1e2fe0..08b99232ee22b 100644 --- a/src/test/ui/error-codes/E0429.stderr +++ b/src/test/ui/error-codes/E0429.stderr @@ -8,7 +8,7 @@ help: consider importing the module directly | LL - use std::fmt::self; LL + use std::fmt; - | + | help: alternatively, use the multi-path `use` syntax to import `self` | LL | use std::fmt::{self}; diff --git a/src/test/ui/error-codes/E0446.stderr b/src/test/ui/error-codes/E0446.stderr index 73b6ba3c50e37..35e79e448d5ac 100644 --- a/src/test/ui/error-codes/E0446.stderr +++ b/src/test/ui/error-codes/E0446.stderr @@ -3,7 +3,7 @@ error[E0446]: private type `Bar` in public interface | LL | struct Bar(u32); | ---------------- `Bar` declared as private -LL | +LL | LL | pub fn bar() -> Bar { | ^^^^^^^^^^^^^^^^^^^ can't leak private type diff --git a/src/test/ui/error-codes/E0453.stderr b/src/test/ui/error-codes/E0453.stderr index 6d60dc84c210f..f982ed26f5c0b 100644 --- a/src/test/ui/error-codes/E0453.stderr +++ b/src/test/ui/error-codes/E0453.stderr @@ -3,7 +3,7 @@ error[E0453]: allow(non_snake_case) incompatible with previous forbid | LL | #![forbid(non_snake_case)] | -------------- `forbid` level set here -LL | +LL | LL | #[allow(non_snake_case)] | ^^^^^^^^^^^^^^ overruled by previous forbid @@ -12,7 +12,7 @@ error[E0453]: allow(non_snake_case) incompatible with previous forbid | LL | #![forbid(non_snake_case)] | -------------- `forbid` level set here -LL | +LL | LL | #[allow(non_snake_case)] | ^^^^^^^^^^^^^^ overruled by previous forbid diff --git a/src/test/ui/error-codes/E0504.stderr b/src/test/ui/error-codes/E0504.stderr index 04811721aa521..e677e89161542 100644 --- a/src/test/ui/error-codes/E0504.stderr +++ b/src/test/ui/error-codes/E0504.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `fancy_num` because it is borrowed | LL | let fancy_ref = &fancy_num; | ---------- borrow of `fancy_num` occurs here -LL | +LL | LL | let x = move || { | ^^^^^^^ move out of `fancy_num` occurs here LL | println!("child function: {}", fancy_num.num); diff --git a/src/test/ui/error-codes/E0506.stderr b/src/test/ui/error-codes/E0506.stderr index 17f883f84b8a2..d70406b750afc 100644 --- a/src/test/ui/error-codes/E0506.stderr +++ b/src/test/ui/error-codes/E0506.stderr @@ -5,7 +5,7 @@ LL | let fancy_ref = &fancy_num; | ---------- borrow of `fancy_num` occurs here LL | fancy_num = FancyNum { num: 6 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `fancy_num` occurs here -LL | +LL | LL | println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num); | ------------- borrow later used here diff --git a/src/test/ui/error-codes/E0605.stderr b/src/test/ui/error-codes/E0605.stderr index d082b6c10cc2a..e385b339402ff 100644 --- a/src/test/ui/error-codes/E0605.stderr +++ b/src/test/ui/error-codes/E0605.stderr @@ -14,7 +14,7 @@ help: consider borrowing the value | LL - v as &u8; LL + &*v; - | + | error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0618.stderr b/src/test/ui/error-codes/E0618.stderr index a3a90968df704..fcee6b47c1d2b 100644 --- a/src/test/ui/error-codes/E0618.stderr +++ b/src/test/ui/error-codes/E0618.stderr @@ -13,7 +13,7 @@ help: `X::Entry` is a unit variant, you need to write it without the parentheses | LL - X::Entry(); LL + X::Entry; - | + | error[E0618]: expected function, found `i32` --> $DIR/E0618.rs:9:5 diff --git a/src/test/ui/expr/if/if-no-match-bindings.stderr b/src/test/ui/expr/if/if-no-match-bindings.stderr index 319371720710c..737a5d604483f 100644 --- a/src/test/ui/expr/if/if-no-match-bindings.stderr +++ b/src/test/ui/expr/if/if-no-match-bindings.stderr @@ -30,7 +30,7 @@ help: consider removing the borrow | LL - if &true {} LL + if true {} - | + | error[E0308]: mismatched types --> $DIR/if-no-match-bindings.rs:21:8 @@ -42,7 +42,7 @@ help: consider removing the borrow | LL - if &mut true {} LL + if true {} - | + | error[E0308]: mismatched types --> $DIR/if-no-match-bindings.rs:24:11 @@ -76,7 +76,7 @@ help: consider removing the borrow | LL - while &true {} LL + while true {} - | + | error[E0308]: mismatched types --> $DIR/if-no-match-bindings.rs:27:11 @@ -88,7 +88,7 @@ help: consider removing the borrow | LL - while &mut true {} LL + while true {} - | + | error: aborting due to 8 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-with_negative_coherence.stderr b/src/test/ui/feature-gates/feature-gate-with_negative_coherence.stderr index 05007dafa37fd..d4c201b5d3ec5 100644 --- a/src/test/ui/feature-gates/feature-gate-with_negative_coherence.stderr +++ b/src/test/ui/feature-gates/feature-gate-with_negative_coherence.stderr @@ -3,7 +3,7 @@ error[E0119]: conflicting implementations of trait `Foo` for type `&_` | LL | impl Foo for T { } | ------------------------------------- first implementation here -LL | +LL | LL | impl Foo for &T { } | ^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_` diff --git a/src/test/ui/fmt/format-string-error.stderr b/src/test/ui/fmt/format-string-error.stderr index 8b018480fb082..8a32c225485fe 100644 --- a/src/test/ui/fmt/format-string-error.stderr +++ b/src/test/ui/fmt/format-string-error.stderr @@ -93,7 +93,7 @@ error: invalid format string: expected `'}'` but string was terminated | LL | { | - because of this opening brace -LL | +LL | LL | "###); | ^ expected `'}'` in format string | diff --git a/src/test/ui/generic-associated-types/equality-bound.stderr b/src/test/ui/generic-associated-types/equality-bound.stderr index 27432641958bd..d78f7a7fbcee1 100644 --- a/src/test/ui/generic-associated-types/equality-bound.stderr +++ b/src/test/ui/generic-associated-types/equality-bound.stderr @@ -9,7 +9,7 @@ help: if `Iterator::Item` is an associated type you're trying to set, use the as | LL - fn sum>(i: I) -> i32 where I::Item = i32 { LL + fn sum>(i: I) -> i32 where { - | + | error: equality constraints are not yet supported in `where` clauses --> $DIR/equality-bound.rs:5:41 @@ -22,7 +22,7 @@ help: if `Iterator::Item` is an associated type you're trying to set, use the as | LL - fn sum2(i: I) -> i32 where I::Item = i32 { LL + fn sum2>(i: I) -> i32 where { - | + | error: equality constraints are not yet supported in `where` clauses --> $DIR/equality-bound.rs:9:41 diff --git a/src/test/ui/hashmap/hashmap-iter-value-lifetime.stderr b/src/test/ui/hashmap/hashmap-iter-value-lifetime.stderr index 0724fec905524..d6e7a1d45f08b 100644 --- a/src/test/ui/hashmap/hashmap-iter-value-lifetime.stderr +++ b/src/test/ui/hashmap/hashmap-iter-value-lifetime.stderr @@ -3,10 +3,10 @@ error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as | LL | let (_, thing) = my_stuff.iter().next().unwrap(); | --------------- immutable borrow occurs here -LL | +LL | LL | my_stuff.clear(); | ^^^^^^^^^^^^^^^^ mutable borrow occurs here -LL | +LL | LL | println!("{}", *thing); | ------ immutable borrow later used here diff --git a/src/test/ui/impl-trait/impl-generic-mismatch.stderr b/src/test/ui/impl-trait/impl-generic-mismatch.stderr index d1a04af070637..489afd7615f54 100644 --- a/src/test/ui/impl-trait/impl-generic-mismatch.stderr +++ b/src/test/ui/impl-trait/impl-generic-mismatch.stderr @@ -11,7 +11,7 @@ help: try removing the generic parameter and using `impl Trait` instead | LL - fn foo(&self, _: &U) { } LL + fn foo(&self, _: &impl Debug) { } - | + | error[E0643]: method `bar` has incompatible signature for trait --> $DIR/impl-generic-mismatch.rs:17:23 diff --git a/src/test/ui/impl-trait/recursive-impl-trait-type-through-non-recursive.stderr b/src/test/ui/impl-trait/recursive-impl-trait-type-through-non-recursive.stderr index fbc58837a8e94..b514e9fef4d79 100644 --- a/src/test/ui/impl-trait/recursive-impl-trait-type-through-non-recursive.stderr +++ b/src/test/ui/impl-trait/recursive-impl-trait-type-through-non-recursive.stderr @@ -3,7 +3,7 @@ error[E0720]: cannot resolve opaque type | LL | fn id(t: T) -> impl Sized { t } | ---------- returning this opaque type `impl Sized` -LL | +LL | LL | fn recursive_id() -> impl Sized { | ^^^^^^^^^^ recursive opaque type LL | id(recursive_id2()) @@ -25,7 +25,7 @@ error[E0720]: cannot resolve opaque type | LL | fn wrap(t: T) -> impl Sized { (t,) } | ---------- returning this opaque type `impl Sized` -LL | +LL | LL | fn recursive_wrap() -> impl Sized { | ^^^^^^^^^^ recursive opaque type LL | wrap(recursive_wrap2()) diff --git a/src/test/ui/imports/issue-45829/import-self.stderr b/src/test/ui/imports/issue-45829/import-self.stderr index 3301b7d4ef80e..0c9424f308351 100644 --- a/src/test/ui/imports/issue-45829/import-self.stderr +++ b/src/test/ui/imports/issue-45829/import-self.stderr @@ -14,7 +14,7 @@ help: consider importing the module directly | LL - use foo::self; LL + use foo; - | + | help: alternatively, use the multi-path `use` syntax to import `self` | LL | use foo::{self}; diff --git a/src/test/ui/imports/issue-59764.stderr b/src/test/ui/imports/issue-59764.stderr index c2cfc0939d6b3..fad1d2ae89a56 100644 --- a/src/test/ui/imports/issue-59764.stderr +++ b/src/test/ui/imports/issue-59764.stderr @@ -9,7 +9,7 @@ help: a macro with this name exists at the root of the crate | LL - use issue_59764::foo::{baz, makro}; LL + use issue_59764::{makro, foo::{baz}}; - | + | error[E0432]: unresolved import `issue_59764::foo::makro` --> $DIR/issue-59764.rs:21:9 @@ -52,7 +52,7 @@ help: a macro with this name exists at the root of the crate | LL - use issue_59764::foo::{baz, makro, foobar}; LL + use issue_59764::{makro, foo::{baz, foobar}}; - | + | error[E0432]: unresolved import `issue_59764::foo::makro` --> $DIR/issue-59764.rs:40:9 @@ -97,7 +97,7 @@ help: a macro with this name exists at the root of the crate | LL - use issue_59764::{foobaz, foo::makro}; LL + use issue_59764::{makro, foobaz}; - | + | error[E0432]: unresolved import `issue_59764::foo::makro` --> $DIR/issue-59764.rs:59:42 @@ -110,7 +110,7 @@ help: a macro with this name exists at the root of the crate | LL - use issue_59764::{foobaz, foo::{baz, makro}}; LL + use issue_59764::{makro, foobaz, foo::{baz}}; - | + | error[E0432]: unresolved import `issue_59764::foo::makro` --> $DIR/issue-59764.rs:68:13 @@ -155,7 +155,7 @@ help: a macro with this name exists at the root of the crate | LL - use issue_59764::{foobaz, foo::{baz, makro, barbaz::{barfoo}}}; LL + use issue_59764::{makro, foobaz, foo::{baz, barbaz::{barfoo}}}; - | + | error[E0432]: unresolved import `issue_59764::foo::makro` --> $DIR/issue-59764.rs:93:13 @@ -196,7 +196,7 @@ help: a macro with this name exists at the root of the crate | LL - use issue_59764::foo::{baz, makro as foobar}; LL + use issue_59764::{makro as foobar, foo::{baz}}; - | + | error[E0432]: unresolved import `issue_59764::foo::makro` --> $DIR/issue-59764.rs:120:17 diff --git a/src/test/ui/inference/deref-suggestion.stderr b/src/test/ui/inference/deref-suggestion.stderr index 8ba9dacb4b21d..e763e17e51786 100644 --- a/src/test/ui/inference/deref-suggestion.stderr +++ b/src/test/ui/inference/deref-suggestion.stderr @@ -48,7 +48,7 @@ help: consider removing the borrow | LL - foo(&"aaa".to_owned()); LL + foo("aaa".to_owned()); - | + | error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:32:9 @@ -67,7 +67,7 @@ help: consider removing the borrow | LL - foo(&mut "aaa".to_owned()); LL + foo("aaa".to_owned()); - | + | error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:2:20 diff --git a/src/test/ui/issues/issue-11873.stderr b/src/test/ui/issues/issue-11873.stderr index 4475bdf147402..c814eedd22614 100644 --- a/src/test/ui/issues/issue-11873.stderr +++ b/src/test/ui/issues/issue-11873.stderr @@ -7,7 +7,7 @@ LL | let mut f = || v.push(2); | borrow of `v` occurs here LL | let _w = v; | ^ move out of `v` occurs here -LL | +LL | LL | f(); | - borrow later used here diff --git a/src/test/ui/issues/issue-22370.stderr b/src/test/ui/issues/issue-22370.stderr index 950c12ef7a21c..4da346f56ab76 100644 --- a/src/test/ui/issues/issue-22370.stderr +++ b/src/test/ui/issues/issue-22370.stderr @@ -3,7 +3,7 @@ error[E0393]: the type parameter `T` must be explicitly specified | LL | trait A {} | ------------------ type parameter `T` must be specified for this -LL | +LL | LL | fn f(a: &dyn A) {} | ^ help: set the type parameter to the desired type: `A` | diff --git a/src/test/ui/issues/issue-28472.stderr b/src/test/ui/issues/issue-28472.stderr index 92b598252bf7b..051ed25b6c9d9 100644 --- a/src/test/ui/issues/issue-28472.stderr +++ b/src/test/ui/issues/issue-28472.stderr @@ -3,7 +3,7 @@ error[E0428]: the name `foo` is defined multiple times | LL | fn foo(); | --------- previous definition of the value `foo` here -LL | +LL | LL | / pub LL | | fn foo(); | |___________^ `foo` redefined here diff --git a/src/test/ui/issues/issue-2995.stderr b/src/test/ui/issues/issue-2995.stderr index 7616f987d7312..0d09612c6c2c6 100644 --- a/src/test/ui/issues/issue-2995.stderr +++ b/src/test/ui/issues/issue-2995.stderr @@ -8,7 +8,7 @@ help: consider borrowing the value | LL - let _q: &isize = p as &isize; LL + let _q: &isize = &*p; - | + | error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3099-a.stderr b/src/test/ui/issues/issue-3099-a.stderr index d6e0a799921f1..e3733cebba58e 100644 --- a/src/test/ui/issues/issue-3099-a.stderr +++ b/src/test/ui/issues/issue-3099-a.stderr @@ -3,7 +3,7 @@ error[E0428]: the name `A` is defined multiple times | LL | enum A { B, C } | ------ previous definition of the type `A` here -LL | +LL | LL | enum A { D, E } | ^^^^^^ `A` redefined here | diff --git a/src/test/ui/issues/issue-3099-b.stderr b/src/test/ui/issues/issue-3099-b.stderr index 3ba8b189da670..c0cfefeb940f4 100644 --- a/src/test/ui/issues/issue-3099-b.stderr +++ b/src/test/ui/issues/issue-3099-b.stderr @@ -3,7 +3,7 @@ error[E0428]: the name `a` is defined multiple times | LL | pub mod a {} | --------- previous definition of the module `a` here -LL | +LL | LL | pub mod a {} | ^^^^^^^^^ `a` redefined here | diff --git a/src/test/ui/issues/issue-35241.stderr b/src/test/ui/issues/issue-35241.stderr index 4e89f59afbe42..319886f878384 100644 --- a/src/test/ui/issues/issue-35241.stderr +++ b/src/test/ui/issues/issue-35241.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | struct Foo(u32); | ---------------- fn(u32) -> Foo {Foo} defined here -LL | +LL | LL | fn test() -> Foo { Foo } | --- ^^^ expected struct `Foo`, found fn item | | diff --git a/src/test/ui/issues/issue-40510-1.stderr b/src/test/ui/issues/issue-40510-1.stderr index 54df40b6e3d05..e88f31ea1ee17 100644 --- a/src/test/ui/issues/issue-40510-1.stderr +++ b/src/test/ui/issues/issue-40510-1.stderr @@ -3,7 +3,7 @@ error: captured variable cannot escape `FnMut` closure body | LL | let mut x: Box<()> = Box::new(()); | ----- variable defined here -LL | +LL | LL | || { | - inferred to be a `FnMut` closure LL | &mut x diff --git a/src/test/ui/issues/issue-40510-3.stderr b/src/test/ui/issues/issue-40510-3.stderr index cb885ec7d952a..22186ba9a67b6 100644 --- a/src/test/ui/issues/issue-40510-3.stderr +++ b/src/test/ui/issues/issue-40510-3.stderr @@ -3,7 +3,7 @@ error: captured variable cannot escape `FnMut` closure body | LL | let mut x: Vec<()> = Vec::new(); | ----- variable defined here -LL | +LL | LL | || { | - inferred to be a `FnMut` closure LL | / || { diff --git a/src/test/ui/issues/issue-4265.stderr b/src/test/ui/issues/issue-4265.stderr index 4faf5d3a92302..acdf963ed3bd7 100644 --- a/src/test/ui/issues/issue-4265.stderr +++ b/src/test/ui/issues/issue-4265.stderr @@ -5,7 +5,7 @@ LL | / fn bar() { LL | | Foo { baz: 0 }.bar(); LL | | } | |_____- previous definition of `bar` here -LL | +LL | LL | / fn bar() { LL | | } | |_____^ duplicate definition diff --git a/src/test/ui/issues/issue-47646.stderr b/src/test/ui/issues/issue-47646.stderr index 32e8588b3c074..4e28874e140a4 100644 --- a/src/test/ui/issues/issue-47646.stderr +++ b/src/test/ui/issues/issue-47646.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `heap` as immutable because it is also borrowed as m | LL | let borrow = heap.peek_mut(); | --------------- mutable borrow occurs here -LL | +LL | LL | match (borrow, ()) { | ------------ a temporary with access to the mutable borrow is created here ... LL | (Some(_), ()) => { diff --git a/src/test/ui/issues/issue-49257.stderr b/src/test/ui/issues/issue-49257.stderr index a14a66659b3b3..846467f7f2268 100644 --- a/src/test/ui/issues/issue-49257.stderr +++ b/src/test/ui/issues/issue-49257.stderr @@ -11,7 +11,7 @@ help: move the `..` to the end of the field list | LL - let Point { .., y, } = p; LL + let Point { y, .. } = p; - | + | error: expected `}`, found `,` --> $DIR/issue-49257.rs:11:19 @@ -26,7 +26,7 @@ help: move the `..` to the end of the field list | LL - let Point { .., y } = p; LL + let Point { y , .. } = p; - | + | error: expected `}`, found `,` --> $DIR/issue-49257.rs:12:19 diff --git a/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr b/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr index 15d2ef3fce8da..cc0726bcade32 100644 --- a/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr +++ b/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr @@ -11,7 +11,7 @@ help: try removing this `?` | LL - missing_discourses()? LL + missing_discourses() - | + | help: try wrapping the expression in `Ok` | LL | Ok(missing_discourses()?) diff --git a/src/test/ui/issues/issue-64792-bad-unicode-ctor.stderr b/src/test/ui/issues/issue-64792-bad-unicode-ctor.stderr index c3dda704b0e93..2ec151d24d1c6 100644 --- a/src/test/ui/issues/issue-64792-bad-unicode-ctor.stderr +++ b/src/test/ui/issues/issue-64792-bad-unicode-ctor.stderr @@ -3,7 +3,7 @@ error[E0423]: expected function, tuple struct or tuple variant, found struct `X` | LL | struct X {} | ----------- `X` defined here -LL | +LL | LL | const Y: X = X("ö"); | ^^^^^^ help: use struct literal syntax instead: `X {}` diff --git a/src/test/ui/issues/issue-86756.stderr b/src/test/ui/issues/issue-86756.stderr index 5b2f04ffa8309..399c940ca195c 100644 --- a/src/test/ui/issues/issue-86756.stderr +++ b/src/test/ui/issues/issue-86756.stderr @@ -27,7 +27,7 @@ help: use `dyn` | LL - eq:: LL + eq:: - | + | error[E0107]: missing generics for trait `Foo` --> $DIR/issue-86756.rs:5:15 diff --git a/src/test/ui/iterators/into-iter-on-arrays-2018.stderr b/src/test/ui/iterators/into-iter-on-arrays-2018.stderr index e994d69110698..9b3125058377c 100644 --- a/src/test/ui/iterators/into-iter-on-arrays-2018.stderr +++ b/src/test/ui/iterators/into-iter-on-arrays-2018.stderr @@ -59,7 +59,7 @@ help: or remove `.into_iter()` to iterate by value | LL - for _ in [1, 2, 3].into_iter() {} LL + for _ in [1, 2, 3] {} - | + | warning: 5 warnings emitted diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr index f764ec43ad1cd..961f9de6614af 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `x` | LL | fn foo<'a>(&'a self, x: &i32) -> &i32 { | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32` -LL | +LL | LL | if true { &self.field } else { x } | ^ lifetime `'a` required diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr index 4c78821157670..5bb763813322d 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr @@ -5,7 +5,7 @@ LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { | -- - let's call the lifetime of this reference `'1` | | | lifetime `'a` defined here -LL | +LL | LL | if x > y { x } else { y } | ^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr index 11e7fa96d7ee9..4bcd7cf9578db 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr @@ -5,7 +5,7 @@ LL | fn foo<'a>(&self, x: &'a i32) -> &i32 { | -- - let's call the lifetime of this reference `'1` | | | lifetime `'a` defined here -LL | +LL | LL | x | ^ associated function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr index c41f08e691ac2..34a64f8a63e60 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr @@ -5,7 +5,7 @@ LL | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo { | -- - let's call the lifetime of this reference `'1` | | | lifetime `'a` defined here -LL | +LL | LL | if true { x } else { self } | ^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` diff --git a/src/test/ui/lint/forbid-group-member.stderr b/src/test/ui/lint/forbid-group-member.stderr index 72772a42bede7..891fa9885f329 100644 --- a/src/test/ui/lint/forbid-group-member.stderr +++ b/src/test/ui/lint/forbid-group-member.stderr @@ -3,7 +3,7 @@ warning: allow(unused_variables) incompatible with previous forbid | LL | #![forbid(unused)] | ------ `forbid` level set here -LL | +LL | LL | #[allow(unused_variables)] | ^^^^^^^^^^^^^^^^ overruled by previous forbid | @@ -16,7 +16,7 @@ warning: allow(unused_variables) incompatible with previous forbid | LL | #![forbid(unused)] | ------ `forbid` level set here -LL | +LL | LL | #[allow(unused_variables)] | ^^^^^^^^^^^^^^^^ overruled by previous forbid | @@ -28,7 +28,7 @@ warning: allow(unused_variables) incompatible with previous forbid | LL | #![forbid(unused)] | ------ `forbid` level set here -LL | +LL | LL | #[allow(unused_variables)] | ^^^^^^^^^^^^^^^^ overruled by previous forbid | diff --git a/src/test/ui/lint/forbid-member-group.stderr b/src/test/ui/lint/forbid-member-group.stderr index 39700af4d5943..e65301778332a 100644 --- a/src/test/ui/lint/forbid-member-group.stderr +++ b/src/test/ui/lint/forbid-member-group.stderr @@ -3,7 +3,7 @@ error[E0453]: allow(unused) incompatible with previous forbid | LL | #![forbid(unused_variables)] | ---------------- `forbid` level set here -LL | +LL | LL | #[allow(unused)] | ^^^^^^ overruled by previous forbid @@ -12,7 +12,7 @@ error[E0453]: allow(unused) incompatible with previous forbid | LL | #![forbid(unused_variables)] | ---------------- `forbid` level set here -LL | +LL | LL | #[allow(unused)] | ^^^^^^ overruled by previous forbid diff --git a/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr b/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr index 99d97ba52a0f2..8d826bd145762 100644 --- a/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr @@ -11,7 +11,7 @@ help: use `dyn` | LL - pub fn function(_x: Box) {} LL + pub fn function(_x: Box) {} - | + | warning: trait objects without an explicit `dyn` are deprecated --> $DIR/allowed-group-warn-by-default-lint.rs:10:25 @@ -25,7 +25,7 @@ help: use `dyn` | LL - pub fn function(_x: Box) {} LL + pub fn function(_x: Box) {} - | + | warning: trait objects without an explicit `dyn` are deprecated --> $DIR/allowed-group-warn-by-default-lint.rs:10:25 @@ -39,7 +39,7 @@ help: use `dyn` | LL - pub fn function(_x: Box) {} LL + pub fn function(_x: Box) {} - | + | warning: 3 warnings emitted diff --git a/src/test/ui/lint/force-warn/cap-lints-allow.stderr b/src/test/ui/lint/force-warn/cap-lints-allow.stderr index 90496ca7d2078..978270872c45c 100644 --- a/src/test/ui/lint/force-warn/cap-lints-allow.stderr +++ b/src/test/ui/lint/force-warn/cap-lints-allow.stderr @@ -11,7 +11,7 @@ help: use `dyn` | LL - pub fn function(_x: Box) {} LL + pub fn function(_x: Box) {} - | + | warning: trait objects without an explicit `dyn` are deprecated --> $DIR/cap-lints-allow.rs:8:25 @@ -25,7 +25,7 @@ help: use `dyn` | LL - pub fn function(_x: Box) {} LL + pub fn function(_x: Box) {} - | + | warning: trait objects without an explicit `dyn` are deprecated --> $DIR/cap-lints-allow.rs:8:25 @@ -39,7 +39,7 @@ help: use `dyn` | LL - pub fn function(_x: Box) {} LL + pub fn function(_x: Box) {} - | + | warning: 3 warnings emitted diff --git a/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr b/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr index b6d36eaac4448..6e67ebf274733 100644 --- a/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr @@ -11,7 +11,7 @@ help: use `dyn` | LL - pub fn function(_x: Box) {} LL + pub fn function(_x: Box) {} - | + | warning: trait objects without an explicit `dyn` are deprecated --> $DIR/lint-group-allowed-cli-warn-by-default-lint.rs:8:25 @@ -25,7 +25,7 @@ help: use `dyn` | LL - pub fn function(_x: Box) {} LL + pub fn function(_x: Box) {} - | + | warning: trait objects without an explicit `dyn` are deprecated --> $DIR/lint-group-allowed-cli-warn-by-default-lint.rs:8:25 @@ -39,7 +39,7 @@ help: use `dyn` | LL - pub fn function(_x: Box) {} LL + pub fn function(_x: Box) {} - | + | warning: 3 warnings emitted diff --git a/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.stderr b/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.stderr index e8fdaa72cc0f6..c5dea84b8f358 100644 --- a/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.stderr +++ b/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.stderr @@ -11,7 +11,7 @@ help: use `dyn` | LL - pub fn function(_x: Box) {} LL + pub fn function(_x: Box) {} - | + | warning: trait objects without an explicit `dyn` are deprecated --> $DIR/lint-group-allowed-lint-group.rs:10:25 @@ -25,7 +25,7 @@ help: use `dyn` | LL - pub fn function(_x: Box) {} LL + pub fn function(_x: Box) {} - | + | warning: trait objects without an explicit `dyn` are deprecated --> $DIR/lint-group-allowed-lint-group.rs:10:25 @@ -39,7 +39,7 @@ help: use `dyn` | LL - pub fn function(_x: Box) {} LL + pub fn function(_x: Box) {} - | + | warning: 3 warnings emitted diff --git a/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr b/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr index 2de30d0c2f43d..acd0c503d9c02 100644 --- a/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr @@ -11,7 +11,7 @@ help: use `dyn` | LL - pub fn function(_x: Box) {} LL + pub fn function(_x: Box) {} - | + | warning: trait objects without an explicit `dyn` are deprecated --> $DIR/lint-group-allowed-warn-by-default-lint.rs:10:25 @@ -25,7 +25,7 @@ help: use `dyn` | LL - pub fn function(_x: Box) {} LL + pub fn function(_x: Box) {} - | + | warning: trait objects without an explicit `dyn` are deprecated --> $DIR/lint-group-allowed-warn-by-default-lint.rs:10:25 @@ -39,7 +39,7 @@ help: use `dyn` | LL - pub fn function(_x: Box) {} LL + pub fn function(_x: Box) {} - | + | warning: 3 warnings emitted diff --git a/src/test/ui/lint/issue-80988.stderr b/src/test/ui/lint/issue-80988.stderr index deee267d0c603..1d397f43133fa 100644 --- a/src/test/ui/lint/issue-80988.stderr +++ b/src/test/ui/lint/issue-80988.stderr @@ -3,7 +3,7 @@ warning: deny(warnings) incompatible with previous forbid | LL | #![forbid(warnings)] | -------- `forbid` level set here -LL | +LL | LL | #[deny(warnings)] | ^^^^^^^^ overruled by previous forbid | @@ -16,7 +16,7 @@ warning: deny(warnings) incompatible with previous forbid | LL | #![forbid(warnings)] | -------- `forbid` level set here -LL | +LL | LL | #[deny(warnings)] | ^^^^^^^^ overruled by previous forbid | @@ -28,7 +28,7 @@ warning: deny(warnings) incompatible with previous forbid | LL | #![forbid(warnings)] | -------- `forbid` level set here -LL | +LL | LL | #[deny(warnings)] | ^^^^^^^^ overruled by previous forbid | diff --git a/src/test/ui/lint/lint-forbid-attr.stderr b/src/test/ui/lint/lint-forbid-attr.stderr index 48228c5dfdd7a..5977b9c949d50 100644 --- a/src/test/ui/lint/lint-forbid-attr.stderr +++ b/src/test/ui/lint/lint-forbid-attr.stderr @@ -3,7 +3,7 @@ error[E0453]: allow(deprecated) incompatible with previous forbid | LL | #![forbid(deprecated)] | ---------- `forbid` level set here -LL | +LL | LL | #[allow(deprecated)] | ^^^^^^^^^^ overruled by previous forbid @@ -12,7 +12,7 @@ error[E0453]: allow(deprecated) incompatible with previous forbid | LL | #![forbid(deprecated)] | ---------- `forbid` level set here -LL | +LL | LL | #[allow(deprecated)] | ^^^^^^^^^^ overruled by previous forbid diff --git a/src/test/ui/lint/lint-incoherent-auto-trait-objects.stderr b/src/test/ui/lint/lint-incoherent-auto-trait-objects.stderr index 5308bba440e06..afbab9896765f 100644 --- a/src/test/ui/lint/lint-incoherent-auto-trait-objects.stderr +++ b/src/test/ui/lint/lint-incoherent-auto-trait-objects.stderr @@ -3,7 +3,7 @@ error: conflicting implementations of trait `Foo` for type `(dyn std::marker::Se | LL | impl Foo for dyn Send {} | --------------------- first implementation here -LL | +LL | LL | impl Foo for dyn Send + Send {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + 'static)` | @@ -16,7 +16,7 @@ error: conflicting implementations of trait `Foo` for type `(dyn std::marker::Se | LL | impl Foo for dyn Send + Sync {} | ---------------------------- first implementation here -LL | +LL | LL | impl Foo for dyn Sync + Send {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` | diff --git a/src/test/ui/lint/lint-unnecessary-parens.stderr b/src/test/ui/lint/lint-unnecessary-parens.stderr index 1d5f9ebb5e5c5..e13620f06ce08 100644 --- a/src/test/ui/lint/lint-unnecessary-parens.stderr +++ b/src/test/ui/lint/lint-unnecessary-parens.stderr @@ -13,7 +13,7 @@ help: remove these parentheses | LL - return (1); LL + return 1; - | + | error: unnecessary parentheses around `return` value --> $DIR/lint-unnecessary-parens.rs:16:12 @@ -25,7 +25,7 @@ help: remove these parentheses | LL - return (X { y }); LL + return X { y }; - | + | error: unnecessary parentheses around type --> $DIR/lint-unnecessary-parens.rs:19:46 @@ -37,7 +37,7 @@ help: remove these parentheses | LL - pub fn unused_parens_around_return_type() -> (u32) { LL + pub fn unused_parens_around_return_type() -> u32 { - | + | error: unnecessary parentheses around block return value --> $DIR/lint-unnecessary-parens.rs:25:9 @@ -49,7 +49,7 @@ help: remove these parentheses | LL - (5) LL + 5 - | + | error: unnecessary parentheses around block return value --> $DIR/lint-unnecessary-parens.rs:27:5 @@ -61,7 +61,7 @@ help: remove these parentheses | LL - (5) LL + 5 - | + | error: unnecessary parentheses around assigned value --> $DIR/lint-unnecessary-parens.rs:44:31 @@ -73,7 +73,7 @@ help: remove these parentheses | LL - pub const CONST_ITEM: usize = (10); LL + pub const CONST_ITEM: usize = 10; - | + | error: unnecessary parentheses around assigned value --> $DIR/lint-unnecessary-parens.rs:45:33 @@ -85,7 +85,7 @@ help: remove these parentheses | LL - pub static STATIC_ITEM: usize = (10); LL + pub static STATIC_ITEM: usize = 10; - | + | error: unnecessary parentheses around function argument --> $DIR/lint-unnecessary-parens.rs:49:9 @@ -97,7 +97,7 @@ help: remove these parentheses | LL - bar((true)); LL + bar(true); - | + | error: unnecessary parentheses around `if` condition --> $DIR/lint-unnecessary-parens.rs:51:8 @@ -109,7 +109,7 @@ help: remove these parentheses | LL - if (true) {} LL + if true {} - | + | error: unnecessary parentheses around `while` condition --> $DIR/lint-unnecessary-parens.rs:52:11 @@ -121,7 +121,7 @@ help: remove these parentheses | LL - while (true) {} LL + while true {} - | + | error: unnecessary parentheses around `match` scrutinee expression --> $DIR/lint-unnecessary-parens.rs:53:11 @@ -133,7 +133,7 @@ help: remove these parentheses | LL - match (true) { LL + match true { - | + | error: unnecessary parentheses around `let` scrutinee expression --> $DIR/lint-unnecessary-parens.rs:56:16 @@ -145,7 +145,7 @@ help: remove these parentheses | LL - if let 1 = (1) {} LL + if let 1 = 1 {} - | + | error: unnecessary parentheses around `let` scrutinee expression --> $DIR/lint-unnecessary-parens.rs:57:19 @@ -157,7 +157,7 @@ help: remove these parentheses | LL - while let 1 = (2) {} LL + while let 1 = 2 {} - | + | error: unnecessary parentheses around method argument --> $DIR/lint-unnecessary-parens.rs:73:24 @@ -169,7 +169,7 @@ help: remove these parentheses | LL - X { y: false }.foo((true)); LL + X { y: false }.foo(true); - | + | error: unnecessary parentheses around assigned value --> $DIR/lint-unnecessary-parens.rs:75:18 @@ -181,7 +181,7 @@ help: remove these parentheses | LL - let mut _a = (0); LL + let mut _a = 0; - | + | error: unnecessary parentheses around assigned value --> $DIR/lint-unnecessary-parens.rs:76:10 @@ -193,7 +193,7 @@ help: remove these parentheses | LL - _a = (0); LL + _a = 0; - | + | error: unnecessary parentheses around assigned value --> $DIR/lint-unnecessary-parens.rs:77:11 @@ -205,7 +205,7 @@ help: remove these parentheses | LL - _a += (1); LL + _a += 1; - | + | error: aborting due to 17 previous errors diff --git a/src/test/ui/lint/must_not_suspend/ref.stderr b/src/test/ui/lint/must_not_suspend/ref.stderr index 6d30f134ec421..5f000014c7dba 100644 --- a/src/test/ui/lint/must_not_suspend/ref.stderr +++ b/src/test/ui/lint/must_not_suspend/ref.stderr @@ -3,7 +3,7 @@ error: `Umm` held across a suspend point, but should not be | LL | let guard = &mut self.u; | ^^^^^^ -LL | +LL | LL | other().await; | ------ the value is held across this suspend point | diff --git a/src/test/ui/lint/must_not_suspend/trait.stderr b/src/test/ui/lint/must_not_suspend/trait.stderr index dd3978b02a852..60369430a3e35 100644 --- a/src/test/ui/lint/must_not_suspend/trait.stderr +++ b/src/test/ui/lint/must_not_suspend/trait.stderr @@ -23,7 +23,7 @@ error: boxed `Wow` trait object held across a suspend point, but should not be | LL | let _guard2 = r#dyn(); | ^^^^^^^ -LL | +LL | LL | other().await; | ------ the value is held across this suspend point | diff --git a/src/test/ui/lint/renamed-lints-still-apply.stderr b/src/test/ui/lint/renamed-lints-still-apply.stderr index 00ed5c89d4b8b..e926719bb6be9 100644 --- a/src/test/ui/lint/renamed-lints-still-apply.stderr +++ b/src/test/ui/lint/renamed-lints-still-apply.stderr @@ -23,7 +23,7 @@ help: elide the single-use lifetime | LL - fn _foo<'a>(_x: &'a u32) {} LL + fn _foo(_x: &u32) {} - | + | error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/lint/suggestions.stderr b/src/test/ui/lint/suggestions.stderr index 255772ff40261..f4c0e2141b232 100644 --- a/src/test/ui/lint/suggestions.stderr +++ b/src/test/ui/lint/suggestions.stderr @@ -21,7 +21,7 @@ help: remove these parentheses | LL - let mut registry_no = (format!("NX-{}", 74205)); LL + let mut registry_no = format!("NX-{}", 74205); - | + | warning: variable does not need to be mutable --> $DIR/suggestions.rs:48:13 diff --git a/src/test/ui/lint/unused/issue-54538-unused-parens-lint.stderr b/src/test/ui/lint/unused/issue-54538-unused-parens-lint.stderr index 677b96d3f32f0..c73884663c8f5 100644 --- a/src/test/ui/lint/unused/issue-54538-unused-parens-lint.stderr +++ b/src/test/ui/lint/unused/issue-54538-unused-parens-lint.stderr @@ -13,7 +13,7 @@ help: remove these parentheses | LL - let (a) = 0; LL + let a = 0; - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:17:9 @@ -25,7 +25,7 @@ help: remove these parentheses | LL - for (a) in 0..1 {} LL + for a in 0..1 {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:18:12 @@ -37,7 +37,7 @@ help: remove these parentheses | LL - if let (a) = 0 {} LL + if let a = 0 {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:19:15 @@ -49,7 +49,7 @@ help: remove these parentheses | LL - while let (a) = 0 {} LL + while let a = 0 {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:20:12 @@ -61,7 +61,7 @@ help: remove these parentheses | LL - fn foo((a): u8) {} LL + fn foo(a: u8) {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:21:14 @@ -73,7 +73,7 @@ help: remove these parentheses | LL - let _ = |(a): u8| 0; LL + let _ = |a: u8| 0; - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:49:12 @@ -85,7 +85,7 @@ help: remove these parentheses | LL - if let (0 | 1) = 0 {} LL + if let 0 | 1 = 0 {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:50:13 @@ -97,7 +97,7 @@ help: remove these parentheses | LL - if let ((0 | 1),) = (0,) {} LL + if let (0 | 1,) = (0,) {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:51:13 @@ -109,7 +109,7 @@ help: remove these parentheses | LL - if let [(0 | 1)] = [0] {} LL + if let [0 | 1] = [0] {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:52:16 @@ -121,7 +121,7 @@ help: remove these parentheses | LL - if let 0 | (1 | 2) = 0 {} LL + if let 0 | 1 | 2 = 0 {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:54:15 @@ -133,7 +133,7 @@ help: remove these parentheses | LL - if let TS((0 | 1)) = TS(0) {} LL + if let TS(0 | 1) = TS(0) {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:56:20 @@ -145,7 +145,7 @@ help: remove these parentheses | LL - if let NS { f: (0 | 1) } = (NS { f: 0 }) {} LL + if let NS { f: 0 | 1 } = (NS { f: 0 }) {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:66:9 @@ -157,7 +157,7 @@ help: remove these parentheses | LL - (_) => {} LL + _ => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:67:9 @@ -169,7 +169,7 @@ help: remove these parentheses | LL - (y) => {} LL + y => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:68:9 @@ -181,7 +181,7 @@ help: remove these parentheses | LL - (ref r) => {} LL + ref r => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:69:9 @@ -193,7 +193,7 @@ help: remove these parentheses | LL - (e @ 1...2) => {} LL + e @ 1...2 => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:75:9 @@ -205,7 +205,7 @@ help: remove these parentheses | LL - (e @ &(1...2)) => {} LL + e @ &(1...2) => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:76:10 @@ -217,7 +217,7 @@ help: remove these parentheses | LL - &(_) => {} LL + &_ => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:87:9 @@ -229,7 +229,7 @@ help: remove these parentheses | LL - (_) => {} LL + _ => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:88:9 @@ -241,7 +241,7 @@ help: remove these parentheses | LL - (y) => {} LL + y => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:89:9 @@ -253,7 +253,7 @@ help: remove these parentheses | LL - (ref r) => {} LL + ref r => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:90:9 @@ -265,7 +265,7 @@ help: remove these parentheses | LL - (e @ 1..=2) => {} LL + e @ 1..=2 => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:96:9 @@ -277,7 +277,7 @@ help: remove these parentheses | LL - (e @ &(1..=2)) => {} LL + e @ &(1..=2) => {} - | + | error: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:97:10 @@ -289,7 +289,7 @@ help: remove these parentheses | LL - &(_) => {} LL + &_ => {} - | + | error: aborting due to 24 previous errors diff --git a/src/test/ui/lint/unused/issue-74883-unused-paren-baren-yield.stderr b/src/test/ui/lint/unused/issue-74883-unused-paren-baren-yield.stderr index a715093df4c32..3f1fee332bec5 100644 --- a/src/test/ui/lint/unused/issue-74883-unused-paren-baren-yield.stderr +++ b/src/test/ui/lint/unused/issue-74883-unused-paren-baren-yield.stderr @@ -13,7 +13,7 @@ help: remove these parentheses | LL - while let Some(_) = ({yield}) {} LL + while let Some(_) = {yield} {} - | + | error: unnecessary parentheses around `let` scrutinee expression --> $DIR/issue-74883-unused-paren-baren-yield.rs:15:29 @@ -25,7 +25,7 @@ help: remove these parentheses | LL - while let Some(_) = ((yield)) {} LL + while let Some(_) = (yield) {} - | + | error: unnecessary braces around block return value --> $DIR/issue-74883-unused-paren-baren-yield.rs:16:10 @@ -42,7 +42,7 @@ help: remove these braces | LL - {{yield}}; LL + {yield}; - | + | error: unnecessary parentheses around block return value --> $DIR/issue-74883-unused-paren-baren-yield.rs:17:10 @@ -54,7 +54,7 @@ help: remove these parentheses | LL - {( yield )}; LL + {yield}; - | + | error: unnecessary parentheses around block return value --> $DIR/issue-74883-unused-paren-baren-yield.rs:18:30 @@ -66,7 +66,7 @@ help: remove these parentheses | LL - while let Some(_) = {(yield)} {} LL + while let Some(_) = {yield} {} - | + | error: unnecessary braces around block return value --> $DIR/issue-74883-unused-paren-baren-yield.rs:19:30 @@ -78,7 +78,7 @@ help: remove these braces | LL - while let Some(_) = {{yield}} {} LL + while let Some(_) = {yield} {} - | + | error: aborting due to 6 previous errors diff --git a/src/test/ui/lint/unused/issue-90807-unused-paren-error.stderr b/src/test/ui/lint/unused/issue-90807-unused-paren-error.stderr index 4e158e126ac1f..b3b809d5f42d4 100644 --- a/src/test/ui/lint/unused/issue-90807-unused-paren-error.stderr +++ b/src/test/ui/lint/unused/issue-90807-unused-paren-error.stderr @@ -13,7 +13,7 @@ help: remove these parentheses | LL - for _ in (1..loop { break 2 }) {} LL + for _ in 1..loop { break 2 } {} - | + | error: unnecessary parentheses around `for` iterator expression --> $DIR/issue-90807-unused-paren-error.rs:8:14 @@ -25,7 +25,7 @@ help: remove these parentheses | LL - for _ in (1..match () { () => 2 }) {} LL + for _ in 1..match () { () => 2 } {} - | + | error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/unused_braces.stderr b/src/test/ui/lint/unused_braces.stderr index 7d6fef00ac1a4..7773f44ea2d38 100644 --- a/src/test/ui/lint/unused_braces.stderr +++ b/src/test/ui/lint/unused_braces.stderr @@ -13,7 +13,7 @@ help: remove these parentheses | LL - let _ = (7); LL + let _ = 7; - | + | warning: unnecessary braces around `if` condition --> $DIR/unused_braces.rs:26:8 @@ -30,7 +30,7 @@ help: remove these braces | LL - if { true } { LL + if true { - | + | warning: unnecessary braces around `while` condition --> $DIR/unused_braces.rs:30:11 @@ -42,7 +42,7 @@ help: remove these braces | LL - while { false } { LL + while false { - | + | warning: unnecessary braces around const expression --> $DIR/unused_braces.rs:34:17 @@ -54,7 +54,7 @@ help: remove these braces | LL - let _: [u8; { 3 }]; LL + let _: [u8; 3]; - | + | warning: unnecessary braces around function argument --> $DIR/unused_braces.rs:37:13 @@ -66,7 +66,7 @@ help: remove these braces | LL - consume({ 7 }); LL + consume(7); - | + | warning: 5 warnings emitted diff --git a/src/test/ui/lint/unused_braces_borrow.stderr b/src/test/ui/lint/unused_braces_borrow.stderr index 5a5326cab3b1d..05f7432b8ab36 100644 --- a/src/test/ui/lint/unused_braces_borrow.stderr +++ b/src/test/ui/lint/unused_braces_borrow.stderr @@ -13,7 +13,7 @@ help: remove these braces | LL - consume({ a.b }); LL + consume(a.b); - | + | warning: 1 warning emitted diff --git a/src/test/ui/lint/unused_parens_json_suggestion.stderr b/src/test/ui/lint/unused_parens_json_suggestion.stderr index 169fb824021ed..ea19e0cdc0cb3 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.stderr +++ b/src/test/ui/lint/unused_parens_json_suggestion.stderr @@ -13,7 +13,7 @@ help: remove these parentheses | LL - let _a = (1 / (2 + 3)); LL + let _a = 1 / (2 + 3); - | + | "} {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error diff --git a/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr b/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr index 43367aaa9113b..f4c6ceaf1dc1b 100644 --- a/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr +++ b/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr @@ -13,7 +13,7 @@ help: remove these parentheses | LL - if (_b) { LL + if _b { - | + | "} {"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":612,"byte_end":613,"line_start":28,"line_end":28,"column_start":7,"column_end":8,"is_primary":true,"text":[{"text":" if(c) { @@ -26,7 +26,7 @@ help: remove these parentheses | LL - if(c) { LL + if c { - | + | "} {"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":692,"byte_end":693,"line_start":32,"line_end":32,"column_start":8,"column_end":9,"is_primary":true,"text":[{"text":" if (c){ @@ -39,7 +39,7 @@ help: remove these parentheses | LL - if (c){ LL + if c { - | + | "} {"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":774,"byte_end":775,"line_start":36,"line_end":36,"column_start":11,"column_end":12,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":12}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":788,"byte_end":789,"line_start":36,"line_end":36,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":774,"byte_end":775,"line_start":36,"line_end":36,"column_start":11,"column_end":12,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":12}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":788,"byte_end":789,"line_start":36,"line_end":36,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":" ","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `while` condition @@ -52,7 +52,7 @@ help: remove these parentheses | LL - while (false && true){ LL + while false && true { - | + | "} {"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":802,"byte_end":803,"line_start":37,"line_end":37,"column_start":12,"column_end":13,"is_primary":true,"text":[{"text":" if (c) { @@ -65,7 +65,7 @@ help: remove these parentheses | LL - if (c) { LL + if c { - | + | "} {"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":899,"byte_end":900,"line_start":43,"line_end":43,"column_start":10,"column_end":11,"is_primary":true,"text":[{"text":" while(true && false) { @@ -78,7 +78,7 @@ help: remove these parentheses | LL - while(true && false) { LL + while true && false { - | + | "} {"message":"unnecessary parentheses around `for` iterator expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":968,"byte_end":969,"line_start":44,"line_end":44,"column_start":18,"column_end":19,"is_primary":true,"text":[{"text":" for _ in (0 .. 3){ @@ -91,7 +91,7 @@ help: remove these parentheses | LL - for _ in (0 .. 3){ LL + for _ in 0 .. 3 { - | + | "} {"message":"unnecessary parentheses around `for` iterator expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1069,"byte_end":1070,"line_start":49,"line_end":49,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" for _ in (0 .. 3) { @@ -104,7 +104,7 @@ help: remove these parentheses | LL - for _ in (0 .. 3) { LL + for _ in 0 .. 3 { - | + | "} {"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1128,"byte_end":1129,"line_start":50,"line_end":50,"column_start":15,"column_end":16,"is_primary":true,"text":[{"text":" while (true && false) { @@ -117,7 +117,7 @@ help: remove these parentheses | LL - while (true && false) { LL + while true && false { - | + | "} {"message":"aborting due to 9 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 9 previous errors diff --git a/src/test/ui/liveness/liveness-use-after-move.stderr b/src/test/ui/liveness/liveness-use-after-move.stderr index df54af9f0f2ce..f7d131109ea8f 100644 --- a/src/test/ui/liveness/liveness-use-after-move.stderr +++ b/src/test/ui/liveness/liveness-use-after-move.stderr @@ -5,7 +5,7 @@ LL | let x: Box<_> = 5.into(); | - move occurs because `x` has type `Box`, which does not implement the `Copy` trait LL | let y = x; | - value moved here -LL | +LL | LL | println!("{}", *x); | ^^ value borrowed here after move | diff --git a/src/test/ui/macros/macro-outer-attributes.stderr b/src/test/ui/macros/macro-outer-attributes.stderr index 91073d3698d91..4ea760ab82b9c 100644 --- a/src/test/ui/macros/macro-outer-attributes.stderr +++ b/src/test/ui/macros/macro-outer-attributes.stderr @@ -12,7 +12,7 @@ help: if you import `bar`, refer to it directly | LL - a::bar(); LL + bar(); - | + | error: aborting due to previous error diff --git a/src/test/ui/match/match-tag-nullary.stderr b/src/test/ui/match/match-tag-nullary.stderr index 723c7fa92b10d..a6add31d1c510 100644 --- a/src/test/ui/match/match-tag-nullary.stderr +++ b/src/test/ui/match/match-tag-nullary.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | enum B { B } | - unit variant defined here -LL | +LL | LL | fn main() { let x: A = A::A; match x { B::B => { } } } | - ^^^^ expected enum `A`, found enum `B` | | diff --git a/src/test/ui/mismatched_types/cast-rfc0401.stderr b/src/test/ui/mismatched_types/cast-rfc0401.stderr index 3a508459cc046..e63ca6e11de59 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.stderr +++ b/src/test/ui/mismatched_types/cast-rfc0401.stderr @@ -30,7 +30,7 @@ help: consider borrowing the value | LL - let _ = v as &u8; LL + let _ = &*v; - | + | error[E0605]: non-primitive cast: `*const u8` as `E` --> $DIR/cast-rfc0401.rs:30:13 diff --git a/src/test/ui/missing/missing-items/missing-type-parameter2.stderr b/src/test/ui/missing/missing-items/missing-type-parameter2.stderr index cbceec58eb1eb..f33951c98bfb3 100644 --- a/src/test/ui/missing/missing-items/missing-type-parameter2.stderr +++ b/src/test/ui/missing/missing-items/missing-type-parameter2.stderr @@ -3,7 +3,7 @@ error[E0412]: cannot find type `N` in this scope | LL | struct X(); | ------------------------ similarly named struct `X` defined here -LL | +LL | LL | impl X {} | ^ | diff --git a/src/test/ui/namespace/namespace-mix.stderr b/src/test/ui/namespace/namespace-mix.stderr index 037a858d7e101..ccdd4dd272e9b 100644 --- a/src/test/ui/namespace/namespace-mix.stderr +++ b/src/test/ui/namespace/namespace-mix.stderr @@ -22,7 +22,7 @@ help: if you import `S`, refer to it directly | LL - check(m1::S); LL + check(S); - | + | error[E0423]: expected value, found type alias `xm1::S` --> $DIR/namespace-mix.rs:40:11 @@ -50,7 +50,7 @@ help: if you import `S`, refer to it directly | LL - check(xm1::S); LL + check(S); - | + | error[E0423]: expected value, found struct variant `m7::V` --> $DIR/namespace-mix.rs:100:11 @@ -81,7 +81,7 @@ help: if you import `V`, refer to it directly | LL - check(m7::V); LL + check(V); - | + | error[E0423]: expected value, found struct variant `xm7::V` --> $DIR/namespace-mix.rs:106:11 @@ -114,7 +114,7 @@ help: if you import `V`, refer to it directly | LL - check(xm7::V); LL + check(V); - | + | error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:33:11 diff --git a/src/test/ui/never_type/diverging-tuple-parts-39485.stderr b/src/test/ui/never_type/diverging-tuple-parts-39485.stderr index 4b5b8c45d5939..52d07ae170c41 100644 --- a/src/test/ui/never_type/diverging-tuple-parts-39485.stderr +++ b/src/test/ui/never_type/diverging-tuple-parts-39485.stderr @@ -14,7 +14,7 @@ help: consider removing the borrow | LL - &panic!() LL + panic!() - | + | error[E0308]: mismatched types --> $DIR/diverging-tuple-parts-39485.rs:12:5 diff --git a/src/test/ui/never_type/issue-52443.stderr b/src/test/ui/never_type/issue-52443.stderr index c2079a19d0a58..3c0daa4c55f01 100644 --- a/src/test/ui/never_type/issue-52443.stderr +++ b/src/test/ui/never_type/issue-52443.stderr @@ -27,7 +27,7 @@ help: consider removing the borrow | LL - [(); & { loop { continue } } ]; LL + [(); { loop { continue } } ]; - | + | error[E0308]: mismatched types --> $DIR/issue-52443.rs:4:17 diff --git a/src/test/ui/nll/capture-ref-in-struct.stderr b/src/test/ui/nll/capture-ref-in-struct.stderr index 521e543bd2693..cdfe7f6db82a9 100644 --- a/src/test/ui/nll/capture-ref-in-struct.stderr +++ b/src/test/ui/nll/capture-ref-in-struct.stderr @@ -6,7 +6,7 @@ LL | y: &y, ... LL | } | - `y` dropped here while still borrowed -LL | +LL | LL | deref(p); | - borrow later used here diff --git a/src/test/ui/nll/closure-requirements/escape-argument.stderr b/src/test/ui/nll/closure-requirements/escape-argument.stderr index 22398f0857255..49ec0dd931ac0 100644 --- a/src/test/ui/nll/closure-requirements/escape-argument.stderr +++ b/src/test/ui/nll/closure-requirements/escape-argument.stderr @@ -32,7 +32,7 @@ LL | closure(&mut p, &y); LL | LL | } | - `y` dropped here while still borrowed -LL | +LL | LL | deref(p); | - borrow later used here diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr index e1b446fc61f61..f0ae4c7fb0492 100644 --- a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr +++ b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr @@ -54,7 +54,7 @@ LL | let mut closure1 = || p = &y; ... LL | } | - `y` dropped here while still borrowed -LL | +LL | LL | deref(p); | - borrow later used here diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr index 0ea1076c32ef4..e99fc4b43a23d 100644 --- a/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr +++ b/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr @@ -36,7 +36,7 @@ LL | let mut closure = || p = &y; ... LL | } | - `y` dropped here while still borrowed -LL | +LL | LL | deref(p); | - borrow later used here diff --git a/src/test/ui/nll/issue-52534-2.stderr b/src/test/ui/nll/issue-52534-2.stderr index cef4aba024037..ac385e056b9f8 100644 --- a/src/test/ui/nll/issue-52534-2.stderr +++ b/src/test/ui/nll/issue-52534-2.stderr @@ -6,7 +6,7 @@ LL | y = &x LL | LL | } | - `x` dropped here while still borrowed -LL | +LL | LL | println!("{}", y); | - borrow later used here diff --git a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr index 6dacfd1f264c6..d8f43cbc92a1e 100644 --- a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr +++ b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr @@ -9,7 +9,7 @@ LL | D("other").next(&_thing1) ... LL | } | - `_thing1` dropped here while still borrowed -LL | +LL | LL | ; | - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` | diff --git a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr index 68d3cef8aa13b..92f5ffdf388ed 100644 --- a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr +++ b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr @@ -8,7 +8,7 @@ LL | D(&_thing1).end() | a temporary with access to the borrow is created here ... LL | } | - `_thing1` dropped here while still borrowed -LL | +LL | LL | ; | - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` | diff --git a/src/test/ui/no-capture-arc.stderr b/src/test/ui/no-capture-arc.stderr index 37032e73f1900..7fa2090e3e614 100644 --- a/src/test/ui/no-capture-arc.stderr +++ b/src/test/ui/no-capture-arc.stderr @@ -3,7 +3,7 @@ error[E0382]: borrow of moved value: `arc_v` | LL | let arc_v = Arc::new(v); | ----- move occurs because `arc_v` has type `Arc>`, which does not implement the `Copy` trait -LL | +LL | LL | thread::spawn(move|| { | ------ value moved into closure here LL | assert_eq!((*arc_v)[3], 4); diff --git a/src/test/ui/no-reuse-move-arc.stderr b/src/test/ui/no-reuse-move-arc.stderr index 6f37d4c9d8691..bcc4506dc8d1c 100644 --- a/src/test/ui/no-reuse-move-arc.stderr +++ b/src/test/ui/no-reuse-move-arc.stderr @@ -3,7 +3,7 @@ error[E0382]: borrow of moved value: `arc_v` | LL | let arc_v = Arc::new(v); | ----- move occurs because `arc_v` has type `Arc>`, which does not implement the `Copy` trait -LL | +LL | LL | thread::spawn(move|| { | ------ value moved into closure here LL | assert_eq!((*arc_v)[3], 4); diff --git a/src/test/ui/non-fmt-panic.stderr b/src/test/ui/non-fmt-panic.stderr index 3305e5cc9068d..4da97ed5d60eb 100644 --- a/src/test/ui/non-fmt-panic.stderr +++ b/src/test/ui/non-fmt-panic.stderr @@ -296,7 +296,7 @@ help: remove the `format!(..)` macro call | LL - panic!(format!("{}", 1)); LL + panic!("{}", 1); - | + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:50:18 @@ -311,7 +311,7 @@ help: remove the `format!(..)` macro call | LL - unreachable!(format!("{}", 1)); LL + unreachable!("{}", 1); - | + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:51:20 @@ -326,7 +326,7 @@ help: remove the `format!(..)` macro call | LL - assert!(false, format!("{}", 1)); LL + assert!(false, "{}", 1); - | + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:52:26 @@ -341,7 +341,7 @@ help: remove the `format!(..)` macro call | LL - debug_assert!(false, format!("{}", 1)); LL + debug_assert!(false, "{}", 1); - | + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:54:12 diff --git a/src/test/ui/not-clone-closure.stderr b/src/test/ui/not-clone-closure.stderr index 92909797c9679..78b35569c2162 100644 --- a/src/test/ui/not-clone-closure.stderr +++ b/src/test/ui/not-clone-closure.stderr @@ -6,7 +6,7 @@ LL | let hello = move || { LL | | println!("Hello {}", a.0); LL | | }; | |_____- within this `[closure@$DIR/not-clone-closure.rs:7:17: 9:6]` -LL | +LL | LL | let hello = hello.clone(); | ^^^^^ within `[closure@$DIR/not-clone-closure.rs:7:17: 9:6]`, the trait `Clone` is not implemented for `S` | diff --git a/src/test/ui/packed/issue-27060-2.stderr b/src/test/ui/packed/issue-27060-2.stderr index 8cd2ce6f36ca6..0836ceaecd198 100644 --- a/src/test/ui/packed/issue-27060-2.stderr +++ b/src/test/ui/packed/issue-27060-2.stderr @@ -12,7 +12,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - pub struct Bad { LL + pub struct Bad { - | + | help: borrowed types always have a statically known size | LL | data: &T, diff --git a/src/test/ui/parser/attr-stmt-expr-attr-bad.stderr b/src/test/ui/parser/attr-stmt-expr-attr-bad.stderr index d38b98a190117..7bb3db0301b3a 100644 --- a/src/test/ui/parser/attr-stmt-expr-attr-bad.stderr +++ b/src/test/ui/parser/attr-stmt-expr-attr-bad.stderr @@ -322,7 +322,7 @@ help: to annotate the item macro invocation, change the attribute from inner to | LL - #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!(); } LL + #[cfg(FALSE)] fn s() { #[attr] #[attr] foo!(); } - | + | error: an inner attribute is not permitted following an outer attribute --> $DIR/attr-stmt-expr-attr-bad.rs:80:32 @@ -338,7 +338,7 @@ help: to annotate the item macro invocation, change the attribute from inner to | LL - #[cfg(FALSE)] fn s() { #[attr] #![attr] foo![]; } LL + #[cfg(FALSE)] fn s() { #[attr] #[attr] foo![]; } - | + | error: an inner attribute is not permitted following an outer attribute --> $DIR/attr-stmt-expr-attr-bad.rs:82:32 @@ -354,7 +354,7 @@ help: to annotate the item macro invocation, change the attribute from inner to | LL - #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!{}; } LL + #[cfg(FALSE)] fn s() { #[attr] #[attr] foo!{}; } - | + | error[E0586]: inclusive range with no end --> $DIR/attr-stmt-expr-attr-bad.rs:88:35 diff --git a/src/test/ui/parser/attr-with-a-semicolon.stderr b/src/test/ui/parser/attr-with-a-semicolon.stderr index 49ed30150d0d7..0de3490b8ea98 100644 --- a/src/test/ui/parser/attr-with-a-semicolon.stderr +++ b/src/test/ui/parser/attr-with-a-semicolon.stderr @@ -8,7 +8,7 @@ help: consider removing this semicolon | LL - #[derive(Debug, Clone)]; LL + #[derive(Debug, Clone)] - | + | error: aborting due to previous error diff --git a/src/test/ui/parser/attr.stderr b/src/test/ui/parser/attr.stderr index 3527274bd0f8c..7cd0ac2244afe 100644 --- a/src/test/ui/parser/attr.stderr +++ b/src/test/ui/parser/attr.stderr @@ -11,7 +11,7 @@ help: to annotate the function, change the attribute from inner to outer style | LL - #![lang = "foo"] LL + #[lang = "foo"] - | + | error: aborting due to previous error diff --git a/src/test/ui/parser/circular_modules_main.stderr b/src/test/ui/parser/circular_modules_main.stderr index c5434c72b382b..1094def6014a9 100644 --- a/src/test/ui/parser/circular_modules_main.stderr +++ b/src/test/ui/parser/circular_modules_main.stderr @@ -18,7 +18,7 @@ help: if you import `hi_str`, refer to it directly | LL - println!("{}", circular_modules_main::hi_str()); LL + println!("{}", hi_str()); - | + | error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/doc-comment-in-if-statement.stderr b/src/test/ui/parser/doc-comment-in-if-statement.stderr index b7c1847fc7c0d..fc0bc507370af 100644 --- a/src/test/ui/parser/doc-comment-in-if-statement.stderr +++ b/src/test/ui/parser/doc-comment-in-if-statement.stderr @@ -9,7 +9,7 @@ help: you might have meant to write a regular comment | LL - if true /*!*/ {} LL + if true /**/ {} - | + | error: outer attributes are not allowed on `if` and `else` branches --> $DIR/doc-comment-in-if-statement.rs:2:13 diff --git a/src/test/ui/parser/expr-as-stmt-2.stderr b/src/test/ui/parser/expr-as-stmt-2.stderr index b7516babc1330..9b939f05e024d 100644 --- a/src/test/ui/parser/expr-as-stmt-2.stderr +++ b/src/test/ui/parser/expr-as-stmt-2.stderr @@ -40,7 +40,7 @@ help: consider removing the `&&` | LL - && LL + if let Some(y) = a { true } else { false } - | + | help: parentheses are required to parse this as an expression | LL | (if let Some(x) = a { true } else { false }) diff --git a/src/test/ui/parser/expr-as-stmt.stderr b/src/test/ui/parser/expr-as-stmt.stderr index e63da52c8fe1d..8eb81301bc3e8 100644 --- a/src/test/ui/parser/expr-as-stmt.stderr +++ b/src/test/ui/parser/expr-as-stmt.stderr @@ -174,7 +174,7 @@ help: consider removing the `&&` | LL - { true } && { true } LL + { true } { true } - | + | help: parentheses are required to parse this as an expression | LL | ({ true }) && { true } diff --git a/src/test/ui/parser/increment-autofix.stderr b/src/test/ui/parser/increment-autofix.stderr index 593592ba4ab74..1dc69fd9f4659 100644 --- a/src/test/ui/parser/increment-autofix.stderr +++ b/src/test/ui/parser/increment-autofix.stderr @@ -8,7 +8,7 @@ help: use `+= 1` instead | LL - ++i; LL + i += 1; - | + | error: Rust has no prefix increment operator --> $DIR/increment-autofix.rs:11:11 @@ -33,7 +33,7 @@ help: use `+= 1` instead | LL - ++tmp; LL + tmp += 1; - | + | error: Rust has no prefix increment operator --> $DIR/increment-autofix.rs:25:11 diff --git a/src/test/ui/parser/increment-notfixed.stderr b/src/test/ui/parser/increment-notfixed.stderr index f23595da32ac8..352d98cf82ec7 100644 --- a/src/test/ui/parser/increment-notfixed.stderr +++ b/src/test/ui/parser/increment-notfixed.stderr @@ -10,7 +10,7 @@ LL | { let tmp = i; i += 1; tmp }; | +++++++++++ ~~~~~~~~~~~~~~~ LL - i++; LL + i += 1; - | + | error: Rust has no postfix increment operator --> $DIR/increment-notfixed.rs:17:12 @@ -26,7 +26,7 @@ LL | while { let tmp = i; i += 1; tmp } < 5 { | +++++++++++ ~~~~~~~~~~~~~~~ LL - while i++ < 5 { LL + while i += 1 < 5 { - | + | error: Rust has no postfix increment operator --> $DIR/increment-notfixed.rs:25:8 @@ -40,7 +40,7 @@ LL | { let tmp_ = tmp; tmp += 1; tmp_ }; | ++++++++++++ ~~~~~~~~~~~~~~~~~~ LL - tmp++; LL + tmp += 1; - | + | error: Rust has no postfix increment operator --> $DIR/increment-notfixed.rs:31:14 @@ -56,7 +56,7 @@ LL | while { let tmp_ = tmp; tmp += 1; tmp_ } < 5 { | ++++++++++++ ~~~~~~~~~~~~~~~~~~ LL - while tmp++ < 5 { LL + while tmp += 1 < 5 { - | + | error: Rust has no postfix increment operator --> $DIR/increment-notfixed.rs:39:16 @@ -70,7 +70,7 @@ LL | { let tmp = foo.bar.qux; foo.bar.qux += 1; tmp }; | +++++++++++ ~~~~~~~~~~~~~~~~~~~~~~~~~ LL - foo.bar.qux++; LL + foo.bar.qux += 1; - | + | error: Rust has no postfix increment operator --> $DIR/increment-notfixed.rs:49:10 @@ -84,7 +84,7 @@ LL | { let tmp = s.tmp; s.tmp += 1; tmp }; | +++++++++++ ~~~~~~~~~~~~~~~~~~~ LL - s.tmp++; LL + s.tmp += 1; - | + | error: Rust has no prefix increment operator --> $DIR/increment-notfixed.rs:56:5 @@ -96,7 +96,7 @@ help: use `+= 1` instead | LL - ++foo.bar.qux; LL + foo.bar.qux += 1; - | + | error: aborting due to 7 previous errors diff --git a/src/test/ui/parser/inner-attr-after-doc-comment.stderr b/src/test/ui/parser/inner-attr-after-doc-comment.stderr index 404800ee15bdd..2cfafac779426 100644 --- a/src/test/ui/parser/inner-attr-after-doc-comment.stderr +++ b/src/test/ui/parser/inner-attr-after-doc-comment.stderr @@ -5,7 +5,7 @@ LL | / /** LL | | * My module LL | | */ | |___- previous doc comment -LL | +LL | LL | #![recursion_limit="100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ not permitted following an outer attribute LL | @@ -17,7 +17,7 @@ help: to annotate the function, change the attribute from inner to outer style | LL - #![recursion_limit="100"] LL + #[recursion_limit="100"] - | + | error: aborting due to previous error diff --git a/src/test/ui/parser/inner-attr.stderr b/src/test/ui/parser/inner-attr.stderr index 1adac74590881..331c254a52b48 100644 --- a/src/test/ui/parser/inner-attr.stderr +++ b/src/test/ui/parser/inner-attr.stderr @@ -3,7 +3,7 @@ error: an inner attribute is not permitted following an outer attribute | LL | #[feature(lang_items)] | ---------------------- previous outer attribute -LL | +LL | LL | #![recursion_limit="100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ not permitted following an outer attribute LL | fn main() {} @@ -14,7 +14,7 @@ help: to annotate the function, change the attribute from inner to outer style | LL - #![recursion_limit="100"] LL + #[recursion_limit="100"] - | + | error: aborting due to previous error diff --git a/src/test/ui/parser/issues/issue-30318.stderr b/src/test/ui/parser/issues/issue-30318.stderr index 7e7108845546a..c441a92abad92 100644 --- a/src/test/ui/parser/issues/issue-30318.stderr +++ b/src/test/ui/parser/issues/issue-30318.stderr @@ -25,7 +25,7 @@ help: to annotate the function, change the attribute from inner to outer style | LL - #![test] LL + #[test] - | + | error[E0753]: expected outer doc comment --> $DIR/issue-30318.rs:13:1 @@ -52,7 +52,7 @@ help: you might have meant to write a regular comment | LL - //! Misplaced comment... LL + // Misplaced comment... - | + | error[E0753]: expected outer doc comment --> $DIR/issue-30318.rs:23:1 @@ -65,7 +65,7 @@ help: you might have meant to write a regular comment | LL - /*! Misplaced comment... */ LL + /* Misplaced comment... */ - | + | error: expected item after doc comment --> $DIR/issue-30318.rs:23:1 diff --git a/src/test/ui/parser/issues/issue-34255-1.stderr b/src/test/ui/parser/issues/issue-34255-1.stderr index fbff75e37d9f0..0e2b0d62ef6d3 100644 --- a/src/test/ui/parser/issues/issue-34255-1.stderr +++ b/src/test/ui/parser/issues/issue-34255-1.stderr @@ -12,7 +12,7 @@ help: if `Test::Drill` is a function, use the arguments directly | LL - Test::Drill(field: 42); LL + Test::Drill(42); - | + | error: aborting due to previous error diff --git a/src/test/ui/parser/issues/issue-35813-postfix-after-cast.stderr b/src/test/ui/parser/issues/issue-35813-postfix-after-cast.stderr index 6823a42682325..4cf273d8be50c 100644 --- a/src/test/ui/parser/issues/issue-35813-postfix-after-cast.stderr +++ b/src/test/ui/parser/issues/issue-35813-postfix-after-cast.stderr @@ -23,7 +23,7 @@ help: alternatively, remove the type ascription | LL - vec![1, 2, 3]: Vec[0]; LL + vec![1, 2, 3][0]; - | + | error: casts cannot be followed by indexing --> $DIR/issue-35813-postfix-after-cast.rs:17:5 @@ -50,7 +50,7 @@ help: alternatively, remove the type ascription | LL - (&[0i32]): &[i32; 1][0]; LL + (&[0i32])[0]; - | + | error: casts cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:39:13 @@ -66,7 +66,7 @@ help: alternatively, remove the type ascription | LL - let _ = 0i32: i32: i32.count_ones(); LL + let _ = 0i32: i32.count_ones(); - | + | error: casts cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:41:13 @@ -82,7 +82,7 @@ help: alternatively, remove the type ascription | LL - let _ = 0 as i32: i32.count_ones(); LL + let _ = 0 as i32.count_ones(); - | + | error: casts cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:43:13 @@ -131,7 +131,7 @@ help: alternatively, remove the type ascription | LL - let _ = 0i32: i32.count_ones(): u32; LL + let _ = 0i32.count_ones(): u32; - | + | error: casts cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:51:13 @@ -158,7 +158,7 @@ help: alternatively, remove the type ascription | LL - let _ = 0i32: i32.count_ones() as u32; LL + let _ = 0i32.count_ones() as u32; - | + | error: casts cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:55:13 @@ -185,7 +185,7 @@ help: alternatively, remove the type ascription | LL - let _ = 0i32: i32: i32.count_ones() as u32 as i32; LL + let _ = 0i32: i32.count_ones() as u32 as i32; - | + | error: casts cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:62:13 @@ -237,7 +237,7 @@ help: alternatively, remove the type ascription | LL - 0: i32.max(0); LL + 0.max(0); - | + | error: casts cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:92:8 @@ -264,7 +264,7 @@ help: alternatively, remove the type ascription | LL - if 5u64: u64.max(0) == 0 { LL + if 5u64.max(0) == 0 { - | + | error: casts cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:102:9 @@ -291,7 +291,7 @@ help: alternatively, remove the type ascription | LL - 5u64: u64.max(0) == 0 LL + 5u64.max(0) == 0 - | + | error: casts cannot be followed by indexing --> $DIR/issue-35813-postfix-after-cast.rs:111:24 @@ -318,7 +318,7 @@ help: alternatively, remove the type ascription | LL - static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]); LL + static bar2: &[i32] = &(&[1i32,2,3][0..1]); - | + | error: casts cannot be followed by `?` --> $DIR/issue-35813-postfix-after-cast.rs:119:5 @@ -345,7 +345,7 @@ help: alternatively, remove the type ascription | LL - Err(0u64): Result?; LL + Err(0u64)?; - | + | error: casts cannot be followed by a function call --> $DIR/issue-35813-postfix-after-cast.rs:145:5 @@ -372,7 +372,7 @@ help: alternatively, remove the type ascription | LL - drop_ptr: fn(u8)(0); LL + drop_ptr(0); - | + | error: casts cannot be followed by `.await` --> $DIR/issue-35813-postfix-after-cast.rs:152:5 @@ -399,7 +399,7 @@ help: alternatively, remove the type ascription | LL - Box::pin(noop()): Pin>.await; LL + Box::pin(noop()).await; - | + | error: casts cannot be followed by a field access --> $DIR/issue-35813-postfix-after-cast.rs:167:5 @@ -426,7 +426,7 @@ help: alternatively, remove the type ascription | LL - Foo::default(): Foo.bar; LL + Foo::default().bar; - | + | error: casts cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:84:9 @@ -453,7 +453,7 @@ help: alternatively, remove the type ascription | LL - if true { 33 } else { 44 }: i32.max(0) LL + if true { 33 } else { 44 }.max(0) - | + | error[E0214]: parenthesized type parameters may only be used with a `Fn` trait --> $DIR/issue-35813-postfix-after-cast.rs:131:13 diff --git a/src/test/ui/parser/issues/issue-44406.stderr b/src/test/ui/parser/issues/issue-44406.stderr index 2f85d8cd8656b..1f0c1ea4c2f13 100644 --- a/src/test/ui/parser/issues/issue-44406.stderr +++ b/src/test/ui/parser/issues/issue-44406.stderr @@ -27,7 +27,7 @@ help: if `bar` is a function, use the arguments directly | LL - bar(baz: $rest) LL + bar(: $rest) - | + | error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/issues/issue-45296.stderr b/src/test/ui/parser/issues/issue-45296.stderr index 6abe266d4e90e..081a72054e8da 100644 --- a/src/test/ui/parser/issues/issue-45296.stderr +++ b/src/test/ui/parser/issues/issue-45296.stderr @@ -11,7 +11,7 @@ help: to annotate the function, change the attribute from inner to outer style | LL - #![allow(unused_variables)] LL + #[allow(unused_variables)] - | + | error: aborting due to previous error diff --git a/src/test/ui/parser/issues/issue-56031.stderr b/src/test/ui/parser/issues/issue-56031.stderr index 7ee5bc6ec6174..2fa05dd2dfbb3 100644 --- a/src/test/ui/parser/issues/issue-56031.stderr +++ b/src/test/ui/parser/issues/issue-56031.stderr @@ -12,7 +12,7 @@ help: for an inherent impl, drop this `for` | LL - impl for T {} LL + impl T {} - | + | error: aborting due to previous error diff --git a/src/test/ui/parser/issues/issue-62894.stderr b/src/test/ui/parser/issues/issue-62894.stderr index ed5e863bd9def..ae89926914eba 100644 --- a/src/test/ui/parser/issues/issue-62894.stderr +++ b/src/test/ui/parser/issues/issue-62894.stderr @@ -6,7 +6,7 @@ LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq! | | | | | unclosed delimiter | unclosed delimiter -LL | +LL | LL | fn main() {} | ^ @@ -18,7 +18,7 @@ LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq! | | | | | unclosed delimiter | unclosed delimiter -LL | +LL | LL | fn main() {} | ^ @@ -30,7 +30,7 @@ LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq! | | | | | unclosed delimiter | unclosed delimiter -LL | +LL | LL | fn main() {} | ^ @@ -39,7 +39,7 @@ error: expected one of `(`, `[`, or `{`, found keyword `fn` | LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq! | - expected one of `(`, `[`, or `{` -LL | +LL | LL | fn main() {} | ^^ unexpected token | diff --git a/src/test/ui/parser/issues/issue-62973.stderr b/src/test/ui/parser/issues/issue-62973.stderr index 871b5d5965134..bc3358fc6baa6 100644 --- a/src/test/ui/parser/issues/issue-62973.stderr +++ b/src/test/ui/parser/issues/issue-62973.stderr @@ -5,8 +5,8 @@ LL | fn p() { match s { v, E { [) {) } | - - unclosed delimiter | | | unclosed delimiter -LL | -LL | +LL | +LL | | ^ error: this file contains an unclosed delimiter @@ -16,8 +16,8 @@ LL | fn p() { match s { v, E { [) {) } | - - unclosed delimiter | | | unclosed delimiter -LL | -LL | +LL | +LL | | ^ error: expected one of `,` or `}`, found `{` @@ -51,8 +51,8 @@ error: expected one of `.`, `?`, `{`, or an operator, found `}` | LL | fn p() { match s { v, E { [) {) } | ----- while parsing this `match` expression -LL | -LL | +LL | +LL | | ^ expected one of `.`, `?`, `{`, or an operator error: mismatched closing delimiter: `)` diff --git a/src/test/ui/parser/issues/issue-88276-unary-plus.stderr b/src/test/ui/parser/issues/issue-88276-unary-plus.stderr index b26761729a837..363e08201f482 100644 --- a/src/test/ui/parser/issues/issue-88276-unary-plus.stderr +++ b/src/test/ui/parser/issues/issue-88276-unary-plus.stderr @@ -8,7 +8,7 @@ help: try removing the `+` | LL - let _ = +1; LL + let _ = 1; - | + | error: leading `+` is not supported --> $DIR/issue-88276-unary-plus.rs:5:20 @@ -20,7 +20,7 @@ help: try removing the `+` | LL - let _ = (1.0 + +2.0) * +3.0; LL + let _ = (1.0 + 2.0) * +3.0; - | + | error: leading `+` is not supported --> $DIR/issue-88276-unary-plus.rs:5:28 @@ -32,7 +32,7 @@ help: try removing the `+` | LL - let _ = (1.0 + +2.0) * +3.0; LL + let _ = (1.0 + +2.0) * 3.0; - | + | error: leading `+` is not supported --> $DIR/issue-88276-unary-plus.rs:7:14 @@ -44,7 +44,7 @@ help: try removing the `+` | LL - let _ = [+3, 4+6]; LL + let _ = [3, 4+6]; - | + | error: aborting due to 4 previous errors diff --git a/src/test/ui/parser/issues/issue-88818.stderr b/src/test/ui/parser/issues/issue-88818.stderr index d30990ae5820f..6e624c5a284e8 100644 --- a/src/test/ui/parser/issues/issue-88818.stderr +++ b/src/test/ui/parser/issues/issue-88818.stderr @@ -12,7 +12,7 @@ help: for an inherent impl, drop this `for` | LL - impl for S { } LL + impl S { } - | + | error: aborting due to previous error diff --git a/src/test/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr b/src/test/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr index 34a6ab00d7b2d..a5ee244452007 100644 --- a/src/test/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr +++ b/src/test/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr @@ -12,7 +12,7 @@ help: to annotate the struct, change the attribute from inner to outer style | LL - #![deny(missing_docs)] LL + #[deny(missing_docs)] - | + | error: aborting due to previous error diff --git a/src/test/ui/parser/labeled-no-colon-expr.stderr b/src/test/ui/parser/labeled-no-colon-expr.stderr index 5c9597c440cbd..a258bd3ccde57 100644 --- a/src/test/ui/parser/labeled-no-colon-expr.stderr +++ b/src/test/ui/parser/labeled-no-colon-expr.stderr @@ -52,7 +52,7 @@ help: consider removing the label | LL - 'l4 0; LL + 0; - | + | error: labeled expression must be followed by `:` --> $DIR/labeled-no-colon-expr.rs:8:9 diff --git a/src/test/ui/parser/mismatched-delim-brace-empty-block.stderr b/src/test/ui/parser/mismatched-delim-brace-empty-block.stderr index c871e549c9ec3..165eb8ae93282 100644 --- a/src/test/ui/parser/mismatched-delim-brace-empty-block.stderr +++ b/src/test/ui/parser/mismatched-delim-brace-empty-block.stderr @@ -3,7 +3,7 @@ error: unexpected closing delimiter: `}` | LL | fn main() { | - this opening brace... -LL | +LL | LL | } | - ...matches this closing brace LL | let _ = (); diff --git a/src/test/ui/parser/recover-assoc-eq-missing-term.stderr b/src/test/ui/parser/recover-assoc-eq-missing-term.stderr index f3ed77cbde215..152f7f2fb0626 100644 --- a/src/test/ui/parser/recover-assoc-eq-missing-term.stderr +++ b/src/test/ui/parser/recover-assoc-eq-missing-term.stderr @@ -12,7 +12,7 @@ help: remove the `=` if `Item` is a type | LL - bar::(); LL + bar::(); - | + | error: aborting due to previous error diff --git a/src/test/ui/parser/recover-for-loop-parens-around-head.stderr b/src/test/ui/parser/recover-for-loop-parens-around-head.stderr index fa55970dbd129..3bad29f20afc5 100644 --- a/src/test/ui/parser/recover-for-loop-parens-around-head.stderr +++ b/src/test/ui/parser/recover-for-loop-parens-around-head.stderr @@ -14,7 +14,7 @@ help: remove parentheses in `for` loop | LL - for ( elem in vec ) { LL + for elem in vec { - | + | error[E0308]: mismatched types --> $DIR/recover-for-loop-parens-around-head.rs:13:38 diff --git a/src/test/ui/parser/recover-from-bad-variant.stderr b/src/test/ui/parser/recover-from-bad-variant.stderr index 8cb71069bdaac..483312c16cc9c 100644 --- a/src/test/ui/parser/recover-from-bad-variant.stderr +++ b/src/test/ui/parser/recover-from-bad-variant.stderr @@ -12,7 +12,7 @@ help: if `Enum::Foo` is a function, use the arguments directly | LL - let x = Enum::Foo(a: 3, b: 4); LL + let x = Enum::Foo(3, 4); - | + | error[E0532]: expected tuple struct or tuple variant, found struct variant `Enum::Foo` --> $DIR/recover-from-bad-variant.rs:10:9 diff --git a/src/test/ui/parser/recover-labeled-non-block-expr.stderr b/src/test/ui/parser/recover-labeled-non-block-expr.stderr index 767389c48088a..27e376d517661 100644 --- a/src/test/ui/parser/recover-labeled-non-block-expr.stderr +++ b/src/test/ui/parser/recover-labeled-non-block-expr.stderr @@ -8,7 +8,7 @@ help: consider removing the label | LL - let _ = 'label: 1 + 1; LL + let _ = 1 + 1; - | + | error: expected `while`, `for`, `loop` or `{` after a label --> $DIR/recover-labeled-non-block-expr.rs:6:13 @@ -20,7 +20,7 @@ help: consider removing the label | LL - 'label: match () { () => {}, }; LL + match () { () => {}, }; - | + | error: expected `while`, `for`, `loop` or `{` after a label --> $DIR/recover-labeled-non-block-expr.rs:7:13 diff --git a/src/test/ui/parser/trait-object-delimiters.stderr b/src/test/ui/parser/trait-object-delimiters.stderr index 75eeeda864607..6eb9c7238cb82 100644 --- a/src/test/ui/parser/trait-object-delimiters.stderr +++ b/src/test/ui/parser/trait-object-delimiters.stderr @@ -14,7 +14,7 @@ help: remove the parentheses | LL - fn foo2(_: &dyn (Drop + AsRef)) {} LL + fn foo2(_: &dyn Drop + AsRef) {} - | + | error: expected parameter name, found `{` --> $DIR/trait-object-delimiters.rs:8:17 diff --git a/src/test/ui/parser/trait-object-trait-parens.stderr b/src/test/ui/parser/trait-object-trait-parens.stderr index a852337b6fe45..7ee965bd2babd 100644 --- a/src/test/ui/parser/trait-object-trait-parens.stderr +++ b/src/test/ui/parser/trait-object-trait-parens.stderr @@ -29,7 +29,7 @@ help: use `dyn` | LL - let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>; LL + let _: Box Trait<'a>)>; - | + | error[E0225]: only auto traits can be used as additional traits in a trait object --> $DIR/trait-object-trait-parens.rs:8:35 @@ -54,7 +54,7 @@ help: use `dyn` | LL - let _: Box Trait<'a>) + (Obj)>; LL + let _: Box Trait<'a>) + (Obj)>; - | + | error[E0225]: only auto traits can be used as additional traits in a trait object --> $DIR/trait-object-trait-parens.rs:13:47 @@ -79,7 +79,7 @@ help: use `dyn` | LL - let _: Box Trait<'a> + (Obj) + (?Sized)>; LL + let _: Box Trait<'a> + (Obj) + (?Sized)>; - | + | error[E0225]: only auto traits can be used as additional traits in a trait object --> $DIR/trait-object-trait-parens.rs:18:36 diff --git a/src/test/ui/parser/type-alias-where-fixable.stderr b/src/test/ui/parser/type-alias-where-fixable.stderr index 7ec1a965bae72..abfeb62fcbb46 100644 --- a/src/test/ui/parser/type-alias-where-fixable.stderr +++ b/src/test/ui/parser/type-alias-where-fixable.stderr @@ -10,7 +10,7 @@ help: move it to the end of the type declaration | LL - type Assoc where u32: Copy = (); LL + type Assoc = () where u32: Copy; - | + | warning: where clause not allowed here --> $DIR/type-alias-where-fixable.rs:18:17 @@ -23,7 +23,7 @@ help: move it to the end of the type declaration | LL - type Assoc2 where u32: Copy = () where i32: Copy; LL + type Assoc2 = () where i32: Copy, u32: Copy; - | + | warning: where clause not allowed here --> $DIR/type-alias-where-fixable.rs:26:17 @@ -36,7 +36,7 @@ help: move it to the end of the type declaration | LL - type Assoc2 where u32: Copy, i32: Copy = (); LL + type Assoc2 = () where u32: Copy, i32: Copy; - | + | warning: 3 warnings emitted diff --git a/src/test/ui/path-lookahead.stderr b/src/test/ui/path-lookahead.stderr index 8adf02b150b87..2cc786fd947c2 100644 --- a/src/test/ui/path-lookahead.stderr +++ b/src/test/ui/path-lookahead.stderr @@ -13,7 +13,7 @@ help: remove these parentheses | LL - return (::to_string(&arg)); LL + return ::to_string(&arg); - | + | warning: 1 warning emitted diff --git a/src/test/ui/privacy/private-in-public-warn.stderr b/src/test/ui/privacy/private-in-public-warn.stderr index a72d824779279..5f2c4935bad37 100644 --- a/src/test/ui/privacy/private-in-public-warn.stderr +++ b/src/test/ui/privacy/private-in-public-warn.stderr @@ -320,7 +320,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - pub type Alias = T; LL + pub type Alias = T; - | + | warning: where clauses are not enforced in type aliases --> $DIR/private-in-public-warn.rs:74:29 @@ -332,7 +332,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - pub type Alias where T: PrivTr = T; LL + pub type Alias = T; - | + | error: aborting due to 34 previous errors; 2 warnings emitted diff --git a/src/test/ui/reachable/unreachable-code.stderr b/src/test/ui/reachable/unreachable-code.stderr index 4b951263dbde6..cb1b760c282b5 100644 --- a/src/test/ui/reachable/unreachable-code.stderr +++ b/src/test/ui/reachable/unreachable-code.stderr @@ -3,7 +3,7 @@ error: unreachable statement | LL | loop{} | ------ any code following this expression is unreachable -LL | +LL | LL | let a = 3; | ^^^^^^^^^^ unreachable statement | diff --git a/src/test/ui/resolve/enums-are-namespaced-xc.stderr b/src/test/ui/resolve/enums-are-namespaced-xc.stderr index 1d26a2c005872..6448e596d56cf 100644 --- a/src/test/ui/resolve/enums-are-namespaced-xc.stderr +++ b/src/test/ui/resolve/enums-are-namespaced-xc.stderr @@ -12,7 +12,7 @@ help: if you import `A`, refer to it directly | LL - let _ = namespaced_enums::A; LL + let _ = A; - | + | error[E0425]: cannot find function, tuple struct or tuple variant `B` in crate `namespaced_enums` --> $DIR/enums-are-namespaced-xc.rs:7:31 @@ -28,7 +28,7 @@ help: if you import `B`, refer to it directly | LL - let _ = namespaced_enums::B(10); LL + let _ = B(10); - | + | error[E0422]: cannot find struct, variant or union type `C` in crate `namespaced_enums` --> $DIR/enums-are-namespaced-xc.rs:9:31 @@ -44,7 +44,7 @@ help: if you import `C`, refer to it directly | LL - let _ = namespaced_enums::C { a: 10 }; LL + let _ = C { a: 10 }; - | + | error: aborting due to 3 previous errors diff --git a/src/test/ui/resolve/issue-23716.stderr b/src/test/ui/resolve/issue-23716.stderr index e7bebfbbcb5f0..8b89c350c8460 100644 --- a/src/test/ui/resolve/issue-23716.stderr +++ b/src/test/ui/resolve/issue-23716.stderr @@ -3,7 +3,7 @@ error[E0530]: function parameters cannot shadow statics | LL | static foo: i32 = 0; | -------------------- the static `foo` is defined here -LL | +LL | LL | fn bar(foo: i32) {} | ^^^ cannot be named the same as a static @@ -12,7 +12,7 @@ error[E0530]: function parameters cannot shadow statics | LL | use self::submod::answer; | -------------------- the static `answer` is imported here -LL | +LL | LL | fn question(answer: i32) {} | ^^^^^^ cannot be named the same as a static diff --git a/src/test/ui/resolve/issue-50599.stderr b/src/test/ui/resolve/issue-50599.stderr index 4cc035cb11e20..30cf64480b92d 100644 --- a/src/test/ui/resolve/issue-50599.stderr +++ b/src/test/ui/resolve/issue-50599.stderr @@ -14,7 +14,7 @@ help: if you import `LOG10_2`, refer to it directly | LL - const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize; LL + const M: usize = (f64::from(N) * LOG10_2) as usize; - | + | error: aborting due to previous error diff --git a/src/test/ui/resolve/issue-81508.stderr b/src/test/ui/resolve/issue-81508.stderr index 15555631b9047..7258174ba89b3 100644 --- a/src/test/ui/resolve/issue-81508.stderr +++ b/src/test/ui/resolve/issue-81508.stderr @@ -3,7 +3,7 @@ error[E0433]: failed to resolve: use of undeclared type `Baz` | LL | let Baz: &str = ""; | --- help: `Baz` is defined here, but is not a type -LL | +LL | LL | println!("{}", Baz::Bar); | ^^^ use of undeclared type `Baz` diff --git a/src/test/ui/resolve/levenshtein.stderr b/src/test/ui/resolve/levenshtein.stderr index a7f10f7719eac..249a7e53d4546 100644 --- a/src/test/ui/resolve/levenshtein.stderr +++ b/src/test/ui/resolve/levenshtein.stderr @@ -9,7 +9,7 @@ error[E0412]: cannot find type `Baz` in this scope | LL | enum Bar { } | -------- similarly named enum `Bar` defined here -LL | +LL | LL | type A = Baz; // Misspelled type name. | ^^^ help: an enum with a similar name exists: `Bar` diff --git a/src/test/ui/resolve/missing-in-namespace.stderr b/src/test/ui/resolve/missing-in-namespace.stderr index 338a5423aa472..3d49b2e5dfcd8 100644 --- a/src/test/ui/resolve/missing-in-namespace.stderr +++ b/src/test/ui/resolve/missing-in-namespace.stderr @@ -12,7 +12,7 @@ help: if you import `HashMap`, refer to it directly | LL - let _map = std::hahmap::HashMap::new(); LL + let _map = HashMap::new(); - | + | error: aborting due to previous error diff --git a/src/test/ui/resolve/privacy-enum-ctor.stderr b/src/test/ui/resolve/privacy-enum-ctor.stderr index ed89170fd8a75..81d8a34881c0c 100644 --- a/src/test/ui/resolve/privacy-enum-ctor.stderr +++ b/src/test/ui/resolve/privacy-enum-ctor.stderr @@ -109,7 +109,7 @@ help: if you import `E`, refer to it directly | LL - let _: E = m::E; LL + let _: E = E; - | + | error[E0423]: expected value, found struct variant `m::E::Struct` --> $DIR/privacy-enum-ctor.rs:45:16 @@ -347,7 +347,7 @@ help: `Z::Unit` is a unit variant, you need to write it without the parentheses | LL - let _ = Z::Unit(); LL + let _ = Z::Unit; - | + | error[E0308]: mismatched types --> $DIR/privacy-enum-ctor.rs:43:16 @@ -382,7 +382,7 @@ help: `m::E::Unit` is a unit variant, you need to write it without the parenthes | LL - let _: E = m::E::Unit(); LL + let _: E = m::E::Unit; - | + | error[E0308]: mismatched types --> $DIR/privacy-enum-ctor.rs:51:16 @@ -417,7 +417,7 @@ help: `E::Unit` is a unit variant, you need to write it without the parentheses | LL - let _: E = E::Unit(); LL + let _: E = E::Unit; - | + | error: aborting due to 23 previous errors diff --git a/src/test/ui/resolve/resolve-conflict-item-vs-import.stderr b/src/test/ui/resolve/resolve-conflict-item-vs-import.stderr index 922753a00db17..5e5c9f6b3d8e2 100644 --- a/src/test/ui/resolve/resolve-conflict-item-vs-import.stderr +++ b/src/test/ui/resolve/resolve-conflict-item-vs-import.stderr @@ -3,7 +3,7 @@ error[E0255]: the name `transmute` is defined multiple times | LL | use std::mem::transmute; | ------------------- previous import of the value `transmute` here -LL | +LL | LL | fn transmute() {} | ^^^^^^^^^^^^^^ `transmute` redefined here | diff --git a/src/test/ui/resolve/resolve-conflict-type-vs-import.stderr b/src/test/ui/resolve/resolve-conflict-type-vs-import.stderr index b63495458a02d..198ef10311ee9 100644 --- a/src/test/ui/resolve/resolve-conflict-type-vs-import.stderr +++ b/src/test/ui/resolve/resolve-conflict-type-vs-import.stderr @@ -3,7 +3,7 @@ error[E0255]: the name `Iter` is defined multiple times | LL | use std::slice::Iter; | ---------------- previous import of the type `Iter` here -LL | +LL | LL | struct Iter; | ^^^^^^^^^^^^ `Iter` redefined here | diff --git a/src/test/ui/resolve/resolve-primitive-fallback.stderr b/src/test/ui/resolve/resolve-primitive-fallback.stderr index fcbc28475f998..f0eb1a4f48737 100644 --- a/src/test/ui/resolve/resolve-primitive-fallback.stderr +++ b/src/test/ui/resolve/resolve-primitive-fallback.stderr @@ -18,7 +18,7 @@ help: if you import `u8`, refer to it directly | LL - let _: ::u8; LL + let _: u8; - | + | error[E0061]: this function takes 0 arguments but 1 argument was supplied --> $DIR/resolve-primitive-fallback.rs:3:5 diff --git a/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr b/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr index 00da9d2605765..dfc7fdc1ed2db 100644 --- a/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr +++ b/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr @@ -982,7 +982,7 @@ help: consider removing the borrow | LL - if &let 0 = 0 {} LL + if let 0 = 0 {} - | + | error[E0614]: type `bool` cannot be dereferenced --> $DIR/disallowed-positions.rs:94:8 @@ -1149,7 +1149,7 @@ help: consider removing the `&&` | LL - if let Range { start: true, end } = t..&&false {} LL + if let Range { start: true, end } = t..false {} - | + | error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:144:8 @@ -1178,7 +1178,7 @@ help: consider removing the borrow | LL - while &let 0 = 0 {} LL + while let 0 = 0 {} - | + | error[E0614]: type `bool` cannot be dereferenced --> $DIR/disallowed-positions.rs:158:11 @@ -1345,7 +1345,7 @@ help: consider removing the `&&` | LL - while let Range { start: true, end } = t..&&false {} LL + while let Range { start: true, end } = t..false {} - | + | error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:208:11 diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-impl-recovery.stderr b/src/test/ui/rfc-2632-const-trait-impl/const-impl-recovery.stderr index 79d170cdd1b61..709084c86e0ae 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-impl-recovery.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/const-impl-recovery.stderr @@ -8,7 +8,7 @@ help: you might have meant to write a const trait impl | LL - const impl Foo for i32 {} LL + impl const Foo for i32 {} - | + | error: expected identifier, found keyword `impl` --> $DIR/const-impl-recovery.rs:9:7 @@ -20,7 +20,7 @@ help: you might have meant to write a const trait impl | LL - const impl Bar for T {} LL + impl const Bar for T {} - | + | error: aborting due to 2 previous errors diff --git a/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr b/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr index b8eba3e075d3e..251d74094caa9 100644 --- a/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr +++ b/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr @@ -13,7 +13,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> { LL + struct TeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:18:61 @@ -25,7 +25,7 @@ help: remove these bounds | LL - struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b { LL + struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:23:53 @@ -37,7 +37,7 @@ help: remove these bounds | LL - struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> { LL + struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:29:48 @@ -49,7 +49,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> { LL + struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:35:48 @@ -61,7 +61,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> { LL + struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:41:46 @@ -73,7 +73,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b { LL + struct TeeOutlivesAyYooWhereBee<'a, 'b, T, U> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:47:67 @@ -85,7 +85,7 @@ help: remove these bounds | LL - struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b { LL + struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:53:53 @@ -97,7 +97,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug { LL + struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:59:53 @@ -109,7 +109,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b { LL + struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:65:69 @@ -121,7 +121,7 @@ help: remove these bounds | LL - struct TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug { LL + struct TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:71:69 @@ -133,7 +133,7 @@ help: remove these bounds | LL - struct TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b { LL + struct TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:77:38 @@ -145,7 +145,7 @@ help: remove these bounds | LL - struct BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b> { LL + struct BeeOutlivesAyTeeBee<'a, 'b, T> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:82:40 @@ -157,7 +157,7 @@ help: remove these bounds | LL - struct BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b> { LL + struct BeeOutlivesAyTeeAyBee<'a, 'b, T> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:87:55 @@ -169,7 +169,7 @@ help: remove these bounds | LL - struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b> { LL + struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:92:68 @@ -181,7 +181,7 @@ help: remove these bounds | LL - struct BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where 'b: 'a, T: 'a + Debug + 'b { LL + struct BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:97:58 @@ -193,7 +193,7 @@ help: remove these bounds | LL - struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b> { LL + struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:104:18 @@ -205,7 +205,7 @@ help: remove these bounds | LL - where U: 'a + Debug + 'b, 'b: 'a LL + where U: Debug, - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:115:47 @@ -217,7 +217,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b>(&'a &'b T); LL + struct TeeOutlivesAyIsDebugBee<'a, 'b, T: Debug>(&'a &'b T); - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:118:72 @@ -229,7 +229,7 @@ help: remove these bounds | LL - struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T>(&'a &'b T) where T: 'a + Debug + 'b; LL + struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T>(&'a &'b T) where T: Debug; - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:121:53 @@ -241,7 +241,7 @@ help: remove these bounds | LL - struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b>(T, &'a &'b U); LL + struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug>(T, &'a &'b U); - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:124:48 @@ -253,7 +253,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug>(&'a T, &'b U); LL + struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T, U: Debug>(&'a T, &'b U); - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:127:48 @@ -265,7 +265,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b>(&'a T, &'b U); LL + struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T, U: Debug>(&'a T, &'b U); - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:130:46 @@ -277,7 +277,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U>(&'a T, &'b U) where U: 'b; LL + struct TeeOutlivesAyYooWhereBee<'a, 'b, T, U>(&'a T, &'b U) ; - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:133:81 @@ -289,7 +289,7 @@ help: remove these bounds | LL - struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U>(T, &'a &'b U) where U: 'a + Debug + 'b; LL + struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U>(T, &'a &'b U) where U: Debug; - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:136:53 @@ -301,7 +301,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U>(&'a T, &'b U) where U: 'b + Debug; LL + struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U>(&'a T, &'b U) where U: Debug; - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:139:53 @@ -313,7 +313,7 @@ help: remove these bounds | LL - struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U>(&'a T, &'b U) where U: Debug + 'b; LL + struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U>(&'a T, &'b U) where U: Debug; - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:142:75 @@ -325,7 +325,7 @@ help: remove these bounds | LL - struct TeeWhereAyYooWhereBeeIsDebug<'a, 'b, T, U>(&'a T, &'b U) where T: 'a, U: 'b + Debug; LL + struct TeeWhereAyYooWhereBeeIsDebug<'a, 'b, T, U>(&'a T, &'b U) where U: Debug; - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:145:75 @@ -337,7 +337,7 @@ help: remove these bounds | LL - struct TeeWhereAyYooWhereIsDebugBee<'a, 'b, T, U>(&'a T, &'b U) where T: 'a, U: Debug + 'b; LL + struct TeeWhereAyYooWhereIsDebugBee<'a, 'b, T, U>(&'a T, &'b U) where U: Debug; - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:148:38 @@ -349,7 +349,7 @@ help: remove these bounds | LL - struct BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b>(&'a &'b T); LL + struct BeeOutlivesAyTeeBee<'a, 'b, T>(&'a &'b T); - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:151:40 @@ -361,7 +361,7 @@ help: remove these bounds | LL - struct BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b>(&'a &'b T); LL + struct BeeOutlivesAyTeeAyBee<'a, 'b, T>(&'a &'b T); - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:154:55 @@ -373,7 +373,7 @@ help: remove these bounds | LL - struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b>(&'a &'b T); LL + struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b, T: Debug>(&'a &'b T); - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:157:71 @@ -385,7 +385,7 @@ help: remove these bounds | LL - struct BeeWhereAyTeeWhereAyIsDebugBee<'a, 'b, T>(&'a &'b T) where 'b: 'a, T: 'a + Debug + 'b; LL + struct BeeWhereAyTeeWhereAyIsDebugBee<'a, 'b, T>(&'a &'b T) where T: Debug; - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:160:58 @@ -397,7 +397,7 @@ help: remove these bounds | LL - struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b>(T, &'a &'b U); LL + struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug>(T, &'a &'b U); - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:164:18 @@ -409,7 +409,7 @@ help: remove these bounds | LL - where U: 'a + Debug + 'b, 'b: 'a; LL + where U: Debug, ; - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:171:45 @@ -421,7 +421,7 @@ help: remove these bounds | LL - enum TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> { LL + enum TeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:176:59 @@ -433,7 +433,7 @@ help: remove these bounds | LL - enum TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b { LL + enum TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:181:51 @@ -445,7 +445,7 @@ help: remove these bounds | LL - enum TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> { LL + enum TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:187:46 @@ -457,7 +457,7 @@ help: remove these bounds | LL - enum TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> { LL + enum TeeOutlivesAyYooBeeIsDebug<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:193:46 @@ -469,7 +469,7 @@ help: remove these bounds | LL - enum TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> { LL + enum TeeOutlivesAyYooIsDebugBee<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:199:44 @@ -481,7 +481,7 @@ help: remove these bounds | LL - enum TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b { LL + enum TeeOutlivesAyYooWhereBee<'a, 'b, T, U> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:205:65 @@ -493,7 +493,7 @@ help: remove these bounds | LL - enum TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b { LL + enum TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:211:51 @@ -505,7 +505,7 @@ help: remove these bounds | LL - enum TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug { LL + enum TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:217:51 @@ -517,7 +517,7 @@ help: remove these bounds | LL - enum TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b { LL + enum TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:223:67 @@ -529,7 +529,7 @@ help: remove these bounds | LL - enum TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug { LL + enum TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:229:67 @@ -541,7 +541,7 @@ help: remove these bounds | LL - enum TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b { LL + enum TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:235:36 @@ -553,7 +553,7 @@ help: remove these bounds | LL - enum BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b> { LL + enum BeeOutlivesAyTeeBee<'a, 'b, T> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:240:38 @@ -565,7 +565,7 @@ help: remove these bounds | LL - enum BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b> { LL + enum BeeOutlivesAyTeeAyBee<'a, 'b, T> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:246:53 @@ -577,7 +577,7 @@ help: remove these bounds | LL - enum BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b> { LL + enum BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:251:66 @@ -589,7 +589,7 @@ help: remove these bounds | LL - enum BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where 'b: 'a, T: 'a + Debug + 'b { LL + enum BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:256:56 @@ -601,7 +601,7 @@ help: remove these bounds | LL - enum BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b> { LL + enum BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:262:75 @@ -613,7 +613,7 @@ help: remove these bounds | LL - enum BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b, 'b: 'a { LL + enum BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug, { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:271:46 @@ -625,7 +625,7 @@ help: remove these bounds | LL - union TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> { LL + union TeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:276:60 @@ -637,7 +637,7 @@ help: remove these bounds | LL - union TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b { LL + union TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:281:52 @@ -649,7 +649,7 @@ help: remove these bounds | LL - union TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> { LL + union TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:287:47 @@ -661,7 +661,7 @@ help: remove these bounds | LL - union TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> { LL + union TeeOutlivesAyYooBeeIsDebug<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:293:47 @@ -673,7 +673,7 @@ help: remove these bounds | LL - union TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> { LL + union TeeOutlivesAyYooIsDebugBee<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:299:45 @@ -685,7 +685,7 @@ help: remove these bounds | LL - union TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b { LL + union TeeOutlivesAyYooWhereBee<'a, 'b, T, U> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:305:66 @@ -697,7 +697,7 @@ help: remove these bounds | LL - union TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b { LL + union TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:311:52 @@ -709,7 +709,7 @@ help: remove these bounds | LL - union TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug { LL + union TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:317:52 @@ -721,7 +721,7 @@ help: remove these bounds | LL - union TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b { LL + union TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:323:68 @@ -733,7 +733,7 @@ help: remove these bounds | LL - union TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug { LL + union TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:329:68 @@ -745,7 +745,7 @@ help: remove these bounds | LL - union TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b { LL + union TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:335:37 @@ -757,7 +757,7 @@ help: remove these bounds | LL - union BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b> { LL + union BeeOutlivesAyTeeBee<'a, 'b, T> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:340:39 @@ -769,7 +769,7 @@ help: remove these bounds | LL - union BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b> { LL + union BeeOutlivesAyTeeAyBee<'a, 'b, T> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:345:54 @@ -781,7 +781,7 @@ help: remove these bounds | LL - union BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b> { LL + union BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:350:67 @@ -793,7 +793,7 @@ help: remove these bounds | LL - union BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where 'b: 'a, T: 'a + Debug + 'b { LL + union BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:355:57 @@ -805,7 +805,7 @@ help: remove these bounds | LL - union BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b> { LL + union BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { - | + | error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:361:76 @@ -817,7 +817,7 @@ help: remove these bounds | LL - union BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b, 'b: 'a { LL + union BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug, { - | + | error: aborting due to 68 previous errors diff --git a/src/test/ui/rust-2021/reserved-prefixes-migration.stderr b/src/test/ui/rust-2021/reserved-prefixes-migration.stderr index dc1152679b920..647a9f3931254 100644 --- a/src/test/ui/rust-2021/reserved-prefixes-migration.stderr +++ b/src/test/ui/rust-2021/reserved-prefixes-migration.stderr @@ -15,7 +15,7 @@ help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 | LL - m2!(z"hey"); LL + m2!(z "hey"); - | + | warning: prefix `prefix` is unknown --> $DIR/reserved-prefixes-migration.rs:19:9 @@ -29,7 +29,7 @@ help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 | LL - m2!(prefix"hey"); LL + m2!(prefix "hey"); - | + | warning: prefix `hey` is unknown --> $DIR/reserved-prefixes-migration.rs:22:9 @@ -43,7 +43,7 @@ help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 | LL - m3!(hey#123); LL + m3!(hey #123); - | + | warning: prefix `hey` is unknown --> $DIR/reserved-prefixes-migration.rs:25:9 @@ -57,7 +57,7 @@ help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 | LL - m3!(hey#hey); LL + m3!(hey #hey); - | + | warning: prefix `kind` is unknown --> $DIR/reserved-prefixes-migration.rs:35:14 @@ -71,7 +71,7 @@ help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 | LL - #name = #kind#value LL + #name = #kind #value - | + | warning: 5 warnings emitted diff --git a/src/test/ui/rust-2021/reserved-prefixes.stderr b/src/test/ui/rust-2021/reserved-prefixes.stderr index 2755688c17f97..df31aee66fea7 100644 --- a/src/test/ui/rust-2021/reserved-prefixes.stderr +++ b/src/test/ui/rust-2021/reserved-prefixes.stderr @@ -9,7 +9,7 @@ help: consider inserting whitespace here | LL - demo3!(foo#bar); LL + demo3!(foo #bar); - | + | error: prefix `foo` is unknown --> $DIR/reserved-prefixes.rs:17:12 @@ -22,7 +22,7 @@ help: consider inserting whitespace here | LL - demo2!(foo"bar"); LL + demo2!(foo "bar"); - | + | error: prefix `foo` is unknown --> $DIR/reserved-prefixes.rs:18:12 @@ -35,7 +35,7 @@ help: consider inserting whitespace here | LL - demo2!(foo'b'); LL + demo2!(foo 'b'); - | + | error: prefix `foo` is unknown --> $DIR/reserved-prefixes.rs:20:12 @@ -48,7 +48,7 @@ help: consider inserting whitespace here | LL - demo2!(foo'b); LL + demo2!(foo 'b); - | + | error: prefix `foo` is unknown --> $DIR/reserved-prefixes.rs:21:12 @@ -61,7 +61,7 @@ help: consider inserting whitespace here | LL - demo3!(foo# bar); LL + demo3!(foo # bar); - | + | error: prefix `foo` is unknown --> $DIR/reserved-prefixes.rs:22:12 @@ -74,7 +74,7 @@ help: consider inserting whitespace here | LL - demo4!(foo#! bar); LL + demo4!(foo #! bar); - | + | error: prefix `foo` is unknown --> $DIR/reserved-prefixes.rs:23:12 @@ -87,7 +87,7 @@ help: consider inserting whitespace here | LL - demo4!(foo## bar); LL + demo4!(foo ## bar); - | + | error: prefix `foo` is unknown --> $DIR/reserved-prefixes.rs:25:12 @@ -100,7 +100,7 @@ help: consider inserting whitespace here | LL - demo4!(foo#bar#); LL + demo4!(foo #bar#); - | + | error: prefix `bar` is unknown --> $DIR/reserved-prefixes.rs:25:16 @@ -113,7 +113,7 @@ help: consider inserting whitespace here | LL - demo4!(foo#bar#); LL + demo4!(foo#bar #); - | + | error: aborting due to 9 previous errors diff --git a/src/test/ui/single-use-lifetime/fn-types.stderr b/src/test/ui/single-use-lifetime/fn-types.stderr index 9290c21620e90..55959def4f37d 100644 --- a/src/test/ui/single-use-lifetime/fn-types.stderr +++ b/src/test/ui/single-use-lifetime/fn-types.stderr @@ -15,7 +15,7 @@ help: elide the single-use lifetime | LL - a: for<'a> fn(&'a u32), LL + a: fn(&u32), - | + | error[E0581]: return type references lifetime `'a`, which is not constrained by the fn input types --> $DIR/fn-types.rs:12:22 diff --git a/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr index d22508998a616..93f16f5bad5f0 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr @@ -15,7 +15,7 @@ help: elide the single-use lifetime | LL - fn a<'a>(x: &'a u32) { LL + fn a(x: &u32) { - | + | error: lifetime parameter `'m` only used once --> $DIR/one-use-in-fn-argument.rs:15:11 @@ -29,7 +29,7 @@ help: elide the single-use lifetime | LL - fn center<'m>(_: Single<'m>) {} LL + fn center(_: Single<'_>) {} - | + | error: lifetime parameter `'y` only used once --> $DIR/one-use-in-fn-argument.rs:17:13 @@ -41,7 +41,7 @@ help: elide the single-use lifetime | LL - fn left<'x, 'y>(foo: Double<'x, 'y>) -> &'x u32 { foo.f } LL + fn left<'x>(foo: Double<'x, '_>) -> &'x u32 { foo.f } - | + | error: lifetime parameter `'x` only used once --> $DIR/one-use-in-fn-argument.rs:19:10 @@ -53,7 +53,7 @@ help: elide the single-use lifetime | LL - fn right<'x, 'y>(foo: Double<'x, 'y>) -> &'y u32 { foo.f } LL + fn right<'y>(foo: Double<'_, 'y>) -> &'y u32 { foo.f } - | + | error: aborting due to 4 previous errors diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr index cf34a1ca299ac..94129560f4043 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr @@ -15,7 +15,7 @@ help: elide the single-use lifetime | LL - impl<'f> Foo<'f> { LL + impl Foo<'_> { - | + | error: aborting due to previous error diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr index 846c1bf41a29c..39507785bbea2 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr @@ -15,7 +15,7 @@ help: elide the single-use lifetime | LL - impl<'f> Foo<'f> { LL + impl Foo<'_> { - | + | error: lifetime parameter `'a` only used once --> $DIR/one-use-in-inherent-method-argument.rs:13:19 @@ -29,7 +29,7 @@ help: elide the single-use lifetime | LL - fn inherent_a<'a>(&self, data: &'a u32) { LL + fn inherent_a(&self, data: &u32) { - | + | error: aborting due to 2 previous errors diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr index 790fcaa409caf..69578fe2f8830 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr @@ -15,7 +15,7 @@ help: elide the single-use lifetime | LL - impl<'f> Foo<'f> { LL + impl Foo<'_> { - | + | error: aborting due to previous error diff --git a/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr index 05944e04bd8bc..1a6e8310d303a 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr @@ -15,7 +15,7 @@ help: elide the single-use lifetime | LL - fn next<'g>(&'g mut self) -> Option { LL + fn next(&mut self) -> Option { - | + | error: aborting due to previous error diff --git a/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr b/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr index b50975a189e4f..4794566eae4dc 100644 --- a/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr +++ b/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr @@ -15,7 +15,7 @@ help: elide the single-use lifetime | LL - impl<'f> Foo<'f> { LL + impl Foo<'_> { - | + | error: aborting due to previous error diff --git a/src/test/ui/span/issue-39018.stderr b/src/test/ui/span/issue-39018.stderr index e2e7ce1ed18e7..e0cfe04cf418e 100644 --- a/src/test/ui/span/issue-39018.stderr +++ b/src/test/ui/span/issue-39018.stderr @@ -66,7 +66,7 @@ help: remove the borrow to obtain an owned `String` | LL - let _ = &a + &b; LL + let _ = a + &b; - | + | error[E0369]: cannot add `String` to `&String` --> $DIR/issue-39018.rs:27:16 @@ -81,7 +81,7 @@ help: remove the borrow on the left and add one on the right | LL - let _ = &a + b; LL + let _ = a + &b; - | + | error[E0308]: mismatched types --> $DIR/issue-39018.rs:29:17 diff --git a/src/test/ui/specialization/issue-52050.stderr b/src/test/ui/specialization/issue-52050.stderr index ab3cf27d0d059..8732b10d8f803 100644 --- a/src/test/ui/specialization/issue-52050.stderr +++ b/src/test/ui/specialization/issue-52050.stderr @@ -17,7 +17,7 @@ LL | | I: Iterator, LL | | { LL | | } | |_- first implementation here -LL | +LL | LL | impl IntoPyDictPointer for () | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()` | diff --git a/src/test/ui/str/str-lit-type-mismatch.stderr b/src/test/ui/str/str-lit-type-mismatch.stderr index 90590b70dfe9f..6b56cd6f3fc12 100644 --- a/src/test/ui/str/str-lit-type-mismatch.stderr +++ b/src/test/ui/str/str-lit-type-mismatch.stderr @@ -42,7 +42,7 @@ help: consider removing the leading `b` | LL - let z: &str = b"foo"; LL + let z: &str = "foo"; - | + | error: aborting due to 3 previous errors diff --git a/src/test/ui/structs/struct-path-self.stderr b/src/test/ui/structs/struct-path-self.stderr index cccdd7b0f023f..4bd0fb3898564 100644 --- a/src/test/ui/structs/struct-path-self.stderr +++ b/src/test/ui/structs/struct-path-self.stderr @@ -16,7 +16,7 @@ help: the `Self` type doesn't accept type parameters | LL - let z = Self:: {}; LL + let z = Self {}; - | + | error[E0071]: expected struct, variant or union type, found type parameter `Self` --> $DIR/struct-path-self.rs:7:17 @@ -50,7 +50,7 @@ help: the `Self` type doesn't accept type parameters | LL - let z = Self:: {}; LL + let z = Self {}; - | + | error[E0109]: type arguments are not allowed on self type --> $DIR/struct-path-self.rs:30:24 @@ -72,7 +72,7 @@ help: the `Self` type doesn't accept type parameters | LL - let z = Self:: {}; LL + let z = Self {}; - | + | error: aborting due to 6 previous errors diff --git a/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr b/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr index fb40c260e2d0c..40b4b42f74293 100644 --- a/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr +++ b/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr @@ -105,7 +105,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - struct Struct5{ LL + struct Struct5{ - | + | error: aborting due to 5 previous errors diff --git a/src/test/ui/suggestions/format-borrow.stderr b/src/test/ui/suggestions/format-borrow.stderr index 8a2941cb6a4de..fac6a5a5f48cb 100644 --- a/src/test/ui/suggestions/format-borrow.stderr +++ b/src/test/ui/suggestions/format-borrow.stderr @@ -10,7 +10,7 @@ help: consider removing the borrow | LL - let a: String = &String::from("a"); LL + let a: String = String::from("a"); - | + | error[E0308]: mismatched types --> $DIR/format-borrow.rs:4:21 @@ -24,7 +24,7 @@ help: consider removing the borrow | LL - let b: String = &format!("b"); LL + let b: String = format!("b"); - | + | error[E0308]: mismatched types --> $DIR/format-borrow.rs:6:21 @@ -38,7 +38,7 @@ help: consider removing the borrow | LL - let c: String = &mut format!("c"); LL + let c: String = format!("c"); - | + | error[E0308]: mismatched types --> $DIR/format-borrow.rs:8:21 @@ -52,7 +52,7 @@ help: consider removing the borrow | LL - let d: String = &mut (format!("d")); LL + let d: String = format!("d")); - | + | error: aborting due to 4 previous errors diff --git a/src/test/ui/suggestions/issue-61963.stderr b/src/test/ui/suggestions/issue-61963.stderr index 1eebd8d60ca90..c0d776e59ab8d 100644 --- a/src/test/ui/suggestions/issue-61963.stderr +++ b/src/test/ui/suggestions/issue-61963.stderr @@ -15,7 +15,7 @@ help: use `dyn` | LL - bar: Box, LL + bar: Box, - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-61963.rs:18:1 @@ -29,7 +29,7 @@ help: use `dyn` | LL - pub struct Foo { LL + dyn pub struct Foo { - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-61963.rs:28:14 @@ -43,7 +43,7 @@ help: use `dyn` | LL - bar: Box, LL + bar: Box, - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-61963.rs:28:14 @@ -57,7 +57,7 @@ help: use `dyn` | LL - bar: Box, LL + bar: Box, - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-61963.rs:18:1 @@ -71,7 +71,7 @@ help: use `dyn` | LL - pub struct Foo { LL + dyn pub struct Foo { - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-61963.rs:18:1 @@ -85,7 +85,7 @@ help: use `dyn` | LL - pub struct Foo { LL + dyn pub struct Foo { - | + | error: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-61963.rs:18:1 @@ -99,7 +99,7 @@ help: use `dyn` | LL - pub struct Foo { LL + dyn pub struct Foo { - | + | error: aborting due to 7 previous errors diff --git a/src/test/ui/suggestions/issue-82361.stderr b/src/test/ui/suggestions/issue-82361.stderr index c09ad17f82acd..e4e8ad15d1789 100644 --- a/src/test/ui/suggestions/issue-82361.stderr +++ b/src/test/ui/suggestions/issue-82361.stderr @@ -31,7 +31,7 @@ help: consider removing the borrow | LL - &1 LL + 1 - | + | error[E0308]: `if` and `else` have incompatible types --> $DIR/issue-82361.rs:22:9 @@ -49,7 +49,7 @@ help: consider removing the borrow | LL - &mut 1 LL + 1 - | + | error: aborting due to 3 previous errors diff --git a/src/test/ui/suggestions/issue-96555.stderr b/src/test/ui/suggestions/issue-96555.stderr index 6d3b8844d954f..a1a603cf246dc 100644 --- a/src/test/ui/suggestions/issue-96555.stderr +++ b/src/test/ui/suggestions/issue-96555.stderr @@ -13,7 +13,7 @@ help: remove the `.await` | LL - m::f1().await; LL + m::f1(); - | + | help: alternatively, consider making `fn f1` asynchronous | LL | pub async fn f1() {} @@ -34,7 +34,7 @@ help: remove the `.await` | LL - m::f2().await; LL + m::f2(); - | + | help: alternatively, consider making `fn f2` asynchronous | LL | pub(crate) async fn f2() {} @@ -55,7 +55,7 @@ help: remove the `.await` | LL - m::f3().await; LL + m::f3(); - | + | help: alternatively, consider making `fn f3` asynchronous | LL | pub async diff --git a/src/test/ui/suggestions/match-prev-arm-needing-semi.stderr b/src/test/ui/suggestions/match-prev-arm-needing-semi.stderr index 4c4b782bd6fb1..8d735b71f8278 100644 --- a/src/test/ui/suggestions/match-prev-arm-needing-semi.stderr +++ b/src/test/ui/suggestions/match-prev-arm-needing-semi.stderr @@ -30,7 +30,7 @@ help: consider removing this semicolon | LL - async_dummy(); LL + async_dummy() - | + | error[E0308]: `match` arms have incompatible types --> $DIR/match-prev-arm-needing-semi.rs:48:18 diff --git a/src/test/ui/suggestions/removal-of-multiline-trait-bound-in-where-clause.stderr b/src/test/ui/suggestions/removal-of-multiline-trait-bound-in-where-clause.stderr index 3df17056ef42c..6071b10d387c2 100644 --- a/src/test/ui/suggestions/removal-of-multiline-trait-bound-in-where-clause.stderr +++ b/src/test/ui/suggestions/removal-of-multiline-trait-bound-in-where-clause.stderr @@ -25,7 +25,7 @@ LL - T LL - : LL - ? LL - Sized - | + | error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/removal-of-multiline-trait-bound-in-where-clause.rs:14:16 @@ -50,7 +50,7 @@ LL | struct Wrapper(T); help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - where T: ?Sized - | + | error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/removal-of-multiline-trait-bound-in-where-clause.rs:21:16 @@ -76,7 +76,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - where LL - T: ?Sized - | + | error: aborting due to 3 previous errors diff --git a/src/test/ui/suggestions/suggest-change-mut.stderr b/src/test/ui/suggestions/suggest-change-mut.stderr index be549239e3685..889b11a741084 100644 --- a/src/test/ui/suggestions/suggest-change-mut.stderr +++ b/src/test/ui/suggestions/suggest-change-mut.stderr @@ -15,7 +15,7 @@ help: consider removing the leading `&`-reference | LL - let mut stream_reader = BufReader::new(&stream); LL + let mut stream_reader = BufReader::new(stream); - | + | help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | fn issue_81421(mut stream: T) where &T: std::io::Read { diff --git a/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr b/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr index dd6951e047410..fc880d6b86a71 100644 --- a/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr +++ b/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr @@ -41,7 +41,7 @@ help: add `dyn` keyword before this trait | LL - impl<'a, T> Struct for Trait<'a, T> {} LL + impl<'a, T> Struct for dyn Trait<'a, T> {} - | + | error: aborting due to 4 previous errors diff --git a/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr b/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr index 86ab8474c4299..f5143762da8e5 100644 --- a/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr +++ b/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr @@ -44,7 +44,7 @@ help: use `dyn` | LL - impl<'a, T> Struct for Trait<'a, T> {} LL + impl<'a, T> Struct for dyn Trait<'a, T> {} - | + | error: aborting due to 3 previous errors; 1 warning emitted diff --git a/src/test/ui/suggestions/suggest-trait-items.stderr b/src/test/ui/suggestions/suggest-trait-items.stderr index 151bae7d1b9cb..4abc34466106d 100644 --- a/src/test/ui/suggestions/suggest-trait-items.stderr +++ b/src/test/ui/suggestions/suggest-trait-items.stderr @@ -48,7 +48,7 @@ error[E0046]: not all trait items implemented, missing: `Type`, `foo`, `bar`, `q | LL | type Type; | ---------- `Type` from trait -LL | +LL | LL | fn foo(); | --------- `foo` from trait LL | fn bar(); diff --git a/src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr b/src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr index a8b275f98034a..b297662955e39 100644 --- a/src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr +++ b/src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr @@ -12,7 +12,7 @@ help: if you import `Trait`, refer to it directly | LL - pub struct A(pub H); LL + pub struct A(pub H); - | + | error: aborting due to previous error diff --git a/src/test/ui/trait-bounds/unsized-bound.stderr b/src/test/ui/trait-bounds/unsized-bound.stderr index 0c758c9ba266f..ec85ada7a8d40 100644 --- a/src/test/ui/trait-bounds/unsized-bound.stderr +++ b/src/test/ui/trait-bounds/unsized-bound.stderr @@ -16,7 +16,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl Trait<(A, B)> for (A, B) where A: ?Sized, B: ?Sized, {} LL + impl Trait<(A, B)> for (A, B) where A: ?Sized, {} - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait Trait {} @@ -35,7 +35,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl Trait<(A, B)> for (A, B) where A: ?Sized, B: ?Sized, {} LL + impl Trait<(A, B)> for (A, B) where B: ?Sized, {} - | + | error[E0277]: the size for values of type `C` cannot be known at compilation time --> $DIR/unsized-bound.rs:5:31 @@ -55,7 +55,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} LL + impl Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait Trait {} @@ -74,7 +74,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} LL + impl Trait<(A, B, C)> for (A, B, C) {} - | + | error[E0277]: the size for values of type `B` cannot be known at compilation time --> $DIR/unsized-bound.rs:5:52 @@ -89,7 +89,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} LL + impl Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} - | + | error[E0277]: the size for values of type `B` cannot be known at compilation time --> $DIR/unsized-bound.rs:10:28 @@ -109,7 +109,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl Trait2<(A, B)> for (A, B) {} LL + impl Trait2<(A, B)> for (A, B) {} - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait Trait2 {} @@ -128,7 +128,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl Trait2<(A, B)> for (A, B) {} LL + impl Trait2<(A, B)> for (A, B) {} - | + | error[E0277]: the size for values of type `A` cannot be known at compilation time --> $DIR/unsized-bound.rs:14:9 @@ -147,7 +147,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl Trait3 for A where A: ?Sized {} LL + impl Trait3 for A {} - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait Trait3 {} @@ -170,7 +170,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl Trait4 for A {} LL + impl Trait4 for A {} - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait Trait4 {} @@ -193,7 +193,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl Trait5 for X where X: ?Sized {} LL + impl Trait5 for X {} - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait Trait5 {} @@ -216,7 +216,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl Trait6 for X {} LL + impl Trait6 for X {} - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait Trait6 {} @@ -239,7 +239,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl Trait7 for X where Y: ?Sized {} LL + impl Trait7 for X {} - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait Trait7 {} @@ -262,7 +262,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl Trait8 for X {} LL + impl Trait8 for X {} - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait Trait8 {} diff --git a/src/test/ui/traits/alias/no-duplicates.stderr b/src/test/ui/traits/alias/no-duplicates.stderr index d3002db46a22e..bf244b97e9b13 100644 --- a/src/test/ui/traits/alias/no-duplicates.stderr +++ b/src/test/ui/traits/alias/no-duplicates.stderr @@ -262,7 +262,7 @@ LL | trait _5 = Obj + Send; | | | additional non-auto trait | first non-auto trait -LL | +LL | LL | type _T20 = dyn _5 + _5; | -- ^^ trait alias used in trait object type (additional use) | | @@ -326,7 +326,7 @@ LL | trait _6 = _5 + _5; // ==> Obj + Send + Obj + Send | -- -- referenced here (additional use) | | | referenced here (first use) -LL | +LL | LL | type _T30 = dyn _6; | ^^ | | @@ -392,7 +392,7 @@ LL | trait _7 = _5 + Sync; | -- referenced here (first use) LL | trait _8 = Unpin + _7; | -- referenced here (first use) -LL | +LL | LL | type _T40 = dyn _8 + Obj; | -- ^^^ additional non-auto trait | | diff --git a/src/test/ui/traits/alias/no-extra-traits.stderr b/src/test/ui/traits/alias/no-extra-traits.stderr index eaba70d7ce395..4b1ddf6843c3d 100644 --- a/src/test/ui/traits/alias/no-extra-traits.stderr +++ b/src/test/ui/traits/alias/no-extra-traits.stderr @@ -148,7 +148,7 @@ LL | trait _1 = _0; ... LL | trait _5 = Sync + ObjB + Send; | ---- first non-auto trait -LL | +LL | LL | type _T20 = dyn _5 + _1; | -- ^^ trait alias used in trait object type (additional use) | | @@ -460,7 +460,7 @@ LL | trait _9 = _5 + Sync; | -- referenced here (first use) LL | trait _10 = Unpin + _9; | -- referenced here (first use) -LL | +LL | LL | type _T40 = dyn _10 + ObjA; | --- ^^^^ additional non-auto trait | | diff --git a/src/test/ui/traits/alias/only-maybe-bound.stderr b/src/test/ui/traits/alias/only-maybe-bound.stderr index e9e846c2ff39a..06c707e4332a5 100644 --- a/src/test/ui/traits/alias/only-maybe-bound.stderr +++ b/src/test/ui/traits/alias/only-maybe-bound.stderr @@ -12,7 +12,7 @@ error[E0224]: at least one trait is required for an object type | LL | trait _2 = _1 + _1; | ------------------- this alias does not contain a trait -LL | +LL | LL | type _T1 = dyn _2; | ^^^^^^ diff --git a/src/test/ui/traits/bound/not-on-bare-trait.stderr b/src/test/ui/traits/bound/not-on-bare-trait.stderr index 08f6d166d226f..8a92dd11872c4 100644 --- a/src/test/ui/traits/bound/not-on-bare-trait.stderr +++ b/src/test/ui/traits/bound/not-on-bare-trait.stderr @@ -11,7 +11,7 @@ help: use `dyn` | LL - fn foo(_x: Foo + Send) { LL + fn foo(_x: dyn Foo + Send) { - | + | error[E0277]: the size for values of type `(dyn Foo + Send + 'static)` cannot be known at compilation time --> $DIR/not-on-bare-trait.rs:7:8 diff --git a/src/test/ui/traits/bound/not-on-struct.stderr b/src/test/ui/traits/bound/not-on-struct.stderr index 407a4f0ef1486..2de35dc7fc376 100644 --- a/src/test/ui/traits/bound/not-on-struct.stderr +++ b/src/test/ui/traits/bound/not-on-struct.stderr @@ -47,7 +47,7 @@ help: if you meant to use a type and not a trait here, remove the bounds | LL - fn a() -> A + 'static { LL + fn a() -> A { - | + | error[E0404]: expected trait, found enum `Result` --> $DIR/not-on-struct.rs:16:34 @@ -66,7 +66,7 @@ help: if you meant to use a type and not a trait here, remove the bounds | LL - fn b<'a,T,E>(iter: Iterator + 'a>) { LL + fn b<'a,T,E>(iter: Iterator>) { - | + | error[E0404]: expected trait, found struct `A` --> $DIR/not-on-struct.rs:19:21 @@ -85,7 +85,7 @@ help: if you meant to use a type and not a trait here, remove the bounds | LL - fn c() -> 'static + A { LL + fn c() -> A { - | + | error[E0404]: expected trait, found enum `Result` --> $DIR/not-on-struct.rs:22:39 @@ -104,7 +104,7 @@ help: if you meant to use a type and not a trait here, remove the bounds | LL - fn d<'a,T,E>(iter: Iterator>) { LL + fn d<'a,T,E>(iter: Iterator>) { - | + | error[E0404]: expected trait, found struct `A` --> $DIR/not-on-struct.rs:25:21 @@ -123,7 +123,7 @@ help: if you meant to use a type and not a trait here, remove the bounds | LL - fn e() -> 'static + A + 'static { LL + fn e() -> A { - | + | error[E0404]: expected trait, found enum `Result` --> $DIR/not-on-struct.rs:29:39 @@ -142,7 +142,7 @@ help: if you meant to use a type and not a trait here, remove the bounds | LL - fn f<'a,T,E>(iter: Iterator + 'a>) { LL + fn f<'a,T,E>(iter: Iterator>) { - | + | error[E0404]: expected trait, found struct `Traitor` --> $DIR/not-on-struct.rs:35:11 @@ -163,7 +163,7 @@ help: if you meant to use a type and not a trait here, remove the bounds | LL - fn g() -> Traitor + 'static { LL + fn g() -> Traitor { - | + | help: a trait with a similar name exists | LL | fn g() -> Trait + 'static { diff --git a/src/test/ui/traits/suggest-where-clause.stderr b/src/test/ui/traits/suggest-where-clause.stderr index 520ee0b5ea733..21b339d12a8de 100644 --- a/src/test/ui/traits/suggest-where-clause.stderr +++ b/src/test/ui/traits/suggest-where-clause.stderr @@ -16,7 +16,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn check() { LL + fn check() { - | + | error[E0277]: the size for values of type `U` cannot be known at compilation time --> $DIR/suggest-where-clause.rs:10:5 @@ -41,7 +41,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn check() { LL + fn check() { - | + | error[E0277]: the trait bound `u64: From` is not satisfied --> $DIR/suggest-where-clause.rs:15:5 diff --git a/src/test/ui/traits/vtable/issue-97381.stderr b/src/test/ui/traits/vtable/issue-97381.stderr index f88c8716ff740..c4f8294e26356 100644 --- a/src/test/ui/traits/vtable/issue-97381.stderr +++ b/src/test/ui/traits/vtable/issue-97381.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `v` because it is borrowed | LL | let el = &v[0]; | - borrow of `v` occurs here -LL | +LL | LL | for _ in v { | ^ move out of `v` occurs here LL | diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr index 16f32e043d500..d66e468873ba4 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr @@ -35,7 +35,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - type Y where i32: Foo = (); LL + type Y = (); - | + | warning: trait bound i32: Foo does not depend on any type or lifetime parameters --> $DIR/trivial-bounds-inconsistent.rs:22:19 diff --git a/src/test/ui/try-block/try-block-bad-lifetime.stderr b/src/test/ui/try-block/try-block-bad-lifetime.stderr index de1667d8832b7..ea079e30d9c39 100644 --- a/src/test/ui/try-block/try-block-bad-lifetime.stderr +++ b/src/test/ui/try-block/try-block-bad-lifetime.stderr @@ -42,7 +42,7 @@ LL | let k = &mut i; ... LL | i = 40; | ^^^^^^ assignment to borrowed `i` occurs here -LL | +LL | LL | let i_ptr = if let Err(i_ptr) = j { i_ptr } else { panic ! ("") }; | - borrow later used here diff --git a/src/test/ui/try-block/try-block-unreachable-code-lint.stderr b/src/test/ui/try-block/try-block-unreachable-code-lint.stderr index 61df702fb8706..9fc0b661f1e7d 100644 --- a/src/test/ui/try-block/try-block-unreachable-code-lint.stderr +++ b/src/test/ui/try-block/try-block-unreachable-code-lint.stderr @@ -3,7 +3,7 @@ warning: unreachable expression | LL | return; | ------ any code following this expression is unreachable -LL | +LL | LL | / try { LL | | loop { LL | | err()?; @@ -32,7 +32,7 @@ LL | / loop { LL | | err()?; LL | | } | |_________- any code following this expression is unreachable -LL | +LL | LL | 42 | ^^ unreachable expression diff --git a/src/test/ui/try-block/try-block-unused-delims.stderr b/src/test/ui/try-block/try-block-unused-delims.stderr index d8dd31645e061..765cd9c0fc4f6 100644 --- a/src/test/ui/try-block/try-block-unused-delims.stderr +++ b/src/test/ui/try-block/try-block-unused-delims.stderr @@ -13,7 +13,7 @@ help: remove these parentheses | LL - consume((try {})); LL + consume(try {}); - | + | warning: unnecessary braces around function argument --> $DIR/try-block-unused-delims.rs:14:13 @@ -30,7 +30,7 @@ help: remove these braces | LL - consume({ try {} }); LL + consume(try {}); - | + | warning: unnecessary parentheses around `match` scrutinee expression --> $DIR/try-block-unused-delims.rs:17:11 @@ -42,7 +42,7 @@ help: remove these parentheses | LL - match (try {}) { LL + match try {} { - | + | warning: unnecessary parentheses around `let` scrutinee expression --> $DIR/try-block-unused-delims.rs:22:22 @@ -54,7 +54,7 @@ help: remove these parentheses | LL - if let Err(()) = (try {}) {} LL + if let Err(()) = try {} {} - | + | warning: unnecessary parentheses around `match` scrutinee expression --> $DIR/try-block-unused-delims.rs:25:11 @@ -66,7 +66,7 @@ help: remove these parentheses | LL - match (try {}) { LL + match try {} { - | + | warning: 5 warnings emitted diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr index 3e60ab108a82f..cfc596e1b78ee 100644 --- a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr +++ b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr @@ -119,7 +119,7 @@ help: you might have meant to specity type parameters on enum `Enum` | LL - Self::SVariant::<()> { v: () }; LL + Enum::<()>::SVariant { v: () }; - | + | error[E0308]: mismatched types --> $DIR/enum-variant-generic-args.rs:28:35 @@ -200,7 +200,7 @@ help: you might have meant to specity type parameters on enum `Enum` | LL - Self::<()>::SVariant::<()> { v: () }; LL + Enum::<()>::SVariant { v: () }; - | + | error[E0308]: mismatched types --> $DIR/enum-variant-generic-args.rs:34:41 @@ -363,7 +363,7 @@ help: you might have meant to specity type parameters on enum `Enum` | LL - Alias::SVariant::<()> { v: () }; LL + Alias::<()>::SVariant { v: () }; - | + | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:77:29 @@ -378,7 +378,7 @@ help: you might have meant to specity type parameters on enum `Enum` | LL - Alias::<()>::SVariant::<()> { v: () }; LL + Alias::<()>::SVariant { v: () }; - | + | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:80:28 @@ -393,7 +393,7 @@ help: you might have meant to specity type parameters on enum `Enum` | LL - AliasFixed::SVariant::<()> { v: () }; LL + AliasFixed::<()>::SVariant { v: () }; - | + | error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:82:5 @@ -436,7 +436,7 @@ help: you might have meant to specity type parameters on enum `Enum` | LL - AliasFixed::<()>::SVariant::<()> { v: () }; LL + AliasFixed::<()>::SVariant { v: () }; - | + | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:90:28 diff --git a/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr b/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr index 0cf020861c749..8ddf9f7cd6819 100644 --- a/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr +++ b/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr @@ -31,7 +31,7 @@ help: `Alias::Unit` is a unit variant, you need to write it without the parenthe | LL - Alias::Unit(); LL + Alias::Unit; - | + | error[E0164]: expected tuple struct or tuple variant, found unit variant `Alias::Unit` --> $DIR/incorrect-variant-form-through-alias-caught.rs:17:9 diff --git a/src/test/ui/type-alias-impl-trait/issue-63279.stderr b/src/test/ui/type-alias-impl-trait/issue-63279.stderr index bcc9c57f91ce6..33f81a77aaf0a 100644 --- a/src/test/ui/type-alias-impl-trait/issue-63279.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-63279.stderr @@ -21,7 +21,7 @@ error[E0308]: mismatched types | LL | type Closure = impl FnOnce(); | ------------- the expected opaque type -LL | +LL | LL | fn c() -> Closure { | ------- expected `Closure` because of return type LL | || -> Closure { || () } diff --git a/src/test/ui/type-alias-impl-trait/issue-74280.stderr b/src/test/ui/type-alias-impl-trait/issue-74280.stderr index 7a22b360a31d0..573e691b4cc07 100644 --- a/src/test/ui/type-alias-impl-trait/issue-74280.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-74280.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | type Test = impl Copy; | --------- the expected opaque type -LL | +LL | LL | fn test() -> Test { | ---- expected `Test` because of return type LL | let y = || -> Test { () }; diff --git a/src/test/ui/type/issue-67690-type-alias-bound-diagnostic-crash.stderr b/src/test/ui/type/issue-67690-type-alias-bound-diagnostic-crash.stderr index db215d2810a01..125ffbbb41757 100644 --- a/src/test/ui/type/issue-67690-type-alias-bound-diagnostic-crash.stderr +++ b/src/test/ui/type/issue-67690-type-alias-bound-diagnostic-crash.stderr @@ -9,7 +9,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - pub type T = P; LL + pub type T

= P; - | + | warning: 1 warning emitted diff --git a/src/test/ui/type/issue-91268.stderr b/src/test/ui/type/issue-91268.stderr index 199fd6a23f755..81b091381f411 100644 --- a/src/test/ui/type/issue-91268.stderr +++ b/src/test/ui/type/issue-91268.stderr @@ -42,7 +42,7 @@ help: primitive type `u8` doesn't have generic parameters | LL - 0: u8(ţ LL + 0: u8 - | + | error[E0308]: mismatched types --> $DIR/issue-91268.rs:9:5 diff --git a/src/test/ui/type/type-alias-bounds.stderr b/src/test/ui/type/type-alias-bounds.stderr index dc44dede13b14..92e573393c90e 100644 --- a/src/test/ui/type/type-alias-bounds.stderr +++ b/src/test/ui/type/type-alias-bounds.stderr @@ -9,7 +9,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type SVec = Vec; LL + type SVec = Vec; - | + | warning: where clauses are not enforced in type aliases --> $DIR/type-alias-bounds.rs:10:21 @@ -21,7 +21,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - type S2Vec where T: Send = Vec; LL + type S2Vec = Vec; - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias-bounds.rs:12:19 @@ -33,7 +33,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type VVec<'b, 'a: 'b + 'b> = (&'b u32, Vec<&'a i32>); LL + type VVec<'b, 'a> = (&'b u32, Vec<&'a i32>); - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias-bounds.rs:14:18 @@ -45,7 +45,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type WVec<'b, T: 'b + 'b> = (&'b u32, Vec); LL + type WVec<'b, T> = (&'b u32, Vec); - | + | warning: where clauses are not enforced in type aliases --> $DIR/type-alias-bounds.rs:16:25 @@ -57,7 +57,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - type W2Vec<'b, T> where T: 'b, T: 'b = (&'b u32, Vec); LL + type W2Vec<'b, T> = (&'b u32, Vec); - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias-bounds.rs:47:12 @@ -74,7 +74,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type T1 = U::Assoc; LL + type T1 = U::Assoc; - | + | warning: where clauses are not enforced in type aliases --> $DIR/type-alias-bounds.rs:48:18 @@ -91,7 +91,7 @@ help: the clause will not be checked when the type alias is used, and should be | LL - type T2 where U: Bound = U::Assoc; LL + type T2 = U::Assoc; - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias-bounds.rs:56:12 @@ -103,7 +103,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type T5 = ::Assoc; LL + type T5 = ::Assoc; - | + | warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias-bounds.rs:57:12 @@ -115,7 +115,7 @@ help: the bound will not be checked when the type alias is used, and should be r | LL - type T6 = ::std::vec::Vec; LL + type T6 = ::std::vec::Vec; - | + | warning: 9 warnings emitted diff --git a/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr b/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr index 4fc21bd7af230..ea259cf3d3785 100644 --- a/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr +++ b/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr @@ -5,7 +5,7 @@ LL | / trait Foo { LL | | fn method(&self); LL | | } | |_- type parameter `T` must be specified for this -LL | +LL | LL | fn foo(x: &dyn Foo) { } | ^^^ help: set the type parameter to the desired type: `Foo` | diff --git a/src/test/ui/typeck/issue-88803-call-expr-method.stderr b/src/test/ui/typeck/issue-88803-call-expr-method.stderr index dd717ed9416d3..645c04b87a1fd 100644 --- a/src/test/ui/typeck/issue-88803-call-expr-method.stderr +++ b/src/test/ui/typeck/issue-88803-call-expr-method.stderr @@ -8,7 +8,7 @@ help: remove wrapping parentheses to call the method | LL - (a.unwrap)() LL + a.unwrap() - | + | error: aborting due to previous error diff --git a/src/test/ui/typeck/prim-with-args.stderr b/src/test/ui/typeck/prim-with-args.stderr index 7e7bc580b3b95..cdc7e96bfc5fc 100644 --- a/src/test/ui/typeck/prim-with-args.stderr +++ b/src/test/ui/typeck/prim-with-args.stderr @@ -10,7 +10,7 @@ help: primitive type `isize` doesn't have generic parameters | LL - let _x: isize; LL + let _x: isize; - | + | error[E0109]: type arguments are not allowed on this type --> $DIR/prim-with-args.rs:5:12 @@ -24,7 +24,7 @@ help: primitive type `i8` doesn't have generic parameters | LL - let _x: i8; LL + let _x: i8; - | + | error[E0109]: type arguments are not allowed on this type --> $DIR/prim-with-args.rs:6:13 @@ -38,7 +38,7 @@ help: primitive type `i16` doesn't have generic parameters | LL - let _x: i16; LL + let _x: i16; - | + | error[E0109]: type arguments are not allowed on this type --> $DIR/prim-with-args.rs:7:13 @@ -52,7 +52,7 @@ help: primitive type `i32` doesn't have generic parameters | LL - let _x: i32; LL + let _x: i32; - | + | error[E0109]: type arguments are not allowed on this type --> $DIR/prim-with-args.rs:8:13 @@ -66,7 +66,7 @@ help: primitive type `i64` doesn't have generic parameters | LL - let _x: i64; LL + let _x: i64; - | + | error[E0109]: type arguments are not allowed on this type --> $DIR/prim-with-args.rs:9:15 @@ -80,7 +80,7 @@ help: primitive type `usize` doesn't have generic parameters | LL - let _x: usize; LL + let _x: usize; - | + | error[E0109]: type arguments are not allowed on this type --> $DIR/prim-with-args.rs:10:12 @@ -94,7 +94,7 @@ help: primitive type `u8` doesn't have generic parameters | LL - let _x: u8; LL + let _x: u8; - | + | error[E0109]: type arguments are not allowed on this type --> $DIR/prim-with-args.rs:11:13 @@ -108,7 +108,7 @@ help: primitive type `u16` doesn't have generic parameters | LL - let _x: u16; LL + let _x: u16; - | + | error[E0109]: type arguments are not allowed on this type --> $DIR/prim-with-args.rs:12:13 @@ -122,7 +122,7 @@ help: primitive type `u32` doesn't have generic parameters | LL - let _x: u32; LL + let _x: u32; - | + | error[E0109]: type arguments are not allowed on this type --> $DIR/prim-with-args.rs:13:13 @@ -136,7 +136,7 @@ help: primitive type `u64` doesn't have generic parameters | LL - let _x: u64; LL + let _x: u64; - | + | error[E0109]: type arguments are not allowed on this type --> $DIR/prim-with-args.rs:14:14 @@ -150,7 +150,7 @@ help: primitive type `char` doesn't have generic parameters | LL - let _x: char; LL + let _x: char; - | + | error[E0109]: lifetime arguments are not allowed on this type --> $DIR/prim-with-args.rs:16:15 @@ -164,7 +164,7 @@ help: primitive type `isize` doesn't have generic parameters | LL - let _x: isize<'static>; LL + let _x: isize; - | + | error[E0109]: lifetime arguments are not allowed on this type --> $DIR/prim-with-args.rs:17:12 @@ -178,7 +178,7 @@ help: primitive type `i8` doesn't have generic parameters | LL - let _x: i8<'static>; LL + let _x: i8; - | + | error[E0109]: lifetime arguments are not allowed on this type --> $DIR/prim-with-args.rs:18:13 @@ -192,7 +192,7 @@ help: primitive type `i16` doesn't have generic parameters | LL - let _x: i16<'static>; LL + let _x: i16; - | + | error[E0109]: lifetime arguments are not allowed on this type --> $DIR/prim-with-args.rs:19:13 @@ -206,7 +206,7 @@ help: primitive type `i32` doesn't have generic parameters | LL - let _x: i32<'static>; LL + let _x: i32; - | + | error[E0109]: lifetime arguments are not allowed on this type --> $DIR/prim-with-args.rs:20:13 @@ -220,7 +220,7 @@ help: primitive type `i64` doesn't have generic parameters | LL - let _x: i64<'static>; LL + let _x: i64; - | + | error[E0109]: lifetime arguments are not allowed on this type --> $DIR/prim-with-args.rs:21:15 @@ -234,7 +234,7 @@ help: primitive type `usize` doesn't have generic parameters | LL - let _x: usize<'static>; LL + let _x: usize; - | + | error[E0109]: lifetime arguments are not allowed on this type --> $DIR/prim-with-args.rs:22:12 @@ -248,7 +248,7 @@ help: primitive type `u8` doesn't have generic parameters | LL - let _x: u8<'static>; LL + let _x: u8; - | + | error[E0109]: lifetime arguments are not allowed on this type --> $DIR/prim-with-args.rs:23:13 @@ -262,7 +262,7 @@ help: primitive type `u16` doesn't have generic parameters | LL - let _x: u16<'static>; LL + let _x: u16; - | + | error[E0109]: lifetime arguments are not allowed on this type --> $DIR/prim-with-args.rs:24:13 @@ -276,7 +276,7 @@ help: primitive type `u32` doesn't have generic parameters | LL - let _x: u32<'static>; LL + let _x: u32; - | + | error[E0109]: lifetime arguments are not allowed on this type --> $DIR/prim-with-args.rs:25:13 @@ -290,7 +290,7 @@ help: primitive type `u64` doesn't have generic parameters | LL - let _x: u64<'static>; LL + let _x: u64; - | + | error[E0109]: lifetime arguments are not allowed on this type --> $DIR/prim-with-args.rs:26:14 @@ -304,7 +304,7 @@ help: primitive type `char` doesn't have generic parameters | LL - let _x: char<'static>; LL + let _x: char; - | + | error: aborting due to 22 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr index 94de194705d83..cbdb4dd0fb5c8 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr @@ -31,7 +31,7 @@ error[E0597]: `factorial` does not live long enough | LL | let mut factorial: Option u32 + 'static>> = None; | ----------------------------------------- type annotation requires that `factorial` is borrowed for `'static` -LL | +LL | LL | let f = |x: u32| -> u32 { | --------------- value captured here LL | let g = factorial.as_ref().unwrap(); @@ -45,7 +45,7 @@ error[E0506]: cannot assign to `factorial` because it is borrowed | LL | let mut factorial: Option u32 + 'static>> = None; | ----------------------------------------- type annotation requires that `factorial` is borrowed for `'static` -LL | +LL | LL | let f = |x: u32| -> u32 { | --------------- borrow of `factorial` occurs here LL | let g = factorial.as_ref().unwrap(); diff --git a/src/test/ui/union/union-sized-field.stderr b/src/test/ui/union/union-sized-field.stderr index 0f66f6c541b3f..3fe6e71f3b863 100644 --- a/src/test/ui/union/union-sized-field.stderr +++ b/src/test/ui/union/union-sized-field.stderr @@ -12,7 +12,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - union Foo { LL + union Foo { - | + | help: borrowed types always have a statically known size | LL | value: &T, @@ -36,7 +36,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - struct Foo2 { LL + struct Foo2 { - | + | help: borrowed types always have a statically known size | LL | value: &T, @@ -60,7 +60,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - enum Foo3 { LL + enum Foo3 { - | + | help: borrowed types always have a statically known size | LL | Value(&T), diff --git a/src/test/ui/unop-move-semantics.stderr b/src/test/ui/unop-move-semantics.stderr index 199d5e3727850..14052486cbbc9 100644 --- a/src/test/ui/unop-move-semantics.stderr +++ b/src/test/ui/unop-move-semantics.stderr @@ -5,7 +5,7 @@ LL | fn move_then_borrow + Clone>(x: T) { | - move occurs because `x` has type `T`, which does not implement the `Copy` trait LL | !x; | -- `x` moved due to usage in operator -LL | +LL | LL | x.clone(); | ^^^^^^^^^ value borrowed here after move | diff --git a/src/test/ui/unsized/unsized-bare-typaram.stderr b/src/test/ui/unsized/unsized-bare-typaram.stderr index 531e9b4c9c955..1eff14be8e19a 100644 --- a/src/test/ui/unsized/unsized-bare-typaram.stderr +++ b/src/test/ui/unsized/unsized-bare-typaram.stderr @@ -15,7 +15,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn foo() { bar::() } LL + fn foo() { bar::() } - | + | error: aborting due to previous error diff --git a/src/test/ui/unsized/unsized-enum.stderr b/src/test/ui/unsized/unsized-enum.stderr index 980dee87e58b4..5f2e224308f3a 100644 --- a/src/test/ui/unsized/unsized-enum.stderr +++ b/src/test/ui/unsized/unsized-enum.stderr @@ -22,7 +22,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn foo2() { not_sized::>() } LL + fn foo2() { not_sized::>() } - | + | error: aborting due to previous error diff --git a/src/test/ui/unsized/unsized-enum2.stderr b/src/test/ui/unsized/unsized-enum2.stderr index 3985f73f118bb..00b80327c9b77 100644 --- a/src/test/ui/unsized/unsized-enum2.stderr +++ b/src/test/ui/unsized/unsized-enum2.stderr @@ -13,7 +13,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - enum E { LL + enum E { - | + | help: borrowed types always have a statically known size | LL | VA(&W), @@ -38,7 +38,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - enum E { LL + enum E { - | + | help: borrowed types always have a statically known size | LL | VB{x: &X}, @@ -63,7 +63,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - enum E { LL + enum E { - | + | help: borrowed types always have a statically known size | LL | VC(isize, &Y), @@ -88,7 +88,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - enum E { LL + enum E { - | + | help: borrowed types always have a statically known size | LL | VD{u: isize, x: &Z}, diff --git a/src/test/ui/unsized/unsized-fn-arg.stderr b/src/test/ui/unsized/unsized-fn-arg.stderr index d81dd7f342cf0..404fa5291b3e2 100644 --- a/src/test/ui/unsized/unsized-fn-arg.stderr +++ b/src/test/ui/unsized/unsized-fn-arg.stderr @@ -11,7 +11,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f(t: T) {} LL + fn f(t: T) {} - | + | help: function arguments must have a statically known size, borrowed types always have a known size | LL | fn f(t: &T) {} diff --git a/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr b/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr index 1a3c7d788f0b8..a952aa063d10b 100644 --- a/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr +++ b/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr @@ -22,7 +22,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl S5 { LL + impl S5 { - | + | error: aborting due to previous error diff --git a/src/test/ui/unsized/unsized-struct.stderr b/src/test/ui/unsized/unsized-struct.stderr index 1c70a840c77dc..c9510e92fecb4 100644 --- a/src/test/ui/unsized/unsized-struct.stderr +++ b/src/test/ui/unsized/unsized-struct.stderr @@ -22,7 +22,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn foo2() { not_sized::>() } LL + fn foo2() { not_sized::>() } - | + | error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/unsized-struct.rs:13:24 @@ -46,7 +46,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn bar2() { is_sized::>() } LL + fn bar2() { is_sized::>() } - | + | error: aborting due to 2 previous errors diff --git a/src/test/ui/unsized/unsized-trait-impl-self-type.stderr b/src/test/ui/unsized/unsized-trait-impl-self-type.stderr index da251d4078b3e..f6ba9a80cb1c2 100644 --- a/src/test/ui/unsized/unsized-trait-impl-self-type.stderr +++ b/src/test/ui/unsized/unsized-trait-impl-self-type.stderr @@ -22,7 +22,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl T3 for S5 { LL + impl T3 for S5 { - | + | error: aborting due to previous error diff --git a/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr b/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr index e91419070f5f9..f81487d5231ab 100644 --- a/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr +++ b/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr @@ -15,7 +15,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl T2 for S4 { LL + impl T2 for S4 { - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait T2 { diff --git a/src/test/ui/unsized/unsized3.stderr b/src/test/ui/unsized/unsized3.stderr index ae89f2f997728..65bdc4c2ea352 100644 --- a/src/test/ui/unsized/unsized3.stderr +++ b/src/test/ui/unsized/unsized3.stderr @@ -17,7 +17,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f1(x: &X) { LL + fn f1(x: &X) { - | + | help: consider relaxing the implicit `Sized` restriction | LL | fn f2(x: &X) { @@ -42,7 +42,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f3(x: &X) { LL + fn f3(x: &X) { - | + | help: consider relaxing the implicit `Sized` restriction | LL | fn f4(x: &X) { @@ -72,7 +72,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f8(x1: &S, x2: &S) { LL + fn f8(x1: &S, x2: &S) { - | + | help: consider relaxing the implicit `Sized` restriction | LL | fn f5(x: &Y) {} @@ -98,7 +98,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f9(x1: Box>) { LL + fn f9(x1: Box>) { - | + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized3.rs:45:8 @@ -121,7 +121,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f10(x1: Box>) { LL + fn f10(x1: Box>) { - | + | error: aborting due to 5 previous errors diff --git a/src/test/ui/unsized/unsized5.stderr b/src/test/ui/unsized/unsized5.stderr index 43463ff8266d6..03ed0c4574ab9 100644 --- a/src/test/ui/unsized/unsized5.stderr +++ b/src/test/ui/unsized/unsized5.stderr @@ -12,7 +12,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - struct S1 { LL + struct S1 { - | + | help: borrowed types always have a statically known size | LL | f1: &X, @@ -37,7 +37,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - struct S2 { LL + struct S2 { - | + | help: borrowed types always have a statically known size | LL | g: &X, @@ -97,7 +97,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - enum E { LL + enum E { - | + | help: borrowed types always have a statically known size | LL | V1(&X, isize), @@ -121,7 +121,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - enum F { LL + enum F { - | + | help: borrowed types always have a statically known size | LL | V2{f1: &X, f: isize}, diff --git a/src/test/ui/unsized/unsized6.stderr b/src/test/ui/unsized/unsized6.stderr index 38ed50daa1d49..011f2b426c7cf 100644 --- a/src/test/ui/unsized/unsized6.stderr +++ b/src/test/ui/unsized/unsized6.stderr @@ -13,7 +13,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f1(x: &X) { LL + fn f1(x: &X) { - | + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:7:12 @@ -29,7 +29,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f1(x: &X) { LL + fn f1(x: &X) { - | + | error[E0277]: the size for values of type `Z` cannot be known at compilation time --> $DIR/unsized6.rs:11:12 @@ -45,7 +45,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f1(x: &X) { LL + fn f1(x: &X) { - | + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:15:9 @@ -61,7 +61,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f2(x: &X) { LL + fn f2(x: &X) { - | + | error[E0277]: the size for values of type `Y` cannot be known at compilation time --> $DIR/unsized6.rs:17:12 @@ -77,7 +77,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f2(x: &X) { LL + fn f2(x: &X) { - | + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:22:9 @@ -93,7 +93,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f3(x1: Box, x2: Box, x3: Box) { LL + fn f3(x1: Box, x2: Box, x3: Box) { - | + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:24:9 @@ -110,7 +110,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f3(x1: Box, x2: Box, x3: Box) { LL + fn f3(x1: Box, x2: Box, x3: Box) { - | + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:26:10 @@ -127,7 +127,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f3(x1: Box, x2: Box, x3: Box) { LL + fn f3(x1: Box, x2: Box, x3: Box) { - | + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:30:9 @@ -143,7 +143,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f4(x1: Box, x2: Box, x3: Box) { LL + fn f4(x1: Box, x2: Box, x3: Box) { - | + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:32:9 @@ -160,7 +160,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f4(x1: Box, x2: Box, x3: Box) { LL + fn f4(x1: Box, x2: Box, x3: Box) { - | + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:34:10 @@ -177,7 +177,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f4(x1: Box, x2: Box, x3: Box) { LL + fn f4(x1: Box, x2: Box, x3: Box) { - | + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:38:18 @@ -192,7 +192,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn g1(x: X) {} LL + fn g1(x: X) {} - | + | help: function arguments must have a statically known size, borrowed types always have a known size | LL | fn g1(x: &X) {} @@ -211,7 +211,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn g2(x: X) {} LL + fn g2(x: X) {} - | + | help: function arguments must have a statically known size, borrowed types always have a known size | LL | fn g2(x: &X) {} diff --git a/src/test/ui/unsized/unsized7.stderr b/src/test/ui/unsized/unsized7.stderr index 3246e26e6eb7d..1555b9df4f8d4 100644 --- a/src/test/ui/unsized/unsized7.stderr +++ b/src/test/ui/unsized/unsized7.stderr @@ -15,7 +15,7 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl T1 for S3 { LL + impl T1 for S3 { - | + | help: consider relaxing the implicit `Sized` restriction | LL | trait T1 { diff --git a/src/test/ui/use/use-after-move-implicity-coerced-object.stderr b/src/test/ui/use/use-after-move-implicity-coerced-object.stderr index 0ad6d6c7c0e07..26804216d9da7 100644 --- a/src/test/ui/use/use-after-move-implicity-coerced-object.stderr +++ b/src/test/ui/use/use-after-move-implicity-coerced-object.stderr @@ -6,7 +6,7 @@ LL | let n: Box<_> = Number { n: 42 }.into(); LL | let mut l: Box<_> = List { list: Vec::new() }.into(); LL | l.push(n); | - value moved here -LL | +LL | LL | let x = n.to_string(); | ^^^^^^^^^^^^^ value borrowed here after move diff --git a/src/test/ui/use/use-mod/use-mod-4.stderr b/src/test/ui/use/use-mod/use-mod-4.stderr index 5bb04b2633b60..0b4fbadb45829 100644 --- a/src/test/ui/use/use-mod/use-mod-4.stderr +++ b/src/test/ui/use/use-mod/use-mod-4.stderr @@ -8,7 +8,7 @@ help: consider importing the module directly | LL - use foo::self; LL + use foo; - | + | help: alternatively, use the multi-path `use` syntax to import `self` | LL | use foo::{self}; @@ -24,7 +24,7 @@ help: consider importing the module directly | LL - use std::mem::self; LL + use std::mem; - | + | help: alternatively, use the multi-path `use` syntax to import `self` | LL | use std::mem::{self}; diff --git a/src/test/ui/use/use-mod/use-mod-5.stderr b/src/test/ui/use/use-mod/use-mod-5.stderr index 627cf73c3148c..62859e261a36a 100644 --- a/src/test/ui/use/use-mod/use-mod-5.stderr +++ b/src/test/ui/use/use-mod/use-mod-5.stderr @@ -8,7 +8,7 @@ help: consider importing the module directly | LL - use foo::bar::self; LL + use foo::bar; - | + | help: alternatively, use the multi-path `use` syntax to import `self` | LL | use foo::bar::{self}; diff --git a/src/test/ui/use/use-mod/use-mod-6.stderr b/src/test/ui/use/use-mod/use-mod-6.stderr index 7be6e7525cbc9..2d2c90067aa61 100644 --- a/src/test/ui/use/use-mod/use-mod-6.stderr +++ b/src/test/ui/use/use-mod/use-mod-6.stderr @@ -8,7 +8,7 @@ help: consider importing the module directly | LL - use foo::bar::self as abc; LL + use foo::bar as abc; - | + | help: alternatively, use the multi-path `use` syntax to import `self` | LL | use foo::bar::{self as abc}; diff --git a/src/test/ui/usize-generic-argument-parent.stderr b/src/test/ui/usize-generic-argument-parent.stderr index c657f0faa0b98..b398010110498 100644 --- a/src/test/ui/usize-generic-argument-parent.stderr +++ b/src/test/ui/usize-generic-argument-parent.stderr @@ -10,7 +10,7 @@ help: primitive type `usize` doesn't have generic parameters | LL - let x: usize; LL + let x: usize; - | + | error: aborting due to previous error diff --git a/src/tools/clippy/clippy_lints/src/almost_complete_letter_range.rs b/src/tools/clippy/clippy_lints/src/almost_complete_letter_range.rs index b364a370efab5..59a7c53540069 100644 --- a/src/tools/clippy/clippy_lints/src/almost_complete_letter_range.rs +++ b/src/tools/clippy/clippy_lints/src/almost_complete_letter_range.rs @@ -90,7 +90,7 @@ fn check_range(cx: &EarlyContext<'_>, span: Span, start: &Expr, end: &Expr, sugg diag.span_suggestion( span, "use an inclusive range", - sugg.to_owned(), + sugg, Applicability::MaybeIncorrect, ); } diff --git a/src/tools/clippy/clippy_lints/src/as_underscore.rs b/src/tools/clippy/clippy_lints/src/as_underscore.rs index 464be4218dd4d..0bdef9d0a7e8e 100644 --- a/src/tools/clippy/clippy_lints/src/as_underscore.rs +++ b/src/tools/clippy/clippy_lints/src/as_underscore.rs @@ -63,7 +63,7 @@ impl<'tcx> LateLintPass<'tcx> for AsUnderscore { diag.span_suggestion( ty.span, "consider giving the type explicitly", - format!("{}", ty_resolved), + ty_resolved, Applicability::MachineApplicable, ); } diff --git a/src/tools/clippy/clippy_lints/src/empty_structs_with_brackets.rs b/src/tools/clippy/clippy_lints/src/empty_structs_with_brackets.rs index 8430e7b4c8271..08bf80a422900 100644 --- a/src/tools/clippy/clippy_lints/src/empty_structs_with_brackets.rs +++ b/src/tools/clippy/clippy_lints/src/empty_structs_with_brackets.rs @@ -44,7 +44,7 @@ impl EarlyLintPass for EmptyStructsWithBrackets { diagnostic.span_suggestion_hidden( span_after_ident, "remove the brackets", - ";".to_string(), + ";", Applicability::MachineApplicable); }, ); diff --git a/src/tools/clippy/clippy_lints/src/large_const_arrays.rs b/src/tools/clippy/clippy_lints/src/large_const_arrays.rs index 27db638813613..14f84a832aa3e 100644 --- a/src/tools/clippy/clippy_lints/src/large_const_arrays.rs +++ b/src/tools/clippy/clippy_lints/src/large_const_arrays.rs @@ -75,7 +75,7 @@ impl<'tcx> LateLintPass<'tcx> for LargeConstArrays { diag.span_suggestion( sugg_span, "make this a static item", - "static".to_string(), + "static", Applicability::MachineApplicable, ); } diff --git a/src/tools/clippy/clippy_lints/src/manual_async_fn.rs b/src/tools/clippy/clippy_lints/src/manual_async_fn.rs index babc6fab3c0fb..c70b1c261b618 100644 --- a/src/tools/clippy/clippy_lints/src/manual_async_fn.rs +++ b/src/tools/clippy/clippy_lints/src/manual_async_fn.rs @@ -86,7 +86,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualAsyncFn { diag.span_suggestion( block.span, "move the body of the async block to the enclosing function", - body_snip.to_string(), + body_snip, Applicability::MachineApplicable ); } diff --git a/src/tools/clippy/clippy_lints/src/matches/match_same_arms.rs b/src/tools/clippy/clippy_lints/src/matches/match_same_arms.rs index a96a7fe55f3a3..4f8baf7efb0bb 100644 --- a/src/tools/clippy/clippy_lints/src/matches/match_same_arms.rs +++ b/src/tools/clippy/clippy_lints/src/matches/match_same_arms.rs @@ -113,7 +113,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, arms: &'tcx [Arm<'_>]) { diag.span_suggestion( arm1.span, "try removing the arm", - String::new(), + "", Applicability::MaybeIncorrect, ) .help("or try changing either arm body") diff --git a/src/tools/clippy/clippy_lints/src/methods/str_splitn.rs b/src/tools/clippy/clippy_lints/src/methods/str_splitn.rs index 90651a6ba0458..4ac738272d085 100644 --- a/src/tools/clippy/clippy_lints/src/methods/str_splitn.rs +++ b/src/tools/clippy/clippy_lints/src/methods/str_splitn.rs @@ -176,13 +176,13 @@ fn check_manual_split_once_indirect( diag.span_suggestion( first.span, &remove_msg, - String::new(), + "", app, ); diag.span_suggestion( second.span, &remove_msg, - String::new(), + "", app, ); }); diff --git a/src/tools/clippy/clippy_lints/src/methods/unnecessary_iter_cloned.rs b/src/tools/clippy/clippy_lints/src/methods/unnecessary_iter_cloned.rs index 7a39557ad5757..19037093e20a1 100644 --- a/src/tools/clippy/clippy_lints/src/methods/unnecessary_iter_cloned.rs +++ b/src/tools/clippy/clippy_lints/src/methods/unnecessary_iter_cloned.rs @@ -85,7 +85,7 @@ pub fn check_for_loop_iter( match addr_of_expr.kind { ExprKind::AddrOf(_, _, referent) => { let span = addr_of_expr.span.with_hi(referent.span.lo()); - diag.span_suggestion(span, "remove this `&`", String::new(), applicability); + diag.span_suggestion(span, "remove this `&`", "", applicability); } _ => unreachable!(), } diff --git a/src/tools/clippy/clippy_lints/src/needless_late_init.rs b/src/tools/clippy/clippy_lints/src/needless_late_init.rs index 26c694a71fedd..1f8c4c85cc2e1 100644 --- a/src/tools/clippy/clippy_lints/src/needless_late_init.rs +++ b/src/tools/clippy/clippy_lints/src/needless_late_init.rs @@ -281,7 +281,7 @@ fn check<'tcx>( diag.tool_only_span_suggestion( local_stmt.span, "remove the local", - String::new(), + "", Applicability::MachineApplicable, ); @@ -318,7 +318,7 @@ fn check<'tcx>( diag.span_suggestion( usage.stmt.span.shrink_to_hi(), "add a semicolon after the `if` expression", - ";".to_string(), + ";", applicability, ); } @@ -353,7 +353,7 @@ fn check<'tcx>( diag.span_suggestion( usage.stmt.span.shrink_to_hi(), "add a semicolon after the `match` expression", - ";".to_string(), + ";", applicability, ); } diff --git a/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs b/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs index f423be4b67a61..8b273aca7d020 100644 --- a/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs +++ b/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs @@ -258,7 +258,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue { diag.span_suggestion( input.span, "consider changing the type to", - "&str".to_string(), + "&str", Applicability::Unspecified, ); diff --git a/src/tools/clippy/clippy_lints/src/redundant_clone.rs b/src/tools/clippy/clippy_lints/src/redundant_clone.rs index 249f11f985082..3b11cbc376062 100644 --- a/src/tools/clippy/clippy_lints/src/redundant_clone.rs +++ b/src/tools/clippy/clippy_lints/src/redundant_clone.rs @@ -255,7 +255,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantClone { diag.span_suggestion( sugg_span, "remove this", - String::new(), + "", app, ); if clone_usage.cloned_used { diff --git a/src/tools/clippy/clippy_lints/src/transmute/transmute_float_to_int.rs b/src/tools/clippy/clippy_lints/src/transmute/transmute_float_to_int.rs index d5ef86dc4e572..1bde977cfa273 100644 --- a/src/tools/clippy/clippy_lints/src/transmute/transmute_float_to_int.rs +++ b/src/tools/clippy/clippy_lints/src/transmute/transmute_float_to_int.rs @@ -55,7 +55,7 @@ pub(super) fn check<'tcx>( sugg }; - diag.span_suggestion(e.span, "consider using", sugg.to_string(), Applicability::Unspecified); + diag.span_suggestion(e.span, "consider using", sugg, Applicability::Unspecified); }, ); true diff --git a/src/tools/clippy/clippy_lints/src/transmute/transmute_ptr_to_ptr.rs b/src/tools/clippy/clippy_lints/src/transmute/transmute_ptr_to_ptr.rs index d712b33de9e1a..31a9b69ca1583 100644 --- a/src/tools/clippy/clippy_lints/src/transmute/transmute_ptr_to_ptr.rs +++ b/src/tools/clippy/clippy_lints/src/transmute/transmute_ptr_to_ptr.rs @@ -25,7 +25,7 @@ pub(super) fn check<'tcx>( |diag| { if let Some(arg) = sugg::Sugg::hir_opt(cx, arg) { let sugg = arg.as_ty(cx.tcx.mk_ptr(*to_ty)); - diag.span_suggestion(e.span, "try", sugg.to_string(), Applicability::Unspecified); + diag.span_suggestion(e.span, "try", sugg, Applicability::Unspecified); } }, ); diff --git a/src/tools/clippy/clippy_lints/src/transmute/transmute_ref_to_ref.rs b/src/tools/clippy/clippy_lints/src/transmute/transmute_ref_to_ref.rs index 786e7bfc56f6e..707a11d361c06 100644 --- a/src/tools/clippy/clippy_lints/src/transmute/transmute_ref_to_ref.rs +++ b/src/tools/clippy/clippy_lints/src/transmute/transmute_ref_to_ref.rs @@ -73,7 +73,7 @@ pub(super) fn check<'tcx>( diag.span_suggestion( e.span, "try", - sugg.to_string(), + sugg, Applicability::Unspecified, ); }, diff --git a/src/tools/clippy/clippy_lints/src/transmute/useless_transmute.rs b/src/tools/clippy/clippy_lints/src/transmute/useless_transmute.rs index a0d104e239042..fc9227b76f025 100644 --- a/src/tools/clippy/clippy_lints/src/transmute/useless_transmute.rs +++ b/src/tools/clippy/clippy_lints/src/transmute/useless_transmute.rs @@ -46,7 +46,7 @@ pub(super) fn check<'tcx>( arg.as_ty(cx.tcx.mk_ptr(rty_and_mut)).as_ty(to_ty) }; - diag.span_suggestion(e.span, "try", sugg.to_string(), Applicability::Unspecified); + diag.span_suggestion(e.span, "try", sugg, Applicability::Unspecified); } }, ); @@ -64,7 +64,7 @@ pub(super) fn check<'tcx>( diag.span_suggestion( e.span, "try", - arg.as_ty(&to_ty.to_string()).to_string(), + arg.as_ty(&to_ty.to_string()), Applicability::Unspecified, ); } diff --git a/src/tools/clippy/clippy_utils/src/attrs.rs b/src/tools/clippy/clippy_utils/src/attrs.rs index 49318849d5802..186bba09d2012 100644 --- a/src/tools/clippy/clippy_utils/src/attrs.rs +++ b/src/tools/clippy/clippy_utils/src/attrs.rs @@ -92,7 +92,7 @@ pub fn get_attr<'a>( diag.span_suggestion( attr_segments[1].ident.span, "consider using", - new_name.to_string(), + new_name, Applicability::MachineApplicable, ); diag.emit();