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

Only return DefIds to Fn-like definitions in clippy_utils::fn_def_id #8896

Merged
merged 1 commit into from
May 26, 2022

Conversation

Alexendoo
Copy link
Member

Fixes #8850

in returns.rs tcx.fn_sig is called on the result of fn_def_id, which panics if the def is a const/static/etc rather than a functions definition

if let Some(def_id) = fn_def_id(self.cx, expr) {
self.borrows = self
.cx
.tcx
.fn_sig(def_id)
.output()
.skip_binder()
.walk()
.any(|arg| matches!(arg.unpack(), GenericArgKind::Lifetime(_)));
}

changelog: Fix ICE due to callable static/consts

@rust-highfive
Copy link

r? @llogiq

(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 May 26, 2022
@Alexendoo Alexendoo mentioned this pull request May 26, 2022
@llogiq
Copy link
Contributor

llogiq commented May 26, 2022

Thank you!

@bors r+

@bors
Copy link
Contributor

bors commented May 26, 2022

📌 Commit 17f7047 has been approved by llogiq

@bors
Copy link
Contributor

bors commented May 26, 2022

⌛ Testing commit 17f7047 with merge 6553b98...

@bors
Copy link
Contributor

bors commented May 26, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: llogiq
Pushing 6553b98 to master...

@bors bors merged commit 6553b98 into rust-lang:master May 26, 2022
@Alexendoo Alexendoo deleted the fn_sig_ice branch May 26, 2022 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

clippy bug report
4 participants