提交 22ef04e2 编写于 作者: J jackh726

A bit of cleanup to astconv

上级 216906fb
...@@ -693,6 +693,61 @@ pub fn instantiate_mono_trait_ref( ...@@ -693,6 +693,61 @@ pub fn instantiate_mono_trait_ref(
) )
} }
fn instantiate_poly_trait_ref_inner(
&self,
hir_id: hir::HirId,
span: Span,
binding_span: Option<Span>,
constness: ty::BoundConstness,
bounds: &mut Bounds<'tcx>,
speculative: bool,
trait_ref_span: Span,
trait_def_id: DefId,
trait_segment: &hir::PathSegment<'_>,
args: &GenericArgs<'_>,
infer_args: bool,
self_ty: Ty<'tcx>,
) -> GenericArgCountResult {
let (substs, arg_count) = self.create_substs_for_ast_path(
trait_ref_span,
trait_def_id,
&[],
trait_segment,
args,
infer_args,
Some(self_ty),
);
let tcx = self.tcx();
let bound_vars = tcx.late_bound_vars(hir_id);
debug!(?bound_vars);
let assoc_bindings = self.create_assoc_bindings_for_generic_args(args);
let poly_trait_ref =
ty::Binder::bind_with_vars(ty::TraitRef::new(trait_def_id, substs), bound_vars);
debug!(?poly_trait_ref, ?assoc_bindings);
bounds.trait_bounds.push((poly_trait_ref, span, constness));
let mut dup_bindings = FxHashMap::default();
for binding in &assoc_bindings {
// Specify type to assert that error was already reported in `Err` case.
let _: Result<_, ErrorReported> = self.add_predicates_for_ast_type_binding(
hir_id,
poly_trait_ref,
binding,
bounds,
speculative,
&mut dup_bindings,
binding_span.unwrap_or(binding.span),
);
// Okay to ignore `Err` because of `ErrorReported` (see above).
}
arg_count
}
/// Given a trait bound like `Debug`, applies that trait bound the given self-type to construct /// Given a trait bound like `Debug`, applies that trait bound the given self-type to construct
/// a full trait reference. The resulting trait reference is returned. This may also generate /// a full trait reference. The resulting trait reference is returned. This may also generate
/// auxiliary bounds, which are added to `bounds`. /// auxiliary bounds, which are added to `bounds`.
...@@ -713,7 +768,7 @@ pub fn instantiate_mono_trait_ref( ...@@ -713,7 +768,7 @@ pub fn instantiate_mono_trait_ref(
/// `Bar<'a>`. The returned poly-trait-ref will have this binder instantiated explicitly, /// `Bar<'a>`. The returned poly-trait-ref will have this binder instantiated explicitly,
/// however. /// however.
#[tracing::instrument(level = "debug", skip(self, span, constness, bounds, speculative))] #[tracing::instrument(level = "debug", skip(self, span, constness, bounds, speculative))]
pub fn instantiate_poly_trait_ref( pub(crate) fn instantiate_poly_trait_ref(
&self, &self,
trait_ref: &hir::TraitRef<'_>, trait_ref: &hir::TraitRef<'_>,
span: Span, span: Span,
...@@ -722,48 +777,34 @@ pub fn instantiate_poly_trait_ref( ...@@ -722,48 +777,34 @@ pub fn instantiate_poly_trait_ref(
bounds: &mut Bounds<'tcx>, bounds: &mut Bounds<'tcx>,
speculative: bool, speculative: bool,
) -> GenericArgCountResult { ) -> GenericArgCountResult {
let hir_id = trait_ref.hir_ref_id;
let binding_span = None;
let trait_ref_span = trait_ref.path.span;
let trait_def_id = trait_ref.trait_def_id().unwrap_or_else(|| FatalError.raise()); let trait_def_id = trait_ref.trait_def_id().unwrap_or_else(|| FatalError.raise());
let trait_segment = trait_ref.path.segments.last().unwrap();
let args = trait_segment.args();
let infer_args = trait_segment.infer_args;
self.prohibit_generics(trait_ref.path.segments.split_last().unwrap().1); self.prohibit_generics(trait_ref.path.segments.split_last().unwrap().1);
self.complain_about_internal_fn_trait(span, trait_def_id, trait_segment);
let tcx = self.tcx(); self.instantiate_poly_trait_ref_inner(
let bound_vars = tcx.late_bound_vars(trait_ref.hir_ref_id); hir_id,
debug!(?bound_vars); span,
binding_span,
let (substs, arg_count) = self.create_substs_for_ast_trait_ref( constness,
trait_ref.path.span, bounds,
speculative,
trait_ref_span,
trait_def_id, trait_def_id,
trait_segment,
args,
infer_args,
self_ty, self_ty,
trait_ref.path.segments.last().unwrap(), )
);
let assoc_bindings = self
.create_assoc_bindings_for_generic_args(trait_ref.path.segments.last().unwrap().args());
let poly_trait_ref =
ty::Binder::bind_with_vars(ty::TraitRef::new(trait_def_id, substs), bound_vars);
debug!(?poly_trait_ref, ?assoc_bindings);
bounds.trait_bounds.push((poly_trait_ref, span, constness));
let mut dup_bindings = FxHashMap::default();
for binding in &assoc_bindings {
// Specify type to assert that error was already reported in `Err` case.
let _: Result<_, ErrorReported> = self.add_predicates_for_ast_type_binding(
trait_ref.hir_ref_id,
poly_trait_ref,
binding,
bounds,
speculative,
&mut dup_bindings,
binding.span,
);
// Okay to ignore `Err` because of `ErrorReported` (see above).
}
arg_count
} }
pub fn instantiate_lang_item_trait_ref( pub(crate) fn instantiate_lang_item_trait_ref(
&self, &self,
lang_item: hir::LangItem, lang_item: hir::LangItem,
span: Span, span: Span,
...@@ -772,36 +813,28 @@ pub fn instantiate_lang_item_trait_ref( ...@@ -772,36 +813,28 @@ pub fn instantiate_lang_item_trait_ref(
self_ty: Ty<'tcx>, self_ty: Ty<'tcx>,
bounds: &mut Bounds<'tcx>, bounds: &mut Bounds<'tcx>,
) { ) {
let binding_span = Some(span);
let constness = ty::BoundConstness::NotConst;
let speculative = false;
let trait_ref_span = span;
let trait_def_id = self.tcx().require_lang_item(lang_item, Some(span)); let trait_def_id = self.tcx().require_lang_item(lang_item, Some(span));
let trait_segment = &hir::PathSegment::invalid();
let infer_args = false;
let (substs, _) = self.create_substs_for_ast_path( self.instantiate_poly_trait_ref_inner(
hir_id,
span, span,
binding_span,
constness,
bounds,
speculative,
trait_ref_span,
trait_def_id, trait_def_id,
&[], trait_segment,
&hir::PathSegment::invalid(),
args, args,
false, infer_args,
Some(self_ty), self_ty,
); );
let assoc_bindings = self.create_assoc_bindings_for_generic_args(args);
let tcx = self.tcx();
let bound_vars = tcx.late_bound_vars(hir_id);
let poly_trait_ref =
ty::Binder::bind_with_vars(ty::TraitRef::new(trait_def_id, substs), bound_vars);
bounds.trait_bounds.push((poly_trait_ref, span, ty::BoundConstness::NotConst));
let mut dup_bindings = FxHashMap::default();
for binding in assoc_bindings {
let _: Result<_, ErrorReported> = self.add_predicates_for_ast_type_binding(
hir_id,
poly_trait_ref,
&binding,
bounds,
false,
&mut dup_bindings,
span,
);
}
} }
fn ast_path_to_mono_trait_ref( fn ast_path_to_mono_trait_ref(
...@@ -935,45 +968,43 @@ pub(crate) fn add_implicitly_sized<'hir>( ...@@ -935,45 +968,43 @@ pub(crate) fn add_implicitly_sized<'hir>(
/// **A note on binders:** there is an implied binder around /// **A note on binders:** there is an implied binder around
/// `param_ty` and `ast_bounds`. See `instantiate_poly_trait_ref` /// `param_ty` and `ast_bounds`. See `instantiate_poly_trait_ref`
/// for more details. /// for more details.
#[tracing::instrument(level = "debug", skip(self, bounds))] #[tracing::instrument(level = "debug", skip(self, ast_bounds, bounds))]
fn add_bounds( pub(crate) fn add_bounds<'hir, I: Iterator<Item = &'hir hir::GenericBound<'hir>>>(
&self, &self,
param_ty: Ty<'tcx>, param_ty: Ty<'tcx>,
ast_bounds: &[hir::GenericBound<'_>], ast_bounds: I,
bounds: &mut Bounds<'tcx>, bounds: &mut Bounds<'tcx>,
bound_vars: &'tcx ty::List<ty::BoundVariableKind>, bound_vars: &'tcx ty::List<ty::BoundVariableKind>,
) { ) {
for ast_bound in ast_bounds { for ast_bound in ast_bounds {
match *ast_bound { match ast_bound {
hir::GenericBound::Trait(ref b, hir::TraitBoundModifier::None) => { hir::GenericBound::Trait(poly_trait_ref, modifier) => {
self.instantiate_poly_trait_ref( let constness = match modifier {
&b.trait_ref, hir::TraitBoundModifier::MaybeConst => ty::BoundConstness::ConstIfConst,
b.span, hir::TraitBoundModifier::None => ty::BoundConstness::NotConst,
ty::BoundConstness::NotConst, hir::TraitBoundModifier::Maybe => continue,
};
let _ = self.instantiate_poly_trait_ref(
&poly_trait_ref.trait_ref,
poly_trait_ref.span,
constness,
param_ty, param_ty,
bounds, bounds,
false, false,
); );
} }
hir::GenericBound::Trait(ref b, hir::TraitBoundModifier::MaybeConst) => { &hir::GenericBound::LangItemTrait(lang_item, span, hir_id, args) => {
self.instantiate_poly_trait_ref( self.instantiate_lang_item_trait_ref(
&b.trait_ref, lang_item, span, hir_id, args, param_ty, bounds,
b.span,
ty::BoundConstness::ConstIfConst,
param_ty,
bounds,
false,
); );
} }
hir::GenericBound::Trait(_, hir::TraitBoundModifier::Maybe) => {} hir::GenericBound::Outlives(lifetime) => {
hir::GenericBound::LangItemTrait(lang_item, span, hir_id, args) => self let region = self.ast_region_to_region(lifetime, None);
.instantiate_lang_item_trait_ref( bounds
lang_item, span, hir_id, args, param_ty, bounds, .region_bounds
), .push((ty::Binder::bind_with_vars(region, bound_vars), lifetime.span));
hir::GenericBound::Outlives(ref l) => bounds.region_bounds.push(( }
ty::Binder::bind_with_vars(self.ast_region_to_region(l, None), bound_vars),
l.span,
)),
} }
} }
} }
...@@ -1032,7 +1063,7 @@ fn compute_bounds_inner( ...@@ -1032,7 +1063,7 @@ fn compute_bounds_inner(
) -> Bounds<'tcx> { ) -> Bounds<'tcx> {
let mut bounds = Bounds::default(); let mut bounds = Bounds::default();
self.add_bounds(param_ty, ast_bounds, &mut bounds, ty::List::empty()); self.add_bounds(param_ty, ast_bounds.iter(), &mut bounds, ty::List::empty());
bounds bounds
} }
...@@ -1224,7 +1255,7 @@ fn add_predicates_for_ast_type_binding( ...@@ -1224,7 +1255,7 @@ fn add_predicates_for_ast_type_binding(
// Calling `skip_binder` is okay, because `add_bounds` expects the `param_ty` // Calling `skip_binder` is okay, because `add_bounds` expects the `param_ty`
// parameter to have a skipped binder. // parameter to have a skipped binder.
let param_ty = tcx.mk_ty(ty::Projection(projection_ty.skip_binder())); let param_ty = tcx.mk_ty(ty::Projection(projection_ty.skip_binder()));
self.add_bounds(param_ty, ast_bounds, bounds, candidate.bound_vars()); self.add_bounds(param_ty, ast_bounds.iter(), bounds, candidate.bound_vars());
} }
} }
Ok(()) Ok(())
......
...@@ -2220,62 +2220,15 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP ...@@ -2220,62 +2220,15 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
} }
} }
for bound in bound_pred.bounds.iter() { let mut bounds = Bounds::default();
match bound { <dyn AstConv<'_>>::add_bounds(
hir::GenericBound::Trait(poly_trait_ref, modifier) => { &icx,
let constness = match modifier { ty,
hir::TraitBoundModifier::None => ty::BoundConstness::NotConst, bound_pred.bounds.iter(),
hir::TraitBoundModifier::MaybeConst => { &mut bounds,
ty::BoundConstness::ConstIfConst bound_vars,
} );
// We ignore `where T: ?Sized`, it is already part of predicates.extend(bounds.predicates(tcx, ty));
// type parameter `T`.
hir::TraitBoundModifier::Maybe => continue,
};
let mut bounds = Bounds::default();
let _ = <dyn AstConv<'_>>::instantiate_poly_trait_ref(
&icx,
&poly_trait_ref.trait_ref,
poly_trait_ref.span,
constness,
ty,
&mut bounds,
false,
);
predicates.extend(bounds.predicates(tcx, ty));
}
&hir::GenericBound::LangItemTrait(lang_item, span, hir_id, args) => {
let mut bounds = Bounds::default();
<dyn AstConv<'_>>::instantiate_lang_item_trait_ref(
&icx,
lang_item,
span,
hir_id,
args,
ty,
&mut bounds,
);
predicates.extend(bounds.predicates(tcx, ty));
}
hir::GenericBound::Outlives(lifetime) => {
let region =
<dyn AstConv<'_>>::ast_region_to_region(&icx, lifetime, None);
predicates.insert((
ty::Binder::bind_with_vars(
ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(
ty, region,
)),
bound_vars,
)
.to_predicate(tcx),
lifetime.span,
));
}
}
}
} }
hir::WherePredicate::RegionPredicate(region_pred) => { hir::WherePredicate::RegionPredicate(region_pred) => {
...@@ -2489,44 +2442,14 @@ fn predicates_from_bound<'tcx>( ...@@ -2489,44 +2442,14 @@ fn predicates_from_bound<'tcx>(
param_ty: Ty<'tcx>, param_ty: Ty<'tcx>,
bound: &'tcx hir::GenericBound<'tcx>, bound: &'tcx hir::GenericBound<'tcx>,
) -> Vec<(ty::Predicate<'tcx>, Span)> { ) -> Vec<(ty::Predicate<'tcx>, Span)> {
match *bound { let mut bounds = Bounds::default();
hir::GenericBound::Trait(ref tr, modifier) => { astconv.add_bounds(
let constness = match modifier { param_ty,
hir::TraitBoundModifier::Maybe => return vec![], std::array::IntoIter::new([bound]),
hir::TraitBoundModifier::MaybeConst => ty::BoundConstness::ConstIfConst, &mut bounds,
hir::TraitBoundModifier::None => ty::BoundConstness::NotConst, ty::List::empty(),
}; );
bounds.predicates(astconv.tcx(), param_ty)
let mut bounds = Bounds::default();
let _ = astconv.instantiate_poly_trait_ref(
&tr.trait_ref,
tr.span,
constness,
param_ty,
&mut bounds,
false,
);
bounds.predicates(astconv.tcx(), param_ty)
}
hir::GenericBound::LangItemTrait(lang_item, span, hir_id, args) => {
let mut bounds = Bounds::default();
astconv.instantiate_lang_item_trait_ref(
lang_item,
span,
hir_id,
args,
param_ty,
&mut bounds,
);
bounds.predicates(astconv.tcx(), param_ty)
}
hir::GenericBound::Outlives(ref lifetime) => {
let region = astconv.ast_region_to_region(lifetime, None);
let pred = ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(param_ty, region))
.to_predicate(astconv.tcx());
vec![(pred, lifetime.span)]
}
}
} }
fn compute_sig_of_foreign_fn_decl<'tcx>( fn compute_sig_of_foreign_fn_decl<'tcx>(
......
...@@ -129,7 +129,6 @@ impl Clean<GenericBound> for hir::GenericBound<'_> { ...@@ -129,7 +129,6 @@ impl Clean<GenericBound> for hir::GenericBound<'_> {
fn clean(&self, cx: &mut DocContext<'_>) -> GenericBound { fn clean(&self, cx: &mut DocContext<'_>) -> GenericBound {
match *self { match *self {
hir::GenericBound::Outlives(lt) => GenericBound::Outlives(lt.clean(cx)), hir::GenericBound::Outlives(lt) => GenericBound::Outlives(lt.clean(cx)),
hir::GenericBound::Unsized(_) => GenericBound::maybe_sized(cx),
hir::GenericBound::LangItemTrait(lang_item, span, _, generic_args) => { hir::GenericBound::LangItemTrait(lang_item, span, _, generic_args) => {
let def_id = cx.tcx.require_lang_item(lang_item, Some(span)); let def_id = cx.tcx.require_lang_item(lang_item, Some(span));
...@@ -557,19 +556,13 @@ fn is_elided_lifetime(param: &hir::GenericParam<'_>) -> bool { ...@@ -557,19 +556,13 @@ fn is_elided_lifetime(param: &hir::GenericParam<'_>) -> bool {
WherePredicate::BoundPredicate { WherePredicate::BoundPredicate {
ty: Generic(ref name), ref mut bounds, .. ty: Generic(ref name), ref mut bounds, ..
} => { } => {
if let [] | [GenericBound::TraitBound(_, hir::TraitBoundModifier::Maybe)] = if bounds.is_empty() {
&bounds[..]
{
for param in &mut generics.params { for param in &mut generics.params {
match param.kind { match param.kind {
GenericParamDefKind::Lifetime { .. } => {} GenericParamDefKind::Lifetime { .. } => {}
GenericParamDefKind::Type { bounds: ref mut ty_bounds, .. } => { GenericParamDefKind::Type { bounds: ref mut ty_bounds, .. } => {
if &param.name == name { if &param.name == name {
mem::swap(bounds, ty_bounds); mem::swap(bounds, ty_bounds);
// We now keep track of `?Sized` obligations in the HIR.
// If we don't clear `ty_bounds` we end up with
// `fn foo<X: ?Sized>(_: X) where X: ?Sized`.
ty_bounds.clear();
break; break;
} }
} }
......
...@@ -6,7 +6,7 @@ LL | impl<R> External for (Q, R) {} ...@@ -6,7 +6,7 @@ LL | impl<R> External for (Q, R) {}
| |
= note: conflicting implementation in crate `complex_impl_support`: = note: conflicting implementation in crate `complex_impl_support`:
- impl<'a, 'b, 'c, T, U, V, W> External for (T, M<'a, 'b, 'c, Box<U>, V, W>) - impl<'a, 'b, 'c, T, U, V, W> External for (T, M<'a, 'b, 'c, Box<U>, V, W>)
where <U as FnOnce<(T,)>>::Output == V, <V as Iterator>::Item == T, 'b: 'a, T: 'a, U: FnOnce<(T,)>, U: 'static, V: Iterator, V: Clone, W: Add, <W as Add>::Output: Copy; where <U as FnOnce<(T,)>>::Output == V, <V as Iterator>::Item == T, 'b: 'a, T: 'a, U: 'static, U: FnOnce<(T,)>, V: Iterator, V: Clone, W: Add, <W as Add>::Output: Copy;
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/complex-impl.rs:9:1 --> $DIR/complex-impl.rs:9:1
......
...@@ -440,17 +440,6 @@ note: trait defined here, with 1 lifetime parameter: `'a` ...@@ -440,17 +440,6 @@ note: trait defined here, with 1 lifetime parameter: `'a`
LL | trait GenericLifetimeAT<'a> { LL | trait GenericLifetimeAT<'a> {
| ^^^^^^^^^^^^^^^^^ -- | ^^^^^^^^^^^^^^^^^ --
error[E0106]: missing lifetime specifier
--> $DIR/wrong-number-of-args.rs:169:44
|
LL | type C = Box<dyn GenericLifetimeAT<(), AssocTy=()>>;
| ^ expected named lifetime parameter
|
help: consider introducing a named lifetime parameter
|
LL | type C<'a> = Box<dyn GenericLifetimeAT<'a, (), AssocTy=()>>;
| ++++ +++
error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/wrong-number-of-args.rs:169:26 --> $DIR/wrong-number-of-args.rs:169:26
| |
...@@ -465,6 +454,17 @@ note: trait defined here, with 0 generic parameters ...@@ -465,6 +454,17 @@ note: trait defined here, with 0 generic parameters
LL | trait GenericLifetimeAT<'a> { LL | trait GenericLifetimeAT<'a> {
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error[E0106]: missing lifetime specifier
--> $DIR/wrong-number-of-args.rs:169:44
|
LL | type C = Box<dyn GenericLifetimeAT<(), AssocTy=()>>;
| ^ expected named lifetime parameter
|
help: consider introducing a named lifetime parameter
|
LL | type C<'a> = Box<dyn GenericLifetimeAT<'a, (), AssocTy=()>>;
| ++++ +++
error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:181:26 --> $DIR/wrong-number-of-args.rs:181:26
| |
...@@ -525,17 +525,6 @@ help: add missing generic argument ...@@ -525,17 +525,6 @@ help: add missing generic argument
LL | type C = Box<dyn GenericTypeAT<'static, A, AssocTy=()>>; LL | type C = Box<dyn GenericTypeAT<'static, A, AssocTy=()>>;
| +++ | +++
error[E0106]: missing lifetime specifier
--> $DIR/wrong-number-of-args.rs:201:48
|
LL | type A = Box<dyn GenericLifetimeTypeAT<AssocTy=()>>;
| ^ expected named lifetime parameter
|
help: consider introducing a named lifetime parameter
|
LL | type A<'a> = Box<dyn GenericLifetimeTypeAT<'a, AssocTy=()>>;
| ++++ +++
error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:201:26 --> $DIR/wrong-number-of-args.rs:201:26
| |
...@@ -552,6 +541,17 @@ help: add missing generic argument ...@@ -552,6 +541,17 @@ help: add missing generic argument
LL | type A = Box<dyn GenericLifetimeTypeAT<A, AssocTy=()>>; LL | type A = Box<dyn GenericLifetimeTypeAT<A, AssocTy=()>>;
| ++ | ++
error[E0106]: missing lifetime specifier
--> $DIR/wrong-number-of-args.rs:201:48
|
LL | type A = Box<dyn GenericLifetimeTypeAT<AssocTy=()>>;
| ^ expected named lifetime parameter
|
help: consider introducing a named lifetime parameter
|
LL | type A<'a> = Box<dyn GenericLifetimeTypeAT<'a, AssocTy=()>>;
| ++++ +++
error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:207:26 --> $DIR/wrong-number-of-args.rs:207:26
| |
...@@ -609,17 +609,6 @@ help: consider introducing a named lifetime parameter ...@@ -609,17 +609,6 @@ help: consider introducing a named lifetime parameter
LL | type D<'a> = Box<dyn GenericLifetimeTypeAT<'a, (), AssocTy=()>>; LL | type D<'a> = Box<dyn GenericLifetimeTypeAT<'a, (), AssocTy=()>>;
| ++++ +++ | ++++ +++
error[E0106]: missing lifetime specifier
--> $DIR/wrong-number-of-args.rs:221:48
|
LL | type E = Box<dyn GenericLifetimeTypeAT<(), (), AssocTy=()>>;
| ^ expected named lifetime parameter
|
help: consider introducing a named lifetime parameter
|
LL | type E<'a> = Box<dyn GenericLifetimeTypeAT<'a, (), (), AssocTy=()>>;
| ++++ +++
error[E0107]: this trait takes 1 generic argument but 2 generic arguments were supplied error[E0107]: this trait takes 1 generic argument but 2 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:221:26 --> $DIR/wrong-number-of-args.rs:221:26
| |
...@@ -634,6 +623,17 @@ note: trait defined here, with 1 generic parameter: `A` ...@@ -634,6 +623,17 @@ note: trait defined here, with 1 generic parameter: `A`
LL | trait GenericLifetimeTypeAT<'a, A> { LL | trait GenericLifetimeTypeAT<'a, A> {
| ^^^^^^^^^^^^^^^^^^^^^ - | ^^^^^^^^^^^^^^^^^^^^^ -
error[E0106]: missing lifetime specifier
--> $DIR/wrong-number-of-args.rs:221:48
|
LL | type E = Box<dyn GenericLifetimeTypeAT<(), (), AssocTy=()>>;
| ^ expected named lifetime parameter
|
help: consider introducing a named lifetime parameter
|
LL | type E<'a> = Box<dyn GenericLifetimeTypeAT<'a, (), (), AssocTy=()>>;
| ++++ +++
error[E0107]: this trait takes 1 lifetime argument but 2 lifetime arguments were supplied error[E0107]: this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
--> $DIR/wrong-number-of-args.rs:227:26 --> $DIR/wrong-number-of-args.rs:227:26
| |
...@@ -767,17 +767,6 @@ help: add missing lifetime argument ...@@ -767,17 +767,6 @@ help: add missing lifetime argument
LL | type B = Box<dyn GenericLifetimeLifetimeAT<'static, 'b, AssocTy=()>>; LL | type B = Box<dyn GenericLifetimeLifetimeAT<'static, 'b, AssocTy=()>>;
| ++++ | ++++
error[E0106]: missing lifetime specifiers
--> $DIR/wrong-number-of-args.rs:279:56
|
LL | type A = Box<dyn GenericLifetimeLifetimeTypeAT<AssocTy=()>>;
| ^ expected 2 lifetime parameters
|
help: consider introducing a named lifetime parameter
|
LL | type A<'a> = Box<dyn GenericLifetimeLifetimeTypeAT<'a, 'a, AssocTy=()>>;
| ++++ +++++++
error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:279:26 --> $DIR/wrong-number-of-args.rs:279:26
| |
...@@ -794,6 +783,17 @@ help: add missing generic argument ...@@ -794,6 +783,17 @@ help: add missing generic argument
LL | type A = Box<dyn GenericLifetimeLifetimeTypeAT<A, AssocTy=()>>; LL | type A = Box<dyn GenericLifetimeLifetimeTypeAT<A, AssocTy=()>>;
| ++ | ++
error[E0106]: missing lifetime specifiers
--> $DIR/wrong-number-of-args.rs:279:56
|
LL | type A = Box<dyn GenericLifetimeLifetimeTypeAT<AssocTy=()>>;
| ^ expected 2 lifetime parameters
|
help: consider introducing a named lifetime parameter
|
LL | type A<'a> = Box<dyn GenericLifetimeLifetimeTypeAT<'a, 'a, AssocTy=()>>;
| ++++ +++++++
error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/wrong-number-of-args.rs:285:26 --> $DIR/wrong-number-of-args.rs:285:26
| |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册