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 allow-by-default lint on implicit ABI in extern function pointers and items #76219

Merged
merged 4 commits into from
Jan 13, 2021

Conversation

Mark-Simulacrum
Copy link
Member

@Mark-Simulacrum Mark-Simulacrum commented Sep 1, 2020

This adds a new lint, missing_abi, which lints on omitted ABIs on extern blocks, function declarations, and function pointers.

It is currently not emitting the best possible diagnostics -- we need to track the span of "extern" at least or do some heuristic searching based on the available spans -- but seems good enough for an initial pass than can be expanded in future PRs.

This is a pretty large PR, but mostly due to updating a large number of tests to include ABIs; I can split that into a separate PR if it would be helpful, but test updates are already in dedicated commits.

@Mark-Simulacrum Mark-Simulacrum added I-nominated T-lang Relevant to the language team, which will review and decide on the PR/issue. labels Sep 1, 2020
@Mark-Simulacrum
Copy link
Member Author

Nominating for discussion at the next lang team meeting. I suspect we'll want a crater run as well, but I would like CI to pass before kicking off a try run -- I suspect I may have missed some tests and that may need behavioral modifications.

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. relnotes Marks issues that should be documented in the release notes of the next release. labels Sep 1, 2020
@Mark-Simulacrum Mark-Simulacrum force-pushed the extern-require-abi branch 4 times, most recently from 857c768 to 8f26f25 Compare September 2, 2020 12:28
@Mark-Simulacrum Mark-Simulacrum removed the relnotes Marks issues that should be documented in the release notes of the next release. label Sep 2, 2020
@Mark-Simulacrum Mark-Simulacrum force-pushed the extern-require-abi branch 5 times, most recently from e4eba6b to f0c6496 Compare September 2, 2020 14:04
@Mark-Simulacrum
Copy link
Member Author

@bors try

@bors
Copy link
Contributor

bors commented Sep 2, 2020

⌛ Trying commit f0c6496ddbd277ddbb7ae5f0e687e351441786b2 with merge 05c8870159e4f328578a970e125aa76d24f03b56...

@bors
Copy link
Contributor

bors commented Sep 2, 2020

☀️ Try build successful - checks-actions, checks-azure
Build commit: 05c8870159e4f328578a970e125aa76d24f03b56 (05c8870159e4f328578a970e125aa76d24f03b56)

@Mark-Simulacrum
Copy link
Member Author

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-76219 created and queued.
🤖 Automatically detected try build 05c8870159e4f328578a970e125aa76d24f03b56
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 2, 2020
@craterbot
Copy link
Collaborator

🚧 Experiment pr-76219 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🚨 Experiment pr-76219 has encountered an error: some threads returned an error
🛠️ If the error is fixed use the retry command.

🆘 Can someone from the infra team check in on this? @rust-lang/infra
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@Mark-Simulacrum
Copy link
Member Author

@craterbot retry

@craterbot
Copy link
Collaborator

🛠️ Experiment pr-76219 queued again.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🚧 Experiment pr-76219 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🎉 Experiment pr-76219 is completed!
📊 695 regressed and 1 fixed (120140 total)
📰 Open the full report.

⚠️ If you notice any spurious failure please add them to the blacklist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@crlf0710 crlf0710 added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 11, 2020
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 11, 2021
@Dylan-DPC-zz
Copy link

@Mark-Simulacrum you can rebase and resolve conflicts again we can push this forward

@estebank
Copy link
Contributor

estebank commented Jan 13, 2021

I got confused first by the update of the tests because it made it seem like this was a deny-by-default.

I don't see any reason not to merge this. r=me after rebase with the lint as allow-by-default.

@@ -297,14 +297,16 @@ impl<'hir> LoweringContext<'_, 'hir> {
);
let sig = hir::FnSig {
decl,
header: this.lower_fn_header(header),
header: this.lower_fn_header(header, span, id),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you might want to use fn_sig_span instead here.

@bors
Copy link
Contributor

bors commented Jan 13, 2021

☔ The latest upstream changes (presumably #80960) made this pull request unmergeable. Please resolve the merge conflicts.

@Mark-Simulacrum
Copy link
Member Author

@bors r=estebank rollup=iffy p=1 (prone to merge conflicts)

@bors
Copy link
Contributor

bors commented Jan 13, 2021

📌 Commit 4614671 has been approved by estebank

@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 13, 2021
@bors
Copy link
Contributor

bors commented Jan 13, 2021

⌛ Testing commit 4614671 with merge fd2df74...

@bors
Copy link
Contributor

bors commented Jan 13, 2021

☀️ Test successful - checks-actions
Approved by: estebank
Pushing fd2df74 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-FFI Area: Foreign function interface (FFI) A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants