-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Explicitly specify type parameter on FromResidual for Option and ControlFlow. #128954
Conversation
This comment has been minimized.
This comment has been minimized.
0bd3dd8
to
eff3994
Compare
r? libs-api |
From the issue it seems that the default here should work and @lcnr is working on a compiler fix. Do we really need this temporary fix? |
We expect to fix the underlying issue here in the medium term, so afaict the impact of this change is to prevent some weird errors when implementing |
Okay, if that is expected to happen before
Kind of, but the errors are nonlocal to the impl using defaulted param, as shown in #99940. The errors occur when implementing
It doesn't change anything within a crate, but across crates, it makes Alternately, this PR could be changed to leave the |
This comment was marked as resolved.
This comment was marked as resolved.
eff3994
to
7e72781
Compare
To work around coherence issue. Also adds regression test.
7e72781
to
1b6df71
Compare
@rustbot ready This PR now does not modify This does not change the API except with respect to the coherence issue. Once the compiler fix happens, the explicit generics should be able to be removed without changing the API. |
Updating just the @bors r+ |
…=scottmcm Explicitly specify type parameter on FromResidual for Option and ControlFlow. ~~Remove type parameter default `R = <Self as Try>::Residual` from `FromResidual`~~ _Specify default type parameter on `FromResidual` impls in the stdlib_ to work around rust-lang#99940 / rust-lang#87350 ~~as mentioned in rust-lang#84277 (comment). This does not completely fix the issue, but works around it for `Option` and `ControlFlow` specifically (`Result` does not have the issue since it already did not use the default parameter of `FromResidual`). ~~(Does this need an ACP or similar?)~~ ~~This probably needs at least an FCP since it changes the API described in [the RFC](rust-lang/rfcs#3058). Not sure if T-lang, T-libs-api, T-libs, or some combination (The tracking issue is tagged T-lang, T-libs-api).~~ This probably doesn't need T-lang input, since it is not changing the API of `FromResidual` from the RFC? Maybe needs T-libs-api FCP?
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#128828 (`-Znext-solver` caching) - rust-lang#128954 (Explicitly specify type parameter on FromResidual for Option and ControlFlow.) - rust-lang#129054 (Subtree update of `rust-analyzer`) - rust-lang#129059 (Record the correct target type when coercing fn items/closures to pointers) - rust-lang#129071 (Port `run-make/sysroot-crates-are-unstable` to rmake) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 6 pull requests Successful merges: - rust-lang#128570 (Stabilize `asm_const`) - rust-lang#128828 (`-Znext-solver` caching) - rust-lang#128954 (Explicitly specify type parameter on FromResidual for Option and ControlFlow.) - rust-lang#129059 (Record the correct target type when coercing fn items/closures to pointers) - rust-lang#129071 (Port `run-make/sysroot-crates-are-unstable` to rmake) - rust-lang#129088 (Make the rendered html doc for rustc better) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#128954 - zachs18:fromresidual-no-default, r=scottmcm Explicitly specify type parameter on FromResidual for Option and ControlFlow. ~~Remove type parameter default `R = <Self as Try>::Residual` from `FromResidual`~~ _Specify default type parameter on `FromResidual` impls in the stdlib_ to work around rust-lang#99940 / rust-lang#87350 ~~as mentioned in rust-lang#84277 (comment). This does not completely fix the issue, but works around it for `Option` and `ControlFlow` specifically (`Result` does not have the issue since it already did not use the default parameter of `FromResidual`). ~~(Does this need an ACP or similar?)~~ ~~This probably needs at least an FCP since it changes the API described in [the RFC](rust-lang/rfcs#3058). Not sure if T-lang, T-libs-api, T-libs, or some combination (The tracking issue is tagged T-lang, T-libs-api).~~ This probably doesn't need T-lang input, since it is not changing the API of `FromResidual` from the RFC? Maybe needs T-libs-api FCP?
Remove type parameter defaultSpecify default type parameter onR = <Self as Try>::Residual
fromFromResidual
FromResidual
impls in the stdlib to work around #99940 / #87350as mentioned in #84277 (comment).This does not completely fix the issue, but works around it for
Option
andControlFlow
specifically (Result
does not have the issue since it already did not use the default parameter ofFromResidual
).(Does this need an ACP or similar?)This probably needs at least an FCP since it changes the API described in the RFC. Not sure if T-lang, T-libs-api, T-libs, or some combination (The tracking issue is tagged T-lang, T-libs-api).This probably doesn't need T-lang input, since it is not changing the API ofFromResidual
from the RFC? Maybe needs T-libs-api FCP?