-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DefineOpaqueTypes::No in UFC Self
resolution
#121404
Labels
A-impl-trait
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.
C-cleanup
Category: PRs that clean code up or issues documenting cleanup.
Comments
oli-obk
added
C-cleanup
Category: PRs that clean code up or issues documenting cleanup.
A-impl-trait
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.
labels
Feb 21, 2024
rustbot
added
the
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
label
Feb 21, 2024
@oli-obk: This |
yay, thought so, I'll add the test with a comment that it is a bug |
Noratrieb
removed
the
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
label
Feb 21, 2024
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Apr 15, 2024
change method resolution to constrain hidden types instead of rejecting method candidates Some of these are in probes and may affect inference. This is therefore a breaking change. This allows new code to compile on stable: ```rust trait Trait {} impl Trait for u32 {} struct Bar<T>(T); impl Bar<u32> { fn foo(self) {} } fn foo(x: bool) -> Bar<impl Sized> { if x { let x = foo(false); x.foo(); //^ this used to not find the `foo` method, because while we did equate `x`'s type with possible candidates, we didn't allow opaque type inference while doing so } todo!() } ``` But it is also a breaking change, since `&self` and `&mut self` method calls on recursive RPIT function calls now constrain the hidden type to `&_` and `&mut _` respectively. This is not what users really expect or want from this, but there's way around this. r? `@compiler-errors` fixes rust-lang#121404 cc rust-lang#116652
3 tasks
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Apr 16, 2024
change method resolution to constrain hidden types instead of rejecting method candidates Some of these are in probes and may affect inference. This is therefore a breaking change. This allows new code to compile on stable: ```rust trait Trait {} impl Trait for u32 {} struct Bar<T>(T); impl Bar<u32> { fn foo(self) {} } fn foo(x: bool) -> Bar<impl Sized> { if x { let x = foo(false); x.foo(); //^ this used to not find the `foo` method, because while we did equate `x`'s type with possible candidates, we didn't allow opaque type inference while doing so } todo!() } ``` But it is also a breaking change, since `&self` and `&mut self` method calls on recursive RPIT function calls now constrain the hidden type to `&_` and `&mut _` respectively. This is not what users really expect or want from this, but there's way around this. r? `@compiler-errors` fixes rust-lang#121404 cc rust-lang#116652
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Apr 22, 2024
change method resolution to constrain hidden types instead of rejecting method candidates Some of these are in probes and may affect inference. This is therefore a breaking change. This allows new code to compile on stable: ```rust trait Trait {} impl Trait for u32 {} struct Bar<T>(T); impl Bar<u32> { fn foo(self) {} } fn foo(x: bool) -> Bar<impl Sized> { if x { let x = foo(false); x.foo(); //^ this used to not find the `foo` method, because while we did equate `x`'s type with possible candidates, we didn't allow opaque type inference while doing so } todo!() } ``` But it is also a breaking change, since `&self` and `&mut self` method calls on recursive RPIT function calls now constrain the hidden type to `&_` and `&mut _` respectively. This is not what users really expect or want from this, but there's way around this. r? `@compiler-errors` fixes rust-lang#121404 cc rust-lang#116652
fmease
added a commit
to fmease/rust
that referenced
this issue
Jun 13, 2024
change method resolution to constrain hidden types instead of rejecting method candidates Some of these are in probes and may affect inference. This is therefore a breaking change. This allows new code to compile on stable: ```rust trait Trait {} impl Trait for u32 {} struct Bar<T>(T); impl Bar<u32> { fn foo(self) {} } fn foo(x: bool) -> Bar<impl Sized> { if x { let x = foo(false); x.foo(); //^ this used to not find the `foo` method, because while we did equate `x`'s type with possible candidates, we didn't allow opaque type inference while doing so } todo!() } ``` r? `@compiler-errors` fixes rust-lang#121404 cc rust-lang#116652
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Jun 13, 2024
change method resolution to constrain hidden types instead of rejecting method candidates Some of these are in probes and may affect inference. This is therefore a breaking change. This allows new code to compile on stable: ```rust trait Trait {} impl Trait for u32 {} struct Bar<T>(T); impl Bar<u32> { fn foo(self) {} } fn foo(x: bool) -> Bar<impl Sized> { if x { let x = foo(false); x.foo(); //^ this used to not find the `foo` method, because while we did equate `x`'s type with possible candidates, we didn't allow opaque type inference while doing so } todo!() } ``` r? ``@compiler-errors`` fixes rust-lang#121404 cc rust-lang#116652
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Jun 13, 2024
change method resolution to constrain hidden types instead of rejecting method candidates Some of these are in probes and may affect inference. This is therefore a breaking change. This allows new code to compile on stable: ```rust trait Trait {} impl Trait for u32 {} struct Bar<T>(T); impl Bar<u32> { fn foo(self) {} } fn foo(x: bool) -> Bar<impl Sized> { if x { let x = foo(false); x.foo(); //^ this used to not find the `foo` method, because while we did equate `x`'s type with possible candidates, we didn't allow opaque type inference while doing so } todo!() } ``` r? ```@compiler-errors``` fixes rust-lang#121404 cc rust-lang#116652
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Jun 13, 2024
change method resolution to constrain hidden types instead of rejecting method candidates Some of these are in probes and may affect inference. This is therefore a breaking change. This allows new code to compile on stable: ```rust trait Trait {} impl Trait for u32 {} struct Bar<T>(T); impl Bar<u32> { fn foo(self) {} } fn foo(x: bool) -> Bar<impl Sized> { if x { let x = foo(false); x.foo(); //^ this used to not find the `foo` method, because while we did equate `x`'s type with possible candidates, we didn't allow opaque type inference while doing so } todo!() } ``` r? ````@compiler-errors```` fixes rust-lang#121404 cc rust-lang#116652
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Jun 13, 2024
change method resolution to constrain hidden types instead of rejecting method candidates Some of these are in probes and may affect inference. This is therefore a breaking change. This allows new code to compile on stable: ```rust trait Trait {} impl Trait for u32 {} struct Bar<T>(T); impl Bar<u32> { fn foo(self) {} } fn foo(x: bool) -> Bar<impl Sized> { if x { let x = foo(false); x.foo(); //^ this used to not find the `foo` method, because while we did equate `x`'s type with possible candidates, we didn't allow opaque type inference while doing so } todo!() } ``` r? `````@compiler-errors````` fixes rust-lang#121404 cc rust-lang#116652
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Jun 14, 2024
change method resolution to constrain hidden types instead of rejecting method candidates Some of these are in probes and may affect inference. This is therefore a breaking change. This allows new code to compile on stable: ```rust trait Trait {} impl Trait for u32 {} struct Bar<T>(T); impl Bar<u32> { fn foo(self) {} } fn foo(x: bool) -> Bar<impl Sized> { if x { let x = foo(false); x.foo(); //^ this used to not find the `foo` method, because while we did equate `x`'s type with possible candidates, we didn't allow opaque type inference while doing so } todo!() } ``` r? ``````@compiler-errors`````` fixes rust-lang#121404 cc rust-lang#116652
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jun 14, 2024
Rollup merge of rust-lang#123962 - oli-obk:define_opaque_types5, r=lcnr change method resolution to constrain hidden types instead of rejecting method candidates Some of these are in probes and may affect inference. This is therefore a breaking change. This allows new code to compile on stable: ```rust trait Trait {} impl Trait for u32 {} struct Bar<T>(T); impl Bar<u32> { fn foo(self) {} } fn foo(x: bool) -> Bar<impl Sized> { if x { let x = foo(false); x.foo(); //^ this used to not find the `foo` method, because while we did equate `x`'s type with possible candidates, we didn't allow opaque type inference while doing so } todo!() } ``` r? ```````@compiler-errors``````` fixes rust-lang#121404 cc rust-lang#116652
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-impl-trait
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.
C-cleanup
Category: PRs that clean code up or issues documenting cleanup.
in
rust/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
Line 1452 in 1d447a9
self_ty
arg ofinstantiate_value_path
isNone
, or there are no generic parameters on the self type, so it gets inference variables which end up working out fine.As an example:
the
Foo::method2(x);
works fine, none of the others do, and none of them have aself_ty
set here either.Wrapping the types in
<>
does not have an effect, even if the code seems to hint at that:rust/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
Line 1150 in 1d447a9
any ideas @compiler-errors
cc #121394
The text was updated successfully, but these errors were encountered: