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 basic checks for well-formedness of fn/fn_mut lang items #86246

Merged
merged 2 commits into from
Sep 25, 2021

Conversation

FabianWolff
Copy link
Contributor

@FabianWolff FabianWolff commented Jun 12, 2021

This pull request fixes #83471. Lang items are never actually checked for well-formedness (#9307). This means that one can get an ICE quite easily, e.g. as follows:

#![feature(lang_items)]
#[lang = "fn"]
trait MyFn {
    const call: i32 = 42;
}

fn main() {
    (|| 42)();
}

or this:

#![feature(lang_items)]
#[lang = "fn"]
trait MyFn {
    fn call(i: i32, j: i32);
}

fn main() {
    (|| 42)();
}

Ideally, there should probably be a more comprehensive strategy for checking lang items for well-formedness, but for the time being, I have added some rudimentary well-formedness checks that prevent #83471 and similar issues.

@rust-highfive
Copy link
Collaborator

r? @matthewjasper

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 12, 2021
@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 Jul 5, 2021
@joelpalmer joelpalmer 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 Jul 20, 2021
@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 Aug 9, 2021
@bors
Copy link
Contributor

bors commented Aug 12, 2021

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

@inquisitivecrystal inquisitivecrystal added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 24, 2021
@pnkfelix pnkfelix assigned pnkfelix and unassigned matthewjasper Sep 9, 2021
@rust-log-analyzer

This comment has been minimized.

@wesleywiser
Copy link
Member

Hey @pnkfelix! This came up during the compiler team triage meeting. If you have a chance, could you please review or if you don't have time, we can re-roll to get another reviewer. Thanks!

compiler/rustc_typeck/src/check/wfcheck.rs Outdated Show resolved Hide resolved
compiler/rustc_typeck/src/check/wfcheck.rs Outdated Show resolved Hide resolved
compiler/rustc_typeck/src/check/wfcheck.rs Show resolved Hide resolved
@estebank
Copy link
Contributor

@bors try @rust-timer queue

@FabianWolff can you address the change for a more targeted message and rebase on top of a recent master?

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 23, 2021
@bors
Copy link
Contributor

bors commented Sep 23, 2021

⌛ Trying commit 28585bf0f5b25e84500627bb38edfcaaebee3efd with merge 3777fcbdcee493db60907aa73da15ddf58397697...

@bors
Copy link
Contributor

bors commented Sep 23, 2021

☀️ Try build successful - checks-actions
Build commit: 3777fcbdcee493db60907aa73da15ddf58397697 (3777fcbdcee493db60907aa73da15ddf58397697)

@rust-timer
Copy link
Collaborator

Queued 3777fcbdcee493db60907aa73da15ddf58397697 with parent 15d9ba0, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3777fcbdcee493db60907aa73da15ddf58397697): comparison url.

Summary: This benchmark run did not return any relevant changes.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR led to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 23, 2021
Copy link
Contributor

@estebank estebank left a comment

Choose a reason for hiding this comment

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

Left one last nitpick, but after that this is r=me.

@estebank
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Sep 24, 2021

📌 Commit cb6c139 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 Sep 24, 2021
@bors
Copy link
Contributor

bors commented Sep 24, 2021

⌛ Testing commit cb6c139 with merge 043972f...

@bors
Copy link
Contributor

bors commented Sep 25, 2021

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 25, 2021
@bors bors merged commit 043972f into rust-lang:master Sep 25, 2021
@rustbot rustbot added this to the 1.57.0 milestone Sep 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE: compiler/rustc_typeck/src/check/callee.rs:236:29: input to call/call_mut is not a ref?