Improve E0277 diagnostics for conditionally implemented traits#158494
Improve E0277 diagnostics for conditionally implemented traits#158494raushan728 wants to merge 2 commits into
Conversation
|
r? @mu001999 rustbot has assigned @mu001999. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
57f7526 to
893f9fc
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Could you try to add the label on unsatisfied bounds, as desired in the issue? I think we can achieve this with ObligationCtxt::new_with_diagnostics.
And for the logic here, perhaps you could check the implementation of impl_may_apply. Maybe the logic could even be shared between them.
@rustbot author
|
Reminder, once the PR becomes ready for a review, use |
893f9fc to
9f2d7b1
Compare
Thanks! I updated this to use @rustbot ready |
This comment has been minimized.
This comment has been minimized.
9f2d7b1 to
28e57e4
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
28e57e4 to
84d3112
Compare
84d3112 to
607962a
Compare
This comment has been minimized.
This comment has been minimized.
|
Thanks! @bors r+ |
Improve E0277 diagnostics for conditionally implemented traits Fixes rust-lang#158423. The diagnostic previously reported that a trait was "implemented" even when the matching impl could not apply because its where-clause requirements were not satisfied, which was misleading. This change: - reports that the trait is "conditionally implemented" when a matching impl is rejected due to unsatisfied where-clause requirements; - highlights the unsatisfied requirement in the impl and includes the corresponding predicate in the diagnostic; - preserves the existing diagnostic flow while making it clearer why the candidate impl was rejected.
…uwer Rollup of 22 pull requests Successful merges: - #155429 (Support `u128`/`i128` c-variadic arguments) - #158100 (Emit retags in codegen to support BorrowSanitizer (part 4)) - #158494 (Improve E0277 diagnostics for conditionally implemented traits) - #158606 (use ProjectionPredicate instead of AliasRelate) - #158627 (Simplify option-iterator flattening in the compiler) - #158658 (Update LLVM submodule) - #158665 (Revert "Remove redundant dyn-compatibility check.") - #158021 (Remove old MinGW workaround) - #158473 (Add `riscv32imfc-unknown-none-elf` bare-metal target) - #158549 (process::exec: using appropriate exit code on vxworks.) - #158585 (Improve diagnostic for too many super keywords) - #158637 (hir_ty_lowering: avoid self type lookup for inherent aliases) - #158651 (ptr doc: reduce use of unsafe block to where needed) - #158669 (Remove `src/tools/test-float-parse/Cargo.lock`) - #158674 (library: Polish transmute's `split_at_stdlib` example) - #158677 (Add extra splat tests) - #158680 (Avoid ICE for `NonZero<char>` in improper_ctypes) - #158681 (Remove unnecessary `Hash` derives from MIR types) - #158682 (Avoid delayed bug for disabled on_type_error arguments) - #158684 (Add missing generic test coverage for ```#[splat]```) - #158687 (Streamline `MacEager`) - #158688 (Cleanup attribute docs and add links to other mentioned attributes)
View all comments
Fixes #158423.
The diagnostic previously reported that a trait was "implemented" even when the matching impl could not apply because its where-clause requirements were not satisfied, which was misleading.
This change: