mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-05 19:57:02 +00:00

Skip suggest impl or dyn when poly trait is not a real trait
Fixes #139174
When `poly_trait_ref` is not a real trait, we should stop suggesting `impl` and `dyn` to avoid false positives. 3 cases were added to the ui test.
0b45675cfc/compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs (L88-L93)
In the first commit, I submitted the test and passed it. In the second commit, I modified the code and we can see the changes in the test.
r? compiler
For high-level intro to how type checking works in rustc, see the type checking chapter of the rustc dev guide.