Fix rebase
This commit is contained in:
parent
e29765250b
commit
d08ab945de
29 changed files with 120 additions and 200 deletions
|
@ -376,7 +376,7 @@ impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> {
|
||||||
| ty::PredicateAtom::Subtype(_)
|
| ty::PredicateAtom::Subtype(_)
|
||||||
| ty::PredicateAtom::ConstEvaluatable(..)
|
| ty::PredicateAtom::ConstEvaluatable(..)
|
||||||
| ty::PredicateAtom::ConstEquate(..) => {
|
| ty::PredicateAtom::ConstEquate(..) => {
|
||||||
let (pred, _) = infcx.replace_bound_vars_with_placeholders(binder);
|
let pred = infcx.replace_bound_vars_with_placeholders(binder);
|
||||||
ProcessResult::Changed(mk_pending(vec![
|
ProcessResult::Changed(mk_pending(vec![
|
||||||
obligation.with(pred.to_predicate(self.selcx.tcx())),
|
obligation.with(pred.to_predicate(self.selcx.tcx())),
|
||||||
]))
|
]))
|
||||||
|
@ -673,7 +673,7 @@ impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> {
|
||||||
Ok(Ok(None)) => {
|
Ok(Ok(None)) => {
|
||||||
*stalled_on = trait_ref_infer_vars(
|
*stalled_on = trait_ref_infer_vars(
|
||||||
self.selcx,
|
self.selcx,
|
||||||
project_obligation.predicate.to_poly_trait_ref(self.selcx.tcx()),
|
project_obligation.predicate.to_poly_trait_ref(tcx),
|
||||||
);
|
);
|
||||||
ProcessResult::Unchanged
|
ProcessResult::Unchanged
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,6 @@ pub use self::specialize::specialization_graph::FutureCompatOverlapErrorKind;
|
||||||
pub use self::specialize::{specialization_graph, translate_substs, OverlapError};
|
pub use self::specialize::{specialization_graph, translate_substs, OverlapError};
|
||||||
pub use self::structural_match::search_for_structural_match_violation;
|
pub use self::structural_match::search_for_structural_match_violation;
|
||||||
pub use self::structural_match::NonStructuralMatchTy;
|
pub use self::structural_match::NonStructuralMatchTy;
|
||||||
pub use self::util::subst_assoc_item_bound;
|
|
||||||
pub use self::util::{elaborate_predicates, elaborate_trait_ref, elaborate_trait_refs};
|
pub use self::util::{elaborate_predicates, elaborate_trait_ref, elaborate_trait_refs};
|
||||||
pub use self::util::{expand_trait_aliases, TraitAliasExpander};
|
pub use self::util::{expand_trait_aliases, TraitAliasExpander};
|
||||||
pub use self::util::{
|
pub use self::util::{
|
||||||
|
|
|
@ -38,7 +38,7 @@ use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||||
use rustc_middle::ty::relate::TypeRelation;
|
use rustc_middle::ty::relate::TypeRelation;
|
||||||
use rustc_middle::ty::subst::{GenericArgKind, Subst, SubstsRef};
|
use rustc_middle::ty::subst::{GenericArgKind, Subst, SubstsRef};
|
||||||
use rustc_middle::ty::{self, PolyProjectionPredicate, ToPolyTraitRef, ToPredicate};
|
use rustc_middle::ty::{self, PolyProjectionPredicate, ToPolyTraitRef, ToPredicate};
|
||||||
use rustc_middle::ty::{Ty, TyCtxt, TypeFoldable};
|
use rustc_middle::ty::{Ty, TyCtxt, TypeFoldable, WithConstness};
|
||||||
use rustc_span::symbol::sym;
|
use rustc_span::symbol::sym;
|
||||||
|
|
||||||
use std::cell::{Cell, RefCell};
|
use std::cell::{Cell, RefCell};
|
||||||
|
|
|
@ -6,13 +6,11 @@ use smallvec::SmallVec;
|
||||||
use rustc_data_structures::fx::FxHashSet;
|
use rustc_data_structures::fx::FxHashSet;
|
||||||
use rustc_hir::def_id::DefId;
|
use rustc_hir::def_id::DefId;
|
||||||
use rustc_middle::ty::subst::{GenericArg, Subst, SubstsRef};
|
use rustc_middle::ty::subst::{GenericArg, Subst, SubstsRef};
|
||||||
use rustc_middle::ty::{self, ToPredicate, Ty, TyCtxt, TypeFoldable, WithConstness};
|
use rustc_middle::ty::{self, ToPredicate, Ty, TyCtxt, WithConstness};
|
||||||
|
|
||||||
use super::{Normalized, Obligation, ObligationCause, PredicateObligation, SelectionContext};
|
use super::{Normalized, Obligation, ObligationCause, PredicateObligation, SelectionContext};
|
||||||
pub use rustc_infer::traits::util::*;
|
pub use rustc_infer::traits::util::*;
|
||||||
|
|
||||||
use std::iter;
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// `TraitAliasExpander` iterator
|
// `TraitAliasExpander` iterator
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -359,69 +357,6 @@ pub fn impl_item_is_final(tcx: TyCtxt<'_>, assoc_item: &ty::AssocItem) -> bool {
|
||||||
assoc_item.defaultness.is_final() && tcx.impl_defaultness(assoc_item.container.id()).is_final()
|
assoc_item.defaultness.is_final() && tcx.impl_defaultness(assoc_item.container.id()).is_final()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Map a bound from an associated item to apply to some other type.
|
|
||||||
/// For example, given the following trait
|
|
||||||
///
|
|
||||||
/// trait X<A> { type Y<'a>: PartialEq<A> }
|
|
||||||
///
|
|
||||||
/// Say that we know that `<() as X<B>>::Y<'c> = i32` and we need to check that
|
|
||||||
/// the `PartialEq` bound applies. We would then call this function with:
|
|
||||||
///
|
|
||||||
/// - `bound` = `<Self as X<A>>::Y<'a>: PartialEq`
|
|
||||||
/// - `normalized_projection_ty` = `i32`
|
|
||||||
/// - `assoc_item_substs` = `[(), B, 'c]`
|
|
||||||
///
|
|
||||||
/// This method would then return `i32: PartialEq<B>`.
|
|
||||||
pub fn subst_assoc_item_bound<'tcx>(
|
|
||||||
tcx: TyCtxt<'tcx>,
|
|
||||||
bound: ty::Predicate<'tcx>,
|
|
||||||
normalized_projection_ty: Ty<'tcx>,
|
|
||||||
assoc_item_substs: &[GenericArg<'tcx>],
|
|
||||||
) -> ty::Predicate<'tcx> {
|
|
||||||
// We're substituting these inside the closure passed to map_bound, so they
|
|
||||||
// can't have escaping bound regions.
|
|
||||||
assert!(!normalized_projection_ty.has_escaping_bound_vars());
|
|
||||||
assert!(!assoc_item_substs.iter().all(|arg| arg.has_escaping_bound_vars()));
|
|
||||||
|
|
||||||
let translate_predicate_substs = move |predicate_substs: SubstsRef<'tcx>| {
|
|
||||||
tcx.mk_substs(
|
|
||||||
iter::once(normalized_projection_ty.into())
|
|
||||||
.chain(predicate_substs[1..].iter().map(|s| s.subst(tcx, assoc_item_substs))),
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
match bound.kind() {
|
|
||||||
ty::PredicateKind::Trait(poly_tr, c) => poly_tr
|
|
||||||
.map_bound(|tr| {
|
|
||||||
let trait_substs = translate_predicate_substs(tr.trait_ref.substs);
|
|
||||||
ty::TraitRef { def_id: tr.def_id(), substs: trait_substs }
|
|
||||||
})
|
|
||||||
.with_constness(*c)
|
|
||||||
.to_predicate(tcx),
|
|
||||||
ty::PredicateKind::Projection(poly_projection) => poly_projection
|
|
||||||
.map_bound(|projection| {
|
|
||||||
let projection_substs = translate_predicate_substs(projection.projection_ty.substs);
|
|
||||||
ty::ProjectionPredicate {
|
|
||||||
projection_ty: ty::ProjectionTy {
|
|
||||||
substs: projection_substs,
|
|
||||||
item_def_id: projection.projection_ty.item_def_id,
|
|
||||||
},
|
|
||||||
ty: projection.ty.subst(tcx, assoc_item_substs),
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.to_predicate(tcx),
|
|
||||||
ty::PredicateKind::TypeOutlives(poly_outlives) => poly_outlives
|
|
||||||
.map_bound(|outlives| {
|
|
||||||
ty::OutlivesPredicate(
|
|
||||||
normalized_projection_ty,
|
|
||||||
outlives.1.subst(tcx, assoc_item_substs),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.to_predicate(tcx),
|
|
||||||
_ => bug!("unexepected projection bound: `{:?}`", bound),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub enum TupleArgumentsFlag {
|
pub enum TupleArgumentsFlag {
|
||||||
Yes,
|
Yes,
|
||||||
No,
|
No,
|
||||||
|
|
|
@ -391,7 +391,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
|
||||||
cause.clone(),
|
cause.clone(),
|
||||||
depth,
|
depth,
|
||||||
param_env,
|
param_env,
|
||||||
ty::PredicateKind::WellFormed(arg).to_predicate(tcx),
|
ty::PredicateAtom::WellFormed(arg).to_predicate(tcx),
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
|
@ -738,10 +738,10 @@ impl<'tcx> LowerInto<'tcx, Option<chalk_solve::rust_ir::QuantifiedInlineBound<Ru
|
||||||
self,
|
self,
|
||||||
interner: &RustInterner<'tcx>,
|
interner: &RustInterner<'tcx>,
|
||||||
) -> Option<chalk_solve::rust_ir::QuantifiedInlineBound<RustInterner<'tcx>>> {
|
) -> Option<chalk_solve::rust_ir::QuantifiedInlineBound<RustInterner<'tcx>>> {
|
||||||
match &self.kind() {
|
match self.bound_atom(interner.tcx).skip_binder() {
|
||||||
ty::PredicateKind::Trait(predicate, _) => {
|
ty::PredicateAtom::Trait(predicate, _) => {
|
||||||
let (predicate, binders, _named_regions) =
|
let (predicate, binders, _named_regions) =
|
||||||
collect_bound_vars(interner, interner.tcx, predicate);
|
collect_bound_vars(interner, interner.tcx, &ty::Binder::bind(predicate));
|
||||||
|
|
||||||
Some(chalk_ir::Binders::new(
|
Some(chalk_ir::Binders::new(
|
||||||
binders,
|
binders,
|
||||||
|
@ -750,24 +750,24 @@ impl<'tcx> LowerInto<'tcx, Option<chalk_solve::rust_ir::QuantifiedInlineBound<Ru
|
||||||
),
|
),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
ty::PredicateKind::Projection(predicate) => {
|
ty::PredicateAtom::Projection(predicate) => {
|
||||||
let (predicate, binders, _named_regions) =
|
let (predicate, binders, _named_regions) =
|
||||||
collect_bound_vars(interner, interner.tcx, predicate);
|
collect_bound_vars(interner, interner.tcx, &ty::Binder::bind(predicate));
|
||||||
|
|
||||||
Some(chalk_ir::Binders::new(
|
Some(chalk_ir::Binders::new(
|
||||||
binders,
|
binders,
|
||||||
chalk_solve::rust_ir::InlineBound::AliasEqBound(predicate.lower_into(interner)),
|
chalk_solve::rust_ir::InlineBound::AliasEqBound(predicate.lower_into(interner)),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
ty::PredicateKind::TypeOutlives(_predicate) => None,
|
ty::PredicateAtom::TypeOutlives(_predicate) => None,
|
||||||
ty::PredicateKind::WellFormed(_ty) => None,
|
ty::PredicateAtom::WellFormed(_ty) => None,
|
||||||
|
|
||||||
ty::PredicateKind::RegionOutlives(..)
|
ty::PredicateAtom::RegionOutlives(..)
|
||||||
| ty::PredicateKind::ObjectSafe(..)
|
| ty::PredicateAtom::ObjectSafe(..)
|
||||||
| ty::PredicateKind::ClosureKind(..)
|
| ty::PredicateAtom::ClosureKind(..)
|
||||||
| ty::PredicateKind::Subtype(..)
|
| ty::PredicateAtom::Subtype(..)
|
||||||
| ty::PredicateKind::ConstEvaluatable(..)
|
| ty::PredicateAtom::ConstEvaluatable(..)
|
||||||
| ty::PredicateKind::ConstEquate(..) => bug!("unexpected predicate {}", &self),
|
| ty::PredicateAtom::ConstEquate(..) => bug!("unexpected predicate {}", &self),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1225,18 +1225,19 @@ pub fn check_type_bounds<'tcx>(
|
||||||
|
|
||||||
let impl_ty_hir_id = tcx.hir().local_def_id_to_hir_id(impl_ty.def_id.expect_local());
|
let impl_ty_hir_id = tcx.hir().local_def_id_to_hir_id(impl_ty.def_id.expect_local());
|
||||||
let normalize_cause = traits::ObligationCause::misc(impl_ty_span, impl_ty_hir_id);
|
let normalize_cause = traits::ObligationCause::misc(impl_ty_span, impl_ty_hir_id);
|
||||||
let cause = ObligationCause::new(
|
let mk_cause = |span| {
|
||||||
impl_ty_span,
|
ObligationCause::new(
|
||||||
impl_ty_hir_id,
|
impl_ty_span,
|
||||||
ObligationCauseCode::ItemObligation(trait_ty.def_id),
|
impl_ty_hir_id,
|
||||||
);
|
ObligationCauseCode::BindingObligation(trait_ty.def_id, span),
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
let obligations = tcx
|
let obligations = tcx
|
||||||
.explicit_item_bounds(trait_ty.def_id)
|
.explicit_item_bounds(trait_ty.def_id)
|
||||||
.iter()
|
.iter()
|
||||||
.map(|&(bound, span)| {
|
.map(|&(bound, span)| {
|
||||||
let concrete_ty_bound =
|
let concrete_ty_bound = bound.subst(tcx, rebased_substs);
|
||||||
traits::subst_assoc_item_bound(tcx, bound, impl_ty_value, rebased_substs);
|
|
||||||
debug!("check_type_bounds: concrete_ty_bound = {:?}", concrete_ty_bound);
|
debug!("check_type_bounds: concrete_ty_bound = {:?}", concrete_ty_bound);
|
||||||
|
|
||||||
traits::Obligation::new(mk_cause(span), param_env, concrete_ty_bound)
|
traits::Obligation::new(mk_cause(span), param_env, concrete_ty_bound)
|
||||||
|
@ -1244,17 +1245,15 @@ pub fn check_type_bounds<'tcx>(
|
||||||
.collect();
|
.collect();
|
||||||
debug!("check_type_bounds: item_bounds={:?}", obligations);
|
debug!("check_type_bounds: item_bounds={:?}", obligations);
|
||||||
|
|
||||||
for obligation in util::elaborate_obligations(tcx, obligations) {
|
for mut obligation in util::elaborate_obligations(tcx, obligations) {
|
||||||
let concrete_ty_predicate = predicate.subst(tcx, rebased_substs);
|
|
||||||
debug!("compare_projection_bounds: concrete predicate = {:?}", concrete_ty_predicate);
|
|
||||||
|
|
||||||
let traits::Normalized { value: normalized_predicate, obligations } = traits::normalize(
|
let traits::Normalized { value: normalized_predicate, obligations } = traits::normalize(
|
||||||
&mut selcx,
|
&mut selcx,
|
||||||
normalize_param_env,
|
normalize_param_env,
|
||||||
normalize_cause.clone(),
|
normalize_cause.clone(),
|
||||||
&concrete_ty_predicate,
|
&obligation.predicate,
|
||||||
);
|
);
|
||||||
debug!("compare_projection_bounds: normalized predicate = {:?}", normalized_predicate);
|
debug!("compare_projection_bounds: normalized predicate = {:?}", normalized_predicate);
|
||||||
|
obligation.predicate = normalized_predicate;
|
||||||
|
|
||||||
inh.register_predicates(obligations);
|
inh.register_predicates(obligations);
|
||||||
inh.register_predicate(obligation);
|
inh.register_predicate(obligation);
|
||||||
|
|
|
@ -2137,8 +2137,8 @@ fn explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicat
|
||||||
// associated type:
|
// associated type:
|
||||||
// * It must use the identity substs of the item.
|
// * It must use the identity substs of the item.
|
||||||
// * Since any generic parameters on the item are not in scope,
|
// * Since any generic parameters on the item are not in scope,
|
||||||
// this means that the item is not a GAT, and its identity substs
|
// this means that the item is not a GAT, and its identity
|
||||||
// are the same as the trait's.
|
// substs are the same as the trait's.
|
||||||
// * It must be an associated type for this trait (*not* a
|
// * It must be an associated type for this trait (*not* a
|
||||||
// supertrait).
|
// supertrait).
|
||||||
if let ty::Projection(projection) = ty.kind {
|
if let ty::Projection(projection) = ty.kind {
|
||||||
|
@ -2158,14 +2158,12 @@ fn explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicat
|
||||||
.predicates
|
.predicates
|
||||||
.iter()
|
.iter()
|
||||||
.copied()
|
.copied()
|
||||||
.filter(|(pred, _)| match pred.kind() {
|
.filter(|(pred, _)| match pred.skip_binders() {
|
||||||
ty::PredicateKind::Trait(tr, _) => !is_assoc_item_ty(tr.skip_binder().self_ty()),
|
ty::PredicateAtom::Trait(tr, _) => !is_assoc_item_ty(tr.self_ty()),
|
||||||
ty::PredicateKind::Projection(proj) => {
|
ty::PredicateAtom::Projection(proj) => {
|
||||||
!is_assoc_item_ty(proj.skip_binder().projection_ty.self_ty())
|
!is_assoc_item_ty(proj.projection_ty.self_ty())
|
||||||
}
|
|
||||||
ty::PredicateKind::TypeOutlives(outlives) => {
|
|
||||||
!is_assoc_item_ty(outlives.skip_binder().0)
|
|
||||||
}
|
}
|
||||||
|
ty::PredicateAtom::TypeOutlives(outlives) => !is_assoc_item_ty(outlives.0),
|
||||||
_ => true,
|
_ => true,
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
|
@ -37,12 +37,10 @@ fn associated_type_bounds<'tcx>(
|
||||||
let trait_predicates = tcx.trait_explicit_predicates_and_bounds(trait_def_id.expect_local());
|
let trait_predicates = tcx.trait_explicit_predicates_and_bounds(trait_def_id.expect_local());
|
||||||
|
|
||||||
let bounds_from_parent =
|
let bounds_from_parent =
|
||||||
trait_predicates.predicates.iter().copied().filter(|(pred, _)| match pred.kind() {
|
trait_predicates.predicates.iter().copied().filter(|(pred, _)| match pred.skip_binders() {
|
||||||
ty::PredicateKind::Trait(tr, _) => tr.skip_binder().self_ty() == item_ty,
|
ty::PredicateAtom::Trait(tr, _) => tr.self_ty() == item_ty,
|
||||||
ty::PredicateKind::Projection(proj) => {
|
ty::PredicateAtom::Projection(proj) => proj.projection_ty.self_ty() == item_ty,
|
||||||
proj.skip_binder().projection_ty.self_ty() == item_ty
|
ty::PredicateAtom::TypeOutlives(outlives) => outlives.0 == item_ty,
|
||||||
}
|
|
||||||
ty::PredicateKind::TypeOutlives(outlives) => outlives.skip_binder().0 == item_ty,
|
|
||||||
_ => false,
|
_ => false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0277]: `<<Self as Case1>::A as std::iter::Iterator>::Item` doesn't implem
|
||||||
LL | type A: Iterator<Item: Debug>;
|
LL | type A: Iterator<Item: Debug>;
|
||||||
| ^^^^^ `<<Self as Case1>::A as std::iter::Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
| ^^^^^ `<<Self as Case1>::A as std::iter::Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
||||||
|
|
|
|
||||||
::: $SRC_DIR/libcore/fmt/mod.rs:LL:COL
|
::: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub trait Debug {
|
LL | pub trait Debug {
|
||||||
| --------------- required by this bound in `std::fmt::Debug`
|
| --------------- required by this bound in `std::fmt::Debug`
|
||||||
|
@ -21,7 +21,7 @@ error[E0277]: the trait bound `<<Self as Foo>::Out as Baz>::Assoc: std::default:
|
||||||
LL | pub trait Foo { type Out: Baz<Assoc: Default>; }
|
LL | pub trait Foo { type Out: Baz<Assoc: Default>; }
|
||||||
| ^^^^^^^ the trait `std::default::Default` is not implemented for `<<Self as Foo>::Out as Baz>::Assoc`
|
| ^^^^^^^ the trait `std::default::Default` is not implemented for `<<Self as Foo>::Out as Baz>::Assoc`
|
||||||
|
|
|
|
||||||
::: $SRC_DIR/libcore/default.rs:LL:COL
|
::: $SRC_DIR/core/src/default.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub trait Default: Sized {
|
LL | pub trait Default: Sized {
|
||||||
| ------------------------ required by this bound in `std::default::Default`
|
| ------------------------ required by this bound in `std::default::Default`
|
||||||
|
|
|
@ -45,7 +45,6 @@ trait C where
|
||||||
bool: IsU8<Self::Assoc>,
|
bool: IsU8<Self::Assoc>,
|
||||||
{
|
{
|
||||||
type Assoc = u8;
|
type Assoc = u8;
|
||||||
//~^ ERROR the trait bound `u8: IsU8<<Self as C>::Assoc>` is not satisfied
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that we get all expected errors if that default is unsuitable
|
// Test that we get all expected errors if that default is unsuitable
|
||||||
|
@ -55,7 +54,7 @@ trait D where
|
||||||
bool: IsU8<Self::Assoc>,
|
bool: IsU8<Self::Assoc>,
|
||||||
{
|
{
|
||||||
type Assoc = NotClone;
|
type Assoc = NotClone;
|
||||||
//~^ ERROR the trait bound `NotClone: IsU8<<Self as D>::Assoc>` is not satisfied
|
//~^ ERROR the trait bound `NotClone: IsU8<NotClone>` is not satisfied
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test behavior of the check when defaults refer to other defaults:
|
// Test behavior of the check when defaults refer to other defaults:
|
||||||
|
|
|
@ -42,20 +42,8 @@ LL | type Assoc: Foo<Self> = ();
|
||||||
| | required by this bound in `Bar::Assoc`
|
| | required by this bound in `Bar::Assoc`
|
||||||
| the trait `Foo<Self>` is not implemented for `()`
|
| the trait `Foo<Self>` is not implemented for `()`
|
||||||
|
|
||||||
error[E0277]: the trait bound `u8: IsU8<<Self as C>::Assoc>` is not satisfied
|
error[E0277]: the trait bound `NotClone: IsU8<NotClone>` is not satisfied
|
||||||
--> $DIR/defaults-suitability.rs:44:5
|
--> $DIR/defaults-suitability.rs:53:5
|
||||||
|
|
|
||||||
LL | Self::Assoc: IsU8<Self::Assoc>,
|
|
||||||
| ----------------- required by this bound in `C::Assoc`
|
|
||||||
...
|
|
||||||
LL | type Assoc = u8;
|
|
||||||
| ^^^^^-----^^^^^^
|
|
||||||
| | |
|
|
||||||
| | required by a bound in this
|
|
||||||
| the trait `IsU8<<Self as C>::Assoc>` is not implemented for `u8`
|
|
||||||
|
|
||||||
error[E0277]: the trait bound `NotClone: IsU8<<Self as D>::Assoc>` is not satisfied
|
|
||||||
--> $DIR/defaults-suitability.rs:54:5
|
|
||||||
|
|
|
|
||||||
LL | Self::Assoc: IsU8<Self::Assoc>,
|
LL | Self::Assoc: IsU8<Self::Assoc>,
|
||||||
| ----------------- required by this bound in `D::Assoc`
|
| ----------------- required by this bound in `D::Assoc`
|
||||||
|
@ -64,10 +52,10 @@ LL | type Assoc = NotClone;
|
||||||
| ^^^^^-----^^^^^^^^^^^^
|
| ^^^^^-----^^^^^^^^^^^^
|
||||||
| | |
|
| | |
|
||||||
| | required by a bound in this
|
| | required by a bound in this
|
||||||
| the trait `IsU8<<Self as D>::Assoc>` is not implemented for `NotClone`
|
| the trait `IsU8<NotClone>` is not implemented for `NotClone`
|
||||||
|
|
||||||
error[E0277]: the trait bound `<Self as Foo2<T>>::Baz: std::clone::Clone` is not satisfied
|
error[E0277]: the trait bound `<Self as Foo2<T>>::Baz: std::clone::Clone` is not satisfied
|
||||||
--> $DIR/defaults-suitability.rs:63:5
|
--> $DIR/defaults-suitability.rs:62:5
|
||||||
|
|
|
|
||||||
LL | type Bar: Clone = Vec<Self::Baz>;
|
LL | type Bar: Clone = Vec<Self::Baz>;
|
||||||
| ^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -82,7 +70,7 @@ LL | trait Foo2<T> where <Self as Foo2<T>>::Baz: Clone {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0277]: the trait bound `<Self as Foo25<T>>::Baz: std::clone::Clone` is not satisfied
|
error[E0277]: the trait bound `<Self as Foo25<T>>::Baz: std::clone::Clone` is not satisfied
|
||||||
--> $DIR/defaults-suitability.rs:72:5
|
--> $DIR/defaults-suitability.rs:71:5
|
||||||
|
|
|
|
||||||
LL | type Bar: Clone = Vec<Self::Baz>;
|
LL | type Bar: Clone = Vec<Self::Baz>;
|
||||||
| ^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -97,7 +85,7 @@ LL | trait Foo25<T: Clone> where <Self as Foo25<T>>::Baz: Clone {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0277]: the trait bound `T: std::clone::Clone` is not satisfied
|
error[E0277]: the trait bound `T: std::clone::Clone` is not satisfied
|
||||||
--> $DIR/defaults-suitability.rs:84:5
|
--> $DIR/defaults-suitability.rs:83:5
|
||||||
|
|
|
|
||||||
LL | Self::Baz: Clone,
|
LL | Self::Baz: Clone,
|
||||||
| ----- required by this bound in `Foo3::Baz`
|
| ----- required by this bound in `Foo3::Baz`
|
||||||
|
@ -113,6 +101,6 @@ help: consider further restricting type parameter `T`
|
||||||
LL | Self::Baz: Clone, T: Clone
|
LL | Self::Baz: Clone, T: Clone
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 9 previous errors
|
error: aborting due to 8 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0277`.
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
|
||||||
LL | type Ty = Vec<[u8]>;
|
LL | type Ty = Vec<[u8]>;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
| ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||||
|
|
|
|
||||||
::: $SRC_DIR/liballoc/vec.rs:LL:COL
|
::: $SRC_DIR/alloc/src/vec.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub struct Vec<T> {
|
LL | pub struct Vec<T> {
|
||||||
| - required by this bound in `std::vec::Vec`
|
| - required by this bound in `std::vec::Vec`
|
||||||
|
|
|
@ -145,7 +145,7 @@ error[E0277]: the trait bound `<<Self as _Tr3>::A as std::iter::Iterator>::Item:
|
||||||
LL | type A: Iterator<Item: Copy>;
|
LL | type A: Iterator<Item: Copy>;
|
||||||
| ^^^^ the trait `std::marker::Copy` is not implemented for `<<Self as _Tr3>::A as std::iter::Iterator>::Item`
|
| ^^^^ the trait `std::marker::Copy` is not implemented for `<<Self as _Tr3>::A as std::iter::Iterator>::Item`
|
||||||
|
|
|
|
||||||
::: $SRC_DIR/libcore/marker.rs:LL:COL
|
::: $SRC_DIR/core/src/marker.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub trait Copy: Clone {
|
LL | pub trait Copy: Clone {
|
||||||
| --------------------- required by this bound in `std::marker::Copy`
|
| --------------------- required by this bound in `std::marker::Copy`
|
||||||
|
|
|
@ -15,6 +15,7 @@ impl PointerFamily<u32> for Foo {
|
||||||
//~^ ERROR generic associated types are unstable
|
//~^ ERROR generic associated types are unstable
|
||||||
type Pointer2<U32> = Box<U32>;
|
type Pointer2<U32> = Box<U32>;
|
||||||
//~^ ERROR generic associated types are unstable
|
//~^ ERROR generic associated types are unstable
|
||||||
|
//~| ERROR the trait bound `U32: std::clone::Clone` is not satisfied
|
||||||
}
|
}
|
||||||
|
|
||||||
trait Bar {
|
trait Bar {
|
||||||
|
|
|
@ -44,7 +44,7 @@ LL | type Pointer2<U32> = Box<U32>;
|
||||||
= help: add `#![feature(generic_associated_types)]` to the crate attributes to enable
|
= help: add `#![feature(generic_associated_types)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: where clauses on associated types are unstable
|
error[E0658]: where clauses on associated types are unstable
|
||||||
--> $DIR/feature-gate-generic_associated_types.rs:21:5
|
--> $DIR/feature-gate-generic_associated_types.rs:22:5
|
||||||
|
|
|
|
||||||
LL | type Assoc where Self: Sized;
|
LL | type Assoc where Self: Sized;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -53,7 +53,7 @@ LL | type Assoc where Self: Sized;
|
||||||
= help: add `#![feature(generic_associated_types)]` to the crate attributes to enable
|
= help: add `#![feature(generic_associated_types)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: where clauses on associated types are unstable
|
error[E0658]: where clauses on associated types are unstable
|
||||||
--> $DIR/feature-gate-generic_associated_types.rs:26:5
|
--> $DIR/feature-gate-generic_associated_types.rs:27:5
|
||||||
|
|
|
|
||||||
LL | type Assoc where Self: Sized = Foo;
|
LL | type Assoc where Self: Sized = Foo;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -61,6 +61,18 @@ LL | type Assoc where Self: Sized = Foo;
|
||||||
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
|
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
|
||||||
= help: add `#![feature(generic_associated_types)]` to the crate attributes to enable
|
= help: add `#![feature(generic_associated_types)]` to the crate attributes to enable
|
||||||
|
|
||||||
error: aborting due to 7 previous errors
|
error[E0277]: the trait bound `U32: std::clone::Clone` is not satisfied
|
||||||
|
--> $DIR/feature-gate-generic_associated_types.rs:16:5
|
||||||
|
|
|
||||||
|
LL | type Pointer2<U32> = Box<U32>;
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `U32`
|
||||||
|
|
|
||||||
|
help: consider restricting type parameter `U32`
|
||||||
|
|
|
||||||
|
LL | type Pointer2<U32: std::clone::Clone> = Box<U32>;
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0658`.
|
error: aborting due to 8 previous errors
|
||||||
|
|
||||||
|
Some errors have detailed explanations: E0277, E0658.
|
||||||
|
For more information about an error, try `rustc --explain E0277`.
|
||||||
|
|
|
@ -17,7 +17,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t
|
||||||
LL | Pin::new(&mut gen).resume(());
|
LL | Pin::new(&mut gen).resume(());
|
||||||
| ^^^^^^ doesn't have a size known at compile-time
|
| ^^^^^^ doesn't have a size known at compile-time
|
||||||
|
|
|
|
||||||
::: $SRC_DIR/libcore/ops/generator.rs:LL:COL
|
::: $SRC_DIR/core/src/ops/generator.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub enum GeneratorState<Y, R> {
|
LL | pub enum GeneratorState<Y, R> {
|
||||||
| - required by this bound in `std::ops::GeneratorState`
|
| - required by this bound in `std::ops::GeneratorState`
|
||||||
|
|
|
@ -19,8 +19,9 @@ struct Bar;
|
||||||
impl Foo for Bar {
|
impl Foo for Bar {
|
||||||
type Assoc = usize;
|
type Assoc = usize;
|
||||||
type Assoc2<T> = Vec<T>;
|
type Assoc2<T> = Vec<T>;
|
||||||
|
//~^ ERROR `T` doesn't implement `std::fmt::Display`
|
||||||
type Assoc3<T> where T: Iterator = Vec<T>;
|
type Assoc3<T> where T: Iterator = Vec<T>;
|
||||||
//~^ impl has stricter requirements than trait
|
//~^ ERROR impl has stricter requirements than trait
|
||||||
type WithDefault<'a, T: Debug + 'a> = &'a dyn Iterator<Item=T>;
|
type WithDefault<'a, T: Debug + 'a> = &'a dyn Iterator<Item=T>;
|
||||||
type NoGenerics = ::std::cell::Cell<i32>;
|
type NoGenerics = ::std::cell::Cell<i32>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,17 @@
|
||||||
|
error[E0277]: `T` doesn't implement `std::fmt::Display`
|
||||||
|
--> $DIR/generic-associated-types-where.rs:21:5
|
||||||
|
|
|
||||||
|
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`
|
||||||
|
|
|
||||||
|
LL | type Assoc2<T: std::fmt::Display> = Vec<T>;
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0276]: impl has stricter requirements than trait
|
error[E0276]: impl has stricter requirements than trait
|
||||||
--> $DIR/generic-associated-types-where.rs:22:5
|
--> $DIR/generic-associated-types-where.rs:23:5
|
||||||
|
|
|
|
||||||
LL | type Assoc3<T>;
|
LL | type Assoc3<T>;
|
||||||
| --------------- definition of `Assoc3` from trait
|
| --------------- definition of `Assoc3` from trait
|
||||||
|
@ -7,6 +19,7 @@ LL | type Assoc3<T>;
|
||||||
LL | type Assoc3<T> where T: Iterator = Vec<T>;
|
LL | type Assoc3<T> where T: Iterator = Vec<T>;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: Iterator`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: Iterator`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0276`.
|
Some errors have detailed explanations: E0276, E0277.
|
||||||
|
For more information about an error, try `rustc --explain E0276`.
|
||||||
|
|
|
@ -16,6 +16,7 @@ impl<T> Foo for Fooy<T> {
|
||||||
//~^ ERROR the parameter type `T` may not live long enough
|
//~^ ERROR the parameter type `T` may not live long enough
|
||||||
type B<'a, 'b> where 'b: 'a = (&'a(), &'b ());
|
type B<'a, 'b> where 'b: 'a = (&'a(), &'b ());
|
||||||
//~^ ERROR lifetime bound not satisfied
|
//~^ ERROR lifetime bound not satisfied
|
||||||
|
//~| ERROR lifetime bound not satisfied
|
||||||
type C where Self: Copy = String;
|
type C where Self: Copy = String;
|
||||||
//~^ ERROR the trait bound `T: Copy` is not satisfied
|
//~^ ERROR the trait bound `T: Copy` is not satisfied
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ help: consider restricting type parameter `T`
|
||||||
LL | impl<T: Copy> Foo for Fooy<T> {
|
LL | impl<T: Copy> Foo for Fooy<T> {
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0277, E0310, E0478.
|
Some errors have detailed explanations: E0277, E0310, E0478.
|
||||||
For more information about an error, try `rustc --explain E0277`.
|
For more information about an error, try `rustc --explain E0277`.
|
||||||
|
|
|
@ -10,11 +10,12 @@ trait Foo {
|
||||||
type C where Self: Clone;
|
type C where Self: Clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
struct Fooy;
|
struct Fooy;
|
||||||
|
|
||||||
impl Foo for Fooy {
|
impl Foo for Fooy {
|
||||||
type A<'a> = (&'a ());
|
type A<'a> = (&'a ());
|
||||||
type B<'a, 'b> = (&'a(), &'b ());
|
type B<'a: 'b, 'b> = (&'a(), &'b ());
|
||||||
type C = String;
|
type C = String;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +25,7 @@ struct Fooer<T>(T);
|
||||||
impl<T> Foo for Fooer<T> {
|
impl<T> Foo for Fooer<T> {
|
||||||
type A<'x> where T: 'x = (&'x ());
|
type A<'x> where T: 'x = (&'x ());
|
||||||
type B<'u, 'v> where 'u: 'v = (&'v &'u ());
|
type B<'u, 'v> where 'u: 'v = (&'v &'u ());
|
||||||
type C where Self: ToOwned = String;
|
type C where Self: Clone + ToOwned = String;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -7,7 +7,7 @@ trait ATy {
|
||||||
|
|
||||||
impl<'b> ATy for &'b () {
|
impl<'b> ATy for &'b () {
|
||||||
type Item<'a> = &'b ();
|
type Item<'a> = &'b ();
|
||||||
//~^ ERROR lifetime bound not satisfied
|
//~^ ERROR the type `&'b ()` does not fulfill the required lifetime
|
||||||
}
|
}
|
||||||
|
|
||||||
trait StaticTy {
|
trait StaticTy {
|
||||||
|
@ -16,7 +16,7 @@ trait StaticTy {
|
||||||
|
|
||||||
impl StaticTy for () {
|
impl StaticTy for () {
|
||||||
type Item<'a> = &'a ();
|
type Item<'a> = &'a ();
|
||||||
//~^ ERROR lifetime bound not satisfied
|
//~^ ERROR the type `&'a ()` does not fulfill the required lifetime
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -1,33 +1,23 @@
|
||||||
error[E0478]: lifetime bound not satisfied
|
error[E0477]: the type `&'b ()` does not fulfill the required lifetime
|
||||||
--> $DIR/unsatisfied-outlives-bound.rs:9:5
|
--> $DIR/unsatisfied-outlives-bound.rs:9:5
|
||||||
|
|
|
|
||||||
LL | type Item<'a> = &'b ();
|
LL | type Item<'a> = &'b ();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: lifetime parameter instantiated with the lifetime `'b` as defined on the impl at 8:6
|
note: type must outlive the lifetime `'a` as defined on the associated item at 9:15
|
||||||
--> $DIR/unsatisfied-outlives-bound.rs:8:6
|
|
||||||
|
|
|
||||||
LL | impl<'b> ATy for &'b () {
|
|
||||||
| ^^
|
|
||||||
note: but lifetime parameter must outlive the lifetime `'a` as defined on the associated item at 9:15
|
|
||||||
--> $DIR/unsatisfied-outlives-bound.rs:9:15
|
--> $DIR/unsatisfied-outlives-bound.rs:9:15
|
||||||
|
|
|
|
||||||
LL | type Item<'a> = &'b ();
|
LL | type Item<'a> = &'b ();
|
||||||
| ^^
|
| ^^
|
||||||
|
|
||||||
error[E0478]: lifetime bound not satisfied
|
error[E0477]: the type `&'a ()` does not fulfill the required lifetime
|
||||||
--> $DIR/unsatisfied-outlives-bound.rs:18:5
|
--> $DIR/unsatisfied-outlives-bound.rs:18:5
|
||||||
|
|
|
|
||||||
LL | type Item<'a> = &'a ();
|
LL | type Item<'a> = &'a ();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: lifetime parameter instantiated with the lifetime `'a` as defined on the associated item at 18:15
|
= note: type must satisfy the static lifetime
|
||||||
--> $DIR/unsatisfied-outlives-bound.rs:18:15
|
|
||||||
|
|
|
||||||
LL | type Item<'a> = &'a ();
|
|
||||||
| ^^
|
|
||||||
= note: but lifetime parameter must outlive the static lifetime
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0478`.
|
For more information about this error, try `rustc --explain E0477`.
|
||||||
|
|
|
@ -19,7 +19,7 @@ error[E0277]: the size for values of type `<() as Trait<'_>>::Item` cannot be kn
|
||||||
LL | foo((), drop)
|
LL | foo((), drop)
|
||||||
| ^^^^ doesn't have a size known at compile-time
|
| ^^^^ doesn't have a size known at compile-time
|
||||||
|
|
|
|
||||||
::: $SRC_DIR/libcore/mem/mod.rs:LL:COL
|
::: $SRC_DIR/core/src/mem/mod.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub fn drop<T>(_x: T) {}
|
LL | pub fn drop<T>(_x: T) {}
|
||||||
| - required by this bound in `std::mem::drop`
|
| - required by this bound in `std::mem::drop`
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
trait Foo<'a> {
|
trait Foo<'a> {
|
||||||
type Value: 'a;
|
type Value: 'a;
|
||||||
fn dummy(&'a self) { }
|
fn dummy(&'a self) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Foo<'a> for &'a i16 {
|
impl<'a> Foo<'a> for &'a i16 {
|
||||||
|
@ -13,12 +13,12 @@ impl<'a> Foo<'a> for &'a i16 {
|
||||||
|
|
||||||
impl<'a> Foo<'static> for &'a i32 {
|
impl<'a> Foo<'static> for &'a i32 {
|
||||||
type Value = &'a i32;
|
type Value = &'a i32;
|
||||||
//~^ ERROR lifetime bound not satisfied
|
//~^ ERROR the type `&'a i32` does not fulfill the required lifetime
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a,'b> Foo<'b> for &'a i64 {
|
impl<'a, 'b> Foo<'b> for &'a i64 {
|
||||||
type Value = &'a i32;
|
type Value = &'a i32;
|
||||||
//~^ ERROR lifetime bound not satisfied
|
//~^ ERROR the type `&'a i32` does not fulfill the required lifetime
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { }
|
fn main() {}
|
||||||
|
|
|
@ -1,33 +1,23 @@
|
||||||
error[E0478]: lifetime bound not satisfied
|
error[E0477]: the type `&'a i32` does not fulfill the required lifetime
|
||||||
--> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:15:5
|
--> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:15:5
|
||||||
|
|
|
|
||||||
LL | type Value = &'a i32;
|
LL | type Value = &'a i32;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: lifetime parameter instantiated with the lifetime `'a` as defined on the impl at 14:6
|
= note: type must satisfy the static lifetime
|
||||||
--> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:14:6
|
|
||||||
|
|
|
||||||
LL | impl<'a> Foo<'static> for &'a i32 {
|
|
||||||
| ^^
|
|
||||||
= note: but lifetime parameter must outlive the static lifetime
|
|
||||||
|
|
||||||
error[E0478]: lifetime bound not satisfied
|
error[E0477]: the type `&'a i32` does not fulfill the required lifetime
|
||||||
--> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:20:5
|
--> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:20:5
|
||||||
|
|
|
|
||||||
LL | type Value = &'a i32;
|
LL | type Value = &'a i32;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: lifetime parameter instantiated with the lifetime `'a` as defined on the impl at 19:6
|
note: type must outlive the lifetime `'b` as defined on the impl at 19:10
|
||||||
--> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:19:6
|
--> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:19:10
|
||||||
|
|
|
|
||||||
LL | impl<'a,'b> Foo<'b> for &'a i64 {
|
LL | impl<'a, 'b> Foo<'b> for &'a i64 {
|
||||||
| ^^
|
| ^^
|
||||||
note: but lifetime parameter must outlive the lifetime `'b` as defined on the impl at 19:9
|
|
||||||
--> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:19:9
|
|
||||||
|
|
|
||||||
LL | impl<'a,'b> Foo<'b> for &'a i64 {
|
|
||||||
| ^^
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0478`.
|
For more information about this error, try `rustc --explain E0477`.
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
|
|
||||||
trait Foo {
|
trait Foo {
|
||||||
type Value: 'static;
|
type Value: 'static;
|
||||||
fn dummy(&self) { }
|
fn dummy(&self) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Foo for &'a i32 {
|
impl<'a> Foo for &'a i32 {
|
||||||
type Value = &'a i32;
|
type Value = &'a i32;
|
||||||
//~^ ERROR lifetime bound not satisfied
|
//~^ ERROR the type `&'a i32` does not fulfill the required lifetime
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Foo for i32 {
|
impl<'a> Foo for i32 {
|
||||||
|
@ -16,4 +16,4 @@ impl<'a> Foo for i32 {
|
||||||
type Value = i32;
|
type Value = i32;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { }
|
fn main() {}
|
||||||
|
|
|
@ -1,16 +1,11 @@
|
||||||
error[E0478]: lifetime bound not satisfied
|
error[E0477]: the type `&'a i32` does not fulfill the required lifetime
|
||||||
--> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:10:5
|
--> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:10:5
|
||||||
|
|
|
|
||||||
LL | type Value = &'a i32;
|
LL | type Value = &'a i32;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: lifetime parameter instantiated with the lifetime `'a` as defined on the impl at 9:6
|
= note: type must satisfy the static lifetime
|
||||||
--> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:9:6
|
|
||||||
|
|
|
||||||
LL | impl<'a> Foo for &'a i32 {
|
|
||||||
| ^^
|
|
||||||
= note: but lifetime parameter must outlive the static lifetime
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0478`.
|
For more information about this error, try `rustc --explain E0477`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue