Improve cross-namespace name diagnostics#159307
Conversation
|
Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @petrochenkov (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
Why was this reviewer chosen?The reviewer was selected based on:
|
4e36c58 to
92d8373
Compare
|
I don't think we should do this - #86290 (comment). |
|
@petrochenkov Makes sense, the resolver fallback should stay as-is. Looking at where the error is built, changing make_base_error unconditionally would also affect wrong-kind errors from the same namespace. Would it make sense to limit the wording change to expression paths whose resolved item comes from another namespace, and apply it consistently to attributes, macros, and enums? For example: “expected value, but a built-in attribute with the same name exists”. |
Yes, I think the wording for the same-namespace case is already good, and the wording for the cross-namespace case is better changed consistently for all the namespace combinations. It may also be better to discuss the details on the issue thread #86290. |
|
This PR modifies |
|
@rustbot review |
This comment has been minimized.
This comment has been minimized.
|
Some tests are also failing. |
|
Reminder, once the PR becomes ready for a review, use |
|
@rustbot ready |
This comment has been minimized.
This comment has been minimized.
|
cc @rust-lang/miri |
|
|
r=me after squashing commits. |
61730f7 to
30bc6d2
Compare
|
@rustbot ready |
|
@bors r+ |
Rollup of 14 pull requests Successful merges: - #159307 (Improve cross-namespace name diagnostics) - #159543 (Remove extra semicolons in parsing item lists) - #157270 (ergonomic_clones_dotuse_capture_by_ref: Capture upvar by ref for `.use` in non-move closures) - #158496 (Move `check_rustc_pub_transparent` into the attribute parser) - #158547 (Move `std::io::buffered` to `alloc::io`) - #158808 (Filter host libstdc++ ABI flag in rustc_llvm cross builds) - #159362 (Add regression test for #120328) - #159472 (Support creating float constants in rustc_public mir) - #159505 (make rustdoc::bare_urls strip trailing periods from url) - #159568 (Suggest close compiler options) - #159578 (Extract coroutine closure helper functions) - #159601 (Make `TokenTreeCursor` private) - #159613 (Set the rustc lib path for unstable-book-gen) - #159616 (Clarify the comment about stage1/stage2 discrepancy in input-stats test)
Rollup merge of #159307 - TorinAsakura:fix/builtin-attribute-value-diagnostics, r=petrochenkov Improve cross-namespace name diagnostics Close #86290 Cross-namespace name matches now use the ordinary missing-name diagnostic while preserving its error code and suggestions. The diagnostic adds a note identifying the item found in another namespace, while same-namespace wrong-kind diagnostics remain unchanged. The UI expectations cover cross-namespace combinations across the resolver suite, including preservation of existing suggestions.
Rollup of 14 pull requests Successful merges: - rust-lang/rust#159307 (Improve cross-namespace name diagnostics) - rust-lang/rust#159543 (Remove extra semicolons in parsing item lists) - rust-lang/rust#157270 (ergonomic_clones_dotuse_capture_by_ref: Capture upvar by ref for `.use` in non-move closures) - rust-lang/rust#158496 (Move `check_rustc_pub_transparent` into the attribute parser) - rust-lang/rust#158547 (Move `std::io::buffered` to `alloc::io`) - rust-lang/rust#158808 (Filter host libstdc++ ABI flag in rustc_llvm cross builds) - rust-lang/rust#159362 (Add regression test for rust-lang/rust#120328) - rust-lang/rust#159472 (Support creating float constants in rustc_public mir) - rust-lang/rust#159505 (make rustdoc::bare_urls strip trailing periods from url) - rust-lang/rust#159568 (Suggest close compiler options) - rust-lang/rust#159578 (Extract coroutine closure helper functions) - rust-lang/rust#159601 (Make `TokenTreeCursor` private) - rust-lang/rust#159613 (Set the rustc lib path for unstable-book-gen) - rust-lang/rust#159616 (Clarify the comment about stage1/stage2 discrepancy in input-stats test)
Close #86290
Cross-namespace name matches now use the ordinary missing-name diagnostic while preserving its error code and suggestions. The diagnostic adds a note identifying the item found in another namespace, while same-namespace wrong-kind diagnostics remain unchanged.
The UI expectations cover cross-namespace combinations across the resolver suite, including preservation of existing suggestions.