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

Add where lint was set #13801

Merged
merged 4 commits into from Apr 25, 2024
Merged

Add where lint was set #13801

merged 4 commits into from Apr 25, 2024

Conversation

Muscraft
Copy link
Contributor

rustc and clippy both show why the lint was emitted and where the level was set the first time it was emitted for a package. We already showed why the list was being emitted but did not show where the lint level was set. This PR adds where the lint was set at.

@rustbot
Copy link
Collaborator

rustbot commented Apr 24, 2024

r? @weihanglo

rustbot has assigned @weihanglo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-manifest Area: Cargo.toml issues A-workspaces Area: workspaces S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 24, 2024
.expect("previously resolved")
.unwrap_or(&default),
);
let resolved_lints = original_toml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use of original_toml should be for exception cases in to_real_manifest

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, I must've forgotten to switch that when I was moving this to here

.edition_lint_opts
.filter(|(e, _)| edition >= *e)
.map(|(_, l)| l);
impl LevelTrait for Lint {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this trait have just been function parameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it could've; I switched it to being a function

@@ -803,7 +795,7 @@ impl InheritableFields {
}

/// Gets the field `workspace.lint`.
fn lints(&self) -> CargoResult<manifest::TomlLints> {
pub fn lints(&self) -> CargoResult<manifest::TomlLints> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imo this shouldn't be in InheritableFields anymore because we are no longer treating it like normal inheritance.

Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is still "Inheritable", it is just not inherited in the normal way. I could go either way on where it should be

@epage
Copy link
Contributor

epage commented Apr 24, 2024

CI failed on Tests macOS x86_64 stable

---- global_cache_tracker::max_download_size stdout ----
running `/Users/runner/work/cargo/cargo/target/debug/cargo clean gc -Zgc -v --max-download-size=30`
running `/Users/runner/work/cargo/cargo/target/debug/cargo clean gc -Zgc -v --max-download-size=29`
running `/Users/runner/work/cargo/cargo/target/debug/cargo clean gc -Zgc -v --max-download-size=24`
running `/Users/runner/work/cargo/cargo/target/debug/cargo clean gc -Zgc -v --max-download-size=20`
running `/Users/runner/work/cargo/cargo/target/debug/cargo clean gc -Zgc -v --max-download-size=1`
thread 'global_cache_tracker::max_download_size' panicked at tests/testsuite/global_cache_tracker.rs:1138:14:

test failed running `/Users/runner/work/cargo/cargo/target/debug/cargo clean gc -Zgc -v --max-download-size=1`
error: Expected lines did not match (ignoring order):
0   1         Removing /Users/runner/work/cargo/cargo/target/tmp/cit/t1583/home/.cargo/registry/src/example.com-a6c4a5adcb232b9a/d-1.0.0
1   4         Removing /Users/runner/work/cargo/cargo/target/tmp/cit/t1583/home/.cargo/registry/cache/example.com-a6c4a5adcb232b9a/d-1.0.0.crate
2   1         Removing /Users/runner/work/cargo/cargo/target/tmp/cit/t1583/home/.cargo/registry/src/example.com-a6c4a5adcb232b9a/c-1.0.0
3   3         Removing /Users/runner/work/cargo/cargo/target/tmp/cit/t1583/home/.cargo/registry/cache/example.com-a6c4a5adcb232b9a/c-1.0.0.crate
4   1         Removing /Users/runner/work/cargo/cargo/target/tmp/cit/t1583/home/.cargo/registry/src/example.com-a6c4a5adcb232b9a/a-1.0.0
5   2         Removing /Users/runner/work/cargo/cargo/target/tmp/cit/t1583/home/.cargo/registry/cache/example.com-a6c4a5adcb232b9a/a-1.0.0.crate
6   1         Removing /Users/runner/work/cargo/cargo/target/tmp/cit/t1583/home/.cargo/registry/src/example.com-a6c4a5adcb232b9a/b-1.0.0
7        -     Removed 7 files, 29B total
    7    +     Removed 8 files, 30B total
    8    +    Removing /Users/runner/work/cargo/cargo/target/tmp/cit/t1583/home/.cargo/registry/cache/example.com-a6c4a5adcb232b9a/b-1.0.0.crate

Same reason as #13798 though I thought that failed on Linux. A retry worked

@epage
Copy link
Contributor

epage commented Apr 25, 2024

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 25, 2024

📌 Commit dfc9bd2 has been approved by epage

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 Apr 25, 2024
@bors
Copy link
Collaborator

bors commented Apr 25, 2024

⌛ Testing commit dfc9bd2 with merge 8aaa727...

bors added a commit that referenced this pull request Apr 25, 2024
Add where lint was set

`rustc` and `clippy` both show why the lint was emitted and where the level was set the first time it was emitted for a package. We already showed why the list was being emitted but did not show where the lint level was set. This PR adds where the lint was set at.
@weihanglo
Copy link
Member

CI is stuck.

@bors r-

@bors bors added S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 25, 2024
@weihanglo
Copy link
Member

@bors r=epage

@bors
Copy link
Collaborator

bors commented Apr 25, 2024

📌 Commit dfc9bd2 has been approved by epage

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-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. labels Apr 25, 2024
bors added a commit that referenced this pull request Apr 25, 2024
Add where lint was set

`rustc` and `clippy` both show why the lint was emitted and where the level was set the first time it was emitted for a package. We already showed why the list was being emitted but did not show where the lint level was set. This PR adds where the lint was set at.
@bors
Copy link
Collaborator

bors commented Apr 25, 2024

⌛ Testing commit dfc9bd2 with merge 5f13038...

@bors
Copy link
Collaborator

bors commented Apr 25, 2024

💔 Test failed - checks-actions

@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 Apr 25, 2024
@epage
Copy link
Contributor

epage commented Apr 25, 2024

@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 Apr 25, 2024
@bors
Copy link
Collaborator

bors commented Apr 25, 2024

⌛ Testing commit dfc9bd2 with merge 93edfb9...

@bors
Copy link
Collaborator

bors commented Apr 25, 2024

☀️ Test successful - checks-actions
Approved by: epage
Pushing 93edfb9 to master...

@bors bors merged commit 93edfb9 into rust-lang:master Apr 25, 2024
21 checks passed
@Muscraft Muscraft deleted the add-lint-reason branch April 25, 2024 18:02
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 26, 2024
Update cargo

9 commits in c9392675917adc2edab269eea27c222b5359c637..b60a1555155111e962018007a6d0ef85207db463
2024-04-23 19:35:19 +0000 to 2024-04-26 16:37:29 +0000
- fix(toml): Remove underscore field support in 2024 (rust-lang/cargo#13804)
- fix: emit 1.77 syntax error only when msrv is incompatible (rust-lang/cargo#13808)
- docs(ref): Index differences between virtual / real manifests (rust-lang/cargo#13794)
- refactor(toml): extract dependency-to-source-id to function (rust-lang/cargo#13802)
- Add where lint was set (rust-lang/cargo#13801)
- fix(toml): Don't double-warn when underscore is used in workspace dep (rust-lang/cargo#13800)
- fix(toml): Be more forceful with underscore/dash redundancy (rust-lang/cargo#13798)
- Fix warning suppression for config.toml vs config compat symlinks (rust-lang/cargo#13793)
- Cleanup linting system (rust-lang/cargo#13797)

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 27, 2024
Update cargo

9 commits in c9392675917adc2edab269eea27c222b5359c637..b60a1555155111e962018007a6d0ef85207db463
2024-04-23 19:35:19 +0000 to 2024-04-26 16:37:29 +0000
- fix(toml): Remove underscore field support in 2024 (rust-lang/cargo#13804)
- fix: emit 1.77 syntax error only when msrv is incompatible (rust-lang/cargo#13808)
- docs(ref): Index differences between virtual / real manifests (rust-lang/cargo#13794)
- refactor(toml): extract dependency-to-source-id to function (rust-lang/cargo#13802)
- Add where lint was set (rust-lang/cargo#13801)
- fix(toml): Don't double-warn when underscore is used in workspace dep (rust-lang/cargo#13800)
- fix(toml): Be more forceful with underscore/dash redundancy (rust-lang/cargo#13798)
- Fix warning suppression for config.toml vs config compat symlinks (rust-lang/cargo#13793)
- Cleanup linting system (rust-lang/cargo#13797)

r? ghost
@rustbot rustbot added this to the 1.79.0 milestone Apr 27, 2024
bors added a commit that referenced this pull request May 3, 2024
fix(lints): Prevent inheritance from bring exposed for published packages

#13843 demonstrated a regression caused by #13801, where we started to keep `[lints]` and `[workspace.lints]` separate, and not truly resolve `[lints]`. This was a nice thing to have and made it easier to tell when a lint came from a workspace. The downside of doing so is the lints table would not get resolved when vendoring or publishing.

To fix this issue, I reverted the change for keeping `[lints]` and `[workspace.lints]` separate and modified how cargo's linting system figures out where a lint is coming from. Due to this change, we no longer specify that a lint was set by `[workspace.lints]`, only `[lints]`. It is true that a lint level is set by `[lints]` always, as it would've had to specify the lint outright or specify that it was inheriting it, seeing that, I do not think this is a regression in diagnostic quality. I still manage to keep the ability to render a lint's location in the workspace's manifest when running ` analyze_cargo_lints_table`, which I am pleased about.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-manifest Area: Cargo.toml issues A-workspaces Area: workspaces S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants