]> git.lizzy.rs Git - rust.git/commitdiff
Tweak `suggest_constraining_type_param`
authorEsteban Küber <esteban@kuber.com.ar>
Sat, 14 Mar 2020 02:28:14 +0000 (19:28 -0700)
committerEsteban Küber <esteban@kuber.com.ar>
Sun, 29 Mar 2020 20:13:17 +0000 (13:13 -0700)
Some of the bound restriction structured suggestions were incorrect
while others had subpar output.

70 files changed:
src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs
src/librustc_trait_selection/lib.rs
src/librustc_trait_selection/traits/error_reporting/mod.rs
src/librustc_trait_selection/traits/error_reporting/suggestions.rs
src/test/ui/associated-const/associated-const-type-parameter-arrays-2.stderr
src/test/ui/associated-const/associated-const-type-parameter-arrays.stderr
src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr
src/test/ui/associated-types/associated-types-no-suitable-bound.stderr
src/test/ui/associated-types/defaults-suitability.stderr
src/test/ui/associated-types/defaults-unsound-62211-1.stderr
src/test/ui/associated-types/defaults-unsound-62211-2.stderr
src/test/ui/bad/bad-method-typaram-kind.stderr
src/test/ui/binop/binop-consume-args.stderr
src/test/ui/binop/binop-move-semantics.stderr
src/test/ui/borrowck/borrowck-unboxed-closures.stderr
src/test/ui/bound-suggestions.fixed
src/test/ui/bound-suggestions.stderr
src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr
src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr
src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr
src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr
src/test/ui/closures/closure-bounds-subtype.stderr
src/test/ui/closures/issue-67123.stderr
src/test/ui/const-generics/issues/issue-61336-2.stderr
src/test/ui/const-generics/issues/issue-61336.stderr
src/test/ui/generic-associated-types/impl_bounds.stderr
src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr
src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr
src/test/ui/impl-trait/issue-55872-1.stderr
src/test/ui/issues/issue-21837.stderr
src/test/ui/issues/issue-34721.fixed
src/test/ui/issues/issue-34721.stderr
src/test/ui/issues/issue-43784-associated-type.stderr
src/test/ui/issues/issue-43784-supertrait.stderr
src/test/ui/kindck/kindck-impl-type-params.nll.stderr
src/test/ui/kindck/kindck-impl-type-params.stderr
src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr
src/test/ui/once-cant-call-twice-on-heap.stderr
src/test/ui/phantom-oibit.stderr
src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr
src/test/ui/suggestions/restrict-type-argument.stderr
src/test/ui/traits/trait-alias/trait-alias-wf.stderr
src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr
src/test/ui/traits/traits-repeated-supertrait-ambig.stderr
src/test/ui/type-alias-impl-trait/bound_reduction2.stderr
src/test/ui/type-alias-impl-trait/generic_underconstrained.stderr
src/test/ui/type-alias-impl-trait/generic_underconstrained2.stderr
src/test/ui/type/type-check-defaults.stderr
src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr
src/test/ui/unop-move-semantics.stderr
src/test/ui/wf/wf-enum-bound.stderr
src/test/ui/wf/wf-enum-fields-struct-variant.stderr
src/test/ui/wf/wf-enum-fields.stderr
src/test/ui/wf/wf-fn-where-clause.stderr
src/test/ui/wf/wf-impl-associated-type-trait.stderr
src/test/ui/wf/wf-in-fn-arg.stderr
src/test/ui/wf/wf-in-fn-ret.stderr
src/test/ui/wf/wf-in-fn-type-arg.stderr
src/test/ui/wf/wf-in-fn-type-ret.stderr
src/test/ui/wf/wf-in-fn-where-clause.stderr
src/test/ui/wf/wf-in-obj-type-trait.stderr
src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr
src/test/ui/wf/wf-inherent-impl-where-clause.stderr
src/test/ui/wf/wf-struct-bound.stderr
src/test/ui/wf/wf-struct-field.stderr
src/test/ui/wf/wf-trait-associated-type-bound.stderr
src/test/ui/wf/wf-trait-bound.stderr
src/test/ui/wf/wf-trait-superbound.stderr
src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr
src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr

index 8f18fb4a30ed3ae5a366b16378d5257e0d3aa4ff..4ab7c4506fe6208f28f196a971fb4f7a66279c2a 100644 (file)
@@ -222,8 +222,6 @@ pub(in crate::borrow_check) fn report_use_of_moved_or_uninitialized(
                             &mut err,
                             &param.name.as_str(),
                             "Copy",
-                            tcx.sess.source_map(),
-                            span,
                             None,
                         );
                     }
index 739aff4fb94c9445ac216b40cee02cf818fabbba..98a623e38860c1c62876c463ce77fd0b9a627497 100644 (file)
@@ -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]
index 8cbed43cac01df032112a10ae05c571cba69f30d..d0cfa5489589d56a27ca12d27637e1ae5876f425 100644 (file)
@@ -25,8 +25,7 @@
 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<DefId>,
 ) -> 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<T = String>: Super<T>` where `T: Copy`, suggest restricting in the
+        // `where` clause instead of `trait Base<T: Copy = String>: Super<T>`.
+        && !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: 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: 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 &param_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,
-                );
-            }
-
-            &[&param_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,
-                    );
-                }
-            }
-
+            &[&param_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,
                 );
index a4be70df122d7af2adcbf8940ca77b9db74e10d7..3ac2117ec697e5f8d7769961cc8735dfd3dacc0d 100644 (file)
@@ -195,8 +195,7 @@ fn suggest_restricting_param_bound(
                     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 @@ fn suggest_restricting_param_bound(
                     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 @@ fn suggest_restricting_param_bound(
                         &mut err,
                         &param_name,
                         &constraint,
-                        self.tcx.sess.source_map(),
-                        *span,
                         Some(trait_ref.def_id()),
                     ) {
                         return;
index ec60db47f44298d1cd3c0102260d665d1431af0f..946a1f1a07abd0c537affe9ac3f6962b875fd9f1 100644 (file)
@@ -7,11 +7,10 @@ LL |     const Y: usize;
 LL |     let _array = [4; <A as Foo>::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<A: Foo, B: Foo>() {
-   |                ^^^
+LL | pub fn test<A: Foo + Foo, B: Foo>() {
+   |                    ^^^^^
 
 error: aborting due to previous error
 
index 3d38deb5a87633dee8d38185fb878fd2cf401e45..ac40e390cfbbd50bce084ffe4a0422b1fda74bd2 100644 (file)
@@ -7,11 +7,10 @@ LL |     const Y: usize;
 LL |     let _array: [u32; <A as Foo>::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<A: Foo, B: Foo>() {
-   |                ^^^
+LL | pub fn test<A: Foo + Foo, B: Foo>() {
+   |                    ^^^^^
 
 error: aborting due to previous error
 
index bac663dfea2b38607b47f027106f138d9e1074cb..1df127873538d2be8cef8d0e43f6e5685d132c50 100644 (file)
@@ -4,11 +4,10 @@ error[E0277]: the trait bound `T: Foo<usize>` is not satisfied
 LL |     let u: <T as Foo<usize>>::Bar = t.get_bar();
    |            ^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo<usize>` is not implemented for `T`
    |
-help: consider further restricting this bound with `+ Foo<usize>`
-  --> $DIR/associated-types-invalid-trait-ref-issue-18865.rs:9:8
+help: consider further restricting this bound
    |
-LL | fn f<T:Foo<isize>>(t: &T) {
-   |        ^^^^^^^^^^
+LL | fn f<T:Foo<isize> + Foo<usize>>(t: &T) {
+   |                   ^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 770845167cf9c5b366a77df844f432050802e8eb..0b5dee611e489be85c879e1d2470c4373807f437 100644 (file)
@@ -4,11 +4,10 @@ error[E0277]: the trait bound `T: Get` is not satisfied
 LL |     fn uhoh<T>(foo: <T as Get>::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<T>(foo: <T as Get>::Value) {}
-   |             ^
+LL |     fn uhoh<T: Get>(foo: <T as Get>::Value) {}
+   |              ^^^^^
 
 error: aborting due to previous error
 
index 60e1821b300d249a054ac2ab4080b2de0ac25a5a..54e39c4367d103a176d16f2f1a2b60b33ea6d89f 100644 (file)
@@ -23,12 +23,11 @@ LL | trait Foo<T> {
 LL |     type Bar: Clone = Vec<T>;
    |               ^^^^^ 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<T> {
-   |           ^
    = note: required because of the requirements on the impl of `std::clone::Clone` for `std::vec::Vec<T>`
+help: consider restricting type parameter `T`
+   |
+LL | trait Foo<T: std::clone::Clone> {
+   |            ^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the trait bound `(): Foo<Self>` 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<T> 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
index 9c4a1260139426b4a676daff476bd7174c8781c8..cfca7cc1011076f2b8018a279c348f0b8bddfa8c 100644 (file)
@@ -47,11 +47,10 @@ LL | impl<T> 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<T> UncheckedCopy for T {}
-   |      ^
+LL | impl<T: std::fmt::Display> 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<T> 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<T> UncheckedCopy for T {}
-   |      ^
+LL | impl<T: std::ops::Deref> 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<T> 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<T> UncheckedCopy for T {}
-   |      ^
+LL | impl<T: std::ops::AddAssign<&'static str>> 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<T> 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<T> UncheckedCopy for T {}
-   |      ^
+LL | impl<T: std::marker::Copy> UncheckedCopy for T {}
+   |       ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 8 previous errors
 
index 4602fbc99fa62945147b0f4e0863eea758c686c4..1dcfbf538e4c73ec85d8e057fdbaecdaae327f04 100644 (file)
@@ -47,11 +47,10 @@ LL | impl<T> 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<T> UncheckedCopy for T {}
-   |      ^
+LL | impl<T: std::fmt::Display> 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<T> 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<T> UncheckedCopy for T {}
-   |      ^
+LL | impl<T: std::ops::Deref> 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<T> 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<T> UncheckedCopy for T {}
-   |      ^
+LL | impl<T: std::ops::AddAssign<&'static str>> 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<T> 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<T> UncheckedCopy for T {}
-   |      ^
+LL | impl<T: std::marker::Copy> UncheckedCopy for T {}
+   |       ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 8 previous errors
 
index 9732363221286a0e79bb4b70ef1f5875730a3f0c..81fc961e3dea0ab05dc15006df92c9528309e319 100644 (file)
@@ -5,11 +5,10 @@ LL |     1.bar::<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/bad-method-typaram-kind.rs:1:10
+help: consider further restricting this bound
    |
-LL | fn foo<T:'static>() {
-   |          ^^^^^^^
+LL | fn foo<T:'static + std::marker::Send>() {
+   |                  ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 3fe7c9cbff42092a211599ea657a4483aeffa6a3..acdc03e3726388e89fd8428ce3c161df1d54207e 100644 (file)
@@ -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<A: Add<B, Output=()>, B>(lhs: A, rhs: B) {
-   |           ^^^^^^^^^^^^^^^^^
+LL | fn add<A: Add<B, Output=()> + 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<A: Add<B, Output=()>, B>(lhs: A, rhs: B) {
-   |                              ^
+LL | fn add<A: Add<B, Output=()>, 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<A: Sub<B, Output=()>, B>(lhs: A, rhs: B) {
-   |           ^^^^^^^^^^^^^^^^^
+LL | fn sub<A: Sub<B, Output=()> + 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<A: Sub<B, Output=()>, B>(lhs: A, rhs: B) {
-   |                              ^
+LL | fn sub<A: Sub<B, Output=()>, 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<A: Mul<B, Output=()>, B>(lhs: A, rhs: B) {
-   |           ^^^^^^^^^^^^^^^^^
+LL | fn mul<A: Mul<B, Output=()> + 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<A: Mul<B, Output=()>, B>(lhs: A, rhs: B) {
-   |                              ^
+LL | fn mul<A: Mul<B, Output=()>, 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<A: Div<B, Output=()>, B>(lhs: A, rhs: B) {
-   |           ^^^^^^^^^^^^^^^^^
+LL | fn div<A: Div<B, Output=()> + 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<A: Div<B, Output=()>, B>(lhs: A, rhs: B) {
-   |                              ^
+LL | fn div<A: Div<B, Output=()>, 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<A: Rem<B, Output=()>, B>(lhs: A, rhs: B) {
-   |           ^^^^^^^^^^^^^^^^^
+LL | fn rem<A: Rem<B, Output=()> + 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<A: Rem<B, Output=()>, B>(lhs: A, rhs: B) {
-   |                              ^
+LL | fn rem<A: Rem<B, Output=()>, 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<A: BitAnd<B, Output=()>, B>(lhs: A, rhs: B) {
-   |              ^^^^^^^^^^^^^^^^^^^^
+LL | fn bitand<A: BitAnd<B, Output=()> + 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<A: BitAnd<B, Output=()>, B>(lhs: A, rhs: B) {
-   |                                    ^
+LL | fn bitand<A: BitAnd<B, Output=()>, 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<A: BitOr<B, Output=()>, B>(lhs: A, rhs: B) {
-   |             ^^^^^^^^^^^^^^^^^^^
+LL | fn bitor<A: BitOr<B, Output=()> + 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<A: BitOr<B, Output=()>, B>(lhs: A, rhs: B) {
-   |                                  ^
+LL | fn bitor<A: BitOr<B, Output=()>, 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<A: BitXor<B, Output=()>, B>(lhs: A, rhs: B) {
-   |              ^^^^^^^^^^^^^^^^^^^^
+LL | fn bitxor<A: BitXor<B, Output=()> + 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<A: BitXor<B, Output=()>, B>(lhs: A, rhs: B) {
-   |                                    ^
+LL | fn bitxor<A: BitXor<B, Output=()>, 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<A: Shl<B, Output=()>, B>(lhs: A, rhs: B) {
-   |           ^^^^^^^^^^^^^^^^^
+LL | fn shl<A: Shl<B, Output=()> + 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<A: Shl<B, Output=()>, B>(lhs: A, rhs: B) {
-   |                              ^
+LL | fn shl<A: Shl<B, Output=()>, 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<A: Shr<B, Output=()>, B>(lhs: A, rhs: B) {
-   |           ^^^^^^^^^^^^^^^^^
+LL | fn shr<A: Shr<B, Output=()> + 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<A: Shr<B, Output=()>, B>(lhs: A, rhs: B) {
-   |                              ^
+LL | fn shr<A: Shr<B, Output=()>, B: Copy>(lhs: A, rhs: B) {
+   |                               ^^^^^^
 
 error: aborting due to 20 previous errors
 
index 31b594eeab4bf818c5d8cd867b7810a84c77342b..6d5ac9cab30c05f29c12890ded4ab7522e8919eb 100644 (file)
@@ -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<T: Add<Output=()>>(x: T) {
-   |                   ^^^^^^^^^^^^^^
+LL | fn double_move<T: Add<Output=()> + 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<T: Add<Output=()> + Clone>(x: T) {
-   |                        ^^^^^^^^^^^^^^^^^^^^^^
+LL | fn move_then_borrow<T: Add<Output=()> + Clone + Copy>(x: T) {
+   |                                               ^^^^^^
 
 error[E0505]: cannot move out of `x` because it is borrowed
   --> $DIR/binop-move-semantics.rs:21:5
index 33a0b0286dfe979f55e940b185ac5d79efb6ae45..a51cda548efd760747c34e55db4c103179cad188 100644 (file)
@@ -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<F:FnOnce(isize, isize) -> isize>(f: F) {
-   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | fn c<F:FnOnce(isize, isize) -> isize + Copy>(f: F) {
+   |                                      ^^^^^^
 
 error: aborting due to 3 previous errors
 
index c77421c97e7c058be5cc2c1c94aa918004cf1f9d..9c98200db513458f5d78728e75d53dbb97f526cd 100644 (file)
@@ -13,7 +13,7 @@ fn test_no_bounds<T: std::fmt::Debug>(t: T) {
 }
 
 #[allow(dead_code)]
-fn test_one_bound<T: std::fmt::Debug +  Sized>(t: T) {
+fn test_one_bound<T: Sized + std::fmt::Debug>(t: T) {
     println!("{:?}", t);
     //~^ ERROR doesn't implement
 }
@@ -25,7 +25,7 @@ fn test_no_bounds_where<X, Y>(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt:
 }
 
 #[allow(dead_code)]
-fn test_one_bound_where<X>(x: X) where X: std::fmt::Debug + Sized {
+fn test_one_bound_where<X>(x: X) where X: Sized + std::fmt::Debug {
     println!("{:?}", x);
     //~^ ERROR doesn't implement
 }
index 1e85c2bf36e46e2e66cdea27d3a22e3e088a747a..b9bc503f5301a35504fcaa02f9bc7ec222520f89 100644 (file)
@@ -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: 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: std::fmt::Debug>(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: Sized>(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: Sized + std::fmt::Debug>(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, Y>(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, Y>(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: 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: 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: 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: X) where X: Sized, X: Sized, X: std::fmt::Debug {
+   |                                                            ^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 6 previous errors
 
index a38705c834a375bf9c0114393a0efaf71d09ae31..ea5215e458d65791f0070898bb1bff8cc0ded295 100644 (file)
@@ -5,12 +5,11 @@ LL | impl <T: Sync+'static> 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 <T: Sync+'static> Foo for (T,) { }
-   |          ^^^^^^^^^^^^
    = note: required because it appears within the type `(T,)`
+help: consider further restricting this bound
+   |
+LL | impl <T: Sync+'static + std::marker::Send> 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 <T: Send> 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 <T: Send> Foo for (T,T) { }
-   |          ^^^^
    = note: required because it appears within the type `(T, T)`
+help: consider further restricting this bound
+   |
+LL | impl <T: Send + std::marker::Sync> Foo for (T,T) { }
+   |               ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 2 previous errors
 
index f379d97bd76c896b06bf9068f4900e5999fcd22b..ba6595f68d5ccbac309460ff3b581c3dddc7e8b4 100644 (file)
@@ -5,12 +5,11 @@ LL | impl <T:Sync+'static> RequiresRequiresShareAndSend for X<T> { }
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `T` cannot be sent between threads safely
    |
    = help: within `X<T>`, 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 <T:Sync+'static> RequiresRequiresShareAndSend for X<T> { }
-   |         ^^^^^^^^^^^^
    = note: required because it appears within the type `X<T>`
+help: consider further restricting this bound
+   |
+LL | impl <T:Sync+'static + std::marker::Send> RequiresRequiresShareAndSend for X<T> { }
+   |                      ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 996f39bfb665c8ff43c2d2addf9c592df540f230..bef33d1fd05d32866ce5588ca17f86ecda1a8b53 100644 (file)
@@ -5,11 +5,10 @@ LL | impl <T: Sync+'static> 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 <T: Sync+'static> Foo for T { }
-   |          ^^^^^^^^^^^^
+LL | impl <T: Sync+'static + std::marker::Send> Foo for T { }
+   |                       ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index b4135af7d7755063cd1331b96fa277b7f6b89f62..f565948f479c3e8e17de4769bfea67ee32b14c42 100644 (file)
@@ -8,11 +8,10 @@ LL | fn foo<F>(blk: F) -> X<F> 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<F>(blk: F) -> X<F> where F: FnOnce() + 'static {
-   |                                 ^^^^^^^^^^^^^^^^^^^^^
+LL | fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static + std::marker::Send {
+   |                                                       ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 47504de814dbee1a8e80ffb003a958527dc76f3a..f746f8502b8c26b314ead877d38739fde79b2bef 100644 (file)
@@ -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: F) where F: FnOnce() + Send {
-   |                              ^^^^^^^^^^^^^^^^^^
+LL | fn give_owned<F>(f: F) where F: FnOnce() + Send + std::marker::Sync {
+   |                                                 ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index f14478d7278cd4773a44f943309217585f26463f..5a6dfb2fdf946fdfe7ed7a235f242731e08513e0 100644 (file)
@@ -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: 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: Copy>(t: T) {
+   |         ^^^^^^
 
 error: aborting due to previous error
 
index 9ced427b93c6589046893e785b9887ef8639d2ca..ef9e3b86694a83194686c4fa41e5e9adc10ea1a4 100644 (file)
@@ -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<T, const N: usize>(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<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] {
+   |       ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index ace7955fbdd77ffd1b0d9f24940a65e767152e9f..88d81c66d1ffe959f919398f4a5fbb0964c89599 100644 (file)
@@ -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<T, const N: usize>(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<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] {
+   |       ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 486b538045e49a559397ed3d610d7f52152268ff..d5560c81337730cfbaaea5d51de5b6440f9413c7 100644 (file)
@@ -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<T> Foo for Fooy<T> {
-   |      ^
    = note: required because of the requirements on the impl of `std::marker::Copy` for `Fooy<T>`
    = note: the requirement `Fooy<T>: 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<T: std::marker::Copy> Foo for Fooy<T> {
+   |       ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 3 previous errors
 
index 6307a9b380ebf29734659bec603b1059a43e9871..268ff057421fe17961c63fcfc9e8f4f376c90044 100644 (file)
@@ -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
 
index 762c7c05f7ae8f90862072cfca89c23140189c8e..2e20d2fe6dda3fcc9d2f5886b053d2d2ee2cc5e0 100644 (file)
@@ -9,11 +9,10 @@ LL | fn want_foo_for_any_tcx<F>(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: &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
 
index d62b8b1c253eae404aa3532a01740d40ed7c0902..6cb2c9fb892f3f5a1caa5c85148f0c58a323d1c3 100644 (file)
@@ -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<S: Default> 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<S: Default + std::marker::Copy> 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<T: Default>() -> 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<T: Default + std::marker::Copy>() -> 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
index cfc294b5fa2d78bd835ab9bff2368e7f08d660dd..ff0c1ca64e2cc6530facfbb3c391e57117c570d0 100644 (file)
@@ -7,11 +7,10 @@ LL | pub struct Foo<T: Bound>(T);
 LL | impl<T> Trait2 for Foo<T> {}
    |         ^^^^^^ 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<T> Trait2 for Foo<T> {}
-   |      ^
+LL | impl<T: Bound> Trait2 for Foo<T> {}
+   |       ^^^^^^^
 
 error: aborting due to previous error
 
index ba2810ee3d725803e3f8e2f2cca978a7fa9dd9e5..f135ad3836ea1e004d04dc43bb76d62aa479a1b2 100644 (file)
@@ -18,7 +18,7 @@ pub mod bar {
 mod baz {
     use bar;
     use Foo;
-    pub fn baz<T: Copy +  Foo>(x: T) -> T {
+    pub fn baz<T: Foo + Copy>(x: T) -> T {
         if 0 == 1 {
             bar::bar(x.zero())
         } else {
index 5c51d0444461ab518b666a8690cf535e811578be..6cfed20f43a042fd2a036507e13ddf31336408e9 100644 (file)
@@ -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<T: Foo>(x: T) -> T {
-   |                   ^^^
+LL |     pub fn baz<T: Foo + Copy>(x: T) -> T {
+   |                       ^^^^^^
 
 error: aborting due to previous error
 
index 2f50a53f26c77323845993910385ee98a9a857f5..21cd39d01fa25ccf039daafcb2920ba8573e0958 100644 (file)
@@ -9,11 +9,10 @@ LL | impl<T> 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<T> Complete for T {
-   |      ^
+LL | impl<T: std::marker::Copy> Complete for T {
+   |       ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 1795db32a57bde44e465b5e9c01c4c53be46201b..2fb0583ee7d593ae16fe4c96793ee8d2da5f0498 100644 (file)
@@ -4,11 +4,10 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
 LL | impl<T> 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<T> Complete for T {}
-   |      ^
+LL | impl<T: std::marker::Copy> Complete for T {}
+   |       ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 593f55a5172d8cbd81c9ac4088e336ab9b91c586..a2f70a8c24082dba0613c22cf0abc126e1871fc1 100644 (file)
@@ -5,13 +5,12 @@ LL |     let a = &t as &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:16:6
-   |
-LL | fn f<T>(val: T) {
-   |      ^
    = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
    = note: required for the cast to the object type `dyn Gettable<T>`
+help: consider restricting type parameter `T`
+   |
+LL | fn f<T: std::marker::Send>(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<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:16:6
-   |
-LL | fn f<T>(val: T) {
-   |      ^
    = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
    = note: required for the cast to the object type `dyn Gettable<T>`
+help: consider restricting type parameter `T`
+   |
+LL | fn f<T: std::marker::Copy>(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;
    |                               ^^ `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<T>(val: T) {
-   |      ^
    = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
    = note: required for the cast to the object type `dyn Gettable<T>`
+help: consider restricting type parameter `T`
+   |
+LL | fn g<T: std::marker::Send>(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> = &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<T>(val: T) {
-   |      ^
    = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
    = note: required for the cast to the object type `dyn Gettable<T>`
+help: consider restricting type parameter `T`
+   |
+LL | fn g<T: std::marker::Copy>(val: T) {
+   |       ^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied
   --> $DIR/kindck-impl-type-params.rs:38:13
index 42318623b4d24f3b0cbd560004532b54ffc6a220..cc98f1d9f34b805875efd2ef28dc3ef5c6d16946 100644 (file)
@@ -5,13 +5,12 @@ LL |     let a = &t as &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:16:6
-   |
-LL | fn f<T>(val: T) {
-   |      ^
    = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
    = note: required for the cast to the object type `dyn Gettable<T>`
+help: consider restricting type parameter `T`
+   |
+LL | fn f<T: std::marker::Send>(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<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:16:6
-   |
-LL | fn f<T>(val: T) {
-   |      ^
    = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
    = note: required for the cast to the object type `dyn Gettable<T>`
+help: consider restricting type parameter `T`
+   |
+LL | fn f<T: std::marker::Copy>(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;
    |                               ^^ `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<T>(val: T) {
-   |      ^
    = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
    = note: required for the cast to the object type `dyn Gettable<T>`
+help: consider restricting type parameter `T`
+   |
+LL | fn g<T: std::marker::Send>(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> = &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<T>(val: T) {
-   |      ^
    = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
    = note: required for the cast to the object type `dyn Gettable<T>`
+help: consider restricting type parameter `T`
+   |
+LL | fn g<T: std::marker::Copy>(val: T) {
+   |       ^^^^^^^^^^^^^^^^^^^
 
 error[E0477]: the type `&'a isize` does not fulfill the required lifetime
   --> $DIR/kindck-impl-type-params.rs:32:13
index 552273b8ba9273ebf01a9d652371745c9689b155..a30bfa66c5a9ca22772fe841b5a242fa305d8cca 100644 (file)
@@ -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<F>(mut f: F) where F: FnMut(&mut R, bool) {
-   |                                   ^^^^^^^^^^^^^^^^^^^^^^
+LL | fn conspirator<F>(mut f: F) where F: FnMut(&mut R, bool) + Copy {
+   |                                                          ^^^^^^
 
 error: aborting due to 2 previous errors
 
index d4884469ce4d2d0b4c595436e5f904fe73b681e5..7133a32431a67ded968b5a7c6023298f3dcec7a4 100644 (file)
@@ -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<F:FnOnce()>(blk: F) {
-   |          ^^^^^^^^
+LL | fn foo<F:FnOnce() + Copy>(blk: F) {
+   |                   ^^^^^^
 
 error: aborting due to previous error
 
index 7b6b105eb032be61ad2604e403bc1e96faa0612a..f8fe6947852fbdd4c9945a6a9427862db2fe60d1 100644 (file)
@@ -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<T>(x: Guard<T>) {
-   |             ^
    = 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<T: std::marker::Sync>(x: Guard<T>) {
+   |              ^^^^^^^^^^^^^^^^^^^
 
 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<T>(x: Nested<Guard<T>>) {
-   |                    ^
    = 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<Guard<'_, T>>`
+help: consider restricting type parameter `T`
+   |
+LL | fn nested_not_sync<T: std::marker::Sync>(x: Nested<Guard<T>>) {
+   |                     ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 2 previous errors
 
index ee7c002b16db1310db6f7dca2b93f83ea397e375..4e4cad624754e010a5b5cb977980a8070278ffa1 100644 (file)
@@ -4,11 +4,10 @@ error[E0277]: the trait bound `U: std::cmp::Eq` is not satisfied
 LL | default impl<U> 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<U> Foo<'static, U> for () {}
-   |              ^
+LL | default impl<U: std::cmp::Eq> Foo<'static, U> for () {}
+   |               ^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 4d5cb8907e8872eba01c3ae63fe0a96746b59fa4..a98cb76a683261226683a6fa3ca35779adf273c6 100644 (file)
@@ -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<S>(val: S) where S: Sync {
-   |                               ^^^^^^^
+LL | fn use_where<S>(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<S: Sync>(val: S) {
-   |                 ^^^^
+LL | fn use_bound<S: Sync + std::marker::Send>(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<S: Sync>(val: S) where S: std::fmt::Debug {
-   |                                               ^^^^^^^^^^^^^^^^^^
+LL | fn use_bound_and_where<S: Sync>(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<S>(val: S) {
-   |                ^
+LL | fn use_unbound<S: std::marker::Send>(val: S) {
+   |                 ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 6 previous errors
 
index e7ed16a02a3f0127a01a917ab789625922c6c6ff..ca4980ca305294c814cbc55e896e58608b184a86 100644 (file)
@@ -6,11 +6,10 @@ LL | trait A<T: Foo> {}
 LL | trait B<T> = A<T>;
    |              ^^^^ 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<T> = A<T>;
-   |         ^
+LL | trait B<T: Foo> = A<T>;
+   |          ^^^^^
 
 error: aborting due to previous error
 
index 56a9e3ff54ec25f98ce1cd94565e11383a451f60..9e8e5e08145022a3f8c97927098382deb99845de 100644 (file)
@@ -7,11 +7,10 @@ LL | struct Foo<T:Trait> {
 LL | impl<T> Foo<T> {
    |         ^^^^^^ 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<T> Foo<T> {
-   |      ^
+LL | impl<T: Trait> Foo<T> {
+   |       ^^^^^^^
 
 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<T:Trait> {
 LL |     b: Foo<U>,
    |     ^^^^^^^^^ 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<U> {
-   |                ^
+LL | struct Badness<U: Trait> {
+   |                 ^^^^^^^
 
 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<T:Trait> {
 LL |     EvenMoreBadness(Bar<V>),
    |                     ^^^^^^ 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<V> {
-   |                  ^
+LL | enum MoreBadness<V: Trait> {
+   |                   ^^^^^^^
 
 error[E0277]: the trait bound `i32: Trait` is not satisfied
   --> $DIR/trait-bounds-on-structs-and-enums.rs:35:5
index 5b7f32ba1e0f06a3b22f482d665fd4f4818edacb..4107c49bd80ce9b6fee0854abed1b8beafaf4137 100644 (file)
@@ -10,11 +10,10 @@ error[E0277]: the trait bound `C: CompareTo<i32>` is not satisfied
 LL |     c.same_as(22)
    |       ^^^^^^^ the trait `CompareTo<i32>` is not implemented for `C`
    |
-help: consider further restricting this bound with `+ CompareTo<i32>`
-  --> $DIR/traits-repeated-supertrait-ambig.rs:29:17
+help: consider further restricting this bound
    |
-LL | fn with_trait<C:CompareToInts>(c: &C) -> bool {
-   |                 ^^^^^^^^^^^^^
+LL | fn with_trait<C:CompareToInts + CompareTo<i32>>(c: &C) -> bool {
+   |                               ^^^^^^^^^^^^^^^^
 
 error[E0277]: the trait bound `dyn CompareToInts: CompareTo<i32>` 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<i32>` is not implemented for `C`
    |
-help: consider further restricting this bound with `+ CompareTo<i32>`
-  --> $DIR/traits-repeated-supertrait-ambig.rs:37:17
+help: consider further restricting this bound
    |
-LL | fn with_ufcs2<C:CompareToInts>(c: &C) -> bool {
-   |                 ^^^^^^^^^^^^^
+LL | fn with_ufcs2<C:CompareToInts + CompareTo<i32>>(c: &C) -> bool {
+   |                               ^^^^^^^^^^^^^^^^
 
 error[E0277]: the trait bound `i64: CompareTo<i32>` is not satisfied
   --> $DIR/traits-repeated-supertrait-ambig.rs:42:23
index 74b858105b92fe0a2a50b09edd376e3c2ba4a687..aff558569eaca038eb0bb5c293d013c1c42d26fe 100644 (file)
@@ -4,11 +4,10 @@ error[E0277]: the trait bound `T: TraitWithAssoc` is not satisfied
 LL | type Foo<V> = impl Trait<V>;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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: TraitWithAssoc>(_: T) -> Foo<T::Assoc> {
-   |                     ^^^^^^^^^^^^^^
+LL | fn foo_desugared<T: TraitWithAssoc + TraitWithAssoc>(_: T) -> Foo<T::Assoc> {
+   |                                    ^^^^^^^^^^^^^^^^
 
 error: defining opaque type use does not fully define opaque type: generic parameter `V` is specified as concrete type `<T as TraitWithAssoc>::Assoc`
   --> $DIR/bound_reduction2.rs:18:1
index 299c7eae8d3a87553e41f84e03dc1e9a4fe4fac8..f7a04263259f60582408b2ae246a24c88e49e363 100644 (file)
@@ -10,12 +10,11 @@ error[E0277]: the trait bound `T: Trait` is not satisfied
 LL | type Underconstrained<T: Trait> = 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>(_: T) -> Underconstrained<T> {
-   |                   ^
    = note: the return type of a function must have a statically known size
+help: consider restricting type parameter `T`
+   |
+LL | fn underconstrain<T: Trait>(_: T) -> Underconstrained<T> {
+   |                    ^^^^^^^
 
 error: aborting due to 2 previous errors
 
index 56966a32b43b2158ac9b36e714d16f4c5f87721a..ad160abcbd5738955a5dfc699df0a2bde1cd4f7f 100644 (file)
@@ -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>(_: U) -> Underconstrained<U> {
-   |                     ^
    = note: the return type of a function must have a statically known size
+help: consider restricting type parameter `U`
+   |
+LL | fn underconstrained<U: std::fmt::Debug>(_: U) -> Underconstrained<U> {
+   |                      ^^^^^^^^^^^^^^^^^
 
 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>(_: U, _: V) -> Underconstrained2<V> {
-   |                         ^
    = note: the return type of a function must have a statically known size
+help: consider restricting type parameter `V`
+   |
+LL | fn underconstrained2<U, V: std::fmt::Debug>(_: U, _: V) -> Underconstrained2<V> {
+   |                          ^^^^^^^^^^^^^^^^^
 
 error: aborting due to 4 previous errors
 
index 31ee15e0745dbeca17b196879d7d40af75882dd9..ca9b85bacba399705992a3555b1ba8e6fafa7cb7 100644 (file)
@@ -54,11 +54,10 @@ LL | trait Super<T: Copy> { }
 LL | trait Base<T = String>: Super<T> { }
    |                         ^^^^^^^^ 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<T = String>: Super<T> { }
-   |            ^
+LL | trait Base<T = String>: Super<T>, T: std::marker::Copy { }
+   |                                 ^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: cannot add `u8` to `i32`
   --> $DIR/type-check-defaults.rs:24:66
index 45c9d8be85ee91746692bdb2526eb2b4b7181a75..c8411017b3c8da9c3018705463c24a94e735d683 100644 (file)
@@ -8,11 +8,10 @@ LL | fn is_send<T: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<T>() {
-   |        ^
+LL | fn foo<T: std::marker::Send>() {
+   |         ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index ab641c40dfe4490d625c7b448dffddd8ed4086b8..e0499cfe95ce9cbad9aa77c511b14943d270ba53 100644 (file)
@@ -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<T: Not<Output=T> + Clone>(x: T) {
-   |                        ^^^^^^^^^^^^^^^^^^^^^
+LL | fn move_then_borrow<T: Not<Output=T> + Clone + Copy>(x: T) {
+   |                                              ^^^^^^
 
 error[E0505]: cannot move out of `x` because it is borrowed
   --> $DIR/unop-move-semantics.rs:15:6
index be64ddb975994ce1b3a2a0d33277500ecddb11dd..f70f67d414fc316af30052d0d42f9fb65f0821e0 100644 (file)
@@ -7,11 +7,10 @@ LL | trait ExtraCopy<T:Copy> { }
 LL |     where T: ExtraCopy<U>
    |              ^^^^^^^^^^^^ 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<T,U>
-   |                 ^
+LL |     where T: ExtraCopy<U>, U: std::marker::Copy
+   |                          ^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 40454b33b7b76cc0961660e5f0aa81eaf58ba4fe..8634b7dba5c36297d473598830024328e9b9705e 100644 (file)
@@ -7,11 +7,10 @@ LL | struct IsCopy<T:Copy> {
 LL |         f: IsCopy<A>
    |         ^^^^^^^^^^^^ 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<A> {
-   |                  ^
+LL | enum AnotherEnum<A: std::marker::Copy> {
+   |                   ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index e2612add776d48a87c527e2f607457d249485dbb..a22b2d11a91cb6c60dbe892d2454b04079dae046 100644 (file)
@@ -7,11 +7,10 @@ LL | struct IsCopy<T:Copy> {
 LL |     SomeVariant(IsCopy<A>)
    |                 ^^^^^^^^^ 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<A> {
-   |               ^
+LL | enum SomeEnum<A: std::marker::Copy> {
+   |                ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 2a4f2df5a898696ae39adc75863e3672790d63c0..cf1aeac7e3e4142284877c7e1ec7bd8e3f4ae6e3 100644 (file)
@@ -7,11 +7,10 @@ LL |
 LL | fn foo<T,U>() where T: ExtraCopy<U>
    |                        ^^^^^^^^^^^^ 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<T,U>() where T: ExtraCopy<U>
-   |          ^
+LL | fn foo<T,U>() where T: ExtraCopy<U>, 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
index 7774299b39357c02754f4dd52e90717232d04851..d44a6f01a47f68661809b65a865409c6c6d28fd2 100644 (file)
@@ -7,11 +7,10 @@ LL | pub struct MySet<T:MyHash> {
 LL |     type Bar = MySet<T>;
    |     ^^^^^^^^^^^^^^^^^^^^ 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<T> Foo for T {
-   |      ^
+LL | impl<T: MyHash> Foo for T {
+   |       ^^^^^^^^
 
 error: aborting due to previous error
 
index c1a6657e63be7aa4a3bce7caa0c19c6d21f34497..907701440aad5c3eaf5577e002757d3e39e064d5 100644 (file)
@@ -7,11 +7,10 @@ LL | struct MustBeCopy<T:Copy> {
 LL | fn bar<T>(_: &MustBeCopy<T>)
    |              ^^^^^^^^^^^^^^ 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<T>(_: &MustBeCopy<T>)
-   |        ^
+LL | fn bar<T: std::marker::Copy>(_: &MustBeCopy<T>)
+   |         ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 754d64df0194bc63450f66685d3b6f1c0c5a578f..2ed4eecefe1351fa5419233413cd4d10fe734ec7 100644 (file)
@@ -7,11 +7,10 @@ LL | struct MustBeCopy<T:Copy> {
 LL | fn bar<T>() -> MustBeCopy<T>
    |                ^^^^^^^^^^^^^ 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<T>() -> MustBeCopy<T>
-   |        ^
+LL | fn bar<T: std::marker::Copy>() -> MustBeCopy<T>
+   |         ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 97a5c0fd913a4b502855d75369c1763f9ac0df94..0c699838abd2a73aa00d58638fc86a6b8e1f3886 100644 (file)
@@ -7,11 +7,10 @@ LL | struct MustBeCopy<T:Copy> {
 LL |     x: fn(MustBeCopy<T>)
    |     ^^^^^^^^^^^^^^^^^^^^ 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<T> {
-   |            ^
+LL | struct Bar<T: std::marker::Copy> {
+   |             ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 527b000edf8832fe59aea881e1c89c93faa88e20..3429ab89ffbac3132a5859a88d0ed8cfcc1ad525 100644 (file)
@@ -7,11 +7,10 @@ LL | struct MustBeCopy<T:Copy> {
 LL |     x: fn() -> MustBeCopy<T>
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ 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<T> {
-   |            ^
+LL | struct Foo<T: std::marker::Copy> {
+   |             ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 62c672a21e86ec85cffa9ca0d32bc55edd643c07..d33749d795c599e513670b3846d27996aa3c7007 100644 (file)
@@ -7,11 +7,10 @@ LL | trait MustBeCopy<T:Copy> {
 LL |     where T: MustBeCopy<U>
    |              ^^^^^^^^^^^^^ 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<T,U>()
-   |          ^
+LL |     where T: MustBeCopy<U>, U: std::marker::Copy
+   |                           ^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 1b6438cdc2477b638d1af0a02a4aaa090b339ecb..605dc49784954163d1bcaf30ef4bb09596583285 100644 (file)
@@ -7,11 +7,10 @@ LL | struct MustBeCopy<T:Copy> {
 LL |     x: dyn Object<MustBeCopy<T>>
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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<T> {
-   |            ^
+LL | struct Bar<T: std::marker::Copy> {
+   |             ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 70337ee40eacfc4cde62410fe510e90fd705eb85..da2f8085a8a9e139627d647844ce127a97bf4565 100644 (file)
@@ -7,11 +7,10 @@ LL | trait ExtraCopy<T:Copy> { }
 LL |     fn foo(self) where T: ExtraCopy<U>
    |                           ^^^^^^^^^^^^ 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<T,U> Foo<T,U> {
-   |        ^
+LL | impl<T,U: std::marker::Copy> Foo<T,U> {
+   |         ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index c26d0ef787195ccd33ab52c59d5c389988d2279b..28d5bc62556abc47c9a0a056b653d8bdd834d3d3 100644 (file)
@@ -7,11 +7,10 @@ LL | trait ExtraCopy<T:Copy> { }
 LL | impl<T,U> Foo<T,U> where T: ExtraCopy<U>
    |                             ^^^^^^^^^^^^ 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<T,U> Foo<T,U> where T: ExtraCopy<U>
-   |        ^
+LL | impl<T,U> Foo<T,U> where T: ExtraCopy<U>, U: std::marker::Copy
+   |                                         ^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 545e4f870954c507e0aa86d8f523bf225feebf7b..07e569ddac11d0f6cd4557eb9ff51435cfe82a90 100644 (file)
@@ -7,11 +7,10 @@ LL | trait ExtraCopy<T:Copy> { }
 LL |     where T: ExtraCopy<U>
    |              ^^^^^^^^^^^^ 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<T,U>
-   |                     ^
+LL |     where T: ExtraCopy<U>, U: std::marker::Copy
+   |                          ^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index f0ebdfba2ffc67c0a4cf6536e7fa39fc614a58dc..f3bce24eace07683537ada5efc152b48ceb5bbab 100644 (file)
@@ -7,11 +7,10 @@ LL | struct IsCopy<T:Copy> {
 LL |     data: IsCopy<A>
    |     ^^^^^^^^^^^^^^^ 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<A> {
-   |                   ^
+LL | struct SomeStruct<A: std::marker::Copy> {
+   |                    ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index dfccd4865686e8ef9c5a2d2b80304f1e64ae2a34..6cf7f2069b6b745e84476ee500180b894d1dcaf6 100644 (file)
@@ -7,11 +7,10 @@ LL | trait ExtraCopy<T:Copy> { }
 LL |     type Type1: ExtraCopy<T>;
    |                 ^^^^^^^^^^^^ 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<T> {
-   |                 ^
+LL | trait SomeTrait<T: std::marker::Copy> {
+   |                  ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 31faa14426a1fe70eaef16db9ea18945e493e89b..b8ffad6d1802bfa3d00e4ca63c1f37faa2ad7da5 100644 (file)
@@ -7,11 +7,10 @@ LL | trait ExtraCopy<T:Copy> { }
 LL |     where T: ExtraCopy<U>
    |              ^^^^^^^^^^^^ 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<T,U>
-   |                   ^
+LL |     where T: ExtraCopy<U>, U: std::marker::Copy
+   |                          ^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 372a5f8ba5db727fe639aee00b39f47547fc7957..88b4bec0451790efcb78bec79301b1f5dd90d8f6 100644 (file)
@@ -7,11 +7,10 @@ LL |
 LL | trait SomeTrait<T>: ExtraCopy<T> {
    |                     ^^^^^^^^^^^^ 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<T>: ExtraCopy<T> {
-   |                 ^
+LL | trait SomeTrait<T: std::marker::Copy>: ExtraCopy<T> {
+   |                  ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index c6f12e7753c82afe125e613a159456a13d026d70..fb1471e95bbd9f3a4053468975fdcb81ac2902d1 100644 (file)
@@ -7,11 +7,10 @@ LL | fn require_copy<T: 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<T> Foo<T> {
-   |      ^
+LL | impl<T: std::marker::Copy> Foo<T> {
+   |       ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 95688d6f2e48584805f344a3ddc4eaf5044fafd0..6c1516d8ac9e727ad8f5732f0a952a83e248d152 100644 (file)
@@ -7,11 +7,10 @@ LL | fn require_copy<T: 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<T> Foo<T> for Bar<T> {
-   |      ^
+LL | impl<T: std::marker::Copy> Foo<T> for Bar<T> {
+   |       ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error