From 2c71894657bc0ac7a250170e3733f140750498a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 13 Mar 2020 19:28:14 -0700 Subject: [PATCH] Tweak `suggest_constraining_type_param` Some of the bound restriction structured suggestions were incorrect while others had subpar output. --- .../diagnostics/conflict_errors.rs | 2 - src/librustc_trait_selection/lib.rs | 1 + .../traits/error_reporting/mod.rs | 130 +++++----------- .../traits/error_reporting/suggestions.rs | 77 +++------- ...iated-const-type-parameter-arrays-2.stderr | 7 +- ...ociated-const-type-parameter-arrays.stderr | 7 +- ...types-invalid-trait-ref-issue-18865.stderr | 7 +- .../associated-types-no-suitable-bound.stderr | 7 +- .../defaults-suitability.stderr | 16 +- .../defaults-unsound-62211-1.stderr | 28 ++-- .../defaults-unsound-62211-2.stderr | 28 ++-- .../ui/bad/bad-method-typaram-kind.stderr | 7 +- src/test/ui/binop/binop-consume-args.stderr | 140 ++++++++---------- src/test/ui/binop/binop-move-semantics.stderr | 14 +- .../borrowck/borrowck-unboxed-closures.stderr | 7 +- src/test/ui/bound-suggestions.fixed | 4 +- src/test/ui/bound-suggestions.stderr | 54 +++---- ...builtin-superkinds-double-superkind.stderr | 18 +-- .../builtin-superkinds-in-metadata.stderr | 9 +- ...builtin-superkinds-typaram-not-send.stderr | 7 +- ...ds-cant-promote-superkind-in-struct.stderr | 7 +- .../ui/closures/closure-bounds-subtype.stderr | 7 +- src/test/ui/closures/issue-67123.stderr | 9 +- .../issues/issue-61336-2.stderr | 9 +- .../const-generics/issues/issue-61336.stderr | 9 +- .../impl_bounds.stderr | 9 +- ...igher-ranker-supertraits-transitive.stderr | 7 +- .../hrtb-higher-ranker-supertraits.stderr | 14 +- src/test/ui/impl-trait/issue-55872-1.stderr | 18 +-- src/test/ui/issues/issue-21837.stderr | 7 +- src/test/ui/issues/issue-34721.fixed | 2 +- src/test/ui/issues/issue-34721.stderr | 7 +- .../issues/issue-43784-associated-type.stderr | 7 +- .../ui/issues/issue-43784-supertrait.stderr | 7 +- .../kindck/kindck-impl-type-params.nll.stderr | 36 ++--- .../ui/kindck/kindck-impl-type-params.stderr | 36 ++--- ...-on-type-no-recursive-stack-closure.stderr | 7 +- .../ui/once-cant-call-twice-on-heap.stderr | 7 +- src/test/ui/phantom-oibit.stderr | 18 +-- .../defaultimpl/specialization-wfcheck.stderr | 7 +- .../suggestions/restrict-type-argument.stderr | 42 +++--- .../traits/trait-alias/trait-alias-wf.stderr | 7 +- .../trait-bounds-on-structs-and-enums.stderr | 21 ++- .../traits-repeated-supertrait-ambig.stderr | 14 +- .../bound_reduction2.stderr | 7 +- .../generic_underconstrained.stderr | 9 +- .../generic_underconstrained2.stderr | 18 +-- src/test/ui/type/type-check-defaults.stderr | 7 +- ...ypeck-default-trait-impl-send-param.stderr | 7 +- src/test/ui/unop-move-semantics.stderr | 7 +- src/test/ui/wf/wf-enum-bound.stderr | 7 +- .../wf/wf-enum-fields-struct-variant.stderr | 7 +- src/test/ui/wf/wf-enum-fields.stderr | 7 +- src/test/ui/wf/wf-fn-where-clause.stderr | 7 +- .../wf/wf-impl-associated-type-trait.stderr | 7 +- src/test/ui/wf/wf-in-fn-arg.stderr | 7 +- src/test/ui/wf/wf-in-fn-ret.stderr | 7 +- src/test/ui/wf/wf-in-fn-type-arg.stderr | 7 +- src/test/ui/wf/wf-in-fn-type-ret.stderr | 7 +- src/test/ui/wf/wf-in-fn-where-clause.stderr | 7 +- src/test/ui/wf/wf-in-obj-type-trait.stderr | 7 +- ...f-inherent-impl-method-where-clause.stderr | 7 +- .../wf/wf-inherent-impl-where-clause.stderr | 7 +- src/test/ui/wf/wf-struct-bound.stderr | 7 +- src/test/ui/wf/wf-struct-field.stderr | 7 +- .../wf/wf-trait-associated-type-bound.stderr | 7 +- src/test/ui/wf/wf-trait-bound.stderr | 7 +- src/test/ui/wf/wf-trait-superbound.stderr | 7 +- ...traints-are-local-for-inherent-impl.stderr | 7 +- ...onstraints-are-local-for-trait-impl.stderr | 7 +- 70 files changed, 439 insertions(+), 640 deletions(-) diff --git a/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs b/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs index 8f18fb4a30ed3..4ab7c4506fe62 100644 --- a/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs +++ b/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs @@ -222,8 +222,6 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { &mut err, ¶m.name.as_str(), "Copy", - tcx.sess.source_map(), - span, None, ); } diff --git a/src/librustc_trait_selection/lib.rs b/src/librustc_trait_selection/lib.rs index 739aff4fb94c9..98a623e38860c 100644 --- a/src/librustc_trait_selection/lib.rs +++ b/src/librustc_trait_selection/lib.rs @@ -15,6 +15,7 @@ #![feature(drain_filter)] #![feature(in_band_lifetimes)] #![feature(crate_visibility_modifier)] +#![feature(or_patterns)] #![recursion_limit = "512"] // For rustdoc #[macro_use] diff --git a/src/librustc_trait_selection/traits/error_reporting/mod.rs b/src/librustc_trait_selection/traits/error_reporting/mod.rs index 8cbed43cac01d..d0cfa5489589d 100644 --- a/src/librustc_trait_selection/traits/error_reporting/mod.rs +++ b/src/librustc_trait_selection/traits/error_reporting/mod.rs @@ -25,8 +25,7 @@ use rustc_hir as hir; use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_hir::{Node, QPath, TyKind, WhereBoundPredicate, WherePredicate}; use rustc_session::DiagnosticMessageId; -use rustc_span::source_map::SourceMap; -use rustc_span::{ExpnKind, Span, DUMMY_SP}; +use rustc_span::{BytePos, ExpnKind, Span, DUMMY_SP}; use std::fmt; use crate::traits::query::evaluate_obligation::InferCtxtExt as _; @@ -1679,14 +1678,8 @@ pub fn suggest_constraining_type_param( err: &mut DiagnosticBuilder<'_>, param_name: &str, constraint: &str, - source_map: &SourceMap, - span: Span, def_id: Option, ) -> bool { - const MSG_RESTRICT_BOUND_FURTHER: &str = "consider further restricting this bound with"; - const MSG_RESTRICT_TYPE: &str = "consider restricting this type parameter with"; - const MSG_RESTRICT_TYPE_FURTHER: &str = "consider further restricting this type parameter with"; - let param = generics.params.iter().find(|p| p.name.ident().as_str() == param_name); let param = if let Some(param) = param { @@ -1695,11 +1688,24 @@ pub fn suggest_constraining_type_param( return false; }; + const MSG_RESTRICT_BOUND_FURTHER: &str = "consider further restricting this bound"; + let msg_restrict_type = format!("consider restricting type parameter `{}`", param_name); + let msg_restrict_type_further = + format!("consider further restricting type parameter `{}`", param_name); + if def_id == tcx.lang_items().sized_trait() { // Type parameters are already `Sized` by default. err.span_label(param.span, &format!("this type parameter needs to be `{}`", constraint)); return true; } + let mut suggest_restrict = |span| { + err.span_suggestion_verbose( + span, + MSG_RESTRICT_BOUND_FURTHER, + format!(" + {}", constraint), + Applicability::MachineApplicable, + ); + }; if param_name.starts_with("impl ") { // If there's an `impl Trait` used in argument position, suggest @@ -1717,19 +1723,15 @@ pub fn suggest_constraining_type_param( // | // replace with: `impl Foo + Bar` - err.span_help(param.span, &format!("{} `+ {}`", MSG_RESTRICT_BOUND_FURTHER, constraint)); - - err.tool_only_span_suggestion( - param.span, - MSG_RESTRICT_BOUND_FURTHER, - format!("{} + {}", param_name, constraint), - Applicability::MachineApplicable, - ); - + suggest_restrict(param.span.shrink_to_hi()); return true; } - if generics.where_clause.predicates.is_empty() { + if generics.where_clause.predicates.is_empty() + // Given `trait Base: Super` where `T: Copy`, suggest restricting in the + // `where` clause instead of `trait Base: Super`. + && !matches!(param.kind, hir::GenericParamKind::Type { default: Some(_), .. }) + { if let Some(bounds_span) = param.bounds_span() { // If user has provided some bounds, suggest restricting them: // @@ -1744,38 +1746,16 @@ pub fn suggest_constraining_type_param( // -- // | // replace with: `T: Bar +` - - err.span_help( - bounds_span, - &format!("{} `+ {}`", MSG_RESTRICT_BOUND_FURTHER, constraint), - ); - - let span_hi = param.span.with_hi(span.hi()); - let span_with_colon = source_map.span_through_char(span_hi, ':'); - - if span_hi != param.span && span_with_colon != span_hi { - err.tool_only_span_suggestion( - span_with_colon, - MSG_RESTRICT_BOUND_FURTHER, - format!("{}: {} + ", param_name, constraint), - Applicability::MachineApplicable, - ); - } + suggest_restrict(bounds_span.shrink_to_hi()); } else { // If user hasn't provided any bounds, suggest adding a new one: // // fn foo(t: T) { ... } // - help: consider restricting this type parameter with `T: Foo` - - err.span_help( - param.span, - &format!("{} `{}: {}`", MSG_RESTRICT_TYPE, param_name, constraint), - ); - - err.tool_only_span_suggestion( - param.span, - MSG_RESTRICT_TYPE, - format!("{}: {}", param_name, constraint), + err.span_suggestion_verbose( + param.span.shrink_to_hi(), + &msg_restrict_type, + format!(": {}", constraint), Applicability::MachineApplicable, ); } @@ -1839,55 +1819,25 @@ pub fn suggest_constraining_type_param( } } - let where_clause_span = - generics.where_clause.span_for_predicates_or_empty_place().shrink_to_hi(); + let where_clause_span = generics.where_clause.span_for_predicates_or_empty_place(); + // Account for `fn foo(t: T) where T: Foo,` so we don't suggest two trailing commas. + let mut trailing_comma = false; + if let Ok(snippet) = tcx.sess.source_map().span_to_snippet(where_clause_span) { + trailing_comma = snippet.ends_with(","); + } + let where_clause_span = if trailing_comma { + let hi = where_clause_span.hi(); + Span::new(hi - BytePos(1), hi, where_clause_span.ctxt()) + } else { + where_clause_span.shrink_to_hi() + }; match ¶m_spans[..] { - &[] => { - err.span_help( - param.span, - &format!("{} `where {}: {}`", MSG_RESTRICT_TYPE, param_name, constraint), - ); - - err.tool_only_span_suggestion( - where_clause_span, - MSG_RESTRICT_TYPE, - format!(", {}: {}", param_name, constraint), - Applicability::MachineApplicable, - ); - } - - &[¶m_span] => { - err.span_help( - param_span, - &format!("{} `+ {}`", MSG_RESTRICT_BOUND_FURTHER, constraint), - ); - - let span_hi = param_span.with_hi(span.hi()); - let span_with_colon = source_map.span_through_char(span_hi, ':'); - - if span_hi != param_span && span_with_colon != span_hi { - err.tool_only_span_suggestion( - span_with_colon, - MSG_RESTRICT_BOUND_FURTHER, - format!("{}: {} +", param_name, constraint), - Applicability::MachineApplicable, - ); - } - } - + &[¶m_span] => suggest_restrict(param_span.shrink_to_hi()), _ => { - err.span_help( - param.span, - &format!( - "{} `where {}: {}`", - MSG_RESTRICT_TYPE_FURTHER, param_name, constraint, - ), - ); - - err.tool_only_span_suggestion( + err.span_suggestion_verbose( where_clause_span, - MSG_RESTRICT_BOUND_FURTHER, + &msg_restrict_type_further, format!(", {}: {}", param_name, constraint), Applicability::MachineApplicable, ); diff --git a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs b/src/librustc_trait_selection/traits/error_reporting/suggestions.rs index a4be70df122d7..3ac2117ec697e 100644 --- a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs +++ b/src/librustc_trait_selection/traits/error_reporting/suggestions.rs @@ -195,8 +195,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { return; } - hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(_, generics, _), .. }) - | hir::Node::TraitItem(hir::TraitItem { + hir::Node::TraitItem(hir::TraitItem { generics, kind: hir::TraitItemKind::Fn(..), .. @@ -206,63 +205,31 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { kind: hir::ImplItemKind::Fn(..), .. }) - | hir::Node::Item(hir::Item { - kind: hir::ItemKind::Trait(_, _, generics, _, _), - .. - }) - | hir::Node::Item(hir::Item { - kind: hir::ItemKind::Impl { generics, .. }, .. - }) if projection.is_some() => { + | hir::Node::Item( + hir::Item { kind: hir::ItemKind::Fn(_, generics, _), .. } + | hir::Item { kind: hir::ItemKind::Trait(_, _, generics, _, _), .. } + | hir::Item { kind: hir::ItemKind::Impl { generics, .. }, .. }, + ) if projection.is_some() => { // Missing associated type bound. suggest_restriction(&generics, "the associated type", err); return; } - hir::Node::Item(hir::Item { - kind: hir::ItemKind::Struct(_, generics), - span, - .. - }) - | hir::Node::Item(hir::Item { - kind: hir::ItemKind::Enum(_, generics), span, .. - }) - | hir::Node::Item(hir::Item { - kind: hir::ItemKind::Union(_, generics), - span, - .. - }) - | hir::Node::Item(hir::Item { - kind: hir::ItemKind::Trait(_, _, generics, ..), - span, - .. - }) - | hir::Node::Item(hir::Item { - kind: hir::ItemKind::Impl { generics, .. }, - span, - .. - }) - | hir::Node::Item(hir::Item { - kind: hir::ItemKind::Fn(_, generics, _), - span, - .. - }) - | hir::Node::Item(hir::Item { - kind: hir::ItemKind::TyAlias(_, generics), - span, - .. - }) - | hir::Node::Item(hir::Item { - kind: hir::ItemKind::TraitAlias(generics, _), - span, - .. - }) - | hir::Node::Item(hir::Item { - kind: hir::ItemKind::OpaqueTy(hir::OpaqueTy { generics, .. }), - span, - .. - }) - | hir::Node::TraitItem(hir::TraitItem { generics, span, .. }) - | hir::Node::ImplItem(hir::ImplItem { generics, span, .. }) + hir::Node::Item( + hir::Item { kind: hir::ItemKind::Struct(_, generics), .. } + | hir::Item { kind: hir::ItemKind::Enum(_, generics), .. } + | hir::Item { kind: hir::ItemKind::Union(_, generics), .. } + | hir::Item { kind: hir::ItemKind::Trait(_, _, generics, ..), .. } + | hir::Item { kind: hir::ItemKind::Impl { generics, .. }, .. } + | hir::Item { kind: hir::ItemKind::Fn(_, generics, _), .. } + | hir::Item { kind: hir::ItemKind::TyAlias(_, generics), .. } + | hir::Item { kind: hir::ItemKind::TraitAlias(generics, _), .. } + | hir::Item { + kind: hir::ItemKind::OpaqueTy(hir::OpaqueTy { generics, .. }), .. + }, + ) + | hir::Node::TraitItem(hir::TraitItem { generics, .. }) + | hir::Node::ImplItem(hir::ImplItem { generics, .. }) if param_ty => { // Missing generic type parameter bound. @@ -274,8 +241,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { &mut err, ¶m_name, &constraint, - self.tcx.sess.source_map(), - *span, Some(trait_ref.def_id()), ) { return; diff --git a/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.stderr b/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.stderr index ec60db47f4429..946a1f1a07abd 100644 --- a/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.stderr +++ b/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.stderr @@ -7,11 +7,10 @@ LL | const Y: usize; LL | let _array = [4; ::Y]; | ^^^^^^^^^^^^^ the trait `Foo` is not implemented for `A` | -help: consider further restricting this bound with `+ Foo` - --> $DIR/associated-const-type-parameter-arrays-2.rs:15:16 +help: consider further restricting this bound | -LL | pub fn test() { - | ^^^ +LL | pub fn test() { + | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/associated-const/associated-const-type-parameter-arrays.stderr b/src/test/ui/associated-const/associated-const-type-parameter-arrays.stderr index 3d38deb5a8763..ac40e390cfbbd 100644 --- a/src/test/ui/associated-const/associated-const-type-parameter-arrays.stderr +++ b/src/test/ui/associated-const/associated-const-type-parameter-arrays.stderr @@ -7,11 +7,10 @@ LL | const Y: usize; LL | let _array: [u32; ::Y]; | ^^^^^^^^^^^^^ the trait `Foo` is not implemented for `A` | -help: consider further restricting this bound with `+ Foo` - --> $DIR/associated-const-type-parameter-arrays.rs:15:16 +help: consider further restricting this bound | -LL | pub fn test() { - | ^^^ +LL | pub fn test() { + | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr b/src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr index bac663dfea2b3..1df127873538d 100644 --- a/src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr +++ b/src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr @@ -4,11 +4,10 @@ error[E0277]: the trait bound `T: Foo` is not satisfied LL | let u: >::Bar = t.get_bar(); | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `T` | -help: consider further restricting this bound with `+ Foo` - --> $DIR/associated-types-invalid-trait-ref-issue-18865.rs:9:8 +help: consider further restricting this bound | -LL | fn f>(t: &T) { - | ^^^^^^^^^^ +LL | fn f + Foo>(t: &T) { + | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr b/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr index 770845167cf9c..0b5dee611e489 100644 --- a/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr +++ b/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr @@ -4,11 +4,10 @@ error[E0277]: the trait bound `T: Get` is not satisfied LL | fn uhoh(foo: ::Value) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `T` | -help: consider restricting this type parameter with `T: Get` - --> $DIR/associated-types-no-suitable-bound.rs:11:13 +help: consider restricting type parameter `T` | -LL | fn uhoh(foo: ::Value) {} - | ^ +LL | fn uhoh(foo: ::Value) {} + | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/associated-types/defaults-suitability.stderr b/src/test/ui/associated-types/defaults-suitability.stderr index 60e1821b300d2..54e39c4367d10 100644 --- a/src/test/ui/associated-types/defaults-suitability.stderr +++ b/src/test/ui/associated-types/defaults-suitability.stderr @@ -23,12 +23,11 @@ LL | trait Foo { LL | type Bar: Clone = Vec; | ^^^^^ the trait `std::clone::Clone` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::clone::Clone` - --> $DIR/defaults-suitability.rs:32:11 - | -LL | trait Foo { - | ^ = note: required because of the requirements on the impl of `std::clone::Clone` for `std::vec::Vec` +help: consider restricting type parameter `T` + | +LL | trait Foo { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `(): Foo` is not satisfied --> $DIR/defaults-suitability.rs:39:17 @@ -119,11 +118,10 @@ LL | | type Baz = T; LL | | } | |_- required by `Foo3` | -help: consider restricting this type parameter with `where T: std::clone::Clone` - --> $DIR/defaults-suitability.rs:88:12 +help: consider further restricting type parameter `T` | -LL | trait Foo3 where - | ^ +LL | Self::Baz: Clone, T: std::clone::Clone + | ^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/defaults-suitability.rs:27:5 diff --git a/src/test/ui/associated-types/defaults-unsound-62211-1.stderr b/src/test/ui/associated-types/defaults-unsound-62211-1.stderr index 9c4a126013942..cfca7cc101107 100644 --- a/src/test/ui/associated-types/defaults-unsound-62211-1.stderr +++ b/src/test/ui/associated-types/defaults-unsound-62211-1.stderr @@ -47,11 +47,10 @@ LL | impl UncheckedCopy for T {} | = help: the trait `std::fmt::Display` is not implemented for `T` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -help: consider restricting this type parameter with `T: std::fmt::Display` - --> $DIR/defaults-unsound-62211-1.rs:41:6 +help: consider restricting type parameter `T` | -LL | impl UncheckedCopy for T {} - | ^ +LL | impl UncheckedCopy for T {} + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: std::ops::Deref` is not satisfied --> $DIR/defaults-unsound-62211-1.rs:41:9 @@ -59,11 +58,10 @@ error[E0277]: the trait bound `T: std::ops::Deref` is not satisfied LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ the trait `std::ops::Deref` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::ops::Deref` - --> $DIR/defaults-unsound-62211-1.rs:41:6 +help: consider restricting type parameter `T` | -LL | impl UncheckedCopy for T {} - | ^ +LL | impl UncheckedCopy for T {} + | ^^^^^^^^^^^^^^^^^ error[E0277]: cannot add-assign `&'static str` to `T` --> $DIR/defaults-unsound-62211-1.rs:41:9 @@ -72,11 +70,10 @@ LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ no implementation for `T += &'static str` | = help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `T` -help: consider restricting this type parameter with `T: std::ops::AddAssign<&'static str>` - --> $DIR/defaults-unsound-62211-1.rs:41:6 +help: consider restricting type parameter `T` | -LL | impl UncheckedCopy for T {} - | ^ +LL | impl> UncheckedCopy for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/defaults-unsound-62211-1.rs:41:9 @@ -84,11 +81,10 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/defaults-unsound-62211-1.rs:41:6 +help: consider restricting type parameter `T` | -LL | impl UncheckedCopy for T {} - | ^ +LL | impl UncheckedCopy for T {} + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 8 previous errors diff --git a/src/test/ui/associated-types/defaults-unsound-62211-2.stderr b/src/test/ui/associated-types/defaults-unsound-62211-2.stderr index 4602fbc99fa62..1dcfbf538e4c7 100644 --- a/src/test/ui/associated-types/defaults-unsound-62211-2.stderr +++ b/src/test/ui/associated-types/defaults-unsound-62211-2.stderr @@ -47,11 +47,10 @@ LL | impl UncheckedCopy for T {} | = help: the trait `std::fmt::Display` is not implemented for `T` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -help: consider restricting this type parameter with `T: std::fmt::Display` - --> $DIR/defaults-unsound-62211-2.rs:41:6 +help: consider restricting type parameter `T` | -LL | impl UncheckedCopy for T {} - | ^ +LL | impl UncheckedCopy for T {} + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: std::ops::Deref` is not satisfied --> $DIR/defaults-unsound-62211-2.rs:41:9 @@ -59,11 +58,10 @@ error[E0277]: the trait bound `T: std::ops::Deref` is not satisfied LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ the trait `std::ops::Deref` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::ops::Deref` - --> $DIR/defaults-unsound-62211-2.rs:41:6 +help: consider restricting type parameter `T` | -LL | impl UncheckedCopy for T {} - | ^ +LL | impl UncheckedCopy for T {} + | ^^^^^^^^^^^^^^^^^ error[E0277]: cannot add-assign `&'static str` to `T` --> $DIR/defaults-unsound-62211-2.rs:41:9 @@ -72,11 +70,10 @@ LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ no implementation for `T += &'static str` | = help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `T` -help: consider restricting this type parameter with `T: std::ops::AddAssign<&'static str>` - --> $DIR/defaults-unsound-62211-2.rs:41:6 +help: consider restricting type parameter `T` | -LL | impl UncheckedCopy for T {} - | ^ +LL | impl> UncheckedCopy for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/defaults-unsound-62211-2.rs:41:9 @@ -84,11 +81,10 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/defaults-unsound-62211-2.rs:41:6 +help: consider restricting type parameter `T` | -LL | impl UncheckedCopy for T {} - | ^ +LL | impl UncheckedCopy for T {} + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 8 previous errors diff --git a/src/test/ui/bad/bad-method-typaram-kind.stderr b/src/test/ui/bad/bad-method-typaram-kind.stderr index 9732363221286..81fc961e3dea0 100644 --- a/src/test/ui/bad/bad-method-typaram-kind.stderr +++ b/src/test/ui/bad/bad-method-typaram-kind.stderr @@ -5,11 +5,10 @@ LL | 1.bar::(); | ^^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` -help: consider further restricting this bound with `+ std::marker::Send` - --> $DIR/bad-method-typaram-kind.rs:1:10 +help: consider further restricting this bound | -LL | fn foo() { - | ^^^^^^^ +LL | fn foo() { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/binop/binop-consume-args.stderr b/src/test/ui/binop/binop-consume-args.stderr index 3fe7c9cbff420..acdc03e372638 100644 --- a/src/test/ui/binop/binop-consume-args.stderr +++ b/src/test/ui/binop/binop-consume-args.stderr @@ -8,11 +8,10 @@ LL | lhs + rhs; LL | drop(lhs); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-consume-args.rs:5:11 +help: consider further restricting this bound | -LL | fn add, B>(lhs: A, rhs: B) { - | ^^^^^^^^^^^^^^^^^ +LL | fn add + Copy, B>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `rhs` --> $DIR/binop-consume-args.rs:8:10 @@ -25,11 +24,10 @@ LL | drop(lhs); LL | drop(rhs); | ^^^ value used here after move | -help: consider restricting this type parameter with `B: Copy` - --> $DIR/binop-consume-args.rs:5:30 +help: consider restricting type parameter `B` | -LL | fn add, B>(lhs: A, rhs: B) { - | ^ +LL | fn add, B: Copy>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `lhs` --> $DIR/binop-consume-args.rs:13:10 @@ -41,11 +39,10 @@ LL | lhs - rhs; LL | drop(lhs); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-consume-args.rs:11:11 +help: consider further restricting this bound | -LL | fn sub, B>(lhs: A, rhs: B) { - | ^^^^^^^^^^^^^^^^^ +LL | fn sub + Copy, B>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `rhs` --> $DIR/binop-consume-args.rs:14:10 @@ -58,11 +55,10 @@ LL | drop(lhs); LL | drop(rhs); | ^^^ value used here after move | -help: consider restricting this type parameter with `B: Copy` - --> $DIR/binop-consume-args.rs:11:30 +help: consider restricting type parameter `B` | -LL | fn sub, B>(lhs: A, rhs: B) { - | ^ +LL | fn sub, B: Copy>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `lhs` --> $DIR/binop-consume-args.rs:19:10 @@ -74,11 +70,10 @@ LL | lhs * rhs; LL | drop(lhs); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-consume-args.rs:17:11 +help: consider further restricting this bound | -LL | fn mul, B>(lhs: A, rhs: B) { - | ^^^^^^^^^^^^^^^^^ +LL | fn mul + Copy, B>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `rhs` --> $DIR/binop-consume-args.rs:20:10 @@ -91,11 +86,10 @@ LL | drop(lhs); LL | drop(rhs); | ^^^ value used here after move | -help: consider restricting this type parameter with `B: Copy` - --> $DIR/binop-consume-args.rs:17:30 +help: consider restricting type parameter `B` | -LL | fn mul, B>(lhs: A, rhs: B) { - | ^ +LL | fn mul, B: Copy>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `lhs` --> $DIR/binop-consume-args.rs:25:10 @@ -107,11 +101,10 @@ LL | lhs / rhs; LL | drop(lhs); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-consume-args.rs:23:11 +help: consider further restricting this bound | -LL | fn div, B>(lhs: A, rhs: B) { - | ^^^^^^^^^^^^^^^^^ +LL | fn div + Copy, B>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `rhs` --> $DIR/binop-consume-args.rs:26:10 @@ -124,11 +117,10 @@ LL | drop(lhs); LL | drop(rhs); | ^^^ value used here after move | -help: consider restricting this type parameter with `B: Copy` - --> $DIR/binop-consume-args.rs:23:30 +help: consider restricting type parameter `B` | -LL | fn div, B>(lhs: A, rhs: B) { - | ^ +LL | fn div, B: Copy>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `lhs` --> $DIR/binop-consume-args.rs:31:10 @@ -140,11 +132,10 @@ LL | lhs % rhs; LL | drop(lhs); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-consume-args.rs:29:11 +help: consider further restricting this bound | -LL | fn rem, B>(lhs: A, rhs: B) { - | ^^^^^^^^^^^^^^^^^ +LL | fn rem + Copy, B>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `rhs` --> $DIR/binop-consume-args.rs:32:10 @@ -157,11 +148,10 @@ LL | drop(lhs); LL | drop(rhs); | ^^^ value used here after move | -help: consider restricting this type parameter with `B: Copy` - --> $DIR/binop-consume-args.rs:29:30 +help: consider restricting type parameter `B` | -LL | fn rem, B>(lhs: A, rhs: B) { - | ^ +LL | fn rem, B: Copy>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `lhs` --> $DIR/binop-consume-args.rs:37:10 @@ -173,11 +163,10 @@ LL | lhs & rhs; LL | drop(lhs); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-consume-args.rs:35:14 +help: consider further restricting this bound | -LL | fn bitand, B>(lhs: A, rhs: B) { - | ^^^^^^^^^^^^^^^^^^^^ +LL | fn bitand + Copy, B>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `rhs` --> $DIR/binop-consume-args.rs:38:10 @@ -190,11 +179,10 @@ LL | drop(lhs); LL | drop(rhs); | ^^^ value used here after move | -help: consider restricting this type parameter with `B: Copy` - --> $DIR/binop-consume-args.rs:35:36 +help: consider restricting type parameter `B` | -LL | fn bitand, B>(lhs: A, rhs: B) { - | ^ +LL | fn bitand, B: Copy>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `lhs` --> $DIR/binop-consume-args.rs:43:10 @@ -206,11 +194,10 @@ LL | lhs | rhs; LL | drop(lhs); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-consume-args.rs:41:13 +help: consider further restricting this bound | -LL | fn bitor, B>(lhs: A, rhs: B) { - | ^^^^^^^^^^^^^^^^^^^ +LL | fn bitor + Copy, B>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `rhs` --> $DIR/binop-consume-args.rs:44:10 @@ -223,11 +210,10 @@ LL | drop(lhs); LL | drop(rhs); | ^^^ value used here after move | -help: consider restricting this type parameter with `B: Copy` - --> $DIR/binop-consume-args.rs:41:34 +help: consider restricting type parameter `B` | -LL | fn bitor, B>(lhs: A, rhs: B) { - | ^ +LL | fn bitor, B: Copy>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `lhs` --> $DIR/binop-consume-args.rs:49:10 @@ -239,11 +225,10 @@ LL | lhs ^ rhs; LL | drop(lhs); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-consume-args.rs:47:14 +help: consider further restricting this bound | -LL | fn bitxor, B>(lhs: A, rhs: B) { - | ^^^^^^^^^^^^^^^^^^^^ +LL | fn bitxor + Copy, B>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `rhs` --> $DIR/binop-consume-args.rs:50:10 @@ -256,11 +241,10 @@ LL | drop(lhs); LL | drop(rhs); | ^^^ value used here after move | -help: consider restricting this type parameter with `B: Copy` - --> $DIR/binop-consume-args.rs:47:36 +help: consider restricting type parameter `B` | -LL | fn bitxor, B>(lhs: A, rhs: B) { - | ^ +LL | fn bitxor, B: Copy>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `lhs` --> $DIR/binop-consume-args.rs:55:10 @@ -272,11 +256,10 @@ LL | lhs << rhs; LL | drop(lhs); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-consume-args.rs:53:11 +help: consider further restricting this bound | -LL | fn shl, B>(lhs: A, rhs: B) { - | ^^^^^^^^^^^^^^^^^ +LL | fn shl + Copy, B>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `rhs` --> $DIR/binop-consume-args.rs:56:10 @@ -289,11 +272,10 @@ LL | drop(lhs); LL | drop(rhs); | ^^^ value used here after move | -help: consider restricting this type parameter with `B: Copy` - --> $DIR/binop-consume-args.rs:53:30 +help: consider restricting type parameter `B` | -LL | fn shl, B>(lhs: A, rhs: B) { - | ^ +LL | fn shl, B: Copy>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `lhs` --> $DIR/binop-consume-args.rs:61:10 @@ -305,11 +287,10 @@ LL | lhs >> rhs; LL | drop(lhs); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-consume-args.rs:59:11 +help: consider further restricting this bound | -LL | fn shr, B>(lhs: A, rhs: B) { - | ^^^^^^^^^^^^^^^^^ +LL | fn shr + Copy, B>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `rhs` --> $DIR/binop-consume-args.rs:62:10 @@ -322,11 +303,10 @@ LL | drop(lhs); LL | drop(rhs); | ^^^ value used here after move | -help: consider restricting this type parameter with `B: Copy` - --> $DIR/binop-consume-args.rs:59:30 +help: consider restricting type parameter `B` | -LL | fn shr, B>(lhs: A, rhs: B) { - | ^ +LL | fn shr, B: Copy>(lhs: A, rhs: B) { + | ^^^^^^ error: aborting due to 20 previous errors diff --git a/src/test/ui/binop/binop-move-semantics.stderr b/src/test/ui/binop/binop-move-semantics.stderr index 31b594eeab4bf..6d5ac9cab30c0 100644 --- a/src/test/ui/binop/binop-move-semantics.stderr +++ b/src/test/ui/binop/binop-move-semantics.stderr @@ -9,11 +9,10 @@ LL | + LL | x; | ^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-move-semantics.rs:5:19 +help: consider further restricting this bound | -LL | fn double_move>(x: T) { - | ^^^^^^^^^^^^^^ +LL | fn double_move + Copy>(x: T) { + | ^^^^^^ error[E0382]: borrow of moved value: `x` --> $DIR/binop-move-semantics.rs:14:5 @@ -26,11 +25,10 @@ LL | + LL | x.clone(); | ^ value borrowed here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-move-semantics.rs:11:24 +help: consider further restricting this bound | -LL | fn move_then_borrow + Clone>(x: T) { - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | fn move_then_borrow + Clone + Copy>(x: T) { + | ^^^^^^ error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/binop-move-semantics.rs:21:5 diff --git a/src/test/ui/borrowck/borrowck-unboxed-closures.stderr b/src/test/ui/borrowck/borrowck-unboxed-closures.stderr index 33a0b0286dfe9..a51cda548efd7 100644 --- a/src/test/ui/borrowck/borrowck-unboxed-closures.stderr +++ b/src/test/ui/borrowck/borrowck-unboxed-closures.stderr @@ -26,11 +26,10 @@ LL | f(1, 2); LL | f(1, 2); | ^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/borrowck-unboxed-closures.rs:10:8 +help: consider further restricting this bound | -LL | fn c isize>(f: F) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn c isize + Copy>(f: F) { + | ^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/bound-suggestions.fixed b/src/test/ui/bound-suggestions.fixed index c77421c97e7c0..9c98200db5134 100644 --- a/src/test/ui/bound-suggestions.fixed +++ b/src/test/ui/bound-suggestions.fixed @@ -13,7 +13,7 @@ fn test_no_bounds(t: T) { } #[allow(dead_code)] -fn test_one_bound(t: T) { +fn test_one_bound(t: T) { println!("{:?}", t); //~^ ERROR doesn't implement } @@ -25,7 +25,7 @@ fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt: } #[allow(dead_code)] -fn test_one_bound_where(x: X) where X: std::fmt::Debug + Sized { +fn test_one_bound_where(x: X) where X: Sized + std::fmt::Debug { println!("{:?}", x); //~^ ERROR doesn't implement } diff --git a/src/test/ui/bound-suggestions.stderr b/src/test/ui/bound-suggestions.stderr index 1e85c2bf36e46..b9bc503f5301a 100644 --- a/src/test/ui/bound-suggestions.stderr +++ b/src/test/ui/bound-suggestions.stderr @@ -5,13 +5,12 @@ LL | println!("{:?}", t); | ^ `impl Sized` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | = help: the trait `std::fmt::Debug` is not implemented for `impl Sized` -help: consider further restricting this bound with `+ std::fmt::Debug` - --> $DIR/bound-suggestions.rs:4:17 - | -LL | fn test_impl(t: impl Sized) { - | ^^^^^^^^^^ = note: required by `std::fmt::Debug::fmt` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider further restricting this bound + | +LL | fn test_impl(t: impl Sized + std::fmt::Debug) { + | ^^^^^^^^^^^^^^^^^ error[E0277]: `T` doesn't implement `std::fmt::Debug` --> $DIR/bound-suggestions.rs:11:22 @@ -20,13 +19,12 @@ LL | println!("{:?}", t); | ^ `T` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | = help: the trait `std::fmt::Debug` is not implemented for `T` -help: consider restricting this type parameter with `T: std::fmt::Debug` - --> $DIR/bound-suggestions.rs:10:19 - | -LL | fn test_no_bounds(t: T) { - | ^ = note: required by `std::fmt::Debug::fmt` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider restricting type parameter `T` + | +LL | fn test_no_bounds(t: T) { + | ^^^^^^^^^^^^^^^^^ error[E0277]: `T` doesn't implement `std::fmt::Debug` --> $DIR/bound-suggestions.rs:17:22 @@ -35,13 +33,12 @@ LL | println!("{:?}", t); | ^ `T` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | = help: the trait `std::fmt::Debug` is not implemented for `T` -help: consider further restricting this bound with `+ std::fmt::Debug` - --> $DIR/bound-suggestions.rs:16:22 - | -LL | fn test_one_bound(t: T) { - | ^^^^^ = note: required by `std::fmt::Debug::fmt` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider further restricting this bound + | +LL | fn test_one_bound(t: T) { + | ^^^^^^^^^^^^^^^^^ error[E0277]: `Y` doesn't implement `std::fmt::Debug` --> $DIR/bound-suggestions.rs:23:30 @@ -50,13 +47,12 @@ LL | println!("{:?} {:?}", x, y); | ^ `Y` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | = help: the trait `std::fmt::Debug` is not implemented for `Y` -help: consider restricting this type parameter with `where Y: std::fmt::Debug` - --> $DIR/bound-suggestions.rs:22:28 - | -LL | fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug { - | ^ = note: required by `std::fmt::Debug::fmt` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider further restricting type parameter `Y` + | +LL | fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug { + | ^^^^^^^^^^^^^^^^^^^^ error[E0277]: `X` doesn't implement `std::fmt::Debug` --> $DIR/bound-suggestions.rs:29:22 @@ -65,13 +61,12 @@ LL | println!("{:?}", x); | ^ `X` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | = help: the trait `std::fmt::Debug` is not implemented for `X` -help: consider further restricting this bound with `+ std::fmt::Debug` - --> $DIR/bound-suggestions.rs:28:40 - | -LL | fn test_one_bound_where(x: X) where X: Sized { - | ^^^^^^^^ = note: required by `std::fmt::Debug::fmt` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider further restricting this bound + | +LL | fn test_one_bound_where(x: X) where X: Sized + std::fmt::Debug { + | ^^^^^^^^^^^^^^^^^ error[E0277]: `X` doesn't implement `std::fmt::Debug` --> $DIR/bound-suggestions.rs:35:22 @@ -80,13 +75,12 @@ LL | println!("{:?}", x); | ^ `X` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | = help: the trait `std::fmt::Debug` is not implemented for `X` -help: consider further restricting this type parameter with `where X: std::fmt::Debug` - --> $DIR/bound-suggestions.rs:34:27 - | -LL | fn test_many_bounds_where(x: X) where X: Sized, X: Sized { - | ^ = note: required by `std::fmt::Debug::fmt` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider further restricting type parameter `X` + | +LL | fn test_many_bounds_where(x: X) where X: Sized, X: Sized, X: std::fmt::Debug { + | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr index a38705c834a37..ea5215e458d65 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr @@ -5,12 +5,11 @@ LL | impl Foo for (T,) { } | ^^^ `T` cannot be sent between threads safely | = help: within `(T,)`, the trait `std::marker::Send` is not implemented for `T` -help: consider further restricting this bound with `+ std::marker::Send` - --> $DIR/builtin-superkinds-double-superkind.rs:6:10 - | -LL | impl Foo for (T,) { } - | ^^^^^^^^^^^^ = note: required because it appears within the type `(T,)` +help: consider further restricting this bound + | +LL | impl Foo for (T,) { } + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `T` cannot be shared between threads safely --> $DIR/builtin-superkinds-double-superkind.rs:9:16 @@ -19,12 +18,11 @@ LL | impl Foo for (T,T) { } | ^^^ `T` cannot be shared between threads safely | = help: within `(T, T)`, the trait `std::marker::Sync` is not implemented for `T` -help: consider further restricting this bound with `+ std::marker::Sync` - --> $DIR/builtin-superkinds-double-superkind.rs:9:10 - | -LL | impl Foo for (T,T) { } - | ^^^^ = note: required because it appears within the type `(T, T)` +help: consider further restricting this bound + | +LL | impl Foo for (T,T) { } + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr index f379d97bd76c8..ba6595f68d5cc 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr @@ -5,12 +5,11 @@ LL | impl RequiresRequiresShareAndSend for X { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `T` cannot be sent between threads safely | = help: within `X`, the trait `std::marker::Send` is not implemented for `T` -help: consider further restricting this bound with `+ std::marker::Send` - --> $DIR/builtin-superkinds-in-metadata.rs:13:9 - | -LL | impl RequiresRequiresShareAndSend for X { } - | ^^^^^^^^^^^^ = note: required because it appears within the type `X` +help: consider further restricting this bound + | +LL | impl RequiresRequiresShareAndSend for X { } + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr index 996f39bfb665c..bef33d1fd05d3 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr @@ -5,11 +5,10 @@ LL | impl Foo for T { } | ^^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` -help: consider further restricting this bound with `+ std::marker::Send` - --> $DIR/builtin-superkinds-typaram-not-send.rs:5:10 +help: consider further restricting this bound | -LL | impl Foo for T { } - | ^^^^^^^^^^^^ +LL | impl Foo for T { } + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr b/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr index b4135af7d7755..f565948f479c3 100644 --- a/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr +++ b/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr @@ -8,11 +8,10 @@ LL | fn foo(blk: F) -> X where F: FnOnce() + 'static { | ^^^^ `F` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `F` -help: consider further restricting this bound with `+ std::marker::Send` - --> $DIR/closure-bounds-cant-promote-superkind-in-struct.rs:5:33 +help: consider further restricting this bound | -LL | fn foo(blk: F) -> X where F: FnOnce() + 'static { - | ^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(blk: F) -> X where F: FnOnce() + 'static + std::marker::Send { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/closures/closure-bounds-subtype.stderr b/src/test/ui/closures/closure-bounds-subtype.stderr index 47504de814dbe..f746f8502b8c2 100644 --- a/src/test/ui/closures/closure-bounds-subtype.stderr +++ b/src/test/ui/closures/closure-bounds-subtype.stderr @@ -8,11 +8,10 @@ LL | take_const_owned(f); | ^ `F` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `F` -help: consider further restricting this bound with `+ std::marker::Sync` - --> $DIR/closure-bounds-subtype.rs:11:30 +help: consider further restricting this bound | -LL | fn give_owned(f: F) where F: FnOnce() + Send { - | ^^^^^^^^^^^^^^^^^^ +LL | fn give_owned(f: F) where F: FnOnce() + Send + std::marker::Sync { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/closures/issue-67123.stderr b/src/test/ui/closures/issue-67123.stderr index f14478d7278cd..5a6dfb2fdf946 100644 --- a/src/test/ui/closures/issue-67123.stderr +++ b/src/test/ui/closures/issue-67123.stderr @@ -6,12 +6,11 @@ LL | || { t; t; }; | | | value moved here | -help: consider restricting this type parameter with `T: Copy` - --> $DIR/issue-67123.rs:1:8 - | -LL | fn foo(t: T) { - | ^ = note: move occurs because `t` has type `T`, which does not implement the `Copy` trait +help: consider restricting type parameter `T` + | +LL | fn foo(t: T) { + | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-61336-2.stderr b/src/test/ui/const-generics/issues/issue-61336-2.stderr index 9ced427b93c65..ef9e3b86694a8 100644 --- a/src/test/ui/const-generics/issues/issue-61336-2.stderr +++ b/src/test/ui/const-generics/issues/issue-61336-2.stderr @@ -12,12 +12,11 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied LL | [x; { N }] | ^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/issue-61336-2.rs:8:6 - | -LL | fn g(x: T) -> [T; N] { - | ^ = note: the `Copy` trait is required because the repeated element will be copied +help: consider restricting type parameter `T` + | +LL | fn g(x: T) -> [T; N] { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-61336.stderr b/src/test/ui/const-generics/issues/issue-61336.stderr index ace7955fbdd77..88d81c66d1ffe 100644 --- a/src/test/ui/const-generics/issues/issue-61336.stderr +++ b/src/test/ui/const-generics/issues/issue-61336.stderr @@ -12,12 +12,11 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied LL | [x; N] | ^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/issue-61336.rs:8:6 - | -LL | fn g(x: T) -> [T; N] { - | ^ = note: the `Copy` trait is required because the repeated element will be copied +help: consider restricting type parameter `T` + | +LL | fn g(x: T) -> [T; N] { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/impl_bounds.stderr b/src/test/ui/generic-associated-types/impl_bounds.stderr index 486b538045e49..d5560c8133773 100644 --- a/src/test/ui/generic-associated-types/impl_bounds.stderr +++ b/src/test/ui/generic-associated-types/impl_bounds.stderr @@ -34,13 +34,12 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied LL | type C where Self: Copy = String; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/impl_bounds.rs:14:6 - | -LL | impl Foo for Fooy { - | ^ = note: required because of the requirements on the impl of `std::marker::Copy` for `Fooy` = note: the requirement `Fooy: std::marker::Copy` appears on the associated impl type but not on the corresponding associated trait type +help: consider restricting type parameter `T` + | +LL | impl Foo for Fooy { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr index 6307a9b380ebf..268ff057421fe 100644 --- a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr +++ b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr @@ -9,11 +9,10 @@ LL | where B : for<'ccx> Bar<'ccx> LL | want_bar_for_any_ccx(b); | ^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B` | -help: consider further restricting this bound with `+ for<'ccx> Bar<'ccx>` - --> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:44:11 +help: consider further restricting this bound | -LL | where B : Qux - | ^^^^^^^ +LL | where B : Qux + for<'ccx> Bar<'ccx> + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr index 762c7c05f7ae8..2e20d2fe6dda3 100644 --- a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr +++ b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr @@ -9,11 +9,10 @@ LL | fn want_foo_for_any_tcx(f: &F) LL | where F : for<'tcx> Foo<'tcx> | ------------------- required by this bound in `want_foo_for_any_tcx` | -help: consider further restricting this bound with `+ for<'tcx> Foo<'tcx>` - --> $DIR/hrtb-higher-ranker-supertraits.rs:15:11 +help: consider further restricting this bound | -LL | where F : Foo<'x> - | ^^^^^^^^^^^ +LL | where F : Foo<'x> + for<'tcx> Foo<'tcx> + | ^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied --> $DIR/hrtb-higher-ranker-supertraits.rs:35:26 @@ -26,11 +25,10 @@ LL | fn want_bar_for_any_ccx(b: &B) LL | where B : for<'ccx> Bar<'ccx> | ------------------- required by this bound in `want_bar_for_any_ccx` | -help: consider further restricting this bound with `+ for<'ccx> Bar<'ccx>` - --> $DIR/hrtb-higher-ranker-supertraits.rs:29:11 +help: consider further restricting this bound | -LL | where B : Bar<'x> - | ^^^^^^^^^^^ +LL | where B : Bar<'x> + for<'ccx> Bar<'ccx> + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/impl-trait/issue-55872-1.stderr b/src/test/ui/impl-trait/issue-55872-1.stderr index d62b8b1c253ea..6cb2c9fb892f3 100644 --- a/src/test/ui/impl-trait/issue-55872-1.stderr +++ b/src/test/ui/impl-trait/issue-55872-1.stderr @@ -4,13 +4,12 @@ error[E0277]: the trait bound `S: std::marker::Copy` is not satisfied in `(S, T) LL | type E = impl Copy; | ^^^^^^^^^^^^^^^^^^^ within `(S, T)`, the trait `std::marker::Copy` is not implemented for `S` | -help: consider further restricting this bound with `+ std::marker::Copy` - --> $DIR/issue-55872-1.rs:11:9 - | -LL | impl Bar for S { - | ^^^^^^^ = note: required because it appears within the type `(S, T)` = note: the return type of a function must have a statically known size +help: consider further restricting this bound + | +LL | impl Bar for S { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied in `(S, T)` --> $DIR/issue-55872-1.rs:12:5 @@ -18,13 +17,12 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied in `(S, T) LL | type E = impl Copy; | ^^^^^^^^^^^^^^^^^^^ within `(S, T)`, the trait `std::marker::Copy` is not implemented for `T` | -help: consider further restricting this bound with `+ std::marker::Copy` - --> $DIR/issue-55872-1.rs:16:15 - | -LL | fn foo() -> Self::E { - | ^^^^^^^ = note: required because it appears within the type `(S, T)` = note: the return type of a function must have a statically known size +help: consider further restricting this bound + | +LL | fn foo() -> Self::E { + | ^^^^^^^^^^^^^^^^^^^ error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias --> $DIR/issue-55872-1.rs:16:37 diff --git a/src/test/ui/issues/issue-21837.stderr b/src/test/ui/issues/issue-21837.stderr index cfc294b5fa2d7..ff0c1ca64e2cc 100644 --- a/src/test/ui/issues/issue-21837.stderr +++ b/src/test/ui/issues/issue-21837.stderr @@ -7,11 +7,10 @@ LL | pub struct Foo(T); LL | impl Trait2 for Foo {} | ^^^^^^ the trait `Bound` is not implemented for `T` | -help: consider restricting this type parameter with `T: Bound` - --> $DIR/issue-21837.rs:8:6 +help: consider restricting type parameter `T` | -LL | impl Trait2 for Foo {} - | ^ +LL | impl Trait2 for Foo {} + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-34721.fixed b/src/test/ui/issues/issue-34721.fixed index ba2810ee3d725..f135ad3836ea1 100644 --- a/src/test/ui/issues/issue-34721.fixed +++ b/src/test/ui/issues/issue-34721.fixed @@ -18,7 +18,7 @@ pub mod bar { mod baz { use bar; use Foo; - pub fn baz(x: T) -> T { + pub fn baz(x: T) -> T { if 0 == 1 { bar::bar(x.zero()) } else { diff --git a/src/test/ui/issues/issue-34721.stderr b/src/test/ui/issues/issue-34721.stderr index 5c51d0444461a..6cfed20f43a04 100644 --- a/src/test/ui/issues/issue-34721.stderr +++ b/src/test/ui/issues/issue-34721.stderr @@ -13,11 +13,10 @@ LL | }; LL | x.zero() | ^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/issue-34721.rs:21:19 +help: consider further restricting this bound | -LL | pub fn baz(x: T) -> T { - | ^^^ +LL | pub fn baz(x: T) -> T { + | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-43784-associated-type.stderr b/src/test/ui/issues/issue-43784-associated-type.stderr index 2f50a53f26c77..21cd39d01fa25 100644 --- a/src/test/ui/issues/issue-43784-associated-type.stderr +++ b/src/test/ui/issues/issue-43784-associated-type.stderr @@ -9,11 +9,10 @@ LL | impl Complete for T { LL | type Assoc = T; | ^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/issue-43784-associated-type.rs:13:6 +help: consider restricting type parameter `T` | -LL | impl Complete for T { - | ^ +LL | impl Complete for T { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-43784-supertrait.stderr b/src/test/ui/issues/issue-43784-supertrait.stderr index 1795db32a57bd..2fb0583ee7d59 100644 --- a/src/test/ui/issues/issue-43784-supertrait.stderr +++ b/src/test/ui/issues/issue-43784-supertrait.stderr @@ -4,11 +4,10 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied LL | impl Complete for T {} | ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/issue-43784-supertrait.rs:8:6 +help: consider restricting type parameter `T` | -LL | impl Complete for T {} - | ^ +LL | impl Complete for T {} + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/kindck/kindck-impl-type-params.nll.stderr b/src/test/ui/kindck/kindck-impl-type-params.nll.stderr index 593f55a5172d8..a2f70a8c24082 100644 --- a/src/test/ui/kindck/kindck-impl-type-params.nll.stderr +++ b/src/test/ui/kindck/kindck-impl-type-params.nll.stderr @@ -5,13 +5,12 @@ LL | let a = &t as &dyn Gettable; | ^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` -help: consider restricting this type parameter with `T: std::marker::Send` - --> $DIR/kindck-impl-type-params.rs:16:6 - | -LL | fn f(val: T) { - | ^ = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` +help: consider restricting type parameter `T` + | +LL | fn f(val: T) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:18:13 @@ -19,13 +18,12 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied LL | let a = &t as &dyn Gettable; | ^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/kindck-impl-type-params.rs:16:6 - | -LL | fn f(val: T) { - | ^ = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` +help: consider restricting type parameter `T` + | +LL | fn f(val: T) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `T` cannot be sent between threads safely --> $DIR/kindck-impl-type-params.rs:25:31 @@ -34,13 +32,12 @@ LL | let a: &dyn Gettable = &t; | ^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` -help: consider restricting this type parameter with `T: std::marker::Send` - --> $DIR/kindck-impl-type-params.rs:23:6 - | -LL | fn g(val: T) { - | ^ = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` +help: consider restricting type parameter `T` + | +LL | fn g(val: T) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:25:31 @@ -48,13 +45,12 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied LL | let a: &dyn Gettable = &t; | ^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/kindck-impl-type-params.rs:23:6 - | -LL | fn g(val: T) { - | ^ = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` +help: consider restricting type parameter `T` + | +LL | fn g(val: T) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:38:13 diff --git a/src/test/ui/kindck/kindck-impl-type-params.stderr b/src/test/ui/kindck/kindck-impl-type-params.stderr index 42318623b4d24..cc98f1d9f34b8 100644 --- a/src/test/ui/kindck/kindck-impl-type-params.stderr +++ b/src/test/ui/kindck/kindck-impl-type-params.stderr @@ -5,13 +5,12 @@ LL | let a = &t as &dyn Gettable; | ^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` -help: consider restricting this type parameter with `T: std::marker::Send` - --> $DIR/kindck-impl-type-params.rs:16:6 - | -LL | fn f(val: T) { - | ^ = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` +help: consider restricting type parameter `T` + | +LL | fn f(val: T) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:18:13 @@ -19,13 +18,12 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied LL | let a = &t as &dyn Gettable; | ^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/kindck-impl-type-params.rs:16:6 - | -LL | fn f(val: T) { - | ^ = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` +help: consider restricting type parameter `T` + | +LL | fn f(val: T) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `T` cannot be sent between threads safely --> $DIR/kindck-impl-type-params.rs:25:31 @@ -34,13 +32,12 @@ LL | let a: &dyn Gettable = &t; | ^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` -help: consider restricting this type parameter with `T: std::marker::Send` - --> $DIR/kindck-impl-type-params.rs:23:6 - | -LL | fn g(val: T) { - | ^ = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` +help: consider restricting type parameter `T` + | +LL | fn g(val: T) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:25:31 @@ -48,13 +45,12 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied LL | let a: &dyn Gettable = &t; | ^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/kindck-impl-type-params.rs:23:6 - | -LL | fn g(val: T) { - | ^ = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` +help: consider restricting type parameter `T` + | +LL | fn g(val: T) { + | ^^^^^^^^^^^^^^^^^^^ error[E0477]: the type `&'a isize` does not fulfill the required lifetime --> $DIR/kindck-impl-type-params.rs:32:13 diff --git a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr index 552273b8ba927..a30bfa66c5a9c 100644 --- a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr +++ b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr @@ -17,11 +17,10 @@ LL | let mut r = R {c: Box::new(f)}; LL | f(&mut r, false) | ^ value borrowed here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/moves-based-on-type-no-recursive-stack-closure.rs:30:35 +help: consider further restricting this bound | -LL | fn conspirator(mut f: F) where F: FnMut(&mut R, bool) { - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | fn conspirator(mut f: F) where F: FnMut(&mut R, bool) + Copy { + | ^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/once-cant-call-twice-on-heap.stderr b/src/test/ui/once-cant-call-twice-on-heap.stderr index d4884469ce4d2..7133a32431a67 100644 --- a/src/test/ui/once-cant-call-twice-on-heap.stderr +++ b/src/test/ui/once-cant-call-twice-on-heap.stderr @@ -8,11 +8,10 @@ LL | blk(); LL | blk(); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/once-cant-call-twice-on-heap.rs:7:10 +help: consider further restricting this bound | -LL | fn foo(blk: F) { - | ^^^^^^^^ +LL | fn foo(blk: F) { + | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/phantom-oibit.stderr b/src/test/ui/phantom-oibit.stderr index 7b6b105eb032b..f8fe6947852fb 100644 --- a/src/test/ui/phantom-oibit.stderr +++ b/src/test/ui/phantom-oibit.stderr @@ -8,14 +8,13 @@ LL | is_zen(x) | ^ `T` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `T` -help: consider restricting this type parameter with `T: std::marker::Sync` - --> $DIR/phantom-oibit.rs:20:13 - | -LL | fn not_sync(x: Guard) { - | ^ = note: required because of the requirements on the impl of `Zen` for `&T` = note: required because it appears within the type `std::marker::PhantomData<&T>` = note: required because it appears within the type `Guard<'_, T>` +help: consider restricting type parameter `T` + | +LL | fn not_sync(x: Guard) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `T` cannot be shared between threads safely --> $DIR/phantom-oibit.rs:26:12 @@ -27,15 +26,14 @@ LL | is_zen(x) | ^ `T` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `T` -help: consider restricting this type parameter with `T: std::marker::Sync` - --> $DIR/phantom-oibit.rs:25:20 - | -LL | fn nested_not_sync(x: Nested>) { - | ^ = note: required because of the requirements on the impl of `Zen` for `&T` = note: required because it appears within the type `std::marker::PhantomData<&T>` = note: required because it appears within the type `Guard<'_, T>` = note: required because it appears within the type `Nested>` +help: consider restricting type parameter `T` + | +LL | fn nested_not_sync(x: Nested>) { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr b/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr index ee7c002b16db1..4e4cad624754e 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr @@ -4,11 +4,10 @@ error[E0277]: the trait bound `U: std::cmp::Eq` is not satisfied LL | default impl Foo<'static, U> for () {} | ^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `U` | -help: consider restricting this type parameter with `U: std::cmp::Eq` - --> $DIR/specialization-wfcheck.rs:7:14 +help: consider restricting type parameter `U` | -LL | default impl Foo<'static, U> for () {} - | ^ +LL | default impl Foo<'static, U> for () {} + | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/suggestions/restrict-type-argument.stderr b/src/test/ui/suggestions/restrict-type-argument.stderr index 4d5cb8907e887..a98cb76a68326 100644 --- a/src/test/ui/suggestions/restrict-type-argument.stderr +++ b/src/test/ui/suggestions/restrict-type-argument.stderr @@ -8,11 +8,10 @@ LL | is_send(val); | ^^^ `impl Sync` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `impl Sync` -help: consider further restricting this bound with `+ std::marker::Send` - --> $DIR/restrict-type-argument.rs:3:23 +help: consider further restricting this bound | -LL | fn use_impl_sync(val: impl Sync) { - | ^^^^^^^^^ +LL | fn use_impl_sync(val: impl Sync + std::marker::Send) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `S` cannot be sent between threads safely --> $DIR/restrict-type-argument.rs:8:13 @@ -24,11 +23,10 @@ LL | is_send(val); | ^^^ `S` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `S` -help: consider further restricting this bound with `+ std::marker::Send` - --> $DIR/restrict-type-argument.rs:7:31 +help: consider further restricting this bound | -LL | fn use_where(val: S) where S: Sync { - | ^^^^^^^ +LL | fn use_where(val: S) where S: Sync + std::marker::Send { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `S` cannot be sent between threads safely --> $DIR/restrict-type-argument.rs:12:13 @@ -40,11 +38,10 @@ LL | is_send(val); | ^^^ `S` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `S` -help: consider further restricting this bound with `+ std::marker::Send` - --> $DIR/restrict-type-argument.rs:11:17 +help: consider further restricting this bound | -LL | fn use_bound(val: S) { - | ^^^^ +LL | fn use_bound(val: S) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `S` cannot be sent between threads safely --> $DIR/restrict-type-argument.rs:20:13 @@ -56,11 +53,10 @@ LL | is_send(val); | ^^^ `S` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `S` -help: consider further restricting this bound with `+ std::marker::Send` - --> $DIR/restrict-type-argument.rs:18:5 +help: consider further restricting this bound | -LL | Sync - | ^^^^ +LL | Sync + std::marker::Send + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `S` cannot be sent between threads safely --> $DIR/restrict-type-argument.rs:24:13 @@ -72,11 +68,10 @@ LL | is_send(val); | ^^^ `S` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `S` -help: consider further restricting this bound with `+ std::marker::Send` - --> $DIR/restrict-type-argument.rs:23:47 +help: consider further restricting this bound | -LL | fn use_bound_and_where(val: S) where S: std::fmt::Debug { - | ^^^^^^^^^^^^^^^^^^ +LL | fn use_bound_and_where(val: S) where S: std::fmt::Debug + std::marker::Send { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `S` cannot be sent between threads safely --> $DIR/restrict-type-argument.rs:28:13 @@ -88,11 +83,10 @@ LL | is_send(val); | ^^^ `S` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `S` -help: consider restricting this type parameter with `S: std::marker::Send` - --> $DIR/restrict-type-argument.rs:27:16 +help: consider restricting type parameter `S` | -LL | fn use_unbound(val: S) { - | ^ +LL | fn use_unbound(val: S) { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/traits/trait-alias/trait-alias-wf.stderr b/src/test/ui/traits/trait-alias/trait-alias-wf.stderr index e7ed16a02a3f0..ca4980ca30529 100644 --- a/src/test/ui/traits/trait-alias/trait-alias-wf.stderr +++ b/src/test/ui/traits/trait-alias/trait-alias-wf.stderr @@ -6,11 +6,10 @@ LL | trait A {} LL | trait B = A; | ^^^^ the trait `Foo` is not implemented for `T` | -help: consider restricting this type parameter with `T: Foo` - --> $DIR/trait-alias-wf.rs:5:9 +help: consider restricting type parameter `T` | -LL | trait B = A; - | ^ +LL | trait B = A; + | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr b/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr index 56a9e3ff54ec2..9e8e5e0814502 100644 --- a/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr +++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr @@ -7,11 +7,10 @@ LL | struct Foo { LL | impl Foo { | ^^^^^^ the trait `Trait` is not implemented for `T` | -help: consider restricting this type parameter with `T: Trait` - --> $DIR/trait-bounds-on-structs-and-enums.rs:13:6 +help: consider restricting type parameter `T` | -LL | impl Foo { - | ^ +LL | impl Foo { + | ^^^^^^^ error[E0277]: the trait bound `isize: Trait` is not satisfied --> $DIR/trait-bounds-on-structs-and-enums.rs:19:5 @@ -40,11 +39,10 @@ LL | struct Foo { LL | b: Foo, | ^^^^^^^^^ the trait `Trait` is not implemented for `U` | -help: consider restricting this type parameter with `U: Trait` - --> $DIR/trait-bounds-on-structs-and-enums.rs:26:16 +help: consider restricting type parameter `U` | -LL | struct Badness { - | ^ +LL | struct Badness { + | ^^^^^^^ error[E0277]: the trait bound `V: Trait` is not satisfied --> $DIR/trait-bounds-on-structs-and-enums.rs:31:21 @@ -55,11 +53,10 @@ LL | enum Bar { LL | EvenMoreBadness(Bar), | ^^^^^^ the trait `Trait` is not implemented for `V` | -help: consider restricting this type parameter with `V: Trait` - --> $DIR/trait-bounds-on-structs-and-enums.rs:30:18 +help: consider restricting type parameter `V` | -LL | enum MoreBadness { - | ^ +LL | enum MoreBadness { + | ^^^^^^^ error[E0277]: the trait bound `i32: Trait` is not satisfied --> $DIR/trait-bounds-on-structs-and-enums.rs:35:5 diff --git a/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr b/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr index 5b7f32ba1e0f0..4107c49bd80ce 100644 --- a/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr +++ b/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr @@ -10,11 +10,10 @@ error[E0277]: the trait bound `C: CompareTo` is not satisfied LL | c.same_as(22) | ^^^^^^^ the trait `CompareTo` is not implemented for `C` | -help: consider further restricting this bound with `+ CompareTo` - --> $DIR/traits-repeated-supertrait-ambig.rs:29:17 +help: consider further restricting this bound | -LL | fn with_trait(c: &C) -> bool { - | ^^^^^^^^^^^^^ +LL | fn with_trait>(c: &C) -> bool { + | ^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `dyn CompareToInts: CompareTo` is not satisfied --> $DIR/traits-repeated-supertrait-ambig.rs:34:5 @@ -34,11 +33,10 @@ LL | fn same_as(&self, t: T) -> bool; LL | CompareTo::same_as(c, 22) | ^^^^^^^^^^^^^^^^^^ the trait `CompareTo` is not implemented for `C` | -help: consider further restricting this bound with `+ CompareTo` - --> $DIR/traits-repeated-supertrait-ambig.rs:37:17 +help: consider further restricting this bound | -LL | fn with_ufcs2(c: &C) -> bool { - | ^^^^^^^^^^^^^ +LL | fn with_ufcs2>(c: &C) -> bool { + | ^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `i64: CompareTo` is not satisfied --> $DIR/traits-repeated-supertrait-ambig.rs:42:23 diff --git a/src/test/ui/type-alias-impl-trait/bound_reduction2.stderr b/src/test/ui/type-alias-impl-trait/bound_reduction2.stderr index 74b858105b92f..aff558569eaca 100644 --- a/src/test/ui/type-alias-impl-trait/bound_reduction2.stderr +++ b/src/test/ui/type-alias-impl-trait/bound_reduction2.stderr @@ -4,11 +4,10 @@ error[E0277]: the trait bound `T: TraitWithAssoc` is not satisfied LL | type Foo = impl Trait; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TraitWithAssoc` is not implemented for `T` | -help: consider further restricting this bound with `+ TraitWithAssoc` - --> $DIR/bound_reduction2.rs:18:21 +help: consider further restricting this bound | -LL | fn foo_desugared(_: T) -> Foo { - | ^^^^^^^^^^^^^^ +LL | fn foo_desugared(_: T) -> Foo { + | ^^^^^^^^^^^^^^^^ error: defining opaque type use does not fully define opaque type: generic parameter `V` is specified as concrete type `::Assoc` --> $DIR/bound_reduction2.rs:18:1 diff --git a/src/test/ui/type-alias-impl-trait/generic_underconstrained.stderr b/src/test/ui/type-alias-impl-trait/generic_underconstrained.stderr index 299c7eae8d3a8..f7a04263259f6 100644 --- a/src/test/ui/type-alias-impl-trait/generic_underconstrained.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_underconstrained.stderr @@ -10,12 +10,11 @@ error[E0277]: the trait bound `T: Trait` is not satisfied LL | type Underconstrained = impl 'static; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T` | -help: consider restricting this type parameter with `T: Trait` - --> $DIR/generic_underconstrained.rs:10:19 - | -LL | fn underconstrain(_: T) -> Underconstrained { - | ^ = note: the return type of a function must have a statically known size +help: consider restricting type parameter `T` + | +LL | fn underconstrain(_: T) -> Underconstrained { + | ^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/type-alias-impl-trait/generic_underconstrained2.stderr b/src/test/ui/type-alias-impl-trait/generic_underconstrained2.stderr index 56966a32b43b2..ad160abcbd573 100644 --- a/src/test/ui/type-alias-impl-trait/generic_underconstrained2.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_underconstrained2.stderr @@ -20,12 +20,11 @@ LL | 5u32 | ---- this returned value is of type `u32` | = help: the trait `std::fmt::Debug` is not implemented for `U` -help: consider restricting this type parameter with `U: std::fmt::Debug` - --> $DIR/generic_underconstrained2.rs:10:21 - | -LL | fn underconstrained(_: U) -> Underconstrained { - | ^ = note: the return type of a function must have a statically known size +help: consider restricting type parameter `U` + | +LL | fn underconstrained(_: U) -> Underconstrained { + | ^^^^^^^^^^^^^^^^^ error[E0277]: `V` doesn't implement `std::fmt::Debug` --> $DIR/generic_underconstrained2.rs:14:1 @@ -37,12 +36,11 @@ LL | 5u32 | ---- this returned value is of type `u32` | = help: the trait `std::fmt::Debug` is not implemented for `V` -help: consider restricting this type parameter with `V: std::fmt::Debug` - --> $DIR/generic_underconstrained2.rs:19:25 - | -LL | fn underconstrained2(_: U, _: V) -> Underconstrained2 { - | ^ = note: the return type of a function must have a statically known size +help: consider restricting type parameter `V` + | +LL | fn underconstrained2(_: U, _: V) -> Underconstrained2 { + | ^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/type/type-check-defaults.stderr b/src/test/ui/type/type-check-defaults.stderr index 31ee15e0745db..ca9b85bacba39 100644 --- a/src/test/ui/type/type-check-defaults.stderr +++ b/src/test/ui/type/type-check-defaults.stderr @@ -54,11 +54,10 @@ LL | trait Super { } LL | trait Base: Super { } | ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/type-check-defaults.rs:21:12 +help: consider further restricting type parameter `T` | -LL | trait Base: Super { } - | ^ +LL | trait Base: Super, T: std::marker::Copy { } + | ^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: cannot add `u8` to `i32` --> $DIR/type-check-defaults.rs:24:66 diff --git a/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr b/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr index 45c9d8be85ee9..c8411017b3c8d 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr @@ -8,11 +8,10 @@ LL | fn is_send() { | ------- ---- required by this bound in `is_send` | = help: the trait `std::marker::Send` is not implemented for `T` -help: consider restricting this type parameter with `T: std::marker::Send` - --> $DIR/typeck-default-trait-impl-send-param.rs:4:8 +help: consider restricting type parameter `T` | -LL | fn foo() { - | ^ +LL | fn foo() { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/unop-move-semantics.stderr b/src/test/ui/unop-move-semantics.stderr index ab641c40dfe44..e0499cfe95ce9 100644 --- a/src/test/ui/unop-move-semantics.stderr +++ b/src/test/ui/unop-move-semantics.stderr @@ -9,11 +9,10 @@ LL | LL | x.clone(); | ^ value borrowed here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/unop-move-semantics.rs:5:24 +help: consider further restricting this bound | -LL | fn move_then_borrow + Clone>(x: T) { - | ^^^^^^^^^^^^^^^^^^^^^ +LL | fn move_then_borrow + Clone + Copy>(x: T) { + | ^^^^^^ error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/unop-move-semantics.rs:15:6 diff --git a/src/test/ui/wf/wf-enum-bound.stderr b/src/test/ui/wf/wf-enum-bound.stderr index be64ddb975994..f70f67d414fc3 100644 --- a/src/test/ui/wf/wf-enum-bound.stderr +++ b/src/test/ui/wf/wf-enum-bound.stderr @@ -7,11 +7,10 @@ LL | trait ExtraCopy { } LL | where T: ExtraCopy | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U` | -help: consider restricting this type parameter with `where U: std::marker::Copy` - --> $DIR/wf-enum-bound.rs:9:17 +help: consider further restricting type parameter `U` | -LL | enum SomeEnum - | ^ +LL | where T: ExtraCopy, U: std::marker::Copy + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-enum-fields-struct-variant.stderr b/src/test/ui/wf/wf-enum-fields-struct-variant.stderr index 40454b33b7b76..8634b7dba5c36 100644 --- a/src/test/ui/wf/wf-enum-fields-struct-variant.stderr +++ b/src/test/ui/wf/wf-enum-fields-struct-variant.stderr @@ -7,11 +7,10 @@ LL | struct IsCopy { LL | f: IsCopy | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A` | -help: consider restricting this type parameter with `A: std::marker::Copy` - --> $DIR/wf-enum-fields-struct-variant.rs:11:18 +help: consider restricting type parameter `A` | -LL | enum AnotherEnum { - | ^ +LL | enum AnotherEnum { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-enum-fields.stderr b/src/test/ui/wf/wf-enum-fields.stderr index e2612add776d4..a22b2d11a91cb 100644 --- a/src/test/ui/wf/wf-enum-fields.stderr +++ b/src/test/ui/wf/wf-enum-fields.stderr @@ -7,11 +7,10 @@ LL | struct IsCopy { LL | SomeVariant(IsCopy) | ^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A` | -help: consider restricting this type parameter with `A: std::marker::Copy` - --> $DIR/wf-enum-fields.rs:11:15 +help: consider restricting type parameter `A` | -LL | enum SomeEnum { - | ^ +LL | enum SomeEnum { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-fn-where-clause.stderr b/src/test/ui/wf/wf-fn-where-clause.stderr index 2a4f2df5a8986..cf1aeac7e3e41 100644 --- a/src/test/ui/wf/wf-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-fn-where-clause.stderr @@ -7,11 +7,10 @@ LL | LL | fn foo() where T: ExtraCopy | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U` | -help: consider restricting this type parameter with `where U: std::marker::Copy` - --> $DIR/wf-fn-where-clause.rs:8:10 +help: consider further restricting type parameter `U` | -LL | fn foo() where T: ExtraCopy - | ^ +LL | fn foo() where T: ExtraCopy, U: std::marker::Copy + | ^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the size for values of type `(dyn std::marker::Copy + 'static)` cannot be known at compilation time --> $DIR/wf-fn-where-clause.rs:12:16 diff --git a/src/test/ui/wf/wf-impl-associated-type-trait.stderr b/src/test/ui/wf/wf-impl-associated-type-trait.stderr index 7774299b39357..d44a6f01a47f6 100644 --- a/src/test/ui/wf/wf-impl-associated-type-trait.stderr +++ b/src/test/ui/wf/wf-impl-associated-type-trait.stderr @@ -7,11 +7,10 @@ LL | pub struct MySet { LL | type Bar = MySet; | ^^^^^^^^^^^^^^^^^^^^ the trait `MyHash` is not implemented for `T` | -help: consider restricting this type parameter with `T: MyHash` - --> $DIR/wf-impl-associated-type-trait.rs:16:6 +help: consider restricting type parameter `T` | -LL | impl Foo for T { - | ^ +LL | impl Foo for T { + | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-fn-arg.stderr b/src/test/ui/wf/wf-in-fn-arg.stderr index c1a6657e63be7..907701440aad5 100644 --- a/src/test/ui/wf/wf-in-fn-arg.stderr +++ b/src/test/ui/wf/wf-in-fn-arg.stderr @@ -7,11 +7,10 @@ LL | struct MustBeCopy { LL | fn bar(_: &MustBeCopy) | ^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/wf-in-fn-arg.rs:10:8 +help: consider restricting type parameter `T` | -LL | fn bar(_: &MustBeCopy) - | ^ +LL | fn bar(_: &MustBeCopy) + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-fn-ret.stderr b/src/test/ui/wf/wf-in-fn-ret.stderr index 754d64df0194b..2ed4eecefe135 100644 --- a/src/test/ui/wf/wf-in-fn-ret.stderr +++ b/src/test/ui/wf/wf-in-fn-ret.stderr @@ -7,11 +7,10 @@ LL | struct MustBeCopy { LL | fn bar() -> MustBeCopy | ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/wf-in-fn-ret.rs:10:8 +help: consider restricting type parameter `T` | -LL | fn bar() -> MustBeCopy - | ^ +LL | fn bar() -> MustBeCopy + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-fn-type-arg.stderr b/src/test/ui/wf/wf-in-fn-type-arg.stderr index 97a5c0fd913a4..0c699838abd2a 100644 --- a/src/test/ui/wf/wf-in-fn-type-arg.stderr +++ b/src/test/ui/wf/wf-in-fn-type-arg.stderr @@ -7,11 +7,10 @@ LL | struct MustBeCopy { LL | x: fn(MustBeCopy) | ^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/wf-in-fn-type-arg.rs:7:12 +help: consider restricting type parameter `T` | -LL | struct Bar { - | ^ +LL | struct Bar { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-fn-type-ret.stderr b/src/test/ui/wf/wf-in-fn-type-ret.stderr index 527b000edf883..3429ab89ffbac 100644 --- a/src/test/ui/wf/wf-in-fn-type-ret.stderr +++ b/src/test/ui/wf/wf-in-fn-type-ret.stderr @@ -7,11 +7,10 @@ LL | struct MustBeCopy { LL | x: fn() -> MustBeCopy | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/wf-in-fn-type-ret.rs:7:12 +help: consider restricting type parameter `T` | -LL | struct Foo { - | ^ +LL | struct Foo { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-fn-where-clause.stderr b/src/test/ui/wf/wf-in-fn-where-clause.stderr index 62c672a21e86e..d33749d795c59 100644 --- a/src/test/ui/wf/wf-in-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-in-fn-where-clause.stderr @@ -7,11 +7,10 @@ LL | trait MustBeCopy { LL | where T: MustBeCopy | ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U` | -help: consider restricting this type parameter with `where U: std::marker::Copy` - --> $DIR/wf-in-fn-where-clause.rs:9:10 +help: consider further restricting type parameter `U` | -LL | fn bar() - | ^ +LL | where T: MustBeCopy, U: std::marker::Copy + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-obj-type-trait.stderr b/src/test/ui/wf/wf-in-obj-type-trait.stderr index 1b6438cdc2477..605dc49784954 100644 --- a/src/test/ui/wf/wf-in-obj-type-trait.stderr +++ b/src/test/ui/wf/wf-in-obj-type-trait.stderr @@ -7,11 +7,10 @@ LL | struct MustBeCopy { LL | x: dyn Object> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/wf-in-obj-type-trait.rs:9:12 +help: consider restricting type parameter `T` | -LL | struct Bar { - | ^ +LL | struct Bar { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr b/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr index 70337ee40eacf..da2f8085a8a9e 100644 --- a/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr +++ b/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr @@ -7,11 +7,10 @@ LL | trait ExtraCopy { } LL | fn foo(self) where T: ExtraCopy | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U` | -help: consider restricting this type parameter with `U: std::marker::Copy` - --> $DIR/wf-inherent-impl-method-where-clause.rs:11:8 +help: consider restricting type parameter `U` | -LL | impl Foo { - | ^ +LL | impl Foo { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-inherent-impl-where-clause.stderr b/src/test/ui/wf/wf-inherent-impl-where-clause.stderr index c26d0ef787195..28d5bc62556ab 100644 --- a/src/test/ui/wf/wf-inherent-impl-where-clause.stderr +++ b/src/test/ui/wf/wf-inherent-impl-where-clause.stderr @@ -7,11 +7,10 @@ LL | trait ExtraCopy { } LL | impl Foo where T: ExtraCopy | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U` | -help: consider restricting this type parameter with `where U: std::marker::Copy` - --> $DIR/wf-inherent-impl-where-clause.rs:11:8 +help: consider further restricting type parameter `U` | -LL | impl Foo where T: ExtraCopy - | ^ +LL | impl Foo where T: ExtraCopy, U: std::marker::Copy + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-struct-bound.stderr b/src/test/ui/wf/wf-struct-bound.stderr index 545e4f870954c..07e569ddac11d 100644 --- a/src/test/ui/wf/wf-struct-bound.stderr +++ b/src/test/ui/wf/wf-struct-bound.stderr @@ -7,11 +7,10 @@ LL | trait ExtraCopy { } LL | where T: ExtraCopy | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U` | -help: consider restricting this type parameter with `where U: std::marker::Copy` - --> $DIR/wf-struct-bound.rs:9:21 +help: consider further restricting type parameter `U` | -LL | struct SomeStruct - | ^ +LL | where T: ExtraCopy, U: std::marker::Copy + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-struct-field.stderr b/src/test/ui/wf/wf-struct-field.stderr index f0ebdfba2ffc6..f3bce24eace07 100644 --- a/src/test/ui/wf/wf-struct-field.stderr +++ b/src/test/ui/wf/wf-struct-field.stderr @@ -7,11 +7,10 @@ LL | struct IsCopy { LL | data: IsCopy | ^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A` | -help: consider restricting this type parameter with `A: std::marker::Copy` - --> $DIR/wf-struct-field.rs:11:19 +help: consider restricting type parameter `A` | -LL | struct SomeStruct { - | ^ +LL | struct SomeStruct { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-trait-associated-type-bound.stderr b/src/test/ui/wf/wf-trait-associated-type-bound.stderr index dfccd4865686e..6cf7f2069b6b7 100644 --- a/src/test/ui/wf/wf-trait-associated-type-bound.stderr +++ b/src/test/ui/wf/wf-trait-associated-type-bound.stderr @@ -7,11 +7,10 @@ LL | trait ExtraCopy { } LL | type Type1: ExtraCopy; | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/wf-trait-associated-type-bound.rs:9:17 +help: consider restricting type parameter `T` | -LL | trait SomeTrait { - | ^ +LL | trait SomeTrait { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-trait-bound.stderr b/src/test/ui/wf/wf-trait-bound.stderr index 31faa14426a1f..b8ffad6d1802b 100644 --- a/src/test/ui/wf/wf-trait-bound.stderr +++ b/src/test/ui/wf/wf-trait-bound.stderr @@ -7,11 +7,10 @@ LL | trait ExtraCopy { } LL | where T: ExtraCopy | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U` | -help: consider restricting this type parameter with `where U: std::marker::Copy` - --> $DIR/wf-trait-bound.rs:9:19 +help: consider further restricting type parameter `U` | -LL | trait SomeTrait - | ^ +LL | where T: ExtraCopy, U: std::marker::Copy + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-trait-superbound.stderr b/src/test/ui/wf/wf-trait-superbound.stderr index 372a5f8ba5db7..88b4bec045179 100644 --- a/src/test/ui/wf/wf-trait-superbound.stderr +++ b/src/test/ui/wf/wf-trait-superbound.stderr @@ -7,11 +7,10 @@ LL | LL | trait SomeTrait: ExtraCopy { | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/wf-trait-superbound.rs:9:17 +help: consider restricting type parameter `T` | -LL | trait SomeTrait: ExtraCopy { - | ^ +LL | trait SomeTrait: ExtraCopy { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr index c6f12e7753c82..fb1471e95bbd9 100644 --- a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr +++ b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr @@ -7,11 +7,10 @@ LL | fn require_copy(x: T) {} LL | require_copy(self.x); | ^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/where-clause-constraints-are-local-for-inherent-impl.rs:6:6 +help: consider restricting type parameter `T` | -LL | impl Foo { - | ^ +LL | impl Foo { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr index 95688d6f2e485..6c1516d8ac9e7 100644 --- a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr +++ b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr @@ -7,11 +7,10 @@ LL | fn require_copy(x: T) {} LL | require_copy(self.x); | ^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/where-clause-constraints-are-local-for-trait-impl.rs:11:6 +help: consider restricting type parameter `T` | -LL | impl Foo for Bar { - | ^ +LL | impl Foo for Bar { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error