Skip trivial cast lint for trait object upcasts#159061
Merged
rust-bors[bot] merged 1 commit intoJul 14, 2026
Merged
Conversation
Collaborator
|
r? @khyperia rustbot has assigned @khyperia. Use Why was this reviewer chosen?The reviewer was selected based on:
|
ce87ffa to
742e489
Compare
742e489 to
d7418a0
Compare
Contributor
|
apologies, I've fallen ill and probably won't get around to reviewing this for a while, so I'm rerolling r? compiler |
Contributor
|
Right, that makes sense, thanks! @bors r+ rollup |
Contributor
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Jul 14, 2026
…al-casts-dyn-any, r=folkertdev Skip trivial cast lint for trait object upcasts Fixes rust-lang#148219 In the case like `(other as &dyn Any).downcast_ref::<T>()`, removing the cast can change method lookup, so the cast is not always trivial, so skip lint on it.
rust-bors Bot
pushed a commit
that referenced
this pull request
Jul 14, 2026
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))
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Jul 14, 2026
…al-casts-dyn-any, r=folkertdev Skip trivial cast lint for trait object upcasts Fixes rust-lang#148219 In the case like `(other as &dyn Any).downcast_ref::<T>()`, removing the cast can change method lookup, so the cast is not always trivial, so skip lint on it.
rust-bors Bot
pushed a commit
that referenced
this pull request
Jul 14, 2026
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))
rust-bors Bot
pushed a commit
that referenced
this pull request
Jul 14, 2026
Rollup of 6 pull requests Successful merges: - #159039 (resolve: fix effective visibilities for items in ambiguous glob sets) - #158981 (Fix where-bound suggestion with legacy const generics) - #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))
rust-timer
added a commit
that referenced
this pull request
Jul 14, 2026
Rollup merge of #159061 - chenyukang:yukang-fix-148219-trivial-casts-dyn-any, r=folkertdev Skip trivial cast lint for trait object upcasts Fixes #148219 In the case like `(other as &dyn Any).downcast_ref::<T>()`, removing the cast can change method lookup, so the cast is not always trivial, so skip lint on it.
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 #148219
In the case like
(other as &dyn Any).downcast_ref::<T>(), removing the cast can change method lookup, so the cast is not always trivial, so skip lint on it.