1
Fork 0

Deny associated type bindings within associated type bindings

This commit is contained in:
Michael Goulet 2022-09-27 00:45:50 +00:00
parent 57ee5cf5a9
commit ca2e0bb51a
9 changed files with 82 additions and 5 deletions

View file

@ -595,7 +595,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
"create_substs_for_associated_item(span: {:?}, item_def_id: {:?}, item_segment: {:?}",
span, item_def_id, item_segment
);
self.create_substs_for_ast_path(
let (args, _) = self.create_substs_for_ast_path(
span,
item_def_id,
parent_substs,
@ -603,8 +603,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
item_segment.args(),
item_segment.infer_args,
None,
)
.0
);
let assoc_bindings = self.create_assoc_bindings_for_generic_args(item_segment.args());
if let Some(b) = assoc_bindings.first() {
Self::prohibit_assoc_ty_binding(self.tcx(), b.span);
}
args
}
/// Instantiates the path for the given trait reference, assuming that it's