mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
fix: Insert a generic arg for impl Trait
when lowering generic args
This commit is contained in:
parent
aa00ddcf65
commit
8fa454d7aa
2 changed files with 24 additions and 0 deletions
|
@ -194,6 +194,11 @@ pub(super) fn lower_generic_args(
|
||||||
match generic_arg {
|
match generic_arg {
|
||||||
ast::GenericArg::TypeArg(type_arg) => {
|
ast::GenericArg::TypeArg(type_arg) => {
|
||||||
let type_ref = TypeRef::from_ast_opt(lower_ctx, type_arg.ty());
|
let type_ref = TypeRef::from_ast_opt(lower_ctx, type_arg.ty());
|
||||||
|
type_ref.walk(&mut |tr| {
|
||||||
|
if let TypeRef::ImplTrait(bounds) = tr {
|
||||||
|
lower_ctx.update_impl_traits_bounds(bounds.clone());
|
||||||
|
}
|
||||||
|
});
|
||||||
args.push(GenericArg::Type(type_ref));
|
args.push(GenericArg::Type(type_ref));
|
||||||
}
|
}
|
||||||
ast::GenericArg::AssocTypeArg(assoc_type_arg) => {
|
ast::GenericArg::AssocTypeArg(assoc_type_arg) => {
|
||||||
|
|
|
@ -2122,3 +2122,22 @@ fn test() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn issue_17191() {
|
||||||
|
check_types(
|
||||||
|
r#"
|
||||||
|
trait A {
|
||||||
|
type Item;
|
||||||
|
}
|
||||||
|
|
||||||
|
trait B<T> {}
|
||||||
|
|
||||||
|
fn foo<T: B<impl A>>() {}
|
||||||
|
|
||||||
|
fn test() {
|
||||||
|
let f = foo;
|
||||||
|
//^ fn foo<{unknown}>()
|
||||||
|
}"#,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue