Force the correct type variable to never for method resolution on an adjusted never type - #163450
Merged
Merged
Conversation
Contributor
|
@bors r+ rollup |
Contributor
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Sep 28, 2026
Force the correct type variable to never for method resolution on an adjusted never type Fixes the problem described in https://rust-lang.zulipchat.com/#narrow/channel/618216-t-types.2Fcall-for-participation/topic/method.20call.20on.20diverging.20infer.20doesn.27t.20constrain.20to.20never/near/627440568 The reason that the old code didn't work, as far as I understand, is that the subtype constraint `root_ty <: ty` is only evaluated after `ty` is unioned with `&_`, causing a `mismatched type` error when `&_` is then given the subtype constraint. This is fixed by demanding `ty`, rather than `root_ty` to be equal to never. I asked lcnr whether they think there's a way to reproduce this on the old trait solver, they were unsure and I also am. I think to be safe we should backport this to 1.100, since the never type stabilization is in 1.100 and there might be a way to break this code then. r? @lcnr cc @WaffleLapkin
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Sep 28, 2026
Force the correct type variable to never for method resolution on an adjusted never type Fixes the problem described in https://rust-lang.zulipchat.com/#narrow/channel/618216-t-types.2Fcall-for-participation/topic/method.20call.20on.20diverging.20infer.20doesn.27t.20constrain.20to.20never/near/627440568 The reason that the old code didn't work, as far as I understand, is that the subtype constraint `root_ty <: ty` is only evaluated after `ty` is unioned with `&_`, causing a `mismatched type` error when `&_` is then given the subtype constraint. This is fixed by demanding `ty`, rather than `root_ty` to be equal to never. I asked lcnr whether they think there's a way to reproduce this on the old trait solver, they were unsure and I also am. I think to be safe we should backport this to 1.100, since the never type stabilization is in 1.100 and there might be a way to break this code then. r? @lcnr cc @WaffleLapkin
rust-bors Bot
pushed a commit
that referenced
this pull request
Sep 28, 2026
…uwer Rollup of 15 pull requests Successful merges: - #158936 (Add `std::fs::{Home|Media}Dirs`) - #129036 (Additional NonZero conversions) - #158997 (Avoid recording unnameable `extern crate` aliases in diagnostic metadata) - #161015 (Stabilize `funnel_shifts` (including `const`)) - #161712 (Stabilize `Result::into_{ok,err}`) - #162493 (Add support for -Zsanitizer-cfi-minimal-runtime) - #162655 (next solver: prefer to select impl candidates over global where-clause candidates) - #162862 (Fix intra doc link resolution when a doc comment is composed of both inner and outer doc comment) - #163200 (make `RustaceansAreAwesome` satisfy trait bounds) - #163331 (Move `Arc` and `Rc` into `rcs` mod) - #163427 (implement #![feature(gca_adts)]) - #163428 (do not complain about unstable target features on nightly) - #163444 (Add `stable_rustc` helper in `run-make-support`) - #163447 (Allow using different index types when reading and writing to tables) - #163450 (Force the correct type variable to never for method resolution on an adjusted never type)
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Sep 29, 2026
Force the correct type variable to never for method resolution on an adjusted never type Fixes the problem described in https://rust-lang.zulipchat.com/#narrow/channel/618216-t-types.2Fcall-for-participation/topic/method.20call.20on.20diverging.20infer.20doesn.27t.20constrain.20to.20never/near/627440568 The reason that the old code didn't work, as far as I understand, is that the subtype constraint `root_ty <: ty` is only evaluated after `ty` is unioned with `&_`, causing a `mismatched type` error when `&_` is then given the subtype constraint. This is fixed by demanding `ty`, rather than `root_ty` to be equal to never. I asked lcnr whether they think there's a way to reproduce this on the old trait solver, they were unsure and I also am. I think to be safe we should backport this to 1.100, since the never type stabilization is in 1.100 and there might be a way to break this code then. r? @lcnr cc @WaffleLapkin
rust-bors Bot
pushed a commit
that referenced
this pull request
Sep 29, 2026
…uwer Rollup of 9 pull requests Successful merges: - #162655 (next solver: prefer to select impl candidates over global where-clause candidates) - #162832 (add `Div` and `Mul` for `Complex<{float}>`) - #162862 (Fix intra doc link resolution when a doc comment is composed of both inner and outer doc comment) - #163024 (Add `Dir` equivalents of `fs::metadata` & `fs::symlink_metadata`) - #163200 (make `RustaceansAreAwesome` satisfy trait bounds) - #163210 (std: split stack overflow module) - #163331 (Move `Arc` and `Rc` into `rcs` mod) - #163183 (Add .seek_read_buf_exact() to std::os::windows::fs::FileExt) - #163450 (Force the correct type variable to never for method resolution on an adjusted never type)
rust-bors Bot
pushed a commit
that referenced
this pull request
Sep 29, 2026
…uwer Rollup of 9 pull requests Successful merges: - #158997 (Avoid recording unnameable `extern crate` aliases in diagnostic metadata) - #162655 (next solver: prefer to select impl candidates over global where-clause candidates) - #162832 (add `Div` and `Mul` for `Complex<{float}>`) - #162862 (Fix intra doc link resolution when a doc comment is composed of both inner and outer doc comment) - #163200 (make `RustaceansAreAwesome` satisfy trait bounds) - #163210 (std: split stack overflow module) - #163331 (Move `Arc` and `Rc` into `rcs` mod) - #163183 (Add .seek_read_buf_exact() to std::os::windows::fs::FileExt) - #163450 (Force the correct type variable to never for method resolution on an adjusted never type)
rust-bors Bot
pushed a commit
that referenced
this pull request
Sep 29, 2026
Rollup merge of #163450 - JonathanBrouwer:fix-never, r=lcnr Force the correct type variable to never for method resolution on an adjusted never type Fixes the problem described in https://rust-lang.zulipchat.com/#narrow/channel/618216-t-types.2Fcall-for-participation/topic/method.20call.20on.20diverging.20infer.20doesn.27t.20constrain.20to.20never/near/627440568 The reason that the old code didn't work, as far as I understand, is that the subtype constraint `root_ty <: ty` is only evaluated after `ty` is unioned with `&_`, causing a `mismatched type` error when `&_` is then given the subtype constraint. This is fixed by demanding `ty`, rather than `root_ty` to be equal to never. I asked lcnr whether they think there's a way to reproduce this on the old trait solver, they were unsure and I also am. I think to be safe we should backport this to 1.100, since the never type stabilization is in 1.100 and there might be a way to break this code then. r? @lcnr cc @WaffleLapkin
pull Bot
pushed a commit
to LeeeeeeM/miri
that referenced
this pull request
Sep 30, 2026
…uwer Rollup of 9 pull requests Successful merges: - rust-lang/rust#158997 (Avoid recording unnameable `extern crate` aliases in diagnostic metadata) - rust-lang/rust#162655 (next solver: prefer to select impl candidates over global where-clause candidates) - rust-lang/rust#162832 (add `Div` and `Mul` for `Complex<{float}>`) - rust-lang/rust#162862 (Fix intra doc link resolution when a doc comment is composed of both inner and outer doc comment) - rust-lang/rust#163200 (make `RustaceansAreAwesome` satisfy trait bounds) - rust-lang/rust#163210 (std: split stack overflow module) - rust-lang/rust#163331 (Move `Arc` and `Rc` into `rcs` mod) - rust-lang/rust#163183 (Add .seek_read_buf_exact() to std::os::windows::fs::FileExt) - rust-lang/rust#163450 (Force the correct type variable to never for method resolution on an adjusted never type)
bjorn3
pushed a commit
to rust-lang/rustc_codegen_cranelift
that referenced
this pull request
Sep 30, 2026
…uwer Rollup of 9 pull requests Successful merges: - rust-lang/rust#158997 (Avoid recording unnameable `extern crate` aliases in diagnostic metadata) - rust-lang/rust#162655 (next solver: prefer to select impl candidates over global where-clause candidates) - rust-lang/rust#162832 (add `Div` and `Mul` for `Complex<{float}>`) - rust-lang/rust#162862 (Fix intra doc link resolution when a doc comment is composed of both inner and outer doc comment) - rust-lang/rust#163200 (make `RustaceansAreAwesome` satisfy trait bounds) - rust-lang/rust#163210 (std: split stack overflow module) - rust-lang/rust#163331 (Move `Arc` and `Rc` into `rcs` mod) - rust-lang/rust#163183 (Add .seek_read_buf_exact() to std::os::windows::fs::FileExt) - rust-lang/rust#163450 (Force the correct type variable to never for method resolution on an adjusted never type)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the problem described in https://rust-lang.zulipchat.com/#narrow/channel/618216-t-types.2Fcall-for-participation/topic/method.20call.20on.20diverging.20infer.20doesn.27t.20constrain.20to.20never/near/627440568
The reason that the old code didn't work, as far as I understand, is that the subtype constraint
root_ty <: tyis only evaluated aftertyis unioned with&_, causing amismatched typeerror when&_is then given the subtype constraint.This is fixed by demanding
ty, rather thanroot_tyto be equal to never.I asked lcnr whether they think there's a way to reproduce this on the old trait solver, they were unsure and I also am.
I think to be safe we should backport this to 1.100, since the never type stabilization is in 1.100 and there might be a way to break this code then.
r? @lcnr
cc @WaffleLapkin