Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress unhelpful diagnostics for unresolved top level attributes #118533

Merged
merged 1 commit into from
Jan 30, 2024

Conversation

chenyukang
Copy link
Member

@chenyukang chenyukang commented Dec 2, 2023

Fixes #118455, unresolved top level attribute error didn't imported prelude and already have emitted an error, report builtin macro and attributes error by the way, so check_invalid_crate_level_attr in can ignore them.

Also fixes #89566, fixes #67107.

r? @petrochenkov

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 2, 2023
@petrochenkov
Copy link
Contributor

(I should get to this on new year holidays.)

@bors

This comment was marked as resolved.

@petrochenkov
Copy link
Contributor

Both this PR and #118511 are hacks, but this one is better.

compiler/rustc_passes/src/check_attr.rs Outdated Show resolved Hide resolved
compiler/rustc_passes/src/check_attr.rs Outdated Show resolved Hide resolved
compiler/rustc_resolve/src/lib.rs Outdated Show resolved Hide resolved
compiler/rustc_resolve/src/macros.rs Outdated Show resolved Hide resolved
compiler/rustc_resolve/src/macros.rs Outdated Show resolved Hide resolved
compiler/rustc_resolve/src/macros.rs Outdated Show resolved Hide resolved
compiler/rustc_resolve/src/macros.rs Outdated Show resolved Hide resolved
compiler/rustc_resolve/src/macros.rs Outdated Show resolved Hide resolved
@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 17, 2024
@chenyukang chenyukang force-pushed the yukang-fix-118455 branch 2 times, most recently from c4250ac to ff90b09 Compare January 27, 2024 09:20
@chenyukang
Copy link
Member Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 27, 2024
compiler/rustc_resolve/src/macros.rs Outdated Show resolved Hide resolved
compiler/rustc_resolve/src/macros.rs Outdated Show resolved Hide resolved
compiler/rustc_resolve/src/macros.rs Outdated Show resolved Hide resolved
compiler/rustc_resolve/src/macros.rs Outdated Show resolved Hide resolved
compiler/rustc_resolve/src/macros.rs Outdated Show resolved Hide resolved
compiler/rustc_resolve/src/macros.rs Outdated Show resolved Hide resolved
@petrochenkov
Copy link
Contributor

Could we actually land the CannotDetermineMacroResolution deduplication change (#118533 (comment)) before this PR?
It seems like an unambiguous improvement, but the crate-level attribute logic here is more questionable.
@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 27, 2024
@chenyukang chenyukang force-pushed the yukang-fix-118455 branch 2 times, most recently from 7de5c65 to c6e936d Compare January 27, 2024 13:37
@chenyukang
Copy link
Member Author

@rustbot ready

How about this version, seems a small change and suppresses a lot of unnecessary messages.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 27, 2024
compiler/rustc_errors/src/lib.rs Outdated Show resolved Hide resolved
compiler/rustc_resolve/src/macros.rs Outdated Show resolved Hide resolved
@petrochenkov
Copy link
Contributor

r=me after addressing #118533 (comment) and remaining cleanup (preferably including auto-inserted imports).
@rustbot author

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 27, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 28, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#116677 (References refer to allocated objects)
 - rust-lang#118533 (Suppress unhelpful diagnostics for unresolved top level attributes)
 - rust-lang#119991 (Reject infinitely-sized reads from io::Repeat)
 - rust-lang#120232 (Add support for custom JSON targets when using build-std.)
 - rust-lang#120358 (Bump Fuchsia, build tests, and use 8 core bots)
 - rust-lang#120424 (raw pointer metadata API: data address -> data pointer)
 - rust-lang#120434 (Revert outdated version of "Add the wasm32-wasi-preview2 target")
 - rust-lang#120443 (Fixes footnote handling in rustdoc)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors

This comment was marked as resolved.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 29, 2024
@chenyukang
Copy link
Member Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 29, 2024
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jan 29, 2024

📌 Commit 492df34 has been approved by petrochenkov

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 29, 2024
@bors
Copy link
Contributor

bors commented Jan 30, 2024

⌛ Testing commit 492df34 with merge a369e7c...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 30, 2024
…ochenkov

Suppress unhelpful diagnostics for unresolved top level attributes

Fixes rust-lang#118455, unresolved top level attribute error didn't imported prelude and already have emitted an error, report builtin macro and attributes error by the way, so `check_invalid_crate_level_attr` in can ignore them.

Also fixes rust-lang#89566, fixes rust-lang#67107.

r? `@petrochenkov`
@bors
Copy link
Contributor

bors commented Jan 30, 2024

💥 Test timed out

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 30, 2024
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@petrochenkov
Copy link
Contributor

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 30, 2024
@chenyukang
Copy link
Member Author

@bors retry

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 30, 2024
…llaumeGomez

Rollup of 11 pull requests

Successful merges:

 - rust-lang#117906 (Improve display of crate name when hovered)
 - rust-lang#118533 (Suppress unhelpful diagnostics for unresolved top level attributes)
 - rust-lang#120293 (Deduplicate more sized errors on call exprs)
 - rust-lang#120295 (Remove `raw_os_nonzero` feature.)
 - rust-lang#120310 (adapt test for v0 symbol mangling)
 - rust-lang#120342 (Remove various `has_errors` or `err_count` uses)
 - rust-lang#120434 (Revert outdated version of "Add the wasm32-wasi-preview2 target")
 - rust-lang#120445 (Fix some `Arc` allocator leaks)
 - rust-lang#120475 (Improve error message when `cargo build` is used to build the compiler)
 - rust-lang#120476 (Remove some unnecessary check logic for lang items in HIR typeck)
 - rust-lang#120485 (add missing potential_query_instability for keys and values in hashmap)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit ee2e9e1 into rust-lang:master Jan 30, 2024
11 of 12 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 30, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 30, 2024
Rollup merge of rust-lang#118533 - chenyukang:yukang-fix-118455, r=petrochenkov

Suppress unhelpful diagnostics for unresolved top level attributes

Fixes rust-lang#118455, unresolved top level attribute error didn't imported prelude and already have emitted an error, report builtin macro and attributes error by the way, so `check_invalid_crate_level_attr` in can ignore them.

Also fixes rust-lang#89566, fixes rust-lang#67107.

r? `@petrochenkov`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
5 participants