-
- Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.
Description
in
| DefineOpaqueTypes::No, |
self_ty arg of instantiate_value_path is None, or there are no generic parameters on the self type, so it gets inference variables which end up working out fine. As an example:
#![feature(type_alias_impl_trait)] struct Foo<T>(T); impl Foo<u32> { fn method() {} fn method2(self) {} } type Bar = impl Sized; fn bar() -> Bar { 42_u32 } impl Foo<Bar> { fn foo() -> Bar { Self::method(); //~^ ERROR: no function or associated item named `method` found for struct `Foo<Bar>` Foo::<Bar>::method(); //~^ ERROR: no function or associated item named `method` found for struct `Foo<Bar>` let x = Foo(bar()); Foo::method2(x); let x = Self(bar()); Self::method2(x); //~^ ERROR: no function or associated item named `method2` found for struct `Foo<Bar>` todo!() } } fn main() {}the Foo::method2(x); works fine, none of the others do, and none of them have a self_ty set here either.
Wrapping the types in <> does not have an effect, even if the code seems to hint at that:
| // `<T>::assoc` will end up here, and so |
any ideas @compiler-errors
cc #121394
Metadata
Metadata
Assignees
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.