Rollup merge of #69745 - estebank:predicate-obligations-3, r=nikomatsakis,eddyb
Use `PredicateObligation`s instead of `Predicate`s Keep more information about trait binding failures. Use more specific spans by pointing at bindings that introduce obligations. Subset of #69709. r? @eddyb
This commit is contained in:
commit
1fe86f47d8
|
@ -296,7 +296,10 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
|
|||
let identity_proj = tcx.mk_projection(assoc_item_def_id, identity_substs);
|
||||
self.collect_outlives_from_predicate_list(
|
||||
move |ty| ty == identity_proj,
|
||||
traits::elaborate_predicates(tcx, trait_predicates),
|
||||
traits::elaborate_predicates(tcx, trait_predicates)
|
||||
.into_iter()
|
||||
.map(|o| o.predicate)
|
||||
.collect::<Vec<_>>(),
|
||||
)
|
||||
.map(|b| b.1)
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
use smallvec::smallvec;
|
||||
|
||||
use crate::traits::{Obligation, ObligationCause, PredicateObligation};
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_middle::ty::outlives::Component;
|
||||
use rustc_middle::ty::{self, ToPolyTraitRef, ToPredicate, TyCtxt, WithConstness};
|
||||
use rustc_span::Span;
|
||||
|
||||
pub fn anonymize_predicate<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
|
@ -87,7 +89,7 @@ impl<T: AsRef<ty::Predicate<'tcx>>> Extend<T> for PredicateSet<'tcx> {
|
|||
/// holds as well. Similarly, if we have `trait Foo: 'static`, and we know that
|
||||
/// `T: Foo`, then we know that `T: 'static`.
|
||||
pub struct Elaborator<'tcx> {
|
||||
stack: Vec<ty::Predicate<'tcx>>,
|
||||
stack: Vec<PredicateObligation<'tcx>>,
|
||||
visited: PredicateSet<'tcx>,
|
||||
}
|
||||
|
||||
|
@ -112,7 +114,29 @@ pub fn elaborate_predicates<'tcx>(
|
|||
) -> Elaborator<'tcx> {
|
||||
let mut visited = PredicateSet::new(tcx);
|
||||
predicates.retain(|pred| visited.insert(pred));
|
||||
Elaborator { stack: predicates, visited }
|
||||
let obligations: Vec<_> =
|
||||
predicates.into_iter().map(|predicate| predicate_obligation(predicate, None)).collect();
|
||||
elaborate_obligations(tcx, obligations)
|
||||
}
|
||||
|
||||
pub fn elaborate_obligations<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
mut obligations: Vec<PredicateObligation<'tcx>>,
|
||||
) -> Elaborator<'tcx> {
|
||||
let mut visited = PredicateSet::new(tcx);
|
||||
obligations.retain(|obligation| visited.insert(&obligation.predicate));
|
||||
Elaborator { stack: obligations, visited }
|
||||
}
|
||||
|
||||
fn predicate_obligation<'tcx>(
|
||||
predicate: ty::Predicate<'tcx>,
|
||||
span: Option<Span>,
|
||||
) -> PredicateObligation<'tcx> {
|
||||
let mut cause = ObligationCause::dummy();
|
||||
if let Some(span) = span {
|
||||
cause.span = span;
|
||||
}
|
||||
Obligation { cause, param_env: ty::ParamEnv::empty(), recursion_depth: 0, predicate }
|
||||
}
|
||||
|
||||
impl Elaborator<'tcx> {
|
||||
|
@ -120,27 +144,30 @@ impl Elaborator<'tcx> {
|
|||
FilterToTraits::new(self)
|
||||
}
|
||||
|
||||
fn elaborate(&mut self, predicate: &ty::Predicate<'tcx>) {
|
||||
fn elaborate(&mut self, obligation: &PredicateObligation<'tcx>) {
|
||||
let tcx = self.visited.tcx;
|
||||
match *predicate {
|
||||
match obligation.predicate {
|
||||
ty::Predicate::Trait(ref data, _) => {
|
||||
// Get predicates declared on the trait.
|
||||
let predicates = tcx.super_predicates_of(data.def_id());
|
||||
|
||||
let predicates = predicates
|
||||
.predicates
|
||||
.iter()
|
||||
.map(|(pred, _)| pred.subst_supertrait(tcx, &data.to_poly_trait_ref()));
|
||||
debug!("super_predicates: data={:?} predicates={:?}", data, predicates.clone());
|
||||
let obligations = predicates.predicates.iter().map(|(pred, span)| {
|
||||
predicate_obligation(
|
||||
pred.subst_supertrait(tcx, &data.to_poly_trait_ref()),
|
||||
Some(*span),
|
||||
)
|
||||
});
|
||||
debug!("super_predicates: data={:?} predicates={:?}", data, &obligations);
|
||||
|
||||
// Only keep those bounds that we haven't already seen.
|
||||
// This is necessary to prevent infinite recursion in some
|
||||
// cases. One common case is when people define
|
||||
// `trait Sized: Sized { }` rather than `trait Sized { }`.
|
||||
let visited = &mut self.visited;
|
||||
let predicates = predicates.filter(|pred| visited.insert(pred));
|
||||
let obligations =
|
||||
obligations.filter(|obligation| visited.insert(&obligation.predicate));
|
||||
|
||||
self.stack.extend(predicates);
|
||||
self.stack.extend(obligations);
|
||||
}
|
||||
ty::Predicate::WellFormed(..) => {
|
||||
// Currently, we do not elaborate WF predicates,
|
||||
|
@ -221,7 +248,8 @@ impl Elaborator<'tcx> {
|
|||
None
|
||||
}
|
||||
})
|
||||
.filter(|p| visited.insert(p)),
|
||||
.filter(|p| visited.insert(p))
|
||||
.map(|p| predicate_obligation(p, None)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -229,17 +257,17 @@ impl Elaborator<'tcx> {
|
|||
}
|
||||
|
||||
impl Iterator for Elaborator<'tcx> {
|
||||
type Item = ty::Predicate<'tcx>;
|
||||
type Item = PredicateObligation<'tcx>;
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
(self.stack.len(), None)
|
||||
}
|
||||
|
||||
fn next(&mut self) -> Option<ty::Predicate<'tcx>> {
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
// Extract next item from top-most stack frame, if any.
|
||||
if let Some(pred) = self.stack.pop() {
|
||||
self.elaborate(&pred);
|
||||
Some(pred)
|
||||
if let Some(obligation) = self.stack.pop() {
|
||||
self.elaborate(&obligation);
|
||||
Some(obligation)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -282,12 +310,12 @@ impl<I> FilterToTraits<I> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx, I: Iterator<Item = ty::Predicate<'tcx>>> Iterator for FilterToTraits<I> {
|
||||
impl<'tcx, I: Iterator<Item = PredicateObligation<'tcx>>> Iterator for FilterToTraits<I> {
|
||||
type Item = ty::PolyTraitRef<'tcx>;
|
||||
|
||||
fn next(&mut self) -> Option<ty::PolyTraitRef<'tcx>> {
|
||||
while let Some(pred) = self.base_iterator.next() {
|
||||
if let ty::Predicate::Trait(data, _) = pred {
|
||||
while let Some(obligation) = self.base_iterator.next() {
|
||||
if let ty::Predicate::Trait(data, _) = obligation.predicate {
|
||||
return Some(data.to_poly_trait_ref());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ impl<'tcx> MirPass<'tcx> for ConstProp {
|
|||
.collect();
|
||||
if !traits::normalize_and_test_predicates(
|
||||
tcx,
|
||||
traits::elaborate_predicates(tcx, predicates).collect(),
|
||||
traits::elaborate_predicates(tcx, predicates).map(|o| o.predicate).collect(),
|
||||
) {
|
||||
trace!("ConstProp skipped for {:?}: found unsatisfiable predicates", source.def_id());
|
||||
return;
|
||||
|
|
|
@ -1255,8 +1255,8 @@ crate fn required_region_bounds(
|
|||
assert!(!erased_self_ty.has_escaping_bound_vars());
|
||||
|
||||
traits::elaborate_predicates(tcx, predicates)
|
||||
.filter_map(|predicate| {
|
||||
match predicate {
|
||||
.filter_map(|obligation| {
|
||||
match obligation.predicate {
|
||||
ty::Predicate::Projection(..)
|
||||
| ty::Predicate::Trait(..)
|
||||
| ty::Predicate::Subtype(..)
|
||||
|
|
|
@ -366,7 +366,8 @@ impl AutoTraitFinder<'tcx> {
|
|||
|
||||
computed_preds.extend(user_computed_preds.iter().cloned());
|
||||
let normalized_preds =
|
||||
elaborate_predicates(tcx, computed_preds.iter().cloned().collect());
|
||||
elaborate_predicates(tcx, computed_preds.iter().cloned().collect())
|
||||
.map(|o| o.predicate);
|
||||
new_env =
|
||||
ty::ParamEnv::new(tcx.mk_predicates(normalized_preds), param_env.reveal, None);
|
||||
}
|
||||
|
|
|
@ -976,8 +976,8 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
}
|
||||
};
|
||||
|
||||
for implication in super::elaborate_predicates(self.tcx, vec![*cond]) {
|
||||
if let ty::Predicate::Trait(implication, _) = implication {
|
||||
for obligation in super::elaborate_predicates(self.tcx, vec![*cond]) {
|
||||
if let ty::Predicate::Trait(implication, _) = obligation.predicate {
|
||||
let error = error.to_poly_trait_ref();
|
||||
let implication = implication.to_poly_trait_ref();
|
||||
// FIXME: I'm just not taking associated types at all here.
|
||||
|
@ -1387,7 +1387,9 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
(self.tcx.sess.source_map().span_to_snippet(span), &obligation.cause.code)
|
||||
{
|
||||
let generics = self.tcx.generics_of(*def_id);
|
||||
if !generics.params.is_empty() && !snippet.ends_with('>') {
|
||||
if generics.params.iter().filter(|p| p.name.as_str() != "Self").next().is_some()
|
||||
&& !snippet.ends_with('>')
|
||||
{
|
||||
// FIXME: To avoid spurious suggestions in functions where type arguments
|
||||
// where already supplied, we check the snippet to make sure it doesn't
|
||||
// end with a turbofish. Ideally we would have access to a `PathSegment`
|
||||
|
@ -1405,7 +1407,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
// | `Tt::const_val::<[i8; 123]>::<T>`
|
||||
// ...
|
||||
// LL | const fn const_val<T: Sized>() -> usize {
|
||||
// | --------- - required by this bound in `Tt::const_val`
|
||||
// | - required by this bound in `Tt::const_val`
|
||||
// |
|
||||
// = note: cannot satisfy `_: Tt`
|
||||
|
||||
|
|
|
@ -142,7 +142,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
if let ObligationCauseCode::ItemObligation(item) = obligation.cause.code {
|
||||
if let ObligationCauseCode::ItemObligation(item)
|
||||
| ObligationCauseCode::BindingObligation(item, _) = obligation.cause.code
|
||||
{
|
||||
// FIXME: maybe also have some way of handling methods
|
||||
// from other traits? That would require name resolution,
|
||||
// which we might want to be some sort of hygienic.
|
||||
|
|
|
@ -948,7 +948,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
/// --> $DIR/issue-64130-2-send.rs:21:5
|
||||
/// |
|
||||
/// LL | fn is_send<T: Send>(t: T) { }
|
||||
/// | ------- ---- required by this bound in `is_send`
|
||||
/// | ---- required by this bound in `is_send`
|
||||
/// ...
|
||||
/// LL | is_send(bar());
|
||||
/// | ^^^^^^^ future returned by `bar` is not send
|
||||
|
@ -1345,7 +1345,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
ObligationCauseCode::ItemObligation(item_def_id) => {
|
||||
let item_name = tcx.def_path_str(item_def_id);
|
||||
let msg = format!("required by `{}`", item_name);
|
||||
|
||||
if let Some(sp) = tcx.hir().span_if_local(item_def_id) {
|
||||
let sp = tcx.sess.source_map().guess_head_span(sp);
|
||||
err.span_label(sp, &msg);
|
||||
|
@ -1357,7 +1356,15 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
let item_name = tcx.def_path_str(item_def_id);
|
||||
let msg = format!("required by this bound in `{}`", item_name);
|
||||
if let Some(ident) = tcx.opt_item_name(item_def_id) {
|
||||
err.span_label(ident.span, "");
|
||||
let sm = self.tcx.sess.source_map();
|
||||
let same_line =
|
||||
match (sm.lookup_line(ident.span.hi()), sm.lookup_line(span.lo())) {
|
||||
(Ok(l), Ok(r)) => l.line == r.line,
|
||||
_ => true,
|
||||
};
|
||||
if !ident.span.overlaps(span) && !same_line {
|
||||
err.span_label(ident.span, "");
|
||||
}
|
||||
}
|
||||
if span != DUMMY_SP {
|
||||
err.span_label(span, &msg);
|
||||
|
|
|
@ -297,7 +297,9 @@ pub fn normalize_param_env_or_error<'tcx>(
|
|||
);
|
||||
|
||||
let mut predicates: Vec<_> =
|
||||
util::elaborate_predicates(tcx, unnormalized_env.caller_bounds.to_vec()).collect();
|
||||
util::elaborate_predicates(tcx, unnormalized_env.caller_bounds.to_vec())
|
||||
.map(|obligation| obligation.predicate)
|
||||
.collect();
|
||||
|
||||
debug!("normalize_param_env_or_error: elaborated-predicates={:?}", predicates);
|
||||
|
||||
|
|
|
@ -298,7 +298,7 @@ fn generics_require_sized_self(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
|||
// Search for a predicate like `Self : Sized` amongst the trait bounds.
|
||||
let predicates = tcx.predicates_of(def_id);
|
||||
let predicates = predicates.instantiate_identity(tcx).predicates;
|
||||
elaborate_predicates(tcx, predicates).any(|predicate| match predicate {
|
||||
elaborate_predicates(tcx, predicates).any(|obligation| match obligation.predicate {
|
||||
ty::Predicate::Trait(ref trait_pred, _) => {
|
||||
trait_pred.def_id() == sized_def_id && trait_pred.skip_binder().self_ty().is_param(0)
|
||||
}
|
||||
|
|
|
@ -900,7 +900,7 @@ fn assemble_candidates_from_trait_def<'cx, 'tcx>(
|
|||
// If so, extract what we know from the trait and try to come up with a good answer.
|
||||
let trait_predicates = tcx.predicates_of(def_id);
|
||||
let bounds = trait_predicates.instantiate(tcx, substs);
|
||||
let bounds = elaborate_predicates(tcx, bounds.predicates);
|
||||
let bounds = elaborate_predicates(tcx, bounds.predicates).map(|o| o.predicate);
|
||||
assemble_candidates_from_predicates(
|
||||
selcx,
|
||||
obligation,
|
||||
|
@ -1162,7 +1162,7 @@ fn confirm_object_candidate<'cx, 'tcx>(
|
|||
|
||||
// select only those projections that are actually projecting an
|
||||
// item with the correct name
|
||||
let env_predicates = env_predicates.filter_map(|p| match p {
|
||||
let env_predicates = env_predicates.filter_map(|o| match o.predicate {
|
||||
ty::Predicate::Projection(data) => {
|
||||
if data.projection_def_id() == obligation.predicate.item_def_id {
|
||||
Some(data)
|
||||
|
|
|
@ -312,19 +312,18 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
|
|||
let item = self.item;
|
||||
|
||||
if let Elaborate::All = elaborate {
|
||||
let predicates = obligations.iter().map(|obligation| obligation.predicate).collect();
|
||||
let implied_obligations = traits::elaborate_predicates(tcx, predicates);
|
||||
let implied_obligations = implied_obligations.map(|pred| {
|
||||
let implied_obligations = traits::util::elaborate_obligations(tcx, obligations.clone());
|
||||
let implied_obligations = implied_obligations.map(|obligation| {
|
||||
let mut cause = cause.clone();
|
||||
extend_cause_with_original_assoc_item_obligation(
|
||||
tcx,
|
||||
trait_ref,
|
||||
item,
|
||||
&mut cause,
|
||||
&pred,
|
||||
&obligation.predicate,
|
||||
tcx.associated_items(trait_ref.def_id).in_definition_order().copied(),
|
||||
);
|
||||
traits::Obligation::new(cause, param_env, pred)
|
||||
traits::Obligation::new(cause, param_env, obligation.predicate)
|
||||
});
|
||||
self.out.extend(implied_obligations);
|
||||
}
|
||||
|
@ -613,11 +612,14 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
|
|||
substs: SubstsRef<'tcx>,
|
||||
) -> Vec<traits::PredicateObligation<'tcx>> {
|
||||
let predicates = self.infcx.tcx.predicates_of(def_id).instantiate(self.infcx.tcx, substs);
|
||||
let cause = self.cause(traits::ItemObligation(def_id));
|
||||
predicates
|
||||
.predicates
|
||||
.into_iter()
|
||||
.map(|pred| traits::Obligation::new(cause.clone(), self.param_env, pred))
|
||||
.zip(predicates.spans.into_iter())
|
||||
.map(|(pred, span)| {
|
||||
let cause = self.cause(traits::BindingObligation(def_id, span));
|
||||
traits::Obligation::new(cause, self.param_env, pred)
|
||||
})
|
||||
.filter(|pred| !pred.has_escaping_bound_vars())
|
||||
.collect()
|
||||
}
|
||||
|
|
|
@ -1601,12 +1601,12 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
for (base_trait_ref, span, constness) in regular_traits_refs_spans {
|
||||
assert_eq!(constness, Constness::NotConst);
|
||||
|
||||
for trait_ref in traits::elaborate_trait_ref(tcx, base_trait_ref) {
|
||||
for obligation in traits::elaborate_trait_ref(tcx, base_trait_ref) {
|
||||
debug!(
|
||||
"conv_object_ty_poly_trait_ref: observing object predicate `{:?}`",
|
||||
trait_ref
|
||||
obligation.predicate
|
||||
);
|
||||
match trait_ref {
|
||||
match obligation.predicate {
|
||||
ty::Predicate::Trait(pred, _) => {
|
||||
associated_types.entry(span).or_default().extend(
|
||||
tcx.associated_items(pred.def_id())
|
||||
|
|
|
@ -573,13 +573,15 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
|
|||
};
|
||||
|
||||
traits::elaborate_predicates(self.tcx, predicates.predicates.clone())
|
||||
.filter_map(|predicate| match predicate {
|
||||
.filter_map(|obligation| match obligation.predicate {
|
||||
ty::Predicate::Trait(trait_pred, _) if trait_pred.def_id() == sized_def_id => {
|
||||
let span = predicates
|
||||
.predicates
|
||||
.iter()
|
||||
.zip(predicates.spans.iter())
|
||||
.filter_map(|(p, span)| if *p == predicate { Some(*span) } else { None })
|
||||
.filter_map(
|
||||
|(p, span)| if *p == obligation.predicate { Some(*span) } else { None },
|
||||
)
|
||||
.next()
|
||||
.unwrap_or(rustc_span::DUMMY_SP);
|
||||
Some((trait_pred, span))
|
||||
|
|
|
@ -1229,7 +1229,8 @@ fn check_false_global_bounds(fcx: &FnCtxt<'_, '_>, span: Span, id: hir::HirId) {
|
|||
// Check elaborated bounds.
|
||||
let implied_obligations = traits::elaborate_predicates(fcx.tcx, predicates);
|
||||
|
||||
for pred in implied_obligations {
|
||||
for obligation in implied_obligations {
|
||||
let pred = obligation.predicate;
|
||||
// Match the existing behavior.
|
||||
if pred.is_global() && !pred.has_late_bound_regions() {
|
||||
let pred = fcx.normalize_associated_types_in(span, &pred);
|
||||
|
|
|
@ -1650,7 +1650,7 @@ fn predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicates<'_> {
|
|||
// prove that the trait applies to the types that were
|
||||
// used, and adding the predicate into this list ensures
|
||||
// that this is done.
|
||||
let span = tcx.def_span(def_id);
|
||||
let span = tcx.sess.source_map().guess_head_span(tcx.def_span(def_id));
|
||||
result.predicates =
|
||||
tcx.arena.alloc_from_iter(result.predicates.iter().copied().chain(std::iter::once((
|
||||
ty::TraitRef::identity(tcx, def_id).without_const().to_predicate(),
|
||||
|
|
|
@ -348,7 +348,10 @@ fn check_predicates<'tcx>(
|
|||
.extend(obligations.into_iter().map(|obligation| obligation.predicate))
|
||||
}
|
||||
}
|
||||
impl2_predicates.predicates.extend(traits::elaborate_predicates(tcx, always_applicable_traits));
|
||||
impl2_predicates.predicates.extend(
|
||||
traits::elaborate_predicates(tcx, always_applicable_traits)
|
||||
.map(|obligation| obligation.predicate),
|
||||
);
|
||||
|
||||
for predicate in impl1_predicates.predicates {
|
||||
if !impl2_predicates.predicates.contains(&predicate) {
|
||||
|
|
|
@ -7,7 +7,7 @@ LL | f1(|_: (), _: ()| {});
|
|||
| expected signature of `for<'r, 's> fn(&'r (), &'s ()) -> _`
|
||||
...
|
||||
LL | fn f1<F>(_: F) where F: Fn(&(), &()) {}
|
||||
| -- ------------ required by this bound in `f1`
|
||||
| ------------ required by this bound in `f1`
|
||||
|
||||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:3:5
|
||||
|
@ -18,7 +18,7 @@ LL | f2(|_: (), _: ()| {});
|
|||
| expected signature of `for<'a, 'r> fn(&'a (), &'r ()) -> _`
|
||||
...
|
||||
LL | fn f2<F>(_: F) where F: for<'a> Fn(&'a (), &()) {}
|
||||
| -- ----------------------- required by this bound in `f2`
|
||||
| ----------------------- required by this bound in `f2`
|
||||
|
||||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:4:5
|
||||
|
@ -29,7 +29,7 @@ LL | f3(|_: (), _: ()| {});
|
|||
| expected signature of `for<'r> fn(&(), &'r ()) -> _`
|
||||
...
|
||||
LL | fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {}
|
||||
| -- --------------- required by this bound in `f3`
|
||||
| --------------- required by this bound in `f3`
|
||||
|
||||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:5:5
|
||||
|
@ -40,7 +40,7 @@ LL | f4(|_: (), _: ()| {});
|
|||
| expected signature of `for<'s, 'r> fn(&'s (), &'r ()) -> _`
|
||||
...
|
||||
LL | fn f4<F>(_: F) where F: for<'r> Fn(&(), &'r ()) {}
|
||||
| -- ----------------------- required by this bound in `f4`
|
||||
| ----------------------- required by this bound in `f4`
|
||||
|
||||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:6:5
|
||||
|
@ -51,7 +51,7 @@ LL | f5(|_: (), _: ()| {});
|
|||
| expected signature of `for<'r> fn(&'r (), &'r ()) -> _`
|
||||
...
|
||||
LL | fn f5<F>(_: F) where F: for<'r> Fn(&'r (), &'r ()) {}
|
||||
| -- -------------------------- required by this bound in `f5`
|
||||
| -------------------------- required by this bound in `f5`
|
||||
|
||||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:7:5
|
||||
|
@ -62,7 +62,7 @@ LL | g1(|_: (), _: ()| {});
|
|||
| expected signature of `for<'r> fn(&'r (), std::boxed::Box<(dyn for<'s> std::ops::Fn(&'s ()) + 'static)>) -> _`
|
||||
...
|
||||
LL | fn g1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>) {}
|
||||
| -- ------------------------- required by this bound in `g1`
|
||||
| ------------------------- required by this bound in `g1`
|
||||
|
||||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:8:5
|
||||
|
@ -73,7 +73,7 @@ LL | g2(|_: (), _: ()| {});
|
|||
| expected signature of `for<'r> fn(&'r (), for<'s> fn(&'s ())) -> _`
|
||||
...
|
||||
LL | fn g2<F>(_: F) where F: Fn(&(), fn(&())) {}
|
||||
| -- ---------------- required by this bound in `g2`
|
||||
| ---------------- required by this bound in `g2`
|
||||
|
||||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:9:5
|
||||
|
@ -84,7 +84,7 @@ LL | g3(|_: (), _: ()| {});
|
|||
| expected signature of `for<'s> fn(&'s (), std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r ()) + 'static)>) -> _`
|
||||
...
|
||||
LL | fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<dyn Fn(&())>) {}
|
||||
| -- ------------------------------------ required by this bound in `g3`
|
||||
| ------------------------------------ required by this bound in `g3`
|
||||
|
||||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:10:5
|
||||
|
@ -95,7 +95,7 @@ LL | g4(|_: (), _: ()| {});
|
|||
| expected signature of `for<'s> fn(&'s (), for<'r> fn(&'r ())) -> _`
|
||||
...
|
||||
LL | fn g4<F>(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {}
|
||||
| -- --------------------------- required by this bound in `g4`
|
||||
| --------------------------- required by this bound in `g4`
|
||||
|
||||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:11:5
|
||||
|
@ -106,7 +106,7 @@ LL | h1(|_: (), _: (), _: (), _: ()| {});
|
|||
| expected signature of `for<'r, 's> fn(&'r (), std::boxed::Box<(dyn for<'t0> std::ops::Fn(&'t0 ()) + 'static)>, &'s (), for<'t0, 't1> fn(&'t0 (), &'t1 ())) -> _`
|
||||
...
|
||||
LL | fn h1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>, &(), fn(&(), &())) {}
|
||||
| -- -------------------------------------------- required by this bound in `h1`
|
||||
| -------------------------------------------- required by this bound in `h1`
|
||||
|
||||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:12:5
|
||||
|
@ -117,7 +117,7 @@ LL | h2(|_: (), _: (), _: (), _: ()| {});
|
|||
| expected signature of `for<'r, 't0> fn(&'r (), std::boxed::Box<(dyn for<'s> std::ops::Fn(&'s ()) + 'static)>, &'t0 (), for<'s, 't1> fn(&'s (), &'t1 ())) -> _`
|
||||
...
|
||||
LL | fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<dyn Fn(&())>, &'t0 (), fn(&(), &())) {}
|
||||
| -- --------------------------------------------------------- required by this bound in `h2`
|
||||
| --------------------------------------------------------- required by this bound in `h2`
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
|
||||
|
|
|
@ -20,7 +20,10 @@ error[E0277]: `<<T as Case1>::C as std::iter::Iterator>::Item` cannot be sent be
|
|||
--> $DIR/bad-bounds-on-assoc-in-trait.rs:36:20
|
||||
|
|
||||
LL | trait Case1 {
|
||||
| ----------- required by `Case1`
|
||||
| -----
|
||||
LL | type C: Clone + Iterator<Item:
|
||||
LL | Send + Iterator<Item:
|
||||
| ---- required by this bound in `Case1`
|
||||
...
|
||||
LL | fn assume_case1<T: Case1>() {
|
||||
| ^^^^^ - help: consider further restricting the associated type: `where <<T as Case1>::C as std::iter::Iterator>::Item: std::marker::Send`
|
||||
|
@ -33,7 +36,10 @@ error[E0277]: `<<T as Case1>::C as std::iter::Iterator>::Item` cannot be shared
|
|||
--> $DIR/bad-bounds-on-assoc-in-trait.rs:36:20
|
||||
|
|
||||
LL | trait Case1 {
|
||||
| ----------- required by `Case1`
|
||||
| -----
|
||||
...
|
||||
LL | > + Sync>;
|
||||
| ---- required by this bound in `Case1`
|
||||
...
|
||||
LL | fn assume_case1<T: Case1>() {
|
||||
| ^^^^^ - help: consider further restricting the associated type: `where <<T as Case1>::C as std::iter::Iterator>::Item: std::marker::Sync`
|
||||
|
@ -46,7 +52,10 @@ error[E0277]: `<_ as Lam<&'a u8>>::App` doesn't implement `std::fmt::Debug`
|
|||
--> $DIR/bad-bounds-on-assoc-in-trait.rs:36:20
|
||||
|
|
||||
LL | trait Case1 {
|
||||
| ----------- required by `Case1`
|
||||
| -----
|
||||
...
|
||||
LL | Debug
|
||||
| ----- required by this bound in `Case1`
|
||||
...
|
||||
LL | fn assume_case1<T: Case1>() {
|
||||
| ^^^^^ `<_ as Lam<&'a u8>>::App` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0271]: type mismatch resolving `<ModelT as Vehicle>::Color == Blue`
|
|||
--> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:31:10
|
||||
|
|
||||
LL | fn blue_car<C:Car<Color=Blue>>(c: C) {
|
||||
| -------- ---------- required by this bound in `blue_car`
|
||||
| ---------- required by this bound in `blue_car`
|
||||
...
|
||||
LL | fn b() { blue_car(ModelT); }
|
||||
| ^^^^^^^^ expected struct `Blue`, found struct `Black`
|
||||
|
@ -11,7 +11,7 @@ error[E0271]: type mismatch resolving `<ModelU as Vehicle>::Color == Black`
|
|||
--> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:32:10
|
||||
|
|
||||
LL | fn black_car<C:Car<Color=Black>>(c: C) {
|
||||
| --------- ----------- required by this bound in `black_car`
|
||||
| ----------- required by this bound in `black_car`
|
||||
...
|
||||
LL | fn c() { black_car(ModelU); }
|
||||
| ^^^^^^^^^ expected struct `Black`, found struct `Blue`
|
||||
|
|
|
@ -15,7 +15,7 @@ error[E0271]: type mismatch resolving `<isize as Foo>::A == Bar`
|
|||
--> $DIR/associated-types-eq-3.rs:38:5
|
||||
|
|
||||
LL | fn foo1<I: Foo<A=Bar>>(x: I) {
|
||||
| ---- ----- required by this bound in `foo1`
|
||||
| ----- required by this bound in `foo1`
|
||||
...
|
||||
LL | foo1(a);
|
||||
| ^^^^ expected struct `Bar`, found `usize`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0271]: type mismatch resolving `<Adapter<I> as Iterator>::Item == std::op
|
|||
--> $DIR/associated-types-issue-20346.rs:34:5
|
||||
|
|
||||
LL | fn is_iterator_of<A, I: Iterator<Item=A>>(_: &I) {}
|
||||
| -------------- ------ required by this bound in `is_iterator_of`
|
||||
| ------ required by this bound in `is_iterator_of`
|
||||
...
|
||||
LL | fn test_adapter<T, I: Iterator<Item=Option<T>>>(it: I) {
|
||||
| - this type parameter
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | want_y(t);
|
|||
| ^^^^^^ expected `i32`, found associated type
|
||||
...
|
||||
LL | fn want_y<T:Foo<Y=i32>>(t: &T) { }
|
||||
| ------ ----- required by this bound in `want_y`
|
||||
| ----- required by this bound in `want_y`
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found associated type `<T as Foo>::Y`
|
||||
|
@ -19,7 +19,7 @@ LL | want_x(t);
|
|||
| ^^^^^^ expected `u32`, found associated type
|
||||
...
|
||||
LL | fn want_x<T:Foo<X=u32>>(t: &T) { }
|
||||
| ------ ----- required by this bound in `want_x`
|
||||
| ----- required by this bound in `want_x`
|
||||
|
|
||||
= note: expected type `u32`
|
||||
found associated type `<T as Foo>::X`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0284]: type annotations needed
|
|||
--> $DIR/associated-types-overridden-binding.rs:4:12
|
||||
|
|
||||
LL | trait Foo: Iterator<Item = i32> {}
|
||||
| ------------------------------- required by `Foo`
|
||||
| ---------- required by this bound in `Foo`
|
||||
LL | trait Bar: Foo<Item = u32> {}
|
||||
| ^^^^^^^^^^^^^^^ cannot infer type for type parameter `Self`
|
||||
|
|
||||
|
@ -12,7 +12,7 @@ error[E0284]: type annotations needed
|
|||
--> $DIR/associated-types-overridden-binding.rs:7:21
|
||||
|
|
||||
LL | trait I32Iterator = Iterator<Item = i32>;
|
||||
| ----------------------------------------- required by `I32Iterator`
|
||||
| ---------- required by this bound in `I32Iterator`
|
||||
LL | trait U32Iterator = I32Iterator<Item = u32>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `Self`
|
||||
|
|
||||
|
|
|
@ -13,7 +13,7 @@ error[E0277]: the trait bound `u32: Foo` is not satisfied
|
|||
--> $DIR/associated-types-path-2.rs:29:5
|
||||
|
|
||||
LL | pub fn f1<T: Foo>(a: T, x: T::A) {}
|
||||
| -- --- required by this bound in `f1`
|
||||
| --- required by this bound in `f1`
|
||||
...
|
||||
LL | f1(2u32, 4u32);
|
||||
| ^^ the trait `Foo` is not implemented for `u32`
|
||||
|
@ -28,7 +28,7 @@ error[E0277]: the trait bound `u32: Foo` is not satisfied
|
|||
--> $DIR/associated-types-path-2.rs:35:5
|
||||
|
|
||||
LL | pub fn f1<T: Foo>(a: T, x: T::A) {}
|
||||
| -- --- required by this bound in `f1`
|
||||
| --- required by this bound in `f1`
|
||||
...
|
||||
LL | f1(2u32, 4i32);
|
||||
| ^^ the trait `Foo` is not implemented for `u32`
|
||||
|
|
|
@ -128,10 +128,14 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
|
|||
|
|
||||
LL | type Ty = Vec<[u8]>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
::: $SRC_DIR/liballoc/vec.rs:LL:COL
|
||||
|
|
||||
LL | pub struct Vec<T> {
|
||||
| - required by this bound in `std::vec::Vec`
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[u8]`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required by `std::vec::Vec`
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ error: future cannot be sent between threads safely
|
|||
--> $DIR/async-fn-nonsend.rs:49:5
|
||||
|
|
||||
LL | fn assert_send(_: impl Send) {}
|
||||
| ----------- ---- required by this bound in `assert_send`
|
||||
| ---- required by this bound in `assert_send`
|
||||
...
|
||||
LL | assert_send(local_dropped_before_await());
|
||||
| ^^^^^^^^^^^ future returned by `local_dropped_before_await` is not `Send`
|
||||
|
@ -23,7 +23,7 @@ error: future cannot be sent between threads safely
|
|||
--> $DIR/async-fn-nonsend.rs:51:5
|
||||
|
|
||||
LL | fn assert_send(_: impl Send) {}
|
||||
| ----------- ---- required by this bound in `assert_send`
|
||||
| ---- required by this bound in `assert_send`
|
||||
...
|
||||
LL | assert_send(non_send_temporary_in_match());
|
||||
| ^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send`
|
||||
|
@ -44,7 +44,7 @@ error: future cannot be sent between threads safely
|
|||
--> $DIR/async-fn-nonsend.rs:53:5
|
||||
|
|
||||
LL | fn assert_send(_: impl Send) {}
|
||||
| ----------- ---- required by this bound in `assert_send`
|
||||
| ---- required by this bound in `assert_send`
|
||||
...
|
||||
LL | assert_send(non_sync_with_method_call());
|
||||
| ^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
|
||||
|
|
|
@ -2,7 +2,7 @@ error: future cannot be shared between threads safely
|
|||
--> $DIR/issue-64130-1-sync.rs:21:5
|
||||
|
|
||||
LL | fn is_sync<T: Sync>(t: T) { }
|
||||
| ------- ---- required by this bound in `is_sync`
|
||||
| ---- required by this bound in `is_sync`
|
||||
...
|
||||
LL | is_sync(bar());
|
||||
| ^^^^^^^ future returned by `bar` is not `Sync`
|
||||
|
|
|
@ -2,7 +2,7 @@ error: future cannot be sent between threads safely
|
|||
--> $DIR/issue-64130-2-send.rs:21:5
|
||||
|
|
||||
LL | fn is_send<T: Send>(t: T) { }
|
||||
| ------- ---- required by this bound in `is_send`
|
||||
| ---- required by this bound in `is_send`
|
||||
...
|
||||
LL | is_send(bar());
|
||||
| ^^^^^^^ future returned by `bar` is not `Send`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl std::future::
|
|||
--> $DIR/issue-64130-3-other.rs:24:5
|
||||
|
|
||||
LL | fn is_qux<T: Qux>(t: T) { }
|
||||
| ------ --- required by this bound in `is_qux`
|
||||
| --- required by this bound in `is_qux`
|
||||
LL |
|
||||
LL | async fn bar() {
|
||||
| - within this `impl std::future::Future`
|
||||
|
|
|
@ -2,7 +2,7 @@ error: future cannot be sent between threads safely
|
|||
--> $DIR/issue-64130-non-send-future-diags.rs:21:5
|
||||
|
|
||||
LL | fn is_send<T: Send>(t: T) { }
|
||||
| ------- ---- required by this bound in `is_send`
|
||||
| ---- required by this bound in `is_send`
|
||||
...
|
||||
LL | is_send(foo());
|
||||
| ^^^^^^^ future returned by `foo` is not `Send`
|
||||
|
|
|
@ -2,7 +2,7 @@ error: future cannot be sent between threads safely
|
|||
--> $DIR/issue-67252-unnamed-future.rs:18:5
|
||||
|
|
||||
LL | fn spawn<T: Send>(_: T) {}
|
||||
| ----- ---- required by this bound in `spawn`
|
||||
| ---- required by this bound in `spawn`
|
||||
...
|
||||
LL | spawn(async {
|
||||
| ^^^^^ future is not `Send`
|
||||
|
|
|
@ -2,7 +2,7 @@ error: future cannot be sent between threads safely
|
|||
--> $DIR/issue-65436-raw-ptr-not-send.rs:12:5
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_: T) {}
|
||||
| ----------- ---- required by this bound in `assert_send`
|
||||
| ---- required by this bound in `assert_send`
|
||||
...
|
||||
LL | assert_send(async {
|
||||
| ^^^^^^^^^^^ future returned by `main` is not `Send`
|
||||
|
|
|
@ -14,10 +14,14 @@ error[E0277]: the size for values of type `dyn Trait` cannot be known at compila
|
|||
|
|
||||
LL | let x: Vec<dyn Trait + Sized> = Vec::new();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
::: $SRC_DIR/liballoc/vec.rs:LL:COL
|
||||
|
|
||||
LL | pub struct Vec<T> {
|
||||
| - required by this bound in `std::vec::Vec`
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `dyn Trait`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required by `std::vec::Vec`
|
||||
|
||||
error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
|
||||
--> $DIR/bad-sized.rs:4:37
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: `F` cannot be sent between threads safely
|
|||
--> $DIR/closure-bounds-cant-promote-superkind-in-struct.rs:5:22
|
||||
|
|
||||
LL | struct X<F> where F: FnOnce() + 'static + Send {
|
||||
| ---------------------------------------------- required by `X`
|
||||
| ---- required by this bound in `X`
|
||||
...
|
||||
LL | fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static {
|
||||
| ^^^^ `F` cannot be sent between threads safely
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: `F` cannot be shared between threads safely
|
|||
--> $DIR/closure-bounds-subtype.rs:13:22
|
||||
|
|
||||
LL | fn take_const_owned<F>(_: F) where F: FnOnce() + Sync + Send {
|
||||
| ---------------- ---- required by this bound in `take_const_owned`
|
||||
| ---- required by this bound in `take_const_owned`
|
||||
...
|
||||
LL | take_const_owned(f);
|
||||
| ^ `F` cannot be shared between threads safely
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `&dyn Trait: Trait` is not satisfied
|
|||
--> $DIR/coherence-unsafe-trait-object-impl.rs:15:13
|
||||
|
|
||||
LL | fn takes_t<S: Trait>(s: S) {
|
||||
| ------- ----- required by this bound in `takes_t`
|
||||
| ----- required by this bound in `takes_t`
|
||||
...
|
||||
LL | takes_t(t);
|
||||
| ^ the trait `Trait` is not implemented for `&dyn Trait`
|
||||
|
|
|
@ -15,7 +15,7 @@ error[E0277]: the size for values of type `A` cannot be known at compilation tim
|
|||
--> $DIR/too_generic_eval_ice.rs:7:13
|
||||
|
|
||||
LL | pub struct Foo<A, B>(A, B);
|
||||
| --------------------------- required by `Foo`
|
||||
| - required by this bound in `Foo`
|
||||
LL |
|
||||
LL | impl<A, B> Foo<A, B> {
|
||||
| - this type parameter needs to be `std::marker::Sized`
|
||||
|
@ -30,7 +30,7 @@ error[E0277]: the size for values of type `B` cannot be known at compilation tim
|
|||
--> $DIR/too_generic_eval_ice.rs:7:13
|
||||
|
|
||||
LL | pub struct Foo<A, B>(A, B);
|
||||
| --------------------------- required by `Foo`
|
||||
| - required by this bound in `Foo`
|
||||
LL |
|
||||
LL | impl<A, B> Foo<A, B> {
|
||||
| - this type parameter needs to be `std::marker::Sized`
|
||||
|
|
|
@ -3,8 +3,12 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied
|
|||
|
|
||||
LL | x: Error
|
||||
| ^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Error`
|
||||
|
|
||||
::: $SRC_DIR/libcore/cmp.rs:LL:COL
|
||||
|
|
||||
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
|
||||
| -- required by this bound in `std::cmp::AssertParamIsEq`
|
||||
|
|
||||
= note: required by `std::cmp::AssertParamIsEq`
|
||||
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
|
@ -3,8 +3,12 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied
|
|||
|
|
||||
LL | Error
|
||||
| ^^^^^ the trait `std::cmp::Eq` is not implemented for `Error`
|
||||
|
|
||||
::: $SRC_DIR/libcore/cmp.rs:LL:COL
|
||||
|
|
||||
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
|
||||
| -- required by this bound in `std::cmp::AssertParamIsEq`
|
||||
|
|
||||
= note: required by `std::cmp::AssertParamIsEq`
|
||||
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
|
@ -3,8 +3,12 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied
|
|||
|
|
||||
LL | x: Error
|
||||
| ^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Error`
|
||||
|
|
||||
::: $SRC_DIR/libcore/cmp.rs:LL:COL
|
||||
|
|
||||
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
|
||||
| -- required by this bound in `std::cmp::AssertParamIsEq`
|
||||
|
|
||||
= note: required by `std::cmp::AssertParamIsEq`
|
||||
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
|
@ -3,8 +3,12 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied
|
|||
|
|
||||
LL | Error
|
||||
| ^^^^^ the trait `std::cmp::Eq` is not implemented for `Error`
|
||||
|
|
||||
::: $SRC_DIR/libcore/cmp.rs:LL:COL
|
||||
|
|
||||
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
|
||||
| -- required by this bound in `std::cmp::AssertParamIsEq`
|
||||
|
|
||||
= note: required by `std::cmp::AssertParamIsEq`
|
||||
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `C: std::marker::Copy` is not satisfied
|
|||
--> $DIR/deriving-copyclone.rs:31:13
|
||||
|
|
||||
LL | fn is_copy<T: Copy>(_: T) {}
|
||||
| ------- ---- required by this bound in `is_copy`
|
||||
| ---- required by this bound in `is_copy`
|
||||
...
|
||||
LL | is_copy(B { a: 1, b: C });
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
@ -16,7 +16,7 @@ error[E0277]: the trait bound `C: std::clone::Clone` is not satisfied
|
|||
--> $DIR/deriving-copyclone.rs:32:14
|
||||
|
|
||||
LL | fn is_clone<T: Clone>(_: T) {}
|
||||
| -------- ----- required by this bound in `is_clone`
|
||||
| ----- required by this bound in `is_clone`
|
||||
...
|
||||
LL | is_clone(B { a: 1, b: C });
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
@ -30,7 +30,7 @@ error[E0277]: the trait bound `D: std::marker::Copy` is not satisfied
|
|||
--> $DIR/deriving-copyclone.rs:35:13
|
||||
|
|
||||
LL | fn is_copy<T: Copy>(_: T) {}
|
||||
| ------- ---- required by this bound in `is_copy`
|
||||
| ---- required by this bound in `is_copy`
|
||||
...
|
||||
LL | is_copy(B { a: 1, b: D });
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0275]: overflow evaluating the requirement `J: std::marker::Send`
|
|||
--> $DIR/recursion_limit.rs:34:5
|
||||
|
|
||||
LL | fn is_send<T:Send>() { }
|
||||
| ------- ---- required by this bound in `is_send`
|
||||
| ---- required by this bound in `is_send`
|
||||
...
|
||||
LL | is_send::<A>();
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0271]: type mismatch resolving `<i8 as Trait>::AssociatedType == u32`
|
|||
--> $DIR/E0271.rs:10:5
|
||||
|
|
||||
LL | fn foo<T>(t: T) where T: Trait<AssociatedType=u32> {
|
||||
| --- ------------------ required by this bound in `foo`
|
||||
| ------------------ required by this bound in `foo`
|
||||
...
|
||||
LL | foo(3_i8);
|
||||
| ^^^ expected `u32`, found `&str`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0275]: overflow evaluating the requirement `Bar<Bar<Bar<Bar<Bar<Bar<Bar<B
|
|||
--> $DIR/E0275.rs:5:33
|
||||
|
|
||||
LL | trait Foo {}
|
||||
| --------- required by `Foo`
|
||||
| --------- required by this bound in `Foo`
|
||||
...
|
||||
LL | impl<T> Foo for T where Bar<T>: Foo {}
|
||||
| ^^^
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: `*const u8` cannot be sent between threads safely
|
|||
--> $DIR/E0277-2.rs:16:5
|
||||
|
|
||||
LL | fn is_send<T: Send>() { }
|
||||
| ------- ---- required by this bound in `is_send`
|
||||
| ---- required by this bound in `is_send`
|
||||
...
|
||||
LL | is_send::<Foo>();
|
||||
| ^^^^^^^^^^^^^^ `*const u8` cannot be sent between threads safely
|
||||
|
|
|
@ -14,7 +14,7 @@ error[E0277]: the trait bound `i32: Foo` is not satisfied
|
|||
--> $DIR/E0277.rs:17:15
|
||||
|
|
||||
LL | fn some_func<T: Foo>(foo: T) {
|
||||
| --------- --- required by this bound in `some_func`
|
||||
| --- required by this bound in `some_func`
|
||||
...
|
||||
LL | some_func(5i32);
|
||||
| ^^^^ the trait `Foo` is not implemented for `i32`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not sa
|
|||
--> $DIR/error-should-say-copy-not-pod.rs:6:17
|
||||
|
|
||||
LL | fn check_bound<T:Copy>(_: T) {}
|
||||
| ----------- ---- required by this bound in `check_bound`
|
||||
| ---- required by this bound in `check_bound`
|
||||
...
|
||||
LL | check_bound("nocopy".to_string());
|
||||
| ^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: `A` cannot be shared between threads safely
|
|||
--> $DIR/extern-types-not-sync-send.rs:13:19
|
||||
|
|
||||
LL | fn assert_sync<T: ?Sized + Sync>() { }
|
||||
| ----------- ---- required by this bound in `assert_sync`
|
||||
| ---- required by this bound in `assert_sync`
|
||||
...
|
||||
LL | assert_sync::<A>();
|
||||
| ^ `A` cannot be shared between threads safely
|
||||
|
@ -13,7 +13,7 @@ error[E0277]: `A` cannot be sent between threads safely
|
|||
--> $DIR/extern-types-not-sync-send.rs:16:19
|
||||
|
|
||||
LL | fn assert_send<T: ?Sized + Send>() { }
|
||||
| ----------- ---- required by this bound in `assert_send`
|
||||
| ---- required by this bound in `assert_send`
|
||||
...
|
||||
LL | assert_send::<A>();
|
||||
| ^ `A` cannot be sent between threads safely
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the size for values of type `A` cannot be known at compilation tim
|
|||
--> $DIR/extern-types-unsized.rs:22:20
|
||||
|
|
||||
LL | fn assert_sized<T>() { }
|
||||
| ------------ - required by this bound in `assert_sized`
|
||||
| - required by this bound in `assert_sized`
|
||||
...
|
||||
LL | assert_sized::<A>();
|
||||
| ^ doesn't have a size known at compile-time
|
||||
|
@ -18,7 +18,7 @@ error[E0277]: the size for values of type `A` cannot be known at compilation tim
|
|||
--> $DIR/extern-types-unsized.rs:25:5
|
||||
|
|
||||
LL | fn assert_sized<T>() { }
|
||||
| ------------ - required by this bound in `assert_sized`
|
||||
| - required by this bound in `assert_sized`
|
||||
...
|
||||
LL | assert_sized::<Foo>();
|
||||
| ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
@ -31,7 +31,7 @@ error[E0277]: the size for values of type `A` cannot be known at compilation tim
|
|||
--> $DIR/extern-types-unsized.rs:28:5
|
||||
|
|
||||
LL | fn assert_sized<T>() { }
|
||||
| ------------ - required by this bound in `assert_sized`
|
||||
| - required by this bound in `assert_sized`
|
||||
...
|
||||
LL | assert_sized::<Bar<A>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
@ -44,7 +44,7 @@ error[E0277]: the size for values of type `A` cannot be known at compilation tim
|
|||
--> $DIR/extern-types-unsized.rs:31:5
|
||||
|
|
||||
LL | fn assert_sized<T>() { }
|
||||
| ------------ - required by this bound in `assert_sized`
|
||||
| - required by this bound in `assert_sized`
|
||||
...
|
||||
LL | assert_sized::<Bar<Bar<A>>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: expected a `std::ops::Fn<()>` closure, found `extern "C" fn() {f}`
|
|||
--> $DIR/extern-wrong-value-type.rs:9:11
|
||||
|
|
||||
LL | fn is_fn<F>(_: F) where F: Fn() {}
|
||||
| ----- ---- required by this bound in `is_fn`
|
||||
| ---- required by this bound in `is_fn`
|
||||
...
|
||||
LL | is_fn(f);
|
||||
| ^ expected an `Fn<()>` closure, found `extern "C" fn() {f}`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: `core::fmt::Opaque` cannot be shared between threads safely
|
|||
--> $DIR/send-sync.rs:8:5
|
||||
|
|
||||
LL | fn send<T: Send>(_: T) {}
|
||||
| ---- ---- required by this bound in `send`
|
||||
| ---- required by this bound in `send`
|
||||
...
|
||||
LL | send(format_args!("{:?}", c));
|
||||
| ^^^^ `core::fmt::Opaque` cannot be shared between threads safely
|
||||
|
@ -18,7 +18,7 @@ error[E0277]: `core::fmt::Opaque` cannot be shared between threads safely
|
|||
--> $DIR/send-sync.rs:9:5
|
||||
|
|
||||
LL | fn sync<T: Sync>(_: T) {}
|
||||
| ---- ---- required by this bound in `sync`
|
||||
| ---- required by this bound in `sync`
|
||||
...
|
||||
LL | sync(format_args!("{:?}", c));
|
||||
| ^^^^ `core::fmt::Opaque` cannot be shared between threads safely
|
||||
|
|
|
@ -35,7 +35,7 @@ error[E0277]: expected a `std::ops::Fn<(isize,)>` closure, found `{integer}`
|
|||
--> $DIR/fn-trait-formatting.rs:19:14
|
||||
|
|
||||
LL | fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {}
|
||||
| -------- ------------------ required by this bound in `needs_fn`
|
||||
| ------------------ required by this bound in `needs_fn`
|
||||
...
|
||||
LL | needs_fn(1);
|
||||
| ^ expected an `Fn<(isize,)>` closure, found `{integer}`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: `std::cell::Cell<i32>` cannot be shared between threads safely
|
|||
--> $DIR/not-send-sync.rs:16:5
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_: T) {}
|
||||
| ----------- ---- required by this bound in `main::assert_send`
|
||||
| ---- required by this bound in `main::assert_send`
|
||||
...
|
||||
LL | assert_send(|| {
|
||||
| ^^^^^^^^^^^ `std::cell::Cell<i32>` cannot be shared between threads safely
|
||||
|
@ -15,7 +15,7 @@ error: future cannot be shared between threads safely
|
|||
--> $DIR/not-send-sync.rs:9:5
|
||||
|
|
||||
LL | fn assert_sync<T: Sync>(_: T) {}
|
||||
| ----------- ---- required by this bound in `main::assert_sync`
|
||||
| ---- required by this bound in `main::assert_sync`
|
||||
...
|
||||
LL | assert_sync(|| {
|
||||
| ^^^^^^^^^^^ future returned by `main` is not `Sync`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0631]: type mismatch in function arguments
|
|||
--> $DIR/resume-arg-late-bound.rs:15:10
|
||||
|
|
||||
LL | fn test(a: impl for<'a> Generator<&'a mut bool>) {}
|
||||
| ---- ------------------------------- required by this bound in `test`
|
||||
| ------------------------------- required by this bound in `test`
|
||||
...
|
||||
LL | test(gen);
|
||||
| ^^^
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: `[static generator@$DIR/static-not-unpin.rs:11:25: 13:6 _]` cannot
|
|||
--> $DIR/static-not-unpin.rs:14:18
|
||||
|
|
||||
LL | fn assert_unpin<T: Unpin>(_: T) {
|
||||
| ------------ ----- required by this bound in `assert_unpin`
|
||||
| ----- required by this bound in `assert_unpin`
|
||||
...
|
||||
LL | assert_unpin(generator);
|
||||
| ^^^^^^^^^ the trait `std::marker::Unpin` is not implemented for `[static generator@$DIR/static-not-unpin.rs:11:25: 13:6 _]`
|
||||
|
|
|
@ -2,9 +2,9 @@ error[E0280]: the requirement `for<'a> <Self as Iterator>::Item<'a>: 'a` is not
|
|||
--> $DIR/issue-62326-parameter-out-of-range.rs:7:20
|
||||
|
|
||||
LL | trait Iterator {
|
||||
| -------------- required by `Iterator`
|
||||
| --------
|
||||
LL | type Item<'a>: 'a;
|
||||
| ^^
|
||||
| ^^ required by this bound in `Iterator`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -38,7 +38,10 @@ error[E0271]: type mismatch resolving `for<'a> <<std::vec::Vec<T> as Iterable>::
|
|||
--> $DIR/iterable.rs:19:30
|
||||
|
|
||||
LL | trait Iterable {
|
||||
| -------------- required by `Iterable`
|
||||
| --------
|
||||
LL | type Item<'a> where Self: 'a;
|
||||
LL | type Iter<'a>: Iterator<Item = Self::Item<'a>> where Self: 'a;
|
||||
| --------------------- required by this bound in `Iterable`
|
||||
...
|
||||
LL | fn iter<'a>(&'a self) -> Self::Iter<'a> {
|
||||
| ^^^^^^^^^^^^^^ expected associated type, found reference
|
||||
|
@ -52,7 +55,10 @@ error[E0271]: type mismatch resolving `for<'a> <<[T] as Iterable>::Iter<'a> as s
|
|||
--> $DIR/iterable.rs:31:30
|
||||
|
|
||||
LL | trait Iterable {
|
||||
| -------------- required by `Iterable`
|
||||
| --------
|
||||
LL | type Item<'a> where Self: 'a;
|
||||
LL | type Iter<'a>: Iterator<Item = Self::Item<'a>> where Self: 'a;
|
||||
| --------------------- required by this bound in `Iterable`
|
||||
...
|
||||
LL | fn iter<'a>(&'a self) -> Self::Iter<'a> {
|
||||
| ^^^^^^^^^^^^^^ expected associated type, found reference
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `for<'r> fn(&'r i32): Foo` is not satisfied
|
|||
--> $DIR/issue-46989.rs:40:18
|
||||
|
|
||||
LL | fn assert_foo<T: Foo>() {}
|
||||
| ---------- --- required by this bound in `assert_foo`
|
||||
| --- required by this bound in `assert_foo`
|
||||
...
|
||||
LL | assert_foo::<fn(&i32)>();
|
||||
| ^^^^^^^^ the trait `Foo` is not implemented for `for<'r> fn(&'r i32)`
|
||||
|
|
|
@ -258,7 +258,7 @@ error[E0277]: `std::rc::Rc<std::string::String>` cannot be sent between threads
|
|||
--> $DIR/auto-trait-leak.rs:16:5
|
||||
|
|
||||
LL | fn send<T: Send>(_: T) {}
|
||||
| ---- ---- required by this bound in `send`
|
||||
| ---- required by this bound in `send`
|
||||
...
|
||||
LL | send(cycle2().clone());
|
||||
| ^^^^ `std::rc::Rc<std::string::String>` cannot be sent between threads safely
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | fn before() -> impl Fn(i32) {
|
|||
| ------------ within this `impl std::ops::Fn<(i32,)>`
|
||||
...
|
||||
LL | fn send<T: Send>(_: T) {}
|
||||
| ---- ---- required by this bound in `send`
|
||||
| ---- required by this bound in `send`
|
||||
...
|
||||
LL | send(before());
|
||||
| ^^^^ `std::rc::Rc<std::cell::Cell<i32>>` cannot be sent between threads safely
|
||||
|
@ -18,7 +18,7 @@ error[E0277]: `std::rc::Rc<std::cell::Cell<i32>>` cannot be sent between threads
|
|||
--> $DIR/auto-trait-leak2.rs:16:5
|
||||
|
|
||||
LL | fn send<T: Send>(_: T) {}
|
||||
| ---- ---- required by this bound in `send`
|
||||
| ---- required by this bound in `send`
|
||||
...
|
||||
LL | send(after());
|
||||
| ^^^^ `std::rc::Rc<std::cell::Cell<i32>>` cannot be sent between threads safely
|
||||
|
|
|
@ -4,4 +4,9 @@ fn ho_func(f: Option<FuncType>) {
|
|||
//~^ ERROR the size for values of type
|
||||
}
|
||||
|
||||
enum Option<T> {
|
||||
Some(T),
|
||||
None,
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -3,10 +3,12 @@ error[E0277]: the size for values of type `dyn for<'r> std::ops::Fn(&'r isize) -
|
|||
|
|
||||
LL | fn ho_func(f: Option<FuncType>) {
|
||||
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
...
|
||||
LL | enum Option<T> {
|
||||
| - required by this bound in `Option`
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `dyn for<'r> std::ops::Fn(&'r isize) -> isize`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required by `std::option::Option`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `foo::issue_1920::S: std::clone::Clone` is not sat
|
|||
--> $DIR/issue-1920-1.rs:12:20
|
||||
|
|
||||
LL | fn assert_clone<T>() where T : Clone { }
|
||||
| ------------ ----- required by this bound in `assert_clone`
|
||||
| ----- required by this bound in `assert_clone`
|
||||
...
|
||||
LL | assert_clone::<foo::issue_1920::S>();
|
||||
| ^^^^^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `foo::issue_1920::S`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `bar::S: std::clone::Clone` is not satisfied
|
|||
--> $DIR/issue-1920-2.rs:10:20
|
||||
|
|
||||
LL | fn assert_clone<T>() where T : Clone { }
|
||||
| ------------ ----- required by this bound in `assert_clone`
|
||||
| ----- required by this bound in `assert_clone`
|
||||
...
|
||||
LL | assert_clone::<bar::S>();
|
||||
| ^^^^^^ the trait `std::clone::Clone` is not implemented for `bar::S`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `issue_1920::S: std::clone::Clone` is not satisfie
|
|||
--> $DIR/issue-1920-3.rs:14:20
|
||||
|
|
||||
LL | fn assert_clone<T>() where T : Clone { }
|
||||
| ------------ ----- required by this bound in `assert_clone`
|
||||
| ----- required by this bound in `assert_clone`
|
||||
...
|
||||
LL | assert_clone::<foo::issue_1920::S>();
|
||||
| ^^^^^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `issue_1920::S`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation
|
|||
--> $DIR/issue-20005.rs:10:49
|
||||
|
|
||||
LL | trait From<Src> {
|
||||
| --------------- required by `From`
|
||||
| --- required by this bound in `From`
|
||||
...
|
||||
LL | ) -> <Dst as From<Self>>::Result where Dst: From<Self> {
|
||||
| ^^^^^^^^^^- help: consider further restricting `Self`: `, Self: std::marker::Sized`
|
||||
|
|
|
@ -10,7 +10,7 @@ error[E0275]: overflow evaluating the requirement `NoData<NoData<NoData<NoData<N
|
|||
--> $DIR/issue-20413.rs:8:36
|
||||
|
|
||||
LL | trait Foo {
|
||||
| --------- required by `Foo`
|
||||
| --------- required by this bound in `Foo`
|
||||
...
|
||||
LL | impl<T> Foo for T where NoData<T>: Foo {
|
||||
| ^^^
|
||||
|
@ -148,7 +148,7 @@ error[E0275]: overflow evaluating the requirement `NoData<NoData<NoData<NoData<N
|
|||
--> $DIR/issue-20413.rs:8:36
|
||||
|
|
||||
LL | trait Foo {
|
||||
| --------- required by `Foo`
|
||||
| --------- required by this bound in `Foo`
|
||||
...
|
||||
LL | impl<T> Foo for T where NoData<T>: Foo {
|
||||
| ^^^
|
||||
|
|
|
@ -3,10 +3,14 @@ error[E0277]: the size for values of type `[i32]` cannot be known at compilation
|
|||
|
|
||||
LL | fn iceman(c: Vec<[i32]>) {}
|
||||
| ^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
::: $SRC_DIR/liballoc/vec.rs:LL:COL
|
||||
|
|
||||
LL | pub struct Vec<T> {
|
||||
| - required by this bound in `std::vec::Vec`
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[i32]`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required by `std::vec::Vec`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: `std::rc::Rc<()>` cannot be sent between threads safely
|
|||
--> $DIR/issue-21763.rs:9:5
|
||||
|
|
||||
LL | fn foo<T: Send>() {}
|
||||
| --- ---- required by this bound in `foo`
|
||||
| ---- required by this bound in `foo`
|
||||
...
|
||||
LL | foo::<HashMap<Rc<()>, Rc<()>>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::rc::Rc<()>` cannot be sent between threads safely
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: Bound` is not satisfied
|
|||
--> $DIR/issue-21837.rs:8:9
|
||||
|
|
||||
LL | pub struct Foo<T: Bound>(T);
|
||||
| ---------------------------- required by `Foo`
|
||||
| ----- required by this bound in `Foo`
|
||||
...
|
||||
LL | impl<T> Trait2 for Foo<T> {}
|
||||
| ^^^^^^ the trait `Bound` is not implemented for `T`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0283]: type annotations needed
|
|||
--> $DIR/issue-21974.rs:11:19
|
||||
|
|
||||
LL | trait Foo {
|
||||
| --------- required by `Foo`
|
||||
| --------- required by this bound in `Foo`
|
||||
...
|
||||
LL | where &'a T : Foo,
|
||||
| ^^^ cannot infer type for reference `&'a T`
|
||||
|
|
|
@ -5,4 +5,8 @@ impl Struct {
|
|||
//~^ ERROR the size for values of type
|
||||
}
|
||||
|
||||
struct Vec<T> {
|
||||
t: T,
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -3,10 +3,12 @@ error[E0277]: the size for values of type `(dyn std::ops::Fn() + 'static)` canno
|
|||
|
|
||||
LL | pub fn function(funs: Vec<dyn Fn() -> ()>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
...
|
||||
LL | struct Vec<T> {
|
||||
| - required by this bound in `Vec`
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() + 'static)`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required by `std::vec::Vec`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@ error[E0271]: type mismatch resolving `<<T as Trait>::A as MultiDispatch<i32>>::
|
|||
--> $DIR/issue-24204.rs:14:12
|
||||
|
|
||||
LL | trait Trait: Sized {
|
||||
| ------------------ required by `Trait`
|
||||
| -----
|
||||
LL | type A: MultiDispatch<Self::B, O = Self>;
|
||||
| -------- required by this bound in `Trait`
|
||||
...
|
||||
LL | fn test<T: Trait<B=i32>>(b: i32) -> T where T::A: MultiDispatch<i32> { T::new(b) }
|
||||
| ^^^^^^^^^^^^ expected type parameter `T`, found associated type
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0283]: type annotations needed
|
|||
--> $DIR/issue-24424.rs:4:57
|
||||
|
|
||||
LL | trait Trait0<'l0> {}
|
||||
| ----------------- required by `Trait0`
|
||||
| ----------------- required by this bound in `Trait0`
|
||||
LL |
|
||||
LL | impl <'l0, 'l1, T0> Trait1<'l0, T0> for bool where T0 : Trait0<'l0>, T0 : Trait0<'l1> {}
|
||||
| ^^^^^^^^^^^ cannot infer type for type parameter `T0`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `(): InOut<_>` is not satisfied
|
|||
--> $DIR/issue-25076.rs:10:20
|
||||
|
|
||||
LL | fn do_fold<B, F: InOut<B, Out=B>>(init: B, f: F) {}
|
||||
| ------- --------------- required by this bound in `do_fold`
|
||||
| --------------- required by this bound in `do_fold`
|
||||
...
|
||||
LL | do_fold(bot(), ());
|
||||
| ^^ the trait `InOut<_>` is not implemented for `()`
|
||||
|
|
|
@ -24,7 +24,7 @@ error[E0277]: the trait bound `dyn Misc: std::marker::Copy` is not satisfied
|
|||
--> $DIR/issue-32963.rs:8:5
|
||||
|
|
||||
LL | fn size_of_copy<T: Copy+?Sized>() -> usize { mem::size_of::<T>() }
|
||||
| ------------ ---- required by this bound in `size_of_copy`
|
||||
| ---- required by this bound in `size_of_copy`
|
||||
...
|
||||
LL | size_of_copy::<dyn Misc + Copy>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `dyn Misc`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: `std::rc::Rc<Foo>` cannot be sent between threads safely
|
|||
--> $DIR/issue-40827.rs:14:5
|
||||
|
|
||||
LL | fn f<T: Send>(_: T) {}
|
||||
| - ---- required by this bound in `f`
|
||||
| ---- required by this bound in `f`
|
||||
...
|
||||
LL | f(Foo(Arc::new(Bar::B(None))));
|
||||
| ^ `std::rc::Rc<Foo>` cannot be sent between threads safely
|
||||
|
@ -16,7 +16,7 @@ error[E0277]: `std::rc::Rc<Foo>` cannot be shared between threads safely
|
|||
--> $DIR/issue-40827.rs:14:5
|
||||
|
|
||||
LL | fn f<T: Send>(_: T) {}
|
||||
| - ---- required by this bound in `f`
|
||||
| ---- required by this bound in `f`
|
||||
...
|
||||
LL | f(Foo(Arc::new(Bar::B(None))));
|
||||
| ^ `std::rc::Rc<Foo>` cannot be shared between threads safely
|
||||
|
|
|
@ -11,7 +11,7 @@ LL | const ARR_LEN: usize = Tt::const_val::<[i8; 123]>();
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
|
||||
...
|
||||
LL | const fn const_val<T: Sized>() -> usize {
|
||||
| --------- - required by this bound in `Tt::const_val`
|
||||
| - required by this bound in `Tt::const_val`
|
||||
|
|
||||
= note: cannot satisfy `_: Tt`
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: `u8` is not an iterator
|
|||
--> $DIR/bound.rs:2:10
|
||||
|
|
||||
LL | struct S<I: Iterator>(I);
|
||||
| ------------------------- required by `S`
|
||||
| -------- required by this bound in `S`
|
||||
LL | struct T(S<u8>);
|
||||
| ^^^^^ `u8` is not an iterator
|
||||
|
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `&'static mut isize: std::marker::Copy` is not sat
|
|||
--> $DIR/kindck-copy.rs:27:19
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ----------- ---- required by this bound in `assert_copy`
|
||||
| ---- required by this bound in `assert_copy`
|
||||
...
|
||||
LL | assert_copy::<&'static mut isize>();
|
||||
| ^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'static mut isize`
|
||||
|
@ -14,7 +14,7 @@ error[E0277]: the trait bound `&'a mut isize: std::marker::Copy` is not satisfie
|
|||
--> $DIR/kindck-copy.rs:28:19
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ----------- ---- required by this bound in `assert_copy`
|
||||
| ---- required by this bound in `assert_copy`
|
||||
...
|
||||
LL | assert_copy::<&'a mut isize>();
|
||||
| ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'a mut isize`
|
||||
|
@ -26,7 +26,7 @@ error[E0277]: the trait bound `std::boxed::Box<isize>: std::marker::Copy` is not
|
|||
--> $DIR/kindck-copy.rs:31:19
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ----------- ---- required by this bound in `assert_copy`
|
||||
| ---- required by this bound in `assert_copy`
|
||||
...
|
||||
LL | assert_copy::<Box<isize>>();
|
||||
| ^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<isize>`
|
||||
|
@ -35,7 +35,7 @@ error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not sa
|
|||
--> $DIR/kindck-copy.rs:32:19
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ----------- ---- required by this bound in `assert_copy`
|
||||
| ---- required by this bound in `assert_copy`
|
||||
...
|
||||
LL | assert_copy::<String>();
|
||||
| ^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String`
|
||||
|
@ -44,7 +44,7 @@ error[E0277]: the trait bound `std::vec::Vec<isize>: std::marker::Copy` is not s
|
|||
--> $DIR/kindck-copy.rs:33:19
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ----------- ---- required by this bound in `assert_copy`
|
||||
| ---- required by this bound in `assert_copy`
|
||||
...
|
||||
LL | assert_copy::<Vec<isize> >();
|
||||
| ^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::vec::Vec<isize>`
|
||||
|
@ -53,7 +53,7 @@ error[E0277]: the trait bound `std::boxed::Box<&'a mut isize>: std::marker::Copy
|
|||
--> $DIR/kindck-copy.rs:34:19
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ----------- ---- required by this bound in `assert_copy`
|
||||
| ---- required by this bound in `assert_copy`
|
||||
...
|
||||
LL | assert_copy::<Box<&'a mut isize>>();
|
||||
| ^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<&'a mut isize>`
|
||||
|
@ -62,7 +62,7 @@ error[E0277]: the trait bound `std::boxed::Box<dyn Dummy>: std::marker::Copy` is
|
|||
--> $DIR/kindck-copy.rs:42:5
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ----------- ---- required by this bound in `assert_copy`
|
||||
| ---- required by this bound in `assert_copy`
|
||||
...
|
||||
LL | assert_copy::<Box<dyn Dummy>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<dyn Dummy>`
|
||||
|
@ -71,7 +71,7 @@ error[E0277]: the trait bound `std::boxed::Box<dyn Dummy + std::marker::Send>: s
|
|||
--> $DIR/kindck-copy.rs:43:5
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ----------- ---- required by this bound in `assert_copy`
|
||||
| ---- required by this bound in `assert_copy`
|
||||
...
|
||||
LL | assert_copy::<Box<dyn Dummy + Send>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<dyn Dummy + std::marker::Send>`
|
||||
|
@ -80,7 +80,7 @@ error[E0277]: the trait bound `&'a mut (dyn Dummy + std::marker::Send + 'a): std
|
|||
--> $DIR/kindck-copy.rs:46:19
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ----------- ---- required by this bound in `assert_copy`
|
||||
| ---- required by this bound in `assert_copy`
|
||||
...
|
||||
LL | assert_copy::<&'a mut (dyn Dummy + Send)>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'a mut (dyn Dummy + std::marker::Send + 'a)`
|
||||
|
@ -89,7 +89,7 @@ error[E0277]: the trait bound `MyNoncopyStruct: std::marker::Copy` is not satisf
|
|||
--> $DIR/kindck-copy.rs:64:19
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ----------- ---- required by this bound in `assert_copy`
|
||||
| ---- required by this bound in `assert_copy`
|
||||
...
|
||||
LL | assert_copy::<MyNoncopyStruct>();
|
||||
| ^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `MyNoncopyStruct`
|
||||
|
@ -98,7 +98,7 @@ error[E0277]: the trait bound `std::rc::Rc<isize>: std::marker::Copy` is not sat
|
|||
--> $DIR/kindck-copy.rs:67:19
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ----------- ---- required by this bound in `assert_copy`
|
||||
| ---- required by this bound in `assert_copy`
|
||||
...
|
||||
LL | assert_copy::<Rc<isize>>();
|
||||
| ^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::rc::Rc<isize>`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `std::boxed::Box<{integer}>: Foo` is not satisfied
|
|||
--> $DIR/kindck-impl-type-params-2.rs:13:16
|
||||
|
|
||||
LL | fn take_param<T:Foo>(foo: &T) { }
|
||||
| ---------- --- required by this bound in `take_param`
|
||||
| --- required by this bound in `take_param`
|
||||
...
|
||||
LL | take_param(&x);
|
||||
| ^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<{integer}>`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `std::boxed::Box<{integer}>: Foo` is not satisfied
|
|||
--> $DIR/kindck-inherited-copy-bound.rs:21:16
|
||||
|
|
||||
LL | fn take_param<T:Foo>(foo: &T) { }
|
||||
| ---------- --- required by this bound in `take_param`
|
||||
| --- required by this bound in `take_param`
|
||||
...
|
||||
LL | take_param(&x);
|
||||
| ^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<{integer}>`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `std::boxed::Box<{integer}>: Foo` is not satisfied
|
|||
--> $DIR/kindck-inherited-copy-bound.rs:21:16
|
||||
|
|
||||
LL | fn take_param<T:Foo>(foo: &T) { }
|
||||
| ---------- --- required by this bound in `take_param`
|
||||
| --- required by this bound in `take_param`
|
||||
...
|
||||
LL | take_param(&x);
|
||||
| ^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<{integer}>`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: `std::rc::Rc<usize>` cannot be sent between threads safely
|
|||
--> $DIR/kindck-nonsendable-1.rs:9:5
|
||||
|
|
||||
LL | fn bar<F:FnOnce() + Send>(_: F) { }
|
||||
| --- ---- required by this bound in `bar`
|
||||
| ---- required by this bound in `bar`
|
||||
...
|
||||
LL | bar(move|| foo(x));
|
||||
| ^^^ ------------- within this `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22 x:std::rc::Rc<usize>]`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: `(dyn Dummy + 'static)` cannot be shared between threads safely
|
|||
--> $DIR/kindck-send-object.rs:12:5
|
||||
|
|
||||
LL | fn assert_send<T:Send>() { }
|
||||
| ----------- ---- required by this bound in `assert_send`
|
||||
| ---- required by this bound in `assert_send`
|
||||
...
|
||||
LL | assert_send::<&'static (dyn Dummy + 'static)>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely
|
||||
|
@ -14,7 +14,7 @@ error[E0277]: `dyn Dummy` cannot be sent between threads safely
|
|||
--> $DIR/kindck-send-object.rs:17:5
|
||||
|
|
||||
LL | fn assert_send<T:Send>() { }
|
||||
| ----------- ---- required by this bound in `assert_send`
|
||||
| ---- required by this bound in `assert_send`
|
||||
...
|
||||
LL | assert_send::<Box<dyn Dummy>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: `(dyn Dummy + 'a)` cannot be shared between threads safely
|
|||
--> $DIR/kindck-send-object1.rs:10:5
|
||||
|
|
||||
LL | fn assert_send<T:Send+'static>() { }
|
||||
| ----------- ---- required by this bound in `assert_send`
|
||||
| ---- required by this bound in `assert_send`
|
||||
...
|
||||
LL | assert_send::<&'a dyn Dummy>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely
|
||||
|
@ -14,7 +14,7 @@ error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely
|
|||
--> $DIR/kindck-send-object1.rs:29:5
|
||||
|
|
||||
LL | fn assert_send<T:Send+'static>() { }
|
||||
| ----------- ---- required by this bound in `assert_send`
|
||||
| ---- required by this bound in `assert_send`
|
||||
...
|
||||
LL | assert_send::<Box<dyn Dummy + 'a>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: `(dyn Dummy + 'a)` cannot be shared between threads safely
|
|||
--> $DIR/kindck-send-object1.rs:10:5
|
||||
|
|
||||
LL | fn assert_send<T:Send+'static>() { }
|
||||
| ----------- ---- required by this bound in `assert_send`
|
||||
| ---- required by this bound in `assert_send`
|
||||
...
|
||||
LL | assert_send::<&'a dyn Dummy>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely
|
||||
|
@ -22,7 +22,7 @@ error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely
|
|||
--> $DIR/kindck-send-object1.rs:29:5
|
||||
|
|
||||
LL | fn assert_send<T:Send+'static>() { }
|
||||
| ----------- ---- required by this bound in `assert_send`
|
||||
| ---- required by this bound in `assert_send`
|
||||
...
|
||||
LL | assert_send::<Box<dyn Dummy + 'a>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: `(dyn Dummy + 'static)` cannot be shared between threads safely
|
|||
--> $DIR/kindck-send-object2.rs:7:5
|
||||
|
|
||||
LL | fn assert_send<T:Send>() { }
|
||||
| ----------- ---- required by this bound in `assert_send`
|
||||
| ---- required by this bound in `assert_send`
|
||||
...
|
||||
LL | assert_send::<&'static dyn Dummy>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely
|
||||
|
@ -14,7 +14,7 @@ error[E0277]: `dyn Dummy` cannot be sent between threads safely
|
|||
--> $DIR/kindck-send-object2.rs:12:5
|
||||
|
|
||||
LL | fn assert_send<T:Send>() { }
|
||||
| ----------- ---- required by this bound in `assert_send`
|
||||
| ---- required by this bound in `assert_send`
|
||||
...
|
||||
LL | assert_send::<Box<dyn Dummy>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: `*mut u8` cannot be sent between threads safely
|
|||
--> $DIR/kindck-send-owned.rs:12:5
|
||||
|
|
||||
LL | fn assert_send<T:Send>() { }
|
||||
| ----------- ---- required by this bound in `assert_send`
|
||||
| ---- required by this bound in `assert_send`
|
||||
...
|
||||
LL | assert_send::<Box<*mut u8>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*mut u8` cannot be sent between threads safely
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: `*mut &'a isize` cannot be sent between threads safely
|
|||
--> $DIR/kindck-send-unsafe.rs:6:19
|
||||
|
|
||||
LL | fn assert_send<T:Send>() { }
|
||||
| ----------- ---- required by this bound in `assert_send`
|
||||
| ---- required by this bound in `assert_send`
|
||||
...
|
||||
LL | assert_send::<*mut &'a isize>();
|
||||
| ^^^^^^^^^^^^^^ `*mut &'a isize` cannot be sent between threads safely
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `NotDebugOrDisplay: Marker` is not satisfied
|
|||
--> $DIR/overlap-marker-trait.rs:27:17
|
||||
|
|
||||
LL | fn is_marker<T: Marker>() { }
|
||||
| --------- ------ required by this bound in `is_marker`
|
||||
| ------ required by this bound in `is_marker`
|
||||
...
|
||||
LL | is_marker::<NotDebugOrDisplay>();
|
||||
| ^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0631]: type mismatch in closure arguments
|
|||
--> $DIR/E0631.rs:7:5
|
||||
|
|
||||
LL | fn foo<F: Fn(usize)>(_: F) {}
|
||||
| --- --------- required by this bound in `foo`
|
||||
| --------- required by this bound in `foo`
|
||||
...
|
||||
LL | foo(|_: isize| {});
|
||||
| ^^^ ---------- found signature of `fn(isize) -> _`
|
||||
|
@ -13,7 +13,7 @@ error[E0631]: type mismatch in closure arguments
|
|||
--> $DIR/E0631.rs:8:5
|
||||
|
|
||||
LL | fn bar<F: Fn<usize>>(_: F) {}
|
||||
| --- --------- required by this bound in `bar`
|
||||
| --------- required by this bound in `bar`
|
||||
...
|
||||
LL | bar(|_: isize| {});
|
||||
| ^^^ ---------- found signature of `fn(isize) -> _`
|
||||
|
@ -24,7 +24,7 @@ error[E0631]: type mismatch in function arguments
|
|||
--> $DIR/E0631.rs:9:9
|
||||
|
|
||||
LL | fn foo<F: Fn(usize)>(_: F) {}
|
||||
| --- --------- required by this bound in `foo`
|
||||
| --------- required by this bound in `foo`
|
||||
...
|
||||
LL | fn f(_: u64) {}
|
||||
| ------------ found signature of `fn(u64) -> _`
|
||||
|
@ -36,7 +36,7 @@ error[E0631]: type mismatch in function arguments
|
|||
--> $DIR/E0631.rs:10:9
|
||||
|
|
||||
LL | fn bar<F: Fn<usize>>(_: F) {}
|
||||
| --- --------- required by this bound in `bar`
|
||||
| --------- required by this bound in `bar`
|
||||
LL | fn main() {
|
||||
LL | fn f(_: u64) {}
|
||||
| ------------ found signature of `fn(u64) -> _`
|
||||
|
|
|
@ -49,7 +49,7 @@ error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
|
|||
--> $DIR/closure-arg-count.rs:13:5
|
||||
|
|
||||
LL | fn f<F: Fn<usize>>(_: F) {}
|
||||
| - --------- required by this bound in `f`
|
||||
| --------- required by this bound in `f`
|
||||
...
|
||||
LL | f(|| panic!());
|
||||
| ^ -- takes 0 arguments
|
||||
|
@ -65,7 +65,7 @@ error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
|
|||
--> $DIR/closure-arg-count.rs:15:5
|
||||
|
|
||||
LL | fn f<F: Fn<usize>>(_: F) {}
|
||||
| - --------- required by this bound in `f`
|
||||
| --------- required by this bound in `f`
|
||||
...
|
||||
LL | f( move || panic!());
|
||||
| ^ ---------- takes 0 arguments
|
||||
|
@ -150,7 +150,7 @@ LL | call(Foo);
|
|||
| ^^^ expected function that takes 0 arguments
|
||||
...
|
||||
LL | fn call<F, R>(_: F) where F: FnOnce() -> R {}
|
||||
| ---- ------------- required by this bound in `call`
|
||||
| ------------- required by this bound in `call`
|
||||
LL | struct Foo(u8);
|
||||
| --------------- takes 1 argument
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ error[E0631]: type mismatch in function arguments
|
|||
--> $DIR/closure-arg-type-mismatch.rs:10:9
|
||||
|
|
||||
LL | fn baz<F: Fn(*mut &u32)>(_: F) {}
|
||||
| --- ------------- required by this bound in `baz`
|
||||
| ------------- required by this bound in `baz`
|
||||
LL | fn _test<'a>(f: fn(*mut &'a u32)) {
|
||||
LL | baz(f);
|
||||
| ^
|
||||
|
@ -38,7 +38,7 @@ error[E0271]: type mismatch resolving `for<'r> <fn(*mut &'a u32) as std::ops::Fn
|
|||
--> $DIR/closure-arg-type-mismatch.rs:10:5
|
||||
|
|
||||
LL | fn baz<F: Fn(*mut &u32)>(_: F) {}
|
||||
| --- ------------- required by this bound in `baz`
|
||||
| ------------- required by this bound in `baz`
|
||||
LL | fn _test<'a>(f: fn(*mut &'a u32)) {
|
||||
LL | baz(f);
|
||||
| ^^^ expected bound lifetime parameter, found concrete lifetime
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0271]: type mismatch resolving `for<'r> <[closure@$DIR/closure-mismatch.r
|
|||
--> $DIR/closure-mismatch.rs:8:5
|
||||
|
|
||||
LL | fn baz<T: Foo>(_: T) {}
|
||||
| --- --- required by this bound in `baz`
|
||||
| --- required by this bound in `baz`
|
||||
...
|
||||
LL | baz(|_| ());
|
||||
| ^^^ expected bound lifetime parameter, found concrete lifetime
|
||||
|
@ -13,7 +13,7 @@ error[E0631]: type mismatch in closure arguments
|
|||
--> $DIR/closure-mismatch.rs:8:5
|
||||
|
|
||||
LL | fn baz<T: Foo>(_: T) {}
|
||||
| --- --- required by this bound in `baz`
|
||||
| --- required by this bound in `baz`
|
||||
...
|
||||
LL | baz(|_| ());
|
||||
| ^^^ ------ found signature of `fn(_) -> _`
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | fn takes_mut(x: &mut isize) { }
|
|||
| --------------------------- found signature of `for<'r> fn(&'r mut isize) -> _`
|
||||
LL |
|
||||
LL | fn apply<T, F>(t: T, f: F) where F: FnOnce(T) {
|
||||
| ----- --------- required by this bound in `apply`
|
||||
| --------- required by this bound in `apply`
|
||||
...
|
||||
LL | apply(&3, takes_mut);
|
||||
| ^^^^^^^^^ expected signature of `fn(&{integer}) -> _`
|
||||
|
@ -17,7 +17,7 @@ LL | fn takes_imm(x: &isize) { }
|
|||
| ----------------------- found signature of `for<'r> fn(&'r isize) -> _`
|
||||
...
|
||||
LL | fn apply<T, F>(t: T, f: F) where F: FnOnce(T) {
|
||||
| ----- --------- required by this bound in `apply`
|
||||
| --------- required by this bound in `apply`
|
||||
...
|
||||
LL | apply(&mut 3, takes_imm);
|
||||
| ^^^^^^^^^ expected signature of `fn(&mut {integer}) -> _`
|
||||
|
|
|
@ -6,7 +6,6 @@ fn to_fn_mut<A,F:FnMut<A>>(f: F) -> F { f }
|
|||
|
||||
fn call_it<F:FnMut(isize,isize)->isize>(y: isize, mut f: F) -> isize {
|
||||
//~^ NOTE required by this bound in `call_it`
|
||||
//~| NOTE
|
||||
f(2, y)
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue