Auto merge of #133522 - estebank:dont-suggest-unstable-trait, r=compiler-errors
Don't suggest restricting bound with unstable traits on stable and mention it's unstable on nightly On nightly, we mention the trait is unstable ``` error[E0277]: the trait bound `T: Unstable` is not satisfied --> $DIR/unstable-trait-suggestion.rs:13:9 | LL | foo(t) | --- ^ the trait `Unstable` is not implemented for `T` | | | required by a bound introduced by this call | note: required by a bound in `foo` --> $DIR/unstable-trait-suggestion.rs:9:11 | LL | fn foo<T: Unstable>(_: T) {} | ^^^^^^^^ required by this bound in `foo` help: consider restricting type parameter `T` but it is an `unstable` trait | LL | pub fn demo<T: Unstable>(t: T) { | ++++++++++ ``` On stable, we don't suggest the trait at all ``` error[E0277]: the trait bound `T: Unstable` is not satisfied --> $DIR/unstable-trait-suggestion.rs:13:9 | LL | foo(t) | --- ^ the trait `Unstable` is not implemented for `T` | | | required by a bound introduced by this call | note: required by a bound in `foo` --> $DIR/unstable-trait-suggestion.rs:9:11 | LL | fn foo<T: Unstable>(_: T) {} | ^^^^^^^^ required by this bound in `foo` ``` Fix #133511.
This commit is contained in:
commit
f415c07494
160 changed files with 486 additions and 374 deletions
|
@ -1450,6 +1450,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
|
|||
ty::Param(param_ty) => Ok((
|
||||
generics.type_param(param_ty, tcx),
|
||||
predicate.trait_ref.print_trait_sugared().to_string(),
|
||||
Some(predicate.trait_ref.def_id),
|
||||
)),
|
||||
_ => Err(()),
|
||||
}
|
||||
|
@ -1463,9 +1464,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
|
|||
tcx,
|
||||
hir_generics,
|
||||
err,
|
||||
predicates
|
||||
.iter()
|
||||
.map(|(param, constraint)| (param.name.as_str(), &**constraint, None)),
|
||||
predicates.iter().map(|(param, constraint, def_id)| {
|
||||
(param.name.as_str(), &**constraint, *def_id)
|
||||
}),
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
|
|||
err,
|
||||
param_ty.name.as_str(),
|
||||
&constraint,
|
||||
None,
|
||||
Some(trait_ref.def_id),
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -279,7 +279,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||
} else {
|
||||
let mut err = self.dcx().create_err(err);
|
||||
if suggest_constraining_type_param(
|
||||
tcx, generics, &mut err, &qself_str, &trait_ref, None, None,
|
||||
tcx,
|
||||
generics,
|
||||
&mut err,
|
||||
&qself_str,
|
||||
&trait_ref,
|
||||
Some(best_trait),
|
||||
None,
|
||||
) && !identically_named
|
||||
{
|
||||
// We suggested constraining a type parameter, but the associated item on it
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
//! Diagnostics related methods for `Ty`.
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::fmt::Write;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_errors::{Applicability, Diag, DiagArgValue, IntoDiagArg, into_diag_arg_using_display};
|
||||
use rustc_errors::{
|
||||
Applicability, Diag, DiagArgValue, IntoDiagArg, into_diag_arg_using_display, pluralize,
|
||||
};
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::{self as hir, LangItem, PredicateOrigin, WherePredicateKind};
|
||||
|
@ -161,7 +162,7 @@ pub fn suggest_arbitrary_trait_bound<'tcx>(
|
|||
true
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
enum SuggestChangingConstraintsMessage<'a> {
|
||||
RestrictBoundFurther,
|
||||
RestrictType { ty: &'a str },
|
||||
|
@ -172,7 +173,7 @@ enum SuggestChangingConstraintsMessage<'a> {
|
|||
|
||||
fn suggest_changing_unsized_bound(
|
||||
generics: &hir::Generics<'_>,
|
||||
suggestions: &mut Vec<(Span, String, SuggestChangingConstraintsMessage<'_>)>,
|
||||
suggestions: &mut Vec<(Span, String, String, SuggestChangingConstraintsMessage<'_>)>,
|
||||
param: &hir::GenericParam<'_>,
|
||||
def_id: Option<DefId>,
|
||||
) {
|
||||
|
@ -207,7 +208,8 @@ fn suggest_changing_unsized_bound(
|
|||
continue;
|
||||
}
|
||||
|
||||
let mut push_suggestion = |sp, msg| suggestions.push((sp, String::new(), msg));
|
||||
let mut push_suggestion =
|
||||
|sp, msg| suggestions.push((sp, "Sized".to_string(), String::new(), msg));
|
||||
|
||||
if predicate.bounds.len() == unsized_bounds.len() {
|
||||
// All the bounds are unsized bounds, e.g.
|
||||
|
@ -278,8 +280,25 @@ pub fn suggest_constraining_type_params<'a>(
|
|||
span_to_replace: Option<Span>,
|
||||
) -> bool {
|
||||
let mut grouped = FxHashMap::default();
|
||||
let mut unstable_suggestion = false;
|
||||
param_names_and_constraints.for_each(|(param_name, constraint, def_id)| {
|
||||
grouped.entry(param_name).or_insert(Vec::new()).push((constraint, def_id))
|
||||
let stable = match def_id {
|
||||
Some(def_id) => match tcx.lookup_stability(def_id) {
|
||||
Some(s) => s.level.is_stable(),
|
||||
None => true,
|
||||
},
|
||||
None => true,
|
||||
};
|
||||
if stable || tcx.sess.is_nightly_build() {
|
||||
grouped.entry(param_name).or_insert(Vec::new()).push((
|
||||
constraint,
|
||||
def_id,
|
||||
if stable { "" } else { "unstable " },
|
||||
));
|
||||
if !stable {
|
||||
unstable_suggestion = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let mut applicability = Applicability::MachineApplicable;
|
||||
|
@ -290,16 +309,21 @@ pub fn suggest_constraining_type_params<'a>(
|
|||
let Some(param) = param else { return false };
|
||||
|
||||
{
|
||||
let mut sized_constraints = constraints.extract_if(|(_, def_id)| {
|
||||
let mut sized_constraints = constraints.extract_if(|(_, def_id, _)| {
|
||||
def_id.is_some_and(|def_id| tcx.is_lang_item(def_id, LangItem::Sized))
|
||||
});
|
||||
if let Some((_, def_id)) = sized_constraints.next() {
|
||||
if let Some((_, def_id, _)) = sized_constraints.next() {
|
||||
applicability = Applicability::MaybeIncorrect;
|
||||
|
||||
err.span_label(param.span, "this type parameter needs to be `Sized`");
|
||||
suggest_changing_unsized_bound(generics, &mut suggestions, param, def_id);
|
||||
}
|
||||
}
|
||||
let bound_message = if constraints.iter().any(|(_, def_id, _)| def_id.is_none()) {
|
||||
SuggestChangingConstraintsMessage::RestrictBoundFurther
|
||||
} else {
|
||||
SuggestChangingConstraintsMessage::RestrictTypeFurther { ty: param_name }
|
||||
};
|
||||
|
||||
// in the scenario like impl has stricter requirements than trait,
|
||||
// we should not suggest restrict bound on the impl, here we double check
|
||||
|
@ -312,15 +336,54 @@ pub fn suggest_constraining_type_params<'a>(
|
|||
.collect();
|
||||
|
||||
constraints
|
||||
.retain(|(_, def_id)| def_id.map_or(true, |def| !bound_trait_defs.contains(&def)));
|
||||
.retain(|(_, def_id, _)| def_id.map_or(true, |def| !bound_trait_defs.contains(&def)));
|
||||
|
||||
if constraints.is_empty() {
|
||||
continue;
|
||||
}
|
||||
|
||||
let mut constraint = constraints.iter().map(|&(c, _)| c).collect::<Vec<_>>();
|
||||
let mut constraint = constraints.iter().map(|&(c, _, _)| c).collect::<Vec<_>>();
|
||||
constraint.sort();
|
||||
constraint.dedup();
|
||||
let all_known = constraints.iter().all(|&(_, def_id, _)| def_id.is_some());
|
||||
let all_stable = constraints.iter().all(|&(_, _, stable)| stable.is_empty());
|
||||
let all_unstable = constraints.iter().all(|&(_, _, stable)| !stable.is_empty());
|
||||
let post = if all_stable || all_unstable {
|
||||
// Don't redundantly say "trait `X`, trait `Y`", instead "traits `X` and `Y`"
|
||||
let mut trait_names = constraints
|
||||
.iter()
|
||||
.map(|&(c, def_id, _)| match def_id {
|
||||
None => format!("`{c}`"),
|
||||
Some(def_id) => format!("`{}`", tcx.item_name(def_id)),
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
trait_names.sort();
|
||||
trait_names.dedup();
|
||||
let n = trait_names.len();
|
||||
let stable = if all_stable { "" } else { "unstable " };
|
||||
let trait_ = if all_known { format!("trait{}", pluralize!(n)) } else { String::new() };
|
||||
format!("{stable}{trait_}{}", match &trait_names[..] {
|
||||
[t] => format!(" {t}"),
|
||||
[ts @ .., last] => format!(" {} and {last}", ts.join(", ")),
|
||||
[] => return false,
|
||||
},)
|
||||
} else {
|
||||
// We're more explicit when there's a mix of stable and unstable traits.
|
||||
let mut trait_names = constraints
|
||||
.iter()
|
||||
.map(|&(c, def_id, stable)| match def_id {
|
||||
None => format!("`{c}`"),
|
||||
Some(def_id) => format!("{stable}trait `{}`", tcx.item_name(def_id)),
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
trait_names.sort();
|
||||
trait_names.dedup();
|
||||
match &trait_names[..] {
|
||||
[t] => t.to_string(),
|
||||
[ts @ .., last] => format!("{} and {last}", ts.join(", ")),
|
||||
[] => return false,
|
||||
}
|
||||
};
|
||||
let constraint = constraint.join(" + ");
|
||||
let mut suggest_restrict = |span, bound_list_non_empty, open_paren_sp| {
|
||||
let suggestion = if span_to_replace.is_some() {
|
||||
|
@ -333,13 +396,11 @@ pub fn suggest_constraining_type_params<'a>(
|
|||
format!(" {constraint}")
|
||||
};
|
||||
|
||||
use SuggestChangingConstraintsMessage::RestrictBoundFurther;
|
||||
|
||||
if let Some(open_paren_sp) = open_paren_sp {
|
||||
suggestions.push((open_paren_sp, "(".to_string(), RestrictBoundFurther));
|
||||
suggestions.push((span, format!("){suggestion}"), RestrictBoundFurther));
|
||||
suggestions.push((open_paren_sp, post.clone(), "(".to_string(), bound_message));
|
||||
suggestions.push((span, post.clone(), format!("){suggestion}"), bound_message));
|
||||
} else {
|
||||
suggestions.push((span, suggestion, RestrictBoundFurther));
|
||||
suggestions.push((span, post.clone(), suggestion, bound_message));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -397,7 +458,8 @@ pub fn suggest_constraining_type_params<'a>(
|
|||
// - insert: `, X: Bar`
|
||||
suggestions.push((
|
||||
generics.tail_span_for_predicate_suggestion(),
|
||||
constraints.iter().fold(String::new(), |mut string, &(constraint, _)| {
|
||||
post,
|
||||
constraints.iter().fold(String::new(), |mut string, &(constraint, _, _)| {
|
||||
write!(string, ", {param_name}: {constraint}").unwrap();
|
||||
string
|
||||
}),
|
||||
|
@ -426,6 +488,7 @@ pub fn suggest_constraining_type_params<'a>(
|
|||
// default (`<T=Foo>`), so we suggest adding `where T: Bar`.
|
||||
suggestions.push((
|
||||
generics.tail_span_for_predicate_suggestion(),
|
||||
post,
|
||||
format!("{where_prefix} {param_name}: {constraint}"),
|
||||
SuggestChangingConstraintsMessage::RestrictTypeFurther { ty: param_name },
|
||||
));
|
||||
|
@ -439,6 +502,7 @@ pub fn suggest_constraining_type_params<'a>(
|
|||
if let Some(colon_span) = param.colon_span {
|
||||
suggestions.push((
|
||||
colon_span.shrink_to_hi(),
|
||||
post,
|
||||
format!(" {constraint}"),
|
||||
SuggestChangingConstraintsMessage::RestrictType { ty: param_name },
|
||||
));
|
||||
|
@ -451,6 +515,7 @@ pub fn suggest_constraining_type_params<'a>(
|
|||
// - help: consider restricting this type parameter with `T: Foo`
|
||||
suggestions.push((
|
||||
param.span.shrink_to_hi(),
|
||||
post,
|
||||
format!(": {constraint}"),
|
||||
SuggestChangingConstraintsMessage::RestrictType { ty: param_name },
|
||||
));
|
||||
|
@ -459,39 +524,46 @@ pub fn suggest_constraining_type_params<'a>(
|
|||
// FIXME: remove the suggestions that are from derive, as the span is not correct
|
||||
suggestions = suggestions
|
||||
.into_iter()
|
||||
.filter(|(span, _, _)| !span.in_derive_expansion())
|
||||
.filter(|(span, _, _, _)| !span.in_derive_expansion())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let suggested = !suggestions.is_empty();
|
||||
if suggestions.len() == 1 {
|
||||
let (span, suggestion, msg) = suggestions.pop().unwrap();
|
||||
let (span, post, suggestion, msg) = suggestions.pop().unwrap();
|
||||
let msg = match msg {
|
||||
SuggestChangingConstraintsMessage::RestrictBoundFurther => {
|
||||
Cow::from("consider further restricting this bound")
|
||||
format!("consider further restricting this bound")
|
||||
}
|
||||
SuggestChangingConstraintsMessage::RestrictTypeFurther { ty }
|
||||
| SuggestChangingConstraintsMessage::RestrictType { ty }
|
||||
if ty.starts_with("impl ") =>
|
||||
{
|
||||
format!("consider restricting opaque type `{ty}` with {post}")
|
||||
}
|
||||
SuggestChangingConstraintsMessage::RestrictType { ty } => {
|
||||
Cow::from(format!("consider restricting type parameter `{ty}`"))
|
||||
format!("consider restricting type parameter `{ty}` with {post}")
|
||||
}
|
||||
SuggestChangingConstraintsMessage::RestrictTypeFurther { ty } => {
|
||||
Cow::from(format!("consider further restricting type parameter `{ty}`"))
|
||||
format!("consider further restricting type parameter `{ty}` with {post}")
|
||||
}
|
||||
SuggestChangingConstraintsMessage::RemoveMaybeUnsized => {
|
||||
Cow::from("consider removing the `?Sized` bound to make the type parameter `Sized`")
|
||||
format!("consider removing the `?Sized` bound to make the type parameter `Sized`")
|
||||
}
|
||||
SuggestChangingConstraintsMessage::ReplaceMaybeUnsizedWithSized => {
|
||||
Cow::from("consider replacing `?Sized` with `Sized`")
|
||||
format!("consider replacing `?Sized` with `Sized`")
|
||||
}
|
||||
};
|
||||
|
||||
err.span_suggestion_verbose(span, msg, suggestion, applicability);
|
||||
} else if suggestions.len() > 1 {
|
||||
let post = if unstable_suggestion { " (some of them are unstable traits)" } else { "" };
|
||||
err.multipart_suggestion_verbose(
|
||||
"consider restricting type parameters",
|
||||
suggestions.into_iter().map(|(span, suggestion, _)| (span, suggestion)).collect(),
|
||||
format!("consider restricting type parameters{post}"),
|
||||
suggestions.into_iter().map(|(span, _, suggestion, _)| (span, suggestion)).collect(),
|
||||
applicability,
|
||||
);
|
||||
}
|
||||
|
||||
true
|
||||
suggested
|
||||
}
|
||||
|
||||
/// Collect al types that have an implicit `'static` obligation that we could suggest `'_` for.
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
pub fn baz<T>(t: std::ops::Range<T>) {
|
||||
for _ in t {}
|
||||
}
|
||||
fn main() {}
|
|
@ -0,0 +1,12 @@
|
|||
error[E0277]: the trait bound `T: Step` is not satisfied
|
||||
--> missing-bound.rs:2:14
|
||||
|
|
||||
2 | for _ in t {}
|
||||
| ^ the trait `Step` is not implemented for `T`
|
||||
|
|
||||
= note: required for `std::ops::Range<T>` to implement `Iterator`
|
||||
= note: required for `std::ops::Range<T>` to implement `IntoIterator`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
24
tests/run-make/missing-unstable-trait-bound/rmake.rs
Normal file
24
tests/run-make/missing-unstable-trait-bound/rmake.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
//@ only-linux
|
||||
//@ ignore-wasm32
|
||||
//@ ignore-wasm64
|
||||
// ignore-tidy-linelength
|
||||
|
||||
// Ensure that on stable we don't suggest restricting with an unsafe trait and we continue
|
||||
// mentioning the rest of the obligation chain.
|
||||
|
||||
use run_make_support::{diff, rust_lib_name, rustc};
|
||||
|
||||
fn main() {
|
||||
let out = rustc()
|
||||
.env("RUSTC_BOOTSTRAP", "-1")
|
||||
.input("missing-bound.rs")
|
||||
.run_fail()
|
||||
.assert_stderr_not_contains("help: consider restricting type parameter `T`")
|
||||
.assert_stderr_contains(
|
||||
r#"
|
||||
= note: required for `std::ops::Range<T>` to implement `Iterator`
|
||||
= note: required for `std::ops::Range<T>` to implement `IntoIterator`"#,
|
||||
)
|
||||
.stderr_utf8();
|
||||
diff().expected_file("missing-bound.stderr").actual_text("(stable rustc)", &out).run()
|
||||
}
|
|
@ -4,7 +4,7 @@ error[E0220]: associated type `Assoc` not found for `V`
|
|||
LL | pub type Foo<V> = impl Trait<V::Assoc>;
|
||||
| ^^^^^ there is an associated type `Assoc` in the trait `TraitWithAssoc`
|
||||
|
|
||||
help: consider restricting type parameter `V`
|
||||
help: consider restricting type parameter `V` with trait `TraitWithAssoc`
|
||||
|
|
||||
LL | pub type Foo<V: TraitWithAssoc> = impl Trait<V::Assoc>;
|
||||
| ++++++++++++++++
|
||||
|
@ -16,7 +16,7 @@ LL | pub type Foo<V> = impl Trait<V::Assoc>;
|
|||
| ^^^^^ there is an associated type `Assoc` in the trait `TraitWithAssoc`
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
help: consider restricting type parameter `V`
|
||||
help: consider restricting type parameter `V` with trait `TraitWithAssoc`
|
||||
|
|
||||
LL | pub type Foo<V: TraitWithAssoc> = impl Trait<V::Assoc>;
|
||||
| ++++++++++++++++
|
||||
|
|
|
@ -4,7 +4,7 @@ error[E0277]: the trait bound `C: Bar<5>` is not satisfied
|
|||
LL | pub struct Structure<C: Tec> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar<5>` is not implemented for `C`
|
||||
|
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `C` with trait `Bar`
|
||||
|
|
||||
LL | pub struct Structure<C: Tec + Bar<5>> {
|
||||
| ++++++++
|
||||
|
@ -15,7 +15,7 @@ error[E0277]: the trait bound `C: Bar<5>` is not satisfied
|
|||
LL | _field: C::BarType,
|
||||
| ^^^^^^^^^^ the trait `Bar<5>` is not implemented for `C`
|
||||
|
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `C` with trait `Bar`
|
||||
|
|
||||
LL | pub struct Structure<C: Tec + Bar<5>> {
|
||||
| ++++++++
|
||||
|
|
|
@ -4,7 +4,7 @@ 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 type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Get`
|
||||
|
|
||||
LL | fn uhoh<T: Get>(foo: <T as Get>::Value) {}
|
||||
| +++++
|
||||
|
@ -15,7 +15,7 @@ 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 type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Get`
|
||||
|
|
||||
LL | fn uhoh<T: Get>(foo: <T as Get>::Value) {}
|
||||
| +++++
|
||||
|
|
|
@ -47,7 +47,7 @@ note: required by a bound in `Foo::Bar`
|
|||
|
|
||||
LL | type Bar: Clone = Vec<T>;
|
||||
| ^^^^^ required by this bound in `Foo::Bar`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Clone`
|
||||
|
|
||||
LL | trait Foo<T: std::clone::Clone> {
|
||||
| +++++++++++++++++++
|
||||
|
@ -132,7 +132,7 @@ LL | Self::Baz: Clone,
|
|||
...
|
||||
LL | type Baz = T;
|
||||
| --- required by a bound in this associated type
|
||||
help: consider further restricting type parameter `T`
|
||||
help: consider further restricting type parameter `T` with trait `Clone`
|
||||
|
|
||||
LL | Self::Baz: Clone, T: std::clone::Clone
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -47,7 +47,7 @@ note: required by a bound in `Foo::Bar`
|
|||
|
|
||||
LL | type Bar: Clone = Vec<T>;
|
||||
| ^^^^^ required by this bound in `Foo::Bar`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Clone`
|
||||
|
|
||||
LL | trait Foo<T: std::clone::Clone> {
|
||||
| +++++++++++++++++++
|
||||
|
@ -132,7 +132,7 @@ LL | Self::Baz: Clone,
|
|||
...
|
||||
LL | type Baz = T;
|
||||
| --- required by a bound in this associated type
|
||||
help: consider further restricting type parameter `T`
|
||||
help: consider further restricting type parameter `T` with trait `Clone`
|
||||
|
|
||||
LL | Self::Baz: Clone, T: std::clone::Clone
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -4,7 +4,7 @@ error[E0277]: the trait bound `for<'b> T: X<'b, T>` is not satisfied
|
|||
LL | impl<S, T> X<'_, T> for (S,) {
|
||||
| ^^^^^^^^ the trait `for<'b> X<'b, T>` is not implemented for `T`
|
||||
|
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `X`
|
||||
|
|
||||
LL | impl<S, T: for<'b> X<'b, T>> X<'_, T> for (S,) {
|
||||
| ++++++++++++++++++
|
||||
|
|
|
@ -9,7 +9,7 @@ note: required by a bound in `copy`
|
|||
|
|
||||
LL | fn copy<U: Setup + ?Sized>(from: &U::From) -> U::From {
|
||||
| ^^^^^ required by this bound in `copy`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | pub fn copy_any<T: std::marker::Copy>(t: &T) -> T {
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -14,7 +14,7 @@ note: required by a bound in `Complete::Assoc`
|
|||
|
|
||||
LL | type Assoc: Partial<Self>;
|
||||
| ^^^^^^^^^^^^^ required by this bound in `Complete::Assoc`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | impl<T: std::marker::Copy> Complete for T {
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -7,7 +7,7 @@ LL | |
|
|||
LL | | Service<AssocType = <Bug as Foo>::OnlyFoo>
|
||||
| |______________________________________________^ the trait `Foo` is not implemented for `Bug`
|
||||
|
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `Bug` with trait `Foo`
|
||||
|
|
||||
LL | pub trait ThriftService<Bug: NotFoo + Foo>:
|
||||
| +++++
|
||||
|
@ -24,7 +24,7 @@ LL | |
|
|||
LL | | }
|
||||
| |_^ the trait `Foo` is not implemented for `Bug`
|
||||
|
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `Bug` with trait `Foo`
|
||||
|
|
||||
LL | pub trait ThriftService<Bug: NotFoo + Foo>:
|
||||
| +++++
|
||||
|
@ -38,7 +38,7 @@ LL | | &self,
|
|||
LL | | ) -> Self::AssocType;
|
||||
| |_________________________^ the trait `Foo` is not implemented for `Bug`
|
||||
|
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `Bug` with trait `Foo`
|
||||
|
|
||||
LL | pub trait ThriftService<Bug: NotFoo + Foo>:
|
||||
| +++++
|
||||
|
@ -61,7 +61,7 @@ error[E0277]: the trait bound `Bug: Foo` is not satisfied
|
|||
LL | ) -> Self::AssocType;
|
||||
| ^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bug`
|
||||
|
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `Bug` with trait `Foo`
|
||||
|
|
||||
LL | pub trait ThriftService<Bug: NotFoo + Foo>:
|
||||
| +++++
|
||||
|
|
|
@ -9,7 +9,7 @@ note: captured value is not `Send`
|
|||
|
|
||||
LL | async { (ty, ty1) }
|
||||
| ^^^ has type `U` which is not `Send`
|
||||
help: consider restricting type parameter `U`
|
||||
help: consider restricting type parameter `U` with trait `Send`
|
||||
|
|
||||
LL | fn foo<T: Send, U: std::marker::Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -14,7 +14,7 @@ note: captured value is not `Send` because `&` references cannot be sent unless
|
|||
LL | let x = x;
|
||||
| ^ has type `&T` which is not `Send`, because `T` is not `Sync`
|
||||
= note: required for the cast from `Pin<Box<{async block@$DIR/issue-86507.rs:18:17: 18:27}>>` to `Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with trait `Sync`
|
||||
|
|
||||
LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T)
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -30,7 +30,7 @@ LL | fn copy<T: Magic>(x: T) -> (T, T) { (x, x) }
|
|||
| ^ - you could clone this value
|
||||
| |
|
||||
| consider constraining this type parameter with `Clone`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | fn copy<T: Magic + Copy>(x: T) -> (T, T) { (x, x) }
|
||||
| ++++++
|
||||
|
|
|
@ -17,7 +17,7 @@ LL | lhs + rhs;
|
|||
| --- you could clone this value
|
||||
note: calling this operator moves the left-hand side
|
||||
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `A` with trait `Copy`
|
||||
|
|
||||
LL | fn add<A: Add<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
|
||||
| ++++++
|
||||
|
@ -40,7 +40,7 @@ LL | fn add<A: Add<B, Output=()>, B>(lhs: A, rhs: B) {
|
|||
| ^ consider constraining this type parameter with `Clone`
|
||||
LL | lhs + rhs;
|
||||
| --- you could clone this value
|
||||
help: consider restricting type parameter `B`
|
||||
help: consider restricting type parameter `B` with trait `Copy`
|
||||
|
|
||||
LL | fn add<A: Add<B, Output=()>, B: Copy>(lhs: A, rhs: B) {
|
||||
| ++++++
|
||||
|
@ -64,7 +64,7 @@ LL | lhs - rhs;
|
|||
| --- you could clone this value
|
||||
note: calling this operator moves the left-hand side
|
||||
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `A` with trait `Copy`
|
||||
|
|
||||
LL | fn sub<A: Sub<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
|
||||
| ++++++
|
||||
|
@ -87,7 +87,7 @@ LL | fn sub<A: Sub<B, Output=()>, B>(lhs: A, rhs: B) {
|
|||
| ^ consider constraining this type parameter with `Clone`
|
||||
LL | lhs - rhs;
|
||||
| --- you could clone this value
|
||||
help: consider restricting type parameter `B`
|
||||
help: consider restricting type parameter `B` with trait `Copy`
|
||||
|
|
||||
LL | fn sub<A: Sub<B, Output=()>, B: Copy>(lhs: A, rhs: B) {
|
||||
| ++++++
|
||||
|
@ -111,7 +111,7 @@ LL | lhs * rhs;
|
|||
| --- you could clone this value
|
||||
note: calling this operator moves the left-hand side
|
||||
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `A` with trait `Copy`
|
||||
|
|
||||
LL | fn mul<A: Mul<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
|
||||
| ++++++
|
||||
|
@ -134,7 +134,7 @@ LL | fn mul<A: Mul<B, Output=()>, B>(lhs: A, rhs: B) {
|
|||
| ^ consider constraining this type parameter with `Clone`
|
||||
LL | lhs * rhs;
|
||||
| --- you could clone this value
|
||||
help: consider restricting type parameter `B`
|
||||
help: consider restricting type parameter `B` with trait `Copy`
|
||||
|
|
||||
LL | fn mul<A: Mul<B, Output=()>, B: Copy>(lhs: A, rhs: B) {
|
||||
| ++++++
|
||||
|
@ -158,7 +158,7 @@ LL | lhs / rhs;
|
|||
| --- you could clone this value
|
||||
note: calling this operator moves the left-hand side
|
||||
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `A` with trait `Copy`
|
||||
|
|
||||
LL | fn div<A: Div<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
|
||||
| ++++++
|
||||
|
@ -181,7 +181,7 @@ LL | fn div<A: Div<B, Output=()>, B>(lhs: A, rhs: B) {
|
|||
| ^ consider constraining this type parameter with `Clone`
|
||||
LL | lhs / rhs;
|
||||
| --- you could clone this value
|
||||
help: consider restricting type parameter `B`
|
||||
help: consider restricting type parameter `B` with trait `Copy`
|
||||
|
|
||||
LL | fn div<A: Div<B, Output=()>, B: Copy>(lhs: A, rhs: B) {
|
||||
| ++++++
|
||||
|
@ -205,7 +205,7 @@ LL | lhs % rhs;
|
|||
| --- you could clone this value
|
||||
note: calling this operator moves the left-hand side
|
||||
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `A` with trait `Copy`
|
||||
|
|
||||
LL | fn rem<A: Rem<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
|
||||
| ++++++
|
||||
|
@ -228,7 +228,7 @@ LL | fn rem<A: Rem<B, Output=()>, B>(lhs: A, rhs: B) {
|
|||
| ^ consider constraining this type parameter with `Clone`
|
||||
LL | lhs % rhs;
|
||||
| --- you could clone this value
|
||||
help: consider restricting type parameter `B`
|
||||
help: consider restricting type parameter `B` with trait `Copy`
|
||||
|
|
||||
LL | fn rem<A: Rem<B, Output=()>, B: Copy>(lhs: A, rhs: B) {
|
||||
| ++++++
|
||||
|
@ -252,7 +252,7 @@ LL | lhs & rhs;
|
|||
| --- you could clone this value
|
||||
note: calling this operator moves the left-hand side
|
||||
--> $SRC_DIR/core/src/ops/bit.rs:LL:COL
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `A` with trait `Copy`
|
||||
|
|
||||
LL | fn bitand<A: BitAnd<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
|
||||
| ++++++
|
||||
|
@ -275,7 +275,7 @@ LL | fn bitand<A: BitAnd<B, Output=()>, B>(lhs: A, rhs: B) {
|
|||
| ^ consider constraining this type parameter with `Clone`
|
||||
LL | lhs & rhs;
|
||||
| --- you could clone this value
|
||||
help: consider restricting type parameter `B`
|
||||
help: consider restricting type parameter `B` with trait `Copy`
|
||||
|
|
||||
LL | fn bitand<A: BitAnd<B, Output=()>, B: Copy>(lhs: A, rhs: B) {
|
||||
| ++++++
|
||||
|
@ -299,7 +299,7 @@ LL | lhs | rhs;
|
|||
| --- you could clone this value
|
||||
note: calling this operator moves the left-hand side
|
||||
--> $SRC_DIR/core/src/ops/bit.rs:LL:COL
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `A` with trait `Copy`
|
||||
|
|
||||
LL | fn bitor<A: BitOr<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
|
||||
| ++++++
|
||||
|
@ -322,7 +322,7 @@ LL | fn bitor<A: BitOr<B, Output=()>, B>(lhs: A, rhs: B) {
|
|||
| ^ consider constraining this type parameter with `Clone`
|
||||
LL | lhs | rhs;
|
||||
| --- you could clone this value
|
||||
help: consider restricting type parameter `B`
|
||||
help: consider restricting type parameter `B` with trait `Copy`
|
||||
|
|
||||
LL | fn bitor<A: BitOr<B, Output=()>, B: Copy>(lhs: A, rhs: B) {
|
||||
| ++++++
|
||||
|
@ -346,7 +346,7 @@ LL | lhs ^ rhs;
|
|||
| --- you could clone this value
|
||||
note: calling this operator moves the left-hand side
|
||||
--> $SRC_DIR/core/src/ops/bit.rs:LL:COL
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `A` with trait `Copy`
|
||||
|
|
||||
LL | fn bitxor<A: BitXor<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
|
||||
| ++++++
|
||||
|
@ -369,7 +369,7 @@ LL | fn bitxor<A: BitXor<B, Output=()>, B>(lhs: A, rhs: B) {
|
|||
| ^ consider constraining this type parameter with `Clone`
|
||||
LL | lhs ^ rhs;
|
||||
| --- you could clone this value
|
||||
help: consider restricting type parameter `B`
|
||||
help: consider restricting type parameter `B` with trait `Copy`
|
||||
|
|
||||
LL | fn bitxor<A: BitXor<B, Output=()>, B: Copy>(lhs: A, rhs: B) {
|
||||
| ++++++
|
||||
|
@ -393,7 +393,7 @@ LL | lhs << rhs;
|
|||
| --- you could clone this value
|
||||
note: calling this operator moves the left-hand side
|
||||
--> $SRC_DIR/core/src/ops/bit.rs:LL:COL
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `A` with trait `Copy`
|
||||
|
|
||||
LL | fn shl<A: Shl<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
|
||||
| ++++++
|
||||
|
@ -416,7 +416,7 @@ LL | fn shl<A: Shl<B, Output=()>, B>(lhs: A, rhs: B) {
|
|||
| ^ consider constraining this type parameter with `Clone`
|
||||
LL | lhs << rhs;
|
||||
| --- you could clone this value
|
||||
help: consider restricting type parameter `B`
|
||||
help: consider restricting type parameter `B` with trait `Copy`
|
||||
|
|
||||
LL | fn shl<A: Shl<B, Output=()>, B: Copy>(lhs: A, rhs: B) {
|
||||
| ++++++
|
||||
|
@ -440,7 +440,7 @@ LL | lhs >> rhs;
|
|||
| --- you could clone this value
|
||||
note: calling this operator moves the left-hand side
|
||||
--> $SRC_DIR/core/src/ops/bit.rs:LL:COL
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `A` with trait `Copy`
|
||||
|
|
||||
LL | fn shr<A: Shr<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
|
||||
| ++++++
|
||||
|
@ -463,7 +463,7 @@ LL | fn shr<A: Shr<B, Output=()>, B>(lhs: A, rhs: B) {
|
|||
| ^ consider constraining this type parameter with `Clone`
|
||||
LL | lhs >> rhs;
|
||||
| --- you could clone this value
|
||||
help: consider restricting type parameter `B`
|
||||
help: consider restricting type parameter `B` with trait `Copy`
|
||||
|
|
||||
LL | fn shr<A: Shr<B, Output=()>, B: Copy>(lhs: A, rhs: B) {
|
||||
| ++++++
|
||||
|
|
|
@ -20,7 +20,7 @@ LL | x
|
|||
| - you could clone this value
|
||||
note: calling this operator moves the left-hand side
|
||||
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | fn double_move<T: Add<Output=()> + Copy>(x: T) {
|
||||
| ++++++
|
||||
|
@ -40,7 +40,7 @@ help: consider cloning the value if the performance cost is acceptable
|
|||
|
|
||||
LL | x.clone()
|
||||
| ++++++++
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | fn move_then_borrow<T: Add<Output=()> + Clone + Copy>(x: T) {
|
||||
| ++++++
|
||||
|
|
|
@ -6,7 +6,7 @@ LL | val == val
|
|||
| |
|
||||
| MyType<T>
|
||||
|
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with trait `Eq`
|
||||
|
|
||||
LL | fn cond<T: PartialEq + std::cmp::Eq>(val: MyType<T>) -> bool {
|
||||
| ++++++++++++++
|
||||
|
|
|
@ -12,7 +12,7 @@ LL |
|
|||
LL | drop(cloned_items);
|
||||
| ------------ immutable borrow later used here
|
||||
|
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with trait `Clone`
|
||||
|
|
||||
LL | fn foo<T: Default + Clone>(list: &mut Vec<T>) {
|
||||
| +++++++
|
||||
|
@ -39,7 +39,7 @@ LL | fn bar<T: std::fmt::Display>(x: T) {
|
|||
| ^ consider constraining this type parameter with `Clone`
|
||||
LL | let a = &x;
|
||||
| - you could clone this value
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with trait `Clone`
|
||||
|
|
||||
LL | fn bar<T: std::fmt::Display + Clone>(x: T) {
|
||||
| +++++++
|
||||
|
|
|
@ -15,7 +15,7 @@ LL | fn test<T, U>(a: i64, b: i64, c: i64, d: i64, e: i64, f: T, g: U) -> i64 {
|
|||
...
|
||||
LL | 6, a as f64, b, b as f64, f, c as f64, d, d as f64, e, e as f64, f, g,
|
||||
| - you could clone this value
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | fn test<T: Copy, U>(a: i64, b: i64, c: i64, d: i64, e: i64, f: T, g: U) -> i64 {
|
||||
| ++++++
|
||||
|
|
|
@ -10,7 +10,7 @@ note: required by a bound in `Foo`
|
|||
|
|
||||
LL | trait Foo : Send+Sync { }
|
||||
| ^^^^ required by this bound in `Foo`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with trait `Send`
|
||||
|
|
||||
LL | impl <T: Sync+'static + std::marker::Send> Foo for (T,) { }
|
||||
| +++++++++++++++++++
|
||||
|
@ -27,7 +27,7 @@ note: required by a bound in `Foo`
|
|||
|
|
||||
LL | trait Foo : Send+Sync { }
|
||||
| ^^^^ required by this bound in `Foo`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with trait `Sync`
|
||||
|
|
||||
LL | impl <T: Send + std::marker::Sync> Foo for (T,T) { }
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -14,7 +14,7 @@ note: required by a bound in `RequiresRequiresShareAndSend`
|
|||
|
|
||||
LL | pub trait RequiresRequiresShareAndSend : RequiresShare + Send { }
|
||||
| ^^^^ required by this bound in `RequiresRequiresShareAndSend`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with trait `Send`
|
||||
|
|
||||
LL | impl <T:Sync+'static + std::marker::Send> RequiresRequiresShareAndSend for X<T> { }
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -9,7 +9,7 @@ note: required by a bound in `Foo`
|
|||
|
|
||||
LL | trait Foo : Send { }
|
||||
| ^^^^ required by this bound in `Foo`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with trait `Send`
|
||||
|
|
||||
LL | impl <T: Sync+'static + std::marker::Send> Foo for T { }
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -9,7 +9,7 @@ note: required by a bound in `X`
|
|||
|
|
||||
LL | struct X<F> where F: FnOnce() + 'static + Send {
|
||||
| ^^^^ required by this bound in `X`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `F` with trait `Send`
|
||||
|
|
||||
LL | fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static + std::marker::Send {
|
||||
| +++++++++++++++++++
|
||||
|
@ -25,7 +25,7 @@ note: required by a bound in `X`
|
|||
|
|
||||
LL | struct X<F> where F: FnOnce() + 'static + Send {
|
||||
| ^^^^ required by this bound in `X`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `F` with trait `Send`
|
||||
|
|
||||
LL | fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static + std::marker::Send {
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -15,7 +15,7 @@ help: use parentheses to call this type parameter
|
|||
|
|
||||
LL | take_const_owned(f());
|
||||
| ++
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `F` with trait `Sync`
|
||||
|
|
||||
LL | fn give_owned<F>(f: F) where F: FnOnce() + Send + std::marker::Sync {
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -7,7 +7,7 @@ LL | || { t; t; };
|
|||
| value moved here
|
||||
|
|
||||
= note: move occurs because `t` has type `T`, which does not implement the `Copy` trait
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | fn foo<T: Copy>(t: T) {
|
||||
| ++++++
|
||||
|
|
|
@ -41,7 +41,7 @@ note: required by a bound in `W`
|
|||
|
|
||||
LL | struct W<T: Trait>(*mut T);
|
||||
| ^^^^^ required by this bound in `W`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Trait`
|
||||
|
|
||||
LL | impl<T: Trait> Trait for W<W<W<T>>> {}
|
||||
| +++++++
|
||||
|
|
|
@ -7,7 +7,7 @@ LL | [x; { N }]
|
|||
= note: the `Copy` trait is required because this value will be copied for each element of the array
|
||||
= help: consider using `core::array::from_fn` to initialize the array
|
||||
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] {
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -7,7 +7,7 @@ LL | [x; N]
|
|||
= note: the `Copy` trait is required because this value will be copied for each element of the array
|
||||
= help: consider using `core::array::from_fn` to initialize the array
|
||||
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] {
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -12,7 +12,7 @@ LL | fn unsatisfied(self)
|
|||
LL | where
|
||||
LL | T: Bar<N>,
|
||||
| ^^^^^^ required by this bound in `Foo::<T, N>::unsatisfied`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Bar`
|
||||
|
|
||||
LL | impl<T: Bar<N>, const N: usize> Foo<T, N> {
|
||||
| ++++++++
|
||||
|
|
|
@ -212,10 +212,6 @@ LL | f()
|
|||
| ^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | T: ~const Fn<()> + ~const Destruct + ~const Fn(),
|
||||
| +++++++++++++
|
||||
|
||||
error[E0015]: cannot call non-const closure in constant functions
|
||||
--> $DIR/fn_trait_refs.rs:23:5
|
||||
|
@ -224,10 +220,6 @@ LL | f()
|
|||
| ^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | T: ~const FnMut<()> + ~const Destruct + ~const FnMut(),
|
||||
| ++++++++++++++++
|
||||
|
||||
error[E0015]: cannot call non-const closure in constant functions
|
||||
--> $DIR/fn_trait_refs.rs:30:5
|
||||
|
@ -236,10 +228,6 @@ LL | f()
|
|||
| ^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | T: ~const FnOnce<()> + ~const FnOnce(),
|
||||
| +++++++++++++++++
|
||||
|
||||
error: aborting due to 25 previous errors
|
||||
|
||||
|
|
|
@ -19,10 +19,6 @@ LL | Opt::None => f(),
|
|||
| ^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | const fn unwrap_or_else<F: ~const FnOnce() -> T + ~const FnOnce()>(self, f: F) -> T {
|
||||
| +++++++++++++++++
|
||||
|
||||
error[E0493]: destructor of `F` cannot be evaluated at compile-time
|
||||
--> $DIR/unstable-const-fn-in-libcore.rs:19:60
|
||||
|
|
|
@ -9,7 +9,7 @@ note: required by a bound in `DropMe`
|
|||
|
|
||||
LL | struct DropMe<T: Copy>(T);
|
||||
| ^^^^ required by this bound in `DropMe`
|
||||
help: consider further restricting type parameter `T`
|
||||
help: consider further restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy`
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -25,7 +25,7 @@ note: required by a bound in `DropMe`
|
|||
|
|
||||
LL | struct DropMe<T: Copy>(T);
|
||||
| ^^^^ required by this bound in `DropMe`
|
||||
help: consider further restricting type parameter `T`
|
||||
help: consider further restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy`
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -9,7 +9,7 @@ note: required by a bound in `DropMe`
|
|||
|
|
||||
LL | struct DropMe<T: Copy>(T);
|
||||
| ^^^^ required by this bound in `DropMe`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | impl<T: std::marker::Copy> Drop for DropMe<T>
|
||||
| +++++++++++++++++++
|
||||
|
@ -25,7 +25,7 @@ note: required by a bound in `DropMe`
|
|||
|
|
||||
LL | struct DropMe<T: Copy>(T);
|
||||
| ^^^^ required by this bound in `DropMe`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | impl<T: std::marker::Copy> Drop for DropMe<T>
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -42,7 +42,7 @@ error[E0277]: the trait bound `I: Foo` is not satisfied
|
|||
LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `I`
|
||||
|
|
||||
help: consider restricting type parameter `I`
|
||||
help: consider restricting type parameter `I` with trait `Foo`
|
||||
|
|
||||
LL | fn baz<I: Foo>(x: &<I as Foo<A = Bar>>::A) {}
|
||||
| +++++
|
||||
|
@ -53,7 +53,7 @@ error[E0277]: the trait bound `I: Foo` is not satisfied
|
|||
LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {}
|
||||
| ^^ the trait `Foo` is not implemented for `I`
|
||||
|
|
||||
help: consider restricting type parameter `I`
|
||||
help: consider restricting type parameter `I` with trait `Foo`
|
||||
|
|
||||
LL | fn baz<I: Foo>(x: &<I as Foo<A = Bar>>::A) {}
|
||||
| +++++
|
||||
|
|
|
@ -25,7 +25,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
@ -73,7 +73,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `Iterator`
|
||||
|
|
||||
LL | fn example<Q: std::iter::Iterator>(q: Q) {
|
||||
| +++++++++++++++++++++
|
||||
|
@ -100,7 +100,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `Iterator`
|
||||
|
|
||||
LL | fn example<Q: std::iter::Iterator>(q: Q) {
|
||||
| +++++++++++++++++++++
|
||||
|
@ -125,7 +125,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
@ -150,7 +150,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
@ -175,7 +175,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
@ -200,7 +200,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
@ -225,7 +225,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
@ -248,7 +248,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
@ -273,7 +273,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
@ -296,7 +296,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
@ -319,7 +319,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
@ -342,7 +342,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
@ -367,7 +367,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
@ -392,7 +392,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
|
|
@ -23,7 +23,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
@ -53,7 +53,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
@ -85,7 +85,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
@ -117,7 +117,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
@ -147,7 +147,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
@ -172,7 +172,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T2`
|
||||
|
|
||||
LL | fn example<Q: T2>(q: Q) {
|
||||
| ++++
|
||||
|
@ -204,7 +204,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
@ -236,7 +236,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
@ -261,7 +261,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T1`
|
||||
|
|
||||
LL | fn example<Q: T1>(q: Q) {
|
||||
| ++++
|
||||
|
@ -286,7 +286,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T1`
|
||||
|
|
||||
LL | fn example<Q: T1>(q: Q) {
|
||||
| ++++
|
||||
|
@ -318,7 +318,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
@ -343,7 +343,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T1`
|
||||
|
|
||||
LL | fn example<Q: T1>(q: Q) {
|
||||
| ++++
|
||||
|
@ -370,7 +370,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T1`
|
||||
|
|
||||
LL | fn example<Q: T1>(q: Q) {
|
||||
| ++++
|
||||
|
@ -402,7 +402,7 @@ note: required by a bound in `want`
|
|||
|
|
||||
LL | fn want<V: T1>(_x: V) {}
|
||||
| ^^ required by this bound in `want`
|
||||
help: consider restricting type parameter `Q`
|
||||
help: consider restricting type parameter `Q` with trait `T3`
|
||||
|
|
||||
LL | fn example<Q: T3>(q: Q) {
|
||||
| ++++
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | type Assoc2<T> = Vec<T>;
|
|||
| ^^^^^^ `T` cannot be formatted with the default formatter
|
||||
|
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Display`
|
||||
|
|
||||
LL | type Assoc2<T: std::fmt::Display> = Vec<T>;
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -41,7 +41,7 @@ LL | trait Foo {
|
|||
LL | type C where Self: Clone;
|
||||
| ^ this trait's associated type doesn't have the requirement `Fooy<T>: Copy`
|
||||
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | impl<T: std::marker::Copy> Foo for Fooy<T> {
|
||||
| +++++++++++++++++++
|
||||
|
@ -66,7 +66,7 @@ LL | trait Foo {
|
|||
LL | fn d() where Self: Clone;
|
||||
| ^ this trait's method doesn't have the requirement `Fooy<T>: Copy`
|
||||
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | impl<T: std::marker::Copy> Foo for Fooy<T> {
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -9,7 +9,7 @@ note: required by a bound in `UnsafeCopy::Item`
|
|||
|
|
||||
LL | type Item<'a>: Copy;
|
||||
| ^^^^ required by this bound in `UnsafeCopy::Item`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | impl<T: std::marker::Copy> UnsafeCopy for T {
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -10,7 +10,7 @@ note: required by a bound in `Fun::F`
|
|||
|
|
||||
LL | type F<'a>: Fn() -> u32;
|
||||
| ^^^^^^^^^^^ required by this bound in `Fun::F`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Fn`
|
||||
|
|
||||
LL | impl<T: Fn()> Fun for T {
|
||||
| ++++++
|
||||
|
|
|
@ -10,7 +10,7 @@ note: required by a bound in `Fun::F`
|
|||
|
|
||||
LL | type F<'a>: Fn() -> u32;
|
||||
| ^^^^^^^^^^^ required by this bound in `Fun::F`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Fn`
|
||||
|
|
||||
LL | impl<T: Fn()> Fun for T {
|
||||
| ++++++
|
||||
|
|
|
@ -10,7 +10,7 @@ note: required by a bound in `Fun::F`
|
|||
|
|
||||
LL | type F<'a>: Fn() -> u32;
|
||||
| ^^^^^^^^^^^ required by this bound in `Fun::F`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Fn`
|
||||
|
|
||||
LL | impl<T: Fn()> Fun for T {
|
||||
| ++++++
|
||||
|
|
|
@ -10,7 +10,7 @@ note: required by a bound in `Fun::F`
|
|||
|
|
||||
LL | type F<'a>: Fn() -> u32;
|
||||
| ^^^^^^^^^^^ required by this bound in `Fun::F`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Fn`
|
||||
|
|
||||
LL | impl<T: Fn()> Fun for T {
|
||||
| ++++++
|
||||
|
|
|
@ -23,7 +23,7 @@ note: required by a bound in `UnsafeCopy::Copy`
|
|||
|
|
||||
LL | type Copy<T>: Copy = Box<T>;
|
||||
| ^^^^ required by this bound in `UnsafeCopy::Copy`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Clone`
|
||||
|
|
||||
LL | type Copy<T: std::clone::Clone>: Copy = Box<T>;
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -23,7 +23,7 @@ note: required by a bound in `UnsafeCopy::Copy`
|
|||
|
|
||||
LL | type Copy<T>: Copy = Box<T>;
|
||||
| ^^^^ required by this bound in `UnsafeCopy::Copy`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Clone`
|
||||
|
|
||||
LL | type Copy<T: std::clone::Clone>: Copy = Box<T>;
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -71,7 +71,7 @@ LL | Self(self.0 + rhs.0)
|
|||
| |
|
||||
| B
|
||||
|
|
||||
help: consider restricting type parameter `B`
|
||||
help: consider restricting type parameter `B` with trait `Add`
|
||||
|
|
||||
LL | impl<B: std::ops::Add<Output = B>> Add for D<B> {
|
||||
| +++++++++++++++++++++++++++
|
||||
|
|
|
@ -5,7 +5,7 @@ error[E0277]: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied
|
|||
LL | impl<T> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {}
|
||||
| ^^^^^^^^^^^^ the trait `for<'a> ToUnit<'a>` is not implemented for `T`
|
||||
|
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `ToUnit`
|
||||
|
|
||||
LL | impl<T: for<'a> ToUnit<'a>> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {}
|
||||
| ++++++++++++++++++++
|
||||
|
|
|
@ -13,7 +13,7 @@ LL | fn want_bar_for_any_ccx<B>(b: &B)
|
|||
| -------------------- required by a bound in this function
|
||||
LL | where B : for<'ccx> Bar<'ccx>
|
||||
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_bar_for_any_ccx`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `B` with trait `Bar`
|
||||
|
|
||||
LL | where B : Qux + for<'ccx> Bar<'ccx>
|
||||
| +++++++++++++++++++++
|
||||
|
|
|
@ -4,7 +4,7 @@ error[E0277]: the trait bound `for<'a> T: SomeTrait<'a>` is not satisfied
|
|||
LL | callee::<fn(&()) -> <T as SomeTrait<'_>>::Associated>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> SomeTrait<'a>` is not implemented for `T`
|
||||
|
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `SomeTrait`
|
||||
|
|
||||
LL | fn give_me_ice<T: for<'a> SomeTrait<'a>>() {
|
||||
| +++++++++++++++++++++++
|
||||
|
@ -15,7 +15,7 @@ error[E0277]: the trait bound `for<'a> T: SomeTrait<'a>` is not satisfied
|
|||
LL | callee::<fn(&()) -> <T as SomeTrait<'_>>::Associated>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> SomeTrait<'a>` is not implemented for `T`
|
||||
|
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `SomeTrait`
|
||||
|
|
||||
LL | fn give_me_ice<T: for<'a> SomeTrait<'a>>() {
|
||||
| +++++++++++++++++++++++
|
||||
|
|
|
@ -17,7 +17,7 @@ LL | impl<A, F: MyFn<A>> Callback<A> for F {
|
|||
| ------- ^^^^^^^^^^^ ^
|
||||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `F` with trait `MyFn`
|
||||
|
|
||||
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
|
||||
| +++++++++++
|
||||
|
@ -43,7 +43,7 @@ LL | fn autobatch<F>(self) -> impl Trait
|
|||
...
|
||||
LL | F: Callback<Self::CallbackArg>,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `<Sender as ChannelSender>::autobatch`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `F` with trait `MyFn`
|
||||
|
|
||||
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
|
||||
| +++++++++++
|
||||
|
@ -68,7 +68,7 @@ LL | impl<A, F: MyFn<A>> Callback<A> for F {
|
|||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `F` with trait `MyFn`
|
||||
|
|
||||
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
|
||||
| +++++++++++
|
||||
|
@ -121,7 +121,7 @@ LL | impl<A, F: MyFn<A>> Callback<A> for F {
|
|||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `F` with trait `MyFn`
|
||||
|
|
||||
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
|
||||
| +++++++++++
|
||||
|
@ -137,7 +137,7 @@ note: required by a bound in `Callback`
|
|||
|
|
||||
LL | trait Callback<A>: MyFn<A, Output = Self::Ret> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Callback`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `F` with trait `MyFn`
|
||||
|
|
||||
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
|
||||
| +++++++++++
|
||||
|
|
|
@ -17,7 +17,7 @@ LL | (S::default(), T::default())
|
|||
| ---------------------------- return type was inferred to be `(S, T)` here
|
||||
|
|
||||
= note: required because it appears within the type `(S, T)`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `S` with trait `Copy`
|
||||
|
|
||||
LL | impl<S: Default + std::marker::Copy> Bar for S {
|
||||
| +++++++++++++++++++
|
||||
|
@ -32,7 +32,7 @@ LL | (S::default(), T::default())
|
|||
| ---------------------------- return type was inferred to be `(S, T)` here
|
||||
|
|
||||
= note: required because it appears within the type `(S, T)`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | fn foo<T: Default + std::marker::Copy>() -> Self::E {
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -33,10 +33,6 @@ LL | fun(filter_positive());
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct + ~const Fn(&foo::Alias<'_>)>(fun: F) {
|
||||
| ++++++++++++++++++++++++++++
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ LL | self.x += v.x;
|
|||
| |
|
||||
| cannot use `+=` on type `T`
|
||||
|
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `AddAssign`
|
||||
|
|
||||
LL | impl<T: std::ops::AddAssign> Foo<T> {
|
||||
| +++++++++++++++++++++
|
||||
|
|
|
@ -12,7 +12,7 @@ LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
|||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
= note: required for the cast from `&S<T>` to `&dyn Gettable<T>`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Send`
|
||||
|
|
||||
LL | fn f<T: std::marker::Send>(val: T) {
|
||||
| +++++++++++++++++++
|
||||
|
@ -31,7 +31,7 @@ LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
|||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
= note: required for the cast from `&S<T>` to `&dyn Gettable<T>`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | fn f<T: std::marker::Copy>(val: T) {
|
||||
| +++++++++++++++++++
|
||||
|
@ -50,7 +50,7 @@ LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
|||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
= note: required for the cast from `&S<T>` to `&dyn Gettable<T>`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Send`
|
||||
|
|
||||
LL | fn g<T: std::marker::Send>(val: T) {
|
||||
| +++++++++++++++++++
|
||||
|
@ -69,7 +69,7 @@ LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
|||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
= note: required for the cast from `&S<T>` to `&dyn Gettable<T>`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | fn g<T: std::marker::Copy>(val: T) {
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -6,7 +6,7 @@ LL | impl<A, B> FnOnce<A> for CachedFun<A, B>
|
|||
|
|
||||
note: required by a bound in `FnOnce`
|
||||
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `A` with unstable trait `Tuple`
|
||||
|
|
||||
LL | A: Eq + Hash + Clone + std::marker::Tuple,
|
||||
| ++++++++++++++++++++
|
||||
|
@ -19,7 +19,7 @@ LL | impl<A, B> FnMut<A> for CachedFun<A, B>
|
|||
|
|
||||
note: required by a bound in `FnMut`
|
||||
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `A` with unstable trait `Tuple`
|
||||
|
|
||||
LL | A: Eq + Hash + Clone + std::marker::Tuple,
|
||||
| ++++++++++++++++++++
|
||||
|
@ -30,7 +30,7 @@ error[E0277]: functions with the "rust-call" ABI must take a single non-self tup
|
|||
LL | extern "rust-call" fn call_once(mut self, a: A) -> Self::Output {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Tuple` is not implemented for `A`
|
||||
|
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `A` with unstable trait `Tuple`
|
||||
|
|
||||
LL | A: Eq + Hash + Clone + std::marker::Tuple,
|
||||
| ++++++++++++++++++++
|
||||
|
@ -41,7 +41,7 @@ error[E0277]: functions with the "rust-call" ABI must take a single non-self tup
|
|||
LL | extern "rust-call" fn call_mut(&mut self, a: A) -> Self::Output {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Tuple` is not implemented for `A`
|
||||
|
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `A` with unstable trait `Tuple`
|
||||
|
|
||||
LL | A: Eq + Hash + Clone + std::marker::Tuple,
|
||||
| ++++++++++++++++++++
|
||||
|
@ -56,7 +56,7 @@ LL | self.call_mut(a)
|
|||
|
|
||||
note: required by a bound in `call_mut`
|
||||
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `A` with unstable trait `Tuple`
|
||||
|
|
||||
LL | A: Eq + Hash + Clone + std::marker::Tuple,
|
||||
| ++++++++++++++++++++
|
||||
|
|
|
@ -4,7 +4,7 @@ error[E0277]: cannot multiply `T` by `T`
|
|||
LL | type Alias<T> = <T as std::ops::Mul>::Output;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `T * T`
|
||||
|
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Mul`
|
||||
|
|
||||
LL | type Alias<T: std::ops::Mul> = <T as std::ops::Mul>::Output;
|
||||
| +++++++++++++++
|
||||
|
|
|
@ -8,7 +8,7 @@ LL | | where
|
|||
LL | | F: for<'a> FnOnce(<F as Output<'a>>::Type),
|
||||
| |___________________________________________________^ the trait `for<'a> Output<'a>` is not implemented for `F`
|
||||
|
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `F` with trait `Output`
|
||||
|
|
||||
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + for<'a> Output<'a>,
|
||||
| ++++++++++++++++++++
|
||||
|
@ -19,7 +19,7 @@ error[E0277]: the trait bound `for<'a> F: Output<'a>` is not satisfied
|
|||
LL | fn do_something_wrapper<O, F>(self, _: F)
|
||||
| ^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Output<'a>` is not implemented for `F`
|
||||
|
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `F` with trait `Output`
|
||||
|
|
||||
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + for<'a> Output<'a>,
|
||||
| ++++++++++++++++++++
|
||||
|
@ -30,7 +30,7 @@ error[E0277]: the trait bound `F: Output<'_>` is not satisfied
|
|||
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Output<'_>` is not implemented for `F`
|
||||
|
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `F` with trait `Output`
|
||||
|
|
||||
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + Output<'_>,
|
||||
| ++++++++++++
|
||||
|
@ -41,7 +41,7 @@ error[E0277]: the trait bound `F: Output<'_>` is not satisfied
|
|||
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Output<'_>` is not implemented for `F`
|
||||
|
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `F` with trait `Output`
|
||||
|
|
||||
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + Output<'_>,
|
||||
| ++++++++++++
|
||||
|
|
|
@ -10,7 +10,7 @@ note: required by a bound in `CastTo`
|
|||
|
|
||||
LL | pub trait CastTo<U: ?Sized>: Unsize<U> {}
|
||||
| ^^^^^^^^^ required by this bound in `CastTo`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with unstable trait `Unsize`
|
||||
|
|
||||
LL | impl<T: ?Sized + std::marker::Unsize<U>, U: ?Sized> CastTo<U> for T {}
|
||||
| ++++++++++++++++++++++++
|
||||
|
|
|
@ -6,7 +6,7 @@ LL | let _ = s == t;
|
|||
| |
|
||||
| &[T]
|
||||
|
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `PartialEq`
|
||||
|
|
||||
LL | pub fn foo<T: std::cmp::PartialEq>(s: &[T], t: &[T]) {
|
||||
| +++++++++++++++++++++
|
||||
|
|
|
@ -18,7 +18,7 @@ note: `Foo::zero` takes ownership of the receiver `self`, which moves `x`
|
|||
|
|
||||
LL | fn zero(self) -> Self;
|
||||
| ^^^^
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | pub fn baz<T: Foo + Copy>(x: T) -> T {
|
||||
| ++++++
|
||||
|
|
|
@ -48,7 +48,7 @@ fn duplicate_custom_1<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) where {
|
|||
fn duplicate_custom_2<T>(t: S<T>) -> (S<T>, S<T>)
|
||||
where
|
||||
T: A + Copy + Trait,
|
||||
//~^ HELP consider further restricting this bound
|
||||
//~^ HELP consider further restricting
|
||||
{
|
||||
(t, t) //~ use of moved value: `t`
|
||||
}
|
||||
|
@ -56,14 +56,14 @@ where
|
|||
fn duplicate_custom_3<T>(t: S<T>) -> (S<T>, S<T>)
|
||||
where
|
||||
T: A + Copy + Trait,
|
||||
//~^ HELP consider further restricting this bound
|
||||
//~^ HELP consider further restricting
|
||||
T: B,
|
||||
{
|
||||
(t, t) //~ use of moved value: `t`
|
||||
}
|
||||
|
||||
fn duplicate_custom_4<T: A + Copy + Trait>(t: S<T>) -> (S<T>, S<T>)
|
||||
//~^ HELP consider further restricting this bound
|
||||
//~^ HELP consider further restricting
|
||||
where
|
||||
T: B,
|
||||
{
|
||||
|
|
|
@ -48,7 +48,7 @@ fn duplicate_custom_1<T>(t: S<T>) -> (S<T>, S<T>) where {
|
|||
fn duplicate_custom_2<T>(t: S<T>) -> (S<T>, S<T>)
|
||||
where
|
||||
T: A,
|
||||
//~^ HELP consider further restricting this bound
|
||||
//~^ HELP consider further restricting
|
||||
{
|
||||
(t, t) //~ use of moved value: `t`
|
||||
}
|
||||
|
@ -56,14 +56,14 @@ where
|
|||
fn duplicate_custom_3<T>(t: S<T>) -> (S<T>, S<T>)
|
||||
where
|
||||
T: A,
|
||||
//~^ HELP consider further restricting this bound
|
||||
//~^ HELP consider further restricting
|
||||
T: B,
|
||||
{
|
||||
(t, t) //~ use of moved value: `t`
|
||||
}
|
||||
|
||||
fn duplicate_custom_4<T: A>(t: S<T>) -> (S<T>, S<T>)
|
||||
//~^ HELP consider further restricting this bound
|
||||
//~^ HELP consider further restricting
|
||||
where
|
||||
T: B,
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@ LL | fn duplicate_t<T>(t: T) -> (T, T) {
|
|||
...
|
||||
LL | (t, t)
|
||||
| - you could clone this value
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | fn duplicate_t<T: Copy>(t: T) -> (T, T) {
|
||||
| ++++++
|
||||
|
@ -33,7 +33,7 @@ LL | (t, t)
|
|||
| |
|
||||
| value moved here
|
||||
|
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | fn duplicate_opt<T: Copy>(t: Option<T>) -> (Option<T>, Option<T>) {
|
||||
| ++++++
|
||||
|
@ -49,7 +49,7 @@ LL | (t, t)
|
|||
| |
|
||||
| value moved here
|
||||
|
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | fn duplicate_tup1<T: Copy>(t: (T,)) -> ((T,), (T,)) {
|
||||
| ++++++
|
||||
|
@ -81,7 +81,7 @@ LL | (t, t)
|
|||
| |
|
||||
| value moved here
|
||||
|
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with traits `Copy` and `Trait`
|
||||
|
|
||||
LL | fn duplicate_custom<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) {
|
||||
| ++++++++++++++
|
||||
|
@ -97,7 +97,7 @@ LL | (t, t)
|
|||
| |
|
||||
| value moved here
|
||||
|
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with traits `Copy` and `Trait`
|
||||
|
|
||||
LL | fn duplicate_custom_1<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) where {
|
||||
| ++++++++++++++
|
||||
|
@ -113,7 +113,7 @@ LL | (t, t)
|
|||
| |
|
||||
| value moved here
|
||||
|
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with traits `Copy` and `Trait`
|
||||
|
|
||||
LL | T: A + Copy + Trait,
|
||||
| ++++++++++++++
|
||||
|
@ -129,7 +129,7 @@ LL | (t, t)
|
|||
| |
|
||||
| value moved here
|
||||
|
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with traits `Copy` and `Trait`
|
||||
|
|
||||
LL | T: A + Copy + Trait,
|
||||
| ++++++++++++++
|
||||
|
@ -145,7 +145,7 @@ LL | (t, t)
|
|||
| |
|
||||
| value moved here
|
||||
|
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with traits `Copy` and `Trait`
|
||||
|
|
||||
LL | fn duplicate_custom_4<T: A + Copy + Trait>(t: S<T>) -> (S<T>, S<T>)
|
||||
| ++++++++++++++
|
||||
|
@ -169,7 +169,7 @@ LL | fn existing_colon<T:>(t: T) {
|
|||
...
|
||||
LL | [t, t];
|
||||
| - you could clone this value
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | fn existing_colon<T: Copy>(t: T) {
|
||||
| ++++
|
||||
|
@ -193,7 +193,7 @@ LL | fn existing_colon_in_where<T>(t: T)
|
|||
...
|
||||
LL | [t, t];
|
||||
| - you could clone this value
|
||||
help: consider further restricting type parameter `T`
|
||||
help: consider further restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | T:, T: Copy
|
||||
| ~~~~~~~~~
|
||||
|
|
|
@ -23,7 +23,7 @@ note: required by a bound in `is_zen`
|
|||
|
|
||||
LL | fn is_zen<T: Zen>(_: T) {}
|
||||
| ^^^ required by this bound in `is_zen`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Sync`
|
||||
|
|
||||
LL | fn not_sync<T: std::marker::Sync>(x: Guard<T>) {
|
||||
| +++++++++++++++++++
|
||||
|
@ -58,7 +58,7 @@ note: required by a bound in `is_zen`
|
|||
|
|
||||
LL | fn is_zen<T: Zen>(_: T) {}
|
||||
| ^^^ required by this bound in `is_zen`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Sync`
|
||||
|
|
||||
LL | fn nested_not_sync<T: std::marker::Sync>(x: Nested<Guard<T>>) {
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -4,7 +4,7 @@ error[E0277]: the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied
|
|||
LL | fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'z> Trait2<'y, 'z>` is not implemented for `T`
|
||||
|
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Trait2`
|
||||
|
|
||||
LL | fn callee<'x, 'y, T: for<'z> Trait2<'y, 'z>>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >)
|
||||
| ++++++++++++++++++++++++
|
||||
|
@ -17,7 +17,7 @@ LL | |
|
|||
LL | | }
|
||||
| |_^ the trait `for<'z> Trait2<'y, 'z>` is not implemented for `T`
|
||||
|
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Trait2`
|
||||
|
|
||||
LL | fn callee<'x, 'y, T: for<'z> Trait2<'y, 'z>>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >)
|
||||
| ++++++++++++++++++++++++
|
||||
|
|
|
@ -15,7 +15,7 @@ error[E0220]: associated type `Baa` not found for `T`
|
|||
LL | T::Baa: std::fmt::Debug,
|
||||
| ^^^ there is a similarly named associated type `Bar` in the trait `Foo`
|
||||
|
|
||||
help: consider further restricting type parameter `T`
|
||||
help: consider further restricting type parameter `T` with trait `Foo`
|
||||
|
|
||||
LL | T::Baa: std::fmt::Debug, T: Foo
|
||||
| ~~~~~~~~
|
||||
|
|
|
@ -20,7 +20,7 @@ note: required by a bound in `X::U`
|
|||
|
|
||||
LL | type U<'a>: PartialEq<&'a Self> where Self: 'a;
|
||||
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `X::U`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with trait `PartialEq`
|
||||
|
|
||||
LL | impl<T: 'static + std::cmp::PartialEq> X for T {
|
||||
| +++++++++++++++++++++
|
||||
|
|
|
@ -19,7 +19,7 @@ note: required by a bound in `Foo`
|
|||
|
|
||||
LL | trait Foo<'a, T: Eq + 'a> { }
|
||||
| ^^ required by this bound in `Foo`
|
||||
help: consider restricting type parameter `U`
|
||||
help: consider restricting type parameter `U` with trait `Eq`
|
||||
|
|
||||
LL | default impl<U: std::cmp::Eq> Foo<'static, U> for () {}
|
||||
| ++++++++++++++
|
||||
|
|
|
@ -9,7 +9,7 @@ note: required by a bound in `UncheckedCopy::Output`
|
|||
|
|
||||
LL | type Output: From<Self> + Copy + Into<Self>;
|
||||
| ^^^^ required by this bound in `UncheckedCopy::Output`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Copy`
|
||||
|
|
||||
LL | impl<T: std::marker::Copy> UncheckedCopy for T {
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | impl<B: ?Sized> Display for Cow<'_, B> {
|
|||
| ^^^^^^^^^^ the trait `Clone` is not implemented for `B`
|
||||
|
|
||||
= note: required for `B` to implement `ToOwned`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `B` with trait `Clone`
|
||||
|
|
||||
LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
|
||||
| +++++++++++++++++++
|
||||
|
@ -17,7 +17,7 @@ LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `B`
|
||||
|
|
||||
= note: required for `B` to implement `ToOwned`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `B` with trait `Clone`
|
||||
|
|
||||
LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
|
||||
| +++++++++++++++++++
|
||||
|
@ -29,7 +29,7 @@ LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|||
| ^^^^ the trait `Clone` is not implemented for `B`
|
||||
|
|
||||
= note: required for `B` to implement `ToOwned`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `B` with trait `Clone`
|
||||
|
|
||||
LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
|
||||
| +++++++++++++++++++
|
||||
|
@ -47,7 +47,7 @@ LL | | }
|
|||
| |_____^ the trait `Clone` is not implemented for `B`
|
||||
|
|
||||
= note: required for `B` to implement `ToOwned`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `B` with trait `Clone`
|
||||
|
|
||||
LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -4,7 +4,7 @@ error[E0277]: the trait bound `T: GlUniformScalar` is not satisfied
|
|||
LL | <T as GlUniformScalar>::FACTORY(1, value);
|
||||
| ^ the trait `GlUniformScalar` is not implemented for `T`
|
||||
|
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with trait `GlUniformScalar`
|
||||
|
|
||||
LL | pub fn foo<T: UniformScalar + GlUniformScalar>(value: T) {
|
||||
| +++++++++++++++++
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | println!("{:?}", t);
|
|||
| ^ `impl Sized` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider further restricting this bound
|
||||
help: consider restricting opaque type `impl Sized` with trait `Debug`
|
||||
|
|
||||
LL | fn test_impl(t: impl Sized + std::fmt::Debug) {
|
||||
| +++++++++++++++++
|
||||
|
@ -17,7 +17,7 @@ LL | println!("{:?}", t);
|
|||
| ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Debug`
|
||||
|
|
||||
LL | fn test_no_bounds<T: std::fmt::Debug>(t: T) {
|
||||
| +++++++++++++++++
|
||||
|
@ -29,7 +29,7 @@ LL | println!("{:?}", t);
|
|||
| ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with trait `Debug`
|
||||
|
|
||||
LL | fn test_one_bound<T: Sized + std::fmt::Debug>(t: T) {
|
||||
| +++++++++++++++++
|
||||
|
@ -41,7 +41,7 @@ LL | println!("{:?} {:?}", x, y);
|
|||
| ^ `Y` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider further restricting type parameter `Y`
|
||||
help: consider further restricting type parameter `Y` with trait `Debug`
|
||||
|
|
||||
LL | fn test_no_bounds_where<X, Y>(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug {
|
||||
| ~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -53,7 +53,7 @@ LL | println!("{:?}", x);
|
|||
| ^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `X` with trait `Debug`
|
||||
|
|
||||
LL | fn test_one_bound_where<X>(x: X) where X: Sized + std::fmt::Debug {
|
||||
| +++++++++++++++++
|
||||
|
@ -65,7 +65,7 @@ LL | println!("{:?}", x);
|
|||
| ^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `X` with trait `Debug`
|
||||
|
|
||||
LL | fn test_many_bounds_where<X>(x: X) where X: Sized + std::fmt::Debug, X: Sized {
|
||||
| +++++++++++++++++
|
||||
|
|
|
@ -6,7 +6,7 @@ trait DoesAThing {}
|
|||
impl DoesAThing for ThingThatDoesAThing {}
|
||||
|
||||
fn clones_impl_ref_inline(thing: &impl DoesAThing) {
|
||||
//~^ HELP consider further restricting this bound
|
||||
//~^ HELP consider restricting opaque type `impl DoesAThing` with trait `Clone`
|
||||
drops_impl_owned(thing.clone()); //~ ERROR E0277
|
||||
//~^ NOTE copies the reference
|
||||
//~| NOTE the trait `DoesAThing` is not implemented for `&impl DoesAThing`
|
||||
|
|
|
@ -9,7 +9,7 @@ note: this `clone()` copies the reference, which does not do anything, because `
|
|||
|
|
||||
LL | drops_impl_owned(thing.clone());
|
||||
| ^^^^^
|
||||
help: consider further restricting this bound
|
||||
help: consider restricting opaque type `impl DoesAThing` with trait `Clone`
|
||||
|
|
||||
LL | fn clones_impl_ref_inline(thing: &impl DoesAThing + Clone) {
|
||||
| +++++++
|
||||
|
|
|
@ -15,7 +15,7 @@ note: `T` does not implement `Clone`, so `&T` was cloned instead
|
|||
|
|
||||
LL | t.clone()
|
||||
| ^
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Clone`
|
||||
|
|
||||
LL | fn wat<T: Clone>(t: &T) -> T {
|
||||
| +++++++
|
||||
|
|
|
@ -14,7 +14,7 @@ LL | impl<T: Clone, U> PartialEq<U> for Struct<T>
|
|||
note: required by a bound in `Eq`
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
= note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Clone`
|
||||
|
|
||||
LL | pub struct Struct<T: std::clone::Clone>(T);
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -38,7 +38,7 @@ LL | impl<T: Debug + Trait> Debug for Inner<T> {
|
|||
= note: required for `&c::Inner<T>` to implement `Debug`
|
||||
= note: required for the cast from `&&c::Inner<T>` to `&dyn Debug`
|
||||
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Trait`
|
||||
|
|
||||
LL | struct Outer<T: c::Trait>(Inner<T>);
|
||||
| ++++++++++
|
||||
|
@ -60,7 +60,7 @@ LL | impl<T> Debug for Inner<T> where T: Debug, T: Trait {
|
|||
= note: required for `&d::Inner<T>` to implement `Debug`
|
||||
= note: required for the cast from `&&d::Inner<T>` to `&dyn Debug`
|
||||
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Trait`
|
||||
|
|
||||
LL | struct Outer<T: d::Trait>(Inner<T>);
|
||||
| ++++++++++
|
||||
|
@ -82,7 +82,7 @@ LL | impl<T> Debug for Inner<T> where T: Debug + Trait {
|
|||
= note: required for `&e::Inner<T>` to implement `Debug`
|
||||
= note: required for the cast from `&&e::Inner<T>` to `&dyn Debug`
|
||||
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Trait`
|
||||
|
|
||||
LL | struct Outer<T: e::Trait>(Inner<T>);
|
||||
| ++++++++++
|
||||
|
@ -104,7 +104,7 @@ LL | impl<T: Debug> Debug for Inner<T> where T: Trait {
|
|||
= note: required for `&f::Inner<T>` to implement `Debug`
|
||||
= note: required for the cast from `&&f::Inner<T>` to `&dyn Debug`
|
||||
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Trait`
|
||||
|
|
||||
LL | struct Outer<T: f::Trait>(Inner<T>);
|
||||
| ++++++++++
|
||||
|
|
|
@ -4,7 +4,7 @@ error[E0277]: the trait bound `&T: X` is not satisfied
|
|||
LL | foo(s);
|
||||
| ^ the trait `X` is not implemented for `&T`
|
||||
|
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with trait `Clone`
|
||||
|
|
||||
LL | fn bar<T: X + Clone>(s: &T) {
|
||||
| +++++++
|
||||
|
|
|
@ -6,7 +6,7 @@ LL | n + 10
|
|||
| |
|
||||
| N
|
||||
|
|
||||
help: consider restricting type parameter `N`
|
||||
help: consider restricting type parameter `N` with trait `Add`
|
||||
|
|
||||
LL | fn add_ten<N: std::ops::Add<i32, Output = N>>(n: N) -> N {
|
||||
| ++++++++++++++++++++++++++++++++
|
||||
|
|
|
@ -9,7 +9,7 @@ note: required by a bound in `Vector2`
|
|||
|
|
||||
LL | pub struct Vector2<T: Debug + Copy + Clone> {
|
||||
| ^^^^ required by this bound in `Vector2`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `K` with trait `Copy`
|
||||
|
|
||||
LL | pub struct AABB<K: Debug + std::marker::Copy> {
|
||||
| +++++++++++++++++++
|
||||
|
@ -32,7 +32,7 @@ LL | pub struct Vector2<T: Debug + Copy + Clone> {
|
|||
| ---- unsatisfied trait bound introduced in this `derive` macro
|
||||
= note: required for the cast from `&Vector2<K>` to `&dyn Debug`
|
||||
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `K` with trait `Copy`
|
||||
|
|
||||
LL | pub struct AABB<K: Debug + std::marker::Copy> {
|
||||
| +++++++++++++++++++
|
||||
|
@ -52,7 +52,7 @@ note: required by a bound in `Vector2`
|
|||
LL | pub struct Vector2<T: Debug + Copy + Clone> {
|
||||
| ^^^^ required by this bound in `Vector2`
|
||||
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `K` with trait `Copy`
|
||||
|
|
||||
LL | pub struct AABB<K: Debug + std::marker::Copy> {
|
||||
| +++++++++++++++++++
|
||||
|
@ -74,7 +74,7 @@ LL | #[derive(Debug, Copy, Clone)]
|
|||
LL | pub struct Vector2<T: Debug + Copy + Clone> {
|
||||
| ---- unsatisfied trait bound introduced in this `derive` macro
|
||||
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `K` with trait `Copy`
|
||||
|
|
||||
LL | pub struct AABB<K: Debug + std::marker::Copy> {
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -13,7 +13,7 @@ note: the `Copy` impl for `Vector2<K>` requires that `K: Debug`
|
|||
LL | pub loc: Vector2<K>,
|
||||
| ^^^^^^^^^^
|
||||
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `K` with trait `Debug`
|
||||
|
|
||||
LL | pub struct AABB<K: Copy + Debug>{
|
||||
| +++++++
|
||||
|
@ -29,7 +29,7 @@ note: required by a bound in `Vector2`
|
|||
|
|
||||
LL | pub struct Vector2<T: Debug + Copy + Clone>{
|
||||
| ^^^^^ required by this bound in `Vector2`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `K` with trait `Debug`
|
||||
|
|
||||
LL | pub struct AABB<K: Copy + std::fmt::Debug>{
|
||||
| +++++++++++++++++
|
||||
|
@ -44,7 +44,7 @@ LL | pub loc: Vector2<K>,
|
|||
| ^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
|
|
||||
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `K` with trait `Debug`
|
||||
|
|
||||
LL | pub struct AABB<K: Copy + std::fmt::Debug>{
|
||||
| +++++++++++++++++
|
||||
|
@ -59,7 +59,7 @@ LL | pub size: Vector2<K>
|
|||
| ^^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
|
|
||||
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `K` with trait `Debug`
|
||||
|
|
||||
LL | pub struct AABB<K: Copy + std::fmt::Debug>{
|
||||
| +++++++++++++++++
|
||||
|
|
|
@ -13,7 +13,7 @@ note: the `Copy` impl for `Vector2<K>` requires that `K: Debug`
|
|||
LL | pub loc: Vector2<K>,
|
||||
| ^^^^^^^^^^
|
||||
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider restricting type parameter `K`
|
||||
help: consider restricting type parameter `K` with trait `Debug`
|
||||
|
|
||||
LL | pub struct AABB<K: Debug> {
|
||||
| +++++++
|
||||
|
@ -29,7 +29,7 @@ note: required by a bound in `Vector2`
|
|||
|
|
||||
LL | pub struct Vector2<T: Debug + Copy + Clone> {
|
||||
| ^^^^^ required by this bound in `Vector2`
|
||||
help: consider restricting type parameter `K`
|
||||
help: consider restricting type parameter `K` with trait `Debug`
|
||||
|
|
||||
LL | pub struct AABB<K: std::fmt::Debug> {
|
||||
| +++++++++++++++++
|
||||
|
@ -45,7 +45,7 @@ note: required by a bound in `Vector2`
|
|||
|
|
||||
LL | pub struct Vector2<T: Debug + Copy + Clone> {
|
||||
| ^^^^ required by this bound in `Vector2`
|
||||
help: consider restricting type parameter `K`
|
||||
help: consider restricting type parameter `K` with trait `Copy`
|
||||
|
|
||||
LL | pub struct AABB<K: std::marker::Copy> {
|
||||
| +++++++++++++++++++
|
||||
|
@ -68,7 +68,7 @@ LL | pub struct Vector2<T: Debug + Copy + Clone> {
|
|||
| ---- unsatisfied trait bound introduced in this `derive` macro
|
||||
= note: required for the cast from `&Vector2<K>` to `&dyn Debug`
|
||||
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider restricting type parameter `K`
|
||||
help: consider restricting type parameter `K` with trait `Copy`
|
||||
|
|
||||
LL | pub struct AABB<K: std::marker::Copy> {
|
||||
| +++++++++++++++++++
|
||||
|
@ -83,7 +83,7 @@ LL | pub loc: Vector2<K>,
|
|||
| ^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
|
|
||||
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider restricting type parameter `K`
|
||||
help: consider restricting type parameter `K` with trait `Debug`
|
||||
|
|
||||
LL | pub struct AABB<K: std::fmt::Debug> {
|
||||
| +++++++++++++++++
|
||||
|
@ -103,7 +103,7 @@ note: required by a bound in `Vector2`
|
|||
LL | pub struct Vector2<T: Debug + Copy + Clone> {
|
||||
| ^^^^ required by this bound in `Vector2`
|
||||
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider restricting type parameter `K`
|
||||
help: consider restricting type parameter `K` with trait `Copy`
|
||||
|
|
||||
LL | pub struct AABB<K: std::marker::Copy> {
|
||||
| +++++++++++++++++++
|
||||
|
@ -118,7 +118,7 @@ LL | pub size: Vector2<K>,
|
|||
| ^^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
|
|
||||
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider restricting type parameter `K`
|
||||
help: consider restricting type parameter `K` with trait `Debug`
|
||||
|
|
||||
LL | pub struct AABB<K: std::fmt::Debug> {
|
||||
| +++++++++++++++++
|
||||
|
@ -140,7 +140,7 @@ LL | #[derive(Debug, Copy, Clone)]
|
|||
LL | pub struct Vector2<T: Debug + Copy + Clone> {
|
||||
| ---- unsatisfied trait bound introduced in this `derive` macro
|
||||
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider restricting type parameter `K`
|
||||
help: consider restricting type parameter `K` with trait `Copy`
|
||||
|
|
||||
LL | pub struct AABB<K: std::marker::Copy> {
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -12,7 +12,7 @@ note: the `Copy` impl for `OnlyCopyIfDisplay<S>` requires that `S: std::fmt::Dis
|
|||
|
|
||||
LL | struct Wrapper<T>(T);
|
||||
| ^
|
||||
help: consider restricting type parameter `S`
|
||||
help: consider restricting type parameter `S` with trait `Display`
|
||||
|
|
||||
LL | impl<S: std::fmt::Display> Copy for Wrapper<OnlyCopyIfDisplay<S>> {}
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -7,7 +7,7 @@ LL |
|
|||
LL | impl<S> Copy for Wrapper<S> {}
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
help: consider restricting type parameter `S`
|
||||
help: consider restricting type parameter `S` with trait `Copy`
|
||||
|
|
||||
LL | impl<S: Copy> Copy for Wrapper<S> {}
|
||||
| ++++++
|
||||
|
|
|
@ -11,7 +11,7 @@ note: required by a bound in `is_send`
|
|||
|
|
||||
LL | fn is_send<T: Send>(val: T) {}
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
help: consider further restricting this bound
|
||||
help: consider restricting opaque type `impl Sync` with trait `Send`
|
||||
|
|
||||
LL | fn use_impl_sync(val: impl Sync + std::marker::Send) {
|
||||
| +++++++++++++++++++
|
||||
|
@ -29,7 +29,7 @@ note: required by a bound in `is_send`
|
|||
|
|
||||
LL | fn is_send<T: Send>(val: T) {}
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `S` with trait `Send`
|
||||
|
|
||||
LL | fn use_where<S>(val: S) where S: Sync + std::marker::Send {
|
||||
| +++++++++++++++++++
|
||||
|
@ -47,7 +47,7 @@ note: required by a bound in `is_send`
|
|||
|
|
||||
LL | fn is_send<T: Send>(val: T) {}
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `S` with trait `Send`
|
||||
|
|
||||
LL | fn use_bound<S: Sync + std::marker::Send>(val: S) {
|
||||
| +++++++++++++++++++
|
||||
|
@ -65,7 +65,7 @@ note: required by a bound in `is_send`
|
|||
|
|
||||
LL | fn is_send<T: Send>(val: T) {}
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `S` with trait `Send`
|
||||
|
|
||||
LL | Sync + std::marker::Send
|
||||
| +++++++++++++++++++
|
||||
|
@ -83,7 +83,7 @@ note: required by a bound in `is_send`
|
|||
|
|
||||
LL | fn is_send<T: Send>(val: T) {}
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `S` with trait `Send`
|
||||
|
|
||||
LL | fn use_bound_and_where<S: Sync + std::marker::Send>(val: S) where S: std::fmt::Debug {
|
||||
| +++++++++++++++++++
|
||||
|
@ -101,7 +101,7 @@ note: required by a bound in `is_send`
|
|||
|
|
||||
LL | fn is_send<T: Send>(val: T) {}
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
help: consider restricting type parameter `S`
|
||||
help: consider restricting type parameter `S` with trait `Send`
|
||||
|
|
||||
LL | fn use_unbound<S: std::marker::Send>(val: S) {
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -9,7 +9,7 @@ note: required by a bound in `ConstrainedStruct`
|
|||
|
|
||||
LL | struct ConstrainedStruct<X: Copy> {
|
||||
| ^^^^ required by this bound in `ConstrainedStruct`
|
||||
help: consider further restricting type parameter `X`
|
||||
help: consider further restricting type parameter `X` with trait `Copy`
|
||||
|
|
||||
LL | trait InsufficientlyConstrainedGeneric<X=()> where Self: Sized, X: std::marker::Copy {
|
||||
| ++++++++++++++++++++++
|
||||
|
@ -25,7 +25,7 @@ note: required by a bound in `ConstrainedStruct`
|
|||
|
|
||||
LL | struct ConstrainedStruct<X: Copy> {
|
||||
| ^^^^ required by this bound in `ConstrainedStruct`
|
||||
help: consider further restricting type parameter `X`
|
||||
help: consider further restricting type parameter `X` with trait `Copy`
|
||||
|
|
||||
LL | trait InsufficientlyConstrainedGenericWithEmptyWhere<X=()> where Self: Sized, X: std::marker::Copy {
|
||||
| ++++++++++++++++++++++
|
||||
|
@ -41,7 +41,7 @@ note: required by a bound in `ConstrainedStruct`
|
|||
|
|
||||
LL | struct ConstrainedStruct<X: Copy> {
|
||||
| ^^^^ required by this bound in `ConstrainedStruct`
|
||||
help: consider further restricting type parameter `X`
|
||||
help: consider further restricting type parameter `X` with trait `Copy`
|
||||
|
|
||||
LL | trait InsufficientlyConstrainedGeneric<X=()> where Self: Sized, X: std::marker::Copy {
|
||||
| ++++++++++++++++++++++
|
||||
|
@ -57,7 +57,7 @@ note: required by a bound in `ConstrainedStruct`
|
|||
|
|
||||
LL | struct ConstrainedStruct<X: Copy> {
|
||||
| ^^^^ required by this bound in `ConstrainedStruct`
|
||||
help: consider further restricting type parameter `X`
|
||||
help: consider further restricting type parameter `X` with trait `Copy`
|
||||
|
|
||||
LL | trait InsufficientlyConstrainedGenericWithEmptyWhere<X=()> where Self: Sized, X: std::marker::Copy {
|
||||
| ++++++++++++++++++++++
|
||||
|
|
19
tests/ui/trait-bounds/unstable-trait-suggestion.rs
Normal file
19
tests/ui/trait-bounds/unstable-trait-suggestion.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
#![feature(staged_api)]
|
||||
#![allow(internal_features)]
|
||||
#![stable(feature = "unit_test", since = "1.0.0")]
|
||||
|
||||
#[unstable(feature = "step_trait", issue = "42168")]
|
||||
pub trait Unstable {}
|
||||
|
||||
#[stable(feature = "unit_test", since = "1.0.0")]
|
||||
fn foo<T: Unstable>(_: T) {}
|
||||
|
||||
#[stable(feature = "unit_test", since = "1.0.0")]
|
||||
pub fn bar<T>(t: T) { //~ HELP consider restricting type parameter `T` with unstable trait `Unstable`
|
||||
foo(t) //~ ERROR E0277
|
||||
}
|
||||
#[stable(feature = "unit_test", since = "1.0.0")]
|
||||
pub fn baz<T>(t: std::ops::Range<T>) { //~ HELP consider restricting type parameter `T` with unstable trait
|
||||
for _ in t {} //~ ERROR E0277
|
||||
}
|
||||
fn main() {}
|
34
tests/ui/trait-bounds/unstable-trait-suggestion.stderr
Normal file
34
tests/ui/trait-bounds/unstable-trait-suggestion.stderr
Normal file
|
@ -0,0 +1,34 @@
|
|||
error[E0277]: the trait bound `T: Unstable` is not satisfied
|
||||
--> $DIR/unstable-trait-suggestion.rs:13:9
|
||||
|
|
||||
LL | foo(t)
|
||||
| --- ^ the trait `Unstable` is not implemented for `T`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: required by a bound in `foo`
|
||||
--> $DIR/unstable-trait-suggestion.rs:9:11
|
||||
|
|
||||
LL | fn foo<T: Unstable>(_: T) {}
|
||||
| ^^^^^^^^ required by this bound in `foo`
|
||||
help: consider restricting type parameter `T` with unstable trait `Unstable`
|
||||
|
|
||||
LL | pub fn bar<T: Unstable>(t: T) {
|
||||
| ++++++++++
|
||||
|
||||
error[E0277]: the trait bound `T: Step` is not satisfied
|
||||
--> $DIR/unstable-trait-suggestion.rs:17:14
|
||||
|
|
||||
LL | for _ in t {}
|
||||
| ^ the trait `Step` is not implemented for `T`
|
||||
|
|
||||
= note: required for `std::ops::Range<T>` to implement `Iterator`
|
||||
= note: required for `std::ops::Range<T>` to implement `IntoIterator`
|
||||
help: consider restricting type parameter `T` with unstable trait `Step`
|
||||
|
|
||||
LL | pub fn baz<T: std::iter::Step>(t: std::ops::Range<T>) {
|
||||
| +++++++++++++++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
|
@ -9,7 +9,7 @@ note: required by a bound in `A`
|
|||
|
|
||||
LL | trait A<T: Foo> {}
|
||||
| ^^^ required by this bound in `A`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Foo`
|
||||
|
|
||||
LL | trait B<T: Foo> = A<T>;
|
||||
| +++++
|
||||
|
|
|
@ -11,7 +11,7 @@ note: required by a bound in `Bar::bar`
|
|||
|
|
||||
LL | fn bar<T:Send>(&self);
|
||||
| ^^^^ required by this bound in `Bar::bar`
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T` with trait `Send`
|
||||
|
|
||||
LL | fn foo<T:'static + std::marker::Send>() {
|
||||
| +++++++++++++++++++
|
||||
|
|
|
@ -9,7 +9,7 @@ note: required by a bound in `Foo`
|
|||
|
|
||||
LL | struct Foo<T:Trait> {
|
||||
| ^^^^^ required by this bound in `Foo`
|
||||
help: consider restricting type parameter `T`
|
||||
help: consider restricting type parameter `T` with trait `Trait`
|
||||
|
|
||||
LL | impl<T: Trait> Foo<T> {
|
||||
| +++++++
|
||||
|
@ -59,7 +59,7 @@ note: required by a bound in `Foo`
|
|||
|
|
||||
LL | struct Foo<T:Trait> {
|
||||
| ^^^^^ required by this bound in `Foo`
|
||||
help: consider restricting type parameter `U`
|
||||
help: consider restricting type parameter `U` with trait `Trait`
|
||||
|
|
||||
LL | struct Badness<U: Trait> {
|
||||
| +++++++
|
||||
|
@ -75,7 +75,7 @@ note: required by a bound in `Bar`
|
|||
|
|
||||
LL | enum Bar<T:Trait> {
|
||||
| ^^^^^ required by this bound in `Bar`
|
||||
help: consider restricting type parameter `V`
|
||||
help: consider restricting type parameter `V` with trait `Trait`
|
||||
|
|
||||
LL | enum MoreBadness<V: Trait> {
|
||||
| +++++++
|
||||
|
|
|
@ -42,10 +42,6 @@ LL | *t == *t
|
|||
| ^^^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | const fn equals_self<T: ~const PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool {
|
||||
| ++++++++++++++++++++++++++++
|
||||
|
||||
error[E0015]: cannot call non-const fn `<S as PartialEq>::eq` in constant functions
|
||||
--> $DIR/call-generic-method-chain.rs:16:15
|
||||
|
|
|
@ -42,10 +42,6 @@ LL | *t == *t
|
|||
| ^^^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | const fn equals_self<T: PartialEq + ~const PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool {
|
||||
| ++++++++++++++++++++++++++++
|
||||
|
||||
error[E0015]: cannot call non-const fn `<S as PartialEq>::eq` in constant functions
|
||||
--> $DIR/call-generic-method-dup-bound.rs:14:15
|
||||
|
@ -62,10 +58,6 @@ LL | *t == *t
|
|||
| ^^^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | const fn equals_self2<T: A + ~const PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool {
|
||||
| ++++++++++++++++++++++++++++
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
|
|
|
@ -5,10 +5,6 @@ LL | *t == *t
|
|||
| ^^^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | pub const fn equals_self<T: PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool {
|
||||
| ++++++++++++++++++++++++++++
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
|
@ -28,10 +28,6 @@ LL | *t == *t
|
|||
| ^^^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | const fn equals_self<T: ~const PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool {
|
||||
| ++++++++++++++++++++++++++++
|
||||
|
||||
error[E0015]: cannot call non-const fn `<S as PartialEq>::eq` in constant functions
|
||||
--> $DIR/call-generic-method-pass.rs:16:15
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue