Don't lower assoc bindings just to deny them
This commit is contained in:
parent
9f1a21ae2b
commit
3722ad4c26
2 changed files with 7 additions and 11 deletions
|
@ -448,8 +448,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
let infer_lifetimes =
|
||||
(gen_pos != GenericArgPosition::Type || infer_args) && !gen_args.has_lifetime_params();
|
||||
|
||||
if gen_pos != GenericArgPosition::Type && !gen_args.bindings.is_empty() {
|
||||
Self::prohibit_assoc_ty_binding(tcx, gen_args.bindings[0].span);
|
||||
if gen_pos != GenericArgPosition::Type && let Some(b) = gen_args.bindings.first() {
|
||||
Self::prohibit_assoc_ty_binding(tcx, b.span);
|
||||
}
|
||||
|
||||
let explicit_late_bound =
|
||||
|
|
|
@ -276,9 +276,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
item_segment.infer_args,
|
||||
None,
|
||||
);
|
||||
let assoc_bindings = self.create_assoc_bindings_for_generic_args(item_segment.args());
|
||||
|
||||
if let Some(b) = assoc_bindings.first() {
|
||||
if let Some(b) = item_segment.args().bindings.first() {
|
||||
Self::prohibit_assoc_ty_binding(self.tcx(), b.span);
|
||||
}
|
||||
|
||||
|
@ -605,8 +603,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
None,
|
||||
);
|
||||
|
||||
let assoc_bindings = self.create_assoc_bindings_for_generic_args(item_segment.args());
|
||||
if let Some(b) = assoc_bindings.first() {
|
||||
if let Some(b) = item_segment.args().bindings.first() {
|
||||
Self::prohibit_assoc_ty_binding(self.tcx(), b.span);
|
||||
}
|
||||
|
||||
|
@ -794,8 +791,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
trait_segment,
|
||||
is_impl,
|
||||
);
|
||||
let assoc_bindings = self.create_assoc_bindings_for_generic_args(trait_segment.args());
|
||||
if let Some(b) = assoc_bindings.first() {
|
||||
if let Some(b) = trait_segment.args().bindings.first() {
|
||||
Self::prohibit_assoc_ty_binding(self.tcx(), b.span);
|
||||
}
|
||||
ty::TraitRef::new(trait_def_id, substs)
|
||||
|
@ -2208,8 +2204,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
|
||||
for segment in segments {
|
||||
// Only emit the first error to avoid overloading the user with error messages.
|
||||
if let [binding, ..] = segment.args().bindings {
|
||||
Self::prohibit_assoc_ty_binding(self.tcx(), binding.span);
|
||||
if let Some(b) = segment.args().bindings.first() {
|
||||
Self::prohibit_assoc_ty_binding(self.tcx(), b.span);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue