Fix trait method resolution on an adjusted never type#156047
Conversation
|
|
There was a problem hiding this comment.
Note that this PR allows more code to compile on stable, for example see this test.
There was a problem hiding this comment.
If this is a problem we could delay the problem by putting this change behind the never_type feature gate
There was a problem hiding this comment.
I think this a reasonable change, I would expect us to emit a FCW here, I don't want to support this permanently or more importantly, this may overlap with other kinds of inference fallback in the future, so we generally don't want users to rely on this
This comment has been minimized.
This comment has been minimized.
75d6b9a to
d72e38a
Compare
|
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
d72e38a to
3787326
Compare
This comment has been minimized.
This comment has been minimized.
3787326 to
a8f68d6
Compare
This comment has been minimized.
This comment has been minimized.
a8f68d6 to
2dd2577
Compare
This comment has been minimized.
This comment has been minimized.
Rollup of 6 pull requests Successful merges: - #159039 (resolve: fix effective visibilities for items in ambiguous glob sets) - #156047 (Fix trait method resolution on an adjusted never type) - #159061 (Skip trivial cast lint for trait object upcasts) - #159241 (Update books) - #159248 (compiler: Remove `-Zmutable-noalias`) - #159250 (Rename `errors.rs` file to `diagnostics.rs` (13/N))
…=lcnr,wafflelapkin Fix trait method resolution on an adjusted never type Fixes rust-lang#143349 r? @WaffleLapkin cc @lcnr
Rollup of 6 pull requests Successful merges: - #159039 (resolve: fix effective visibilities for items in ambiguous glob sets) - #156047 (Fix trait method resolution on an adjusted never type) - #158981 (Fix where-bound suggestion with legacy const generics) - #159061 (Skip trivial cast lint for trait object upcasts) - #159248 (compiler: Remove `-Zmutable-noalias`) - #159250 (Rename `errors.rs` file to `diagnostics.rs` (13/N))
|
Simple typo |
|
This pull request was unapproved. This PR was contained in a rollup (#159262), which was unapproved. |
| /// | ||
| /// ### Example | ||
| /// | ||
| /// ```rust,ignore (does not compile on stage1 until bootstrap, change this to no_run after bootstrap is updated, writing CURRENT_RUSTC_VERSION hoping this is noticed in the diff) |
There was a problem hiding this comment.
This isn't quite the correct way to do this for a new lint. I think it requires some combination of #[cfg_attr(bootstrap, doc = "```rust")] lines. See https://github.com/rust-lang/rust/pull/155521/changes#diff-c39514e6f2a747139246fae90b0fca9c3485b104d3a0a04aea11361918d2434fR20-R23 for an example.
(I don't love that the tests are run this way.)
There was a problem hiding this comment.
(I don't love that the tests are run this way.)
Do you mean that we still run ignore'ed tests? How does that happen?
There was a problem hiding this comment.
I didn't even know you can cfg_attr doc comments, awesome! Will fix it
There was a problem hiding this comment.
I tried looking for this on the rustc dev guide but couldn't find it, I'll also add a section for it :)
There was a problem hiding this comment.
The ignore tests aren't run. The error message explains what is happening:
The documentation generator cannot generate the example output when the example is ignored.
Manually include the sample output below the example. For example:
It's the {{produces}} part that doesn't work with ignore (since there's no way for it to generate the output).
However, using ignore in this situation isn't the right thing. ignore should only be used in cases where it is impossible to exercise the lint with our current harness.
The reason you can't just have a normal rust example here is because there is a CI job that tries to run doctests with an older rustc. Personally I don't think that is worth trying to support that, but I understand it's not simple.
It's also just a bad interaction of using doc-comments for this purpose. The code examples are only intended to run with the lint-docs tool. I don't remember, but I don't think I ever intended them to run via doctests. I feel like something changed along the line, because this used to not be a problem.
One idea to try to work around this is to stop using doc-comments for this documentation. They cause several problems (like showing up in search engines). Perhaps either change them to regular comments, or move them to separate files (like the E code files).
That's not the case here. There's no typo for the |
40b907f to
62c7143
Compare
|
@bors try jobs=x86_64-gnu-llvm-22-3 |
This comment has been minimized.
This comment has been minimized.
Fix trait method resolution on an adjusted never type try-job: x86_64-gnu-llvm-22-3
|
@bors r=lcnr,wafflelapkin |
…uwer Rollup of 22 pull requests Successful merges: - #156047 (Fix trait method resolution on an adjusted never type) - #157824 (Comptime inherent impls) - #158235 (Store `DefId` instead of `EiiDecl` in `EiiImplResolution::Known`) - #158723 (Support EII on Windows MSVC) - #158993 (rerun in original typing mode if we meet any opaques in post analysis) - #159160 (Make `HasTokens` a sub-trait of `HasAttrs`.) - #159183 (Introduce InstanceKind::LlvmIntrinsic) - #159251 (Bump rustc-perf submodule) - #155013 (Suggest the `[const] Destruct` bound for type parameters in const functions when missing) - #159155 (unstable book: Document `diagnostic_on_unknown` feature) - #159235 (Add regression test for #95719) - #159243 (inline Once wait and wait_force) - #159255 (Replace shortened type with `_` instead of `...` as placeholder) - #159259 (Add regression test for #144033) - #159265 (bootstrap: skip intrinsic-test when rustfmt is unavailable) - #159269 (disable range-len-try-from.rs on s390x) - #159272 (slice: make swap delegate to swap_unchecked) - #159274 (bootstrap: Rename `std_crates_for_run_make` to `std_crates_for_make_run`) - #159275 (remove obsolete comment) - #159277 (Construct `tokens` for attrs made by `mk_attr_word` and other variants) - #159283 (Remove obsolete verbose flag from deref/ref suggestions) - #159290 (rustc-dev-guide subtree update)
…uwer Rollup of 22 pull requests Successful merges: - #156047 (Fix trait method resolution on an adjusted never type) - #157824 (Comptime inherent impls) - #158235 (Store `DefId` instead of `EiiDecl` in `EiiImplResolution::Known`) - #158723 (Support EII on Windows MSVC) - #158993 (rerun in original typing mode if we meet any opaques in post analysis) - #159160 (Make `HasTokens` a sub-trait of `HasAttrs`.) - #159183 (Introduce InstanceKind::LlvmIntrinsic) - #159251 (Bump rustc-perf submodule) - #155013 (Suggest the `[const] Destruct` bound for type parameters in const functions when missing) - #159155 (unstable book: Document `diagnostic_on_unknown` feature) - #159235 (Add regression test for #95719) - #159243 (inline Once wait and wait_force) - #159255 (Replace shortened type with `_` instead of `...` as placeholder) - #159259 (Add regression test for #144033) - #159265 (bootstrap: skip intrinsic-test when rustfmt is unavailable) - #159269 (disable range-len-try-from.rs on s390x) - #159272 (slice: make swap delegate to swap_unchecked) - #159274 (bootstrap: Rename `std_crates_for_run_make` to `std_crates_for_make_run`) - #159275 (remove obsolete comment) - #159277 (Construct `tokens` for attrs made by `mk_attr_word` and other variants) - #159283 (Remove obsolete verbose flag from deref/ref suggestions) - #159290 (rustc-dev-guide subtree update)
Rollup merge of #156047 - JonathanBrouwer:never-ty-method, r=lcnr,wafflelapkin Fix trait method resolution on an adjusted never type Fixes #143349 r? @WaffleLapkin cc @lcnr
…uwer Rollup of 22 pull requests Successful merges: - rust-lang/rust#156047 (Fix trait method resolution on an adjusted never type) - rust-lang/rust#157824 (Comptime inherent impls) - rust-lang/rust#158235 (Store `DefId` instead of `EiiDecl` in `EiiImplResolution::Known`) - rust-lang/rust#158723 (Support EII on Windows MSVC) - rust-lang/rust#158993 (rerun in original typing mode if we meet any opaques in post analysis) - rust-lang/rust#159160 (Make `HasTokens` a sub-trait of `HasAttrs`.) - rust-lang/rust#159183 (Introduce InstanceKind::LlvmIntrinsic) - rust-lang/rust#159251 (Bump rustc-perf submodule) - rust-lang/rust#155013 (Suggest the `[const] Destruct` bound for type parameters in const functions when missing) - rust-lang/rust#159155 (unstable book: Document `diagnostic_on_unknown` feature) - rust-lang/rust#159235 (Add regression test for rust-lang/rust#95719) - rust-lang/rust#159243 (inline Once wait and wait_force) - rust-lang/rust#159255 (Replace shortened type with `_` instead of `...` as placeholder) - rust-lang/rust#159259 (Add regression test for rust-lang/rust#144033) - rust-lang/rust#159265 (bootstrap: skip intrinsic-test when rustfmt is unavailable) - rust-lang/rust#159269 (disable range-len-try-from.rs on s390x) - rust-lang/rust#159272 (slice: make swap delegate to swap_unchecked) - rust-lang/rust#159274 (bootstrap: Rename `std_crates_for_run_make` to `std_crates_for_make_run`) - rust-lang/rust#159275 (remove obsolete comment) - rust-lang/rust#159277 (Construct `tokens` for attrs made by `mk_attr_word` and other variants) - rust-lang/rust#159283 (Remove obsolete verbose flag from deref/ref suggestions) - rust-lang/rust#159290 (rustc-dev-guide subtree update)
View all comments
Fixes #143349
r? @WaffleLapkin
cc @lcnr