&mut err,
¶m.name.as_str(),
"Copy",
- tcx.sess.source_map(),
- span,
None,
);
}
#![feature(drain_filter)]
#![feature(in_band_lifetimes)]
#![feature(crate_visibility_modifier)]
+#![feature(or_patterns)]
#![recursion_limit = "512"] // For rustdoc
#[macro_use]
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 _;
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 {
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
// |
// 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:
//
// --
// |
// 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,
);
}
}
}
- 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 ¶m_spans[..] {
- &[] => {
- err.span_help(
- param.span,
- &format!("{} `where {}: {}`", MSG_RESTRICT_TYPE, param_name, constraint),
- );
-
- err.tool_only_span_suggestion(
- where_clause_span,
- MSG_RESTRICT_TYPE,
- format!(", {}: {}", param_name, constraint),
- Applicability::MachineApplicable,
- );
- }
-
- &[¶m_span] => {
- err.span_help(
- param_span,
- &format!("{} `+ {}`", MSG_RESTRICT_BOUND_FURTHER, constraint),
- );
-
- let span_hi = param_span.with_hi(span.hi());
- let span_with_colon = source_map.span_through_char(span_hi, ':');
-
- if span_hi != param_span && span_with_colon != span_hi {
- err.tool_only_span_suggestion(
- span_with_colon,
- MSG_RESTRICT_BOUND_FURTHER,
- format!("{}: {} +", param_name, constraint),
- Applicability::MachineApplicable,
- );
- }
- }
-
+ &[¶m_span] => suggest_restrict(param_span.shrink_to_hi()),
_ => {
- err.span_help(
- param.span,
- &format!(
- "{} `where {}: {}`",
- MSG_RESTRICT_TYPE_FURTHER, param_name, constraint,
- ),
- );
-
- err.tool_only_span_suggestion(
+ err.span_suggestion_verbose(
where_clause_span,
- MSG_RESTRICT_BOUND_FURTHER,
+ &msg_restrict_type_further,
format!(", {}: {}", param_name, constraint),
Applicability::MachineApplicable,
);
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(..),
..
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.
&mut err,
¶m_name,
&constraint,
- self.tcx.sess.source_map(),
- *span,
Some(trait_ref.def_id()),
) {
return;
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
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
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
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
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
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
|
= 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
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
| ^^^^^^^^^^^^^ 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
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
|
= 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
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
| ^^^^^^^^^^^^^ 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
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
| ^^^ `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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
}
#[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
}
}
#[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
}
| ^ `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
| ^ `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
| ^ `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
| ^ `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
| ^ `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
| ^ `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
| ^^^ `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
| ^^^ `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
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `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
| ^^^ `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
| ^^^^ `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
| ^ `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
| |
| 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
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
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
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
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
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
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
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
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
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
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 {
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
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
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
| ^^ `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
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
| ^^ `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
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
| ^^ `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
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
| ^^ `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
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
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
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
| ^ `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
| ^ `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
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
| ^^^ `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
| ^^^ `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
| ^^^ `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
| ^^^ `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
| ^^^ `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
| ^^^ `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
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
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
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
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
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
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
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
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
| ---- 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
| ---- 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
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
| ------- ---- 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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