Repository navigation
debug assertion ice: bad spans: -Wunused-lifetimes #108248
Copy link
Copy link
Open
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️L-unused_lifetimesLint: unused_lifetimesLint: unused_lifetimesS-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.Status: This bug is tracked inside the repo by a `known-bug` test.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-debug-assertionsThis issue requires a build of rustc or tooling with debug-assertions in some wayThis issue requires a build of rustc or tooling with debug-assertions in some way
Description
Code
fn main() {
let _: extern fn<'a: 'static>();
}The problem is this first garbage span:
warning: lifetime parameter `'a` never used
--> recover-fn-ptr-with-generics.rs:2:22
|
2 | let _: extern fn<'a: 'static>();
| - ^^
| |
| help: elide the unused lifetime
|
= note: requested on the command line with `-W unused-lifetimes`
Meta
rustc --version --verbose:
eebdfb55fce148676c24555505aebf648123b2de
Error output
<output>
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️L-unused_lifetimesLint: unused_lifetimesLint: unused_lifetimesS-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.Status: This bug is tracked inside the repo by a `known-bug` test.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-debug-assertionsThis issue requires a build of rustc or tooling with debug-assertions in some wayThis issue requires a build of rustc or tooling with debug-assertions in some way
Activity
KittyBorgX commentedon Feb 20, 2023
@matthiaskrgr I think I can take this up.
Before I do, just some questions:
help: elide the unused lifetimepart:and there's no ICE for me.
rustc --version --verbosefor me:Edit : I'm on the latest nightly
clubby789 commentedon Feb 20, 2023
You need to build with debug assertions, and invoke with
-Wunused-lifetimes. I believe the bad span is created aroundrust/compiler/rustc_resolve/src/late.rs
Line 739 in e7eaed2
I tried modifying that span to instead contain the generics, which fixes this case but regresses a few other cases
layerkugou commentedon Feb 21, 2023
very good
Rollup merge of rust-lang#136072 - cyrgani:old-crash-tests, r=WaffleL…
Unrolled build for rust-lang#136072
cyrgani commentedon Jan 27, 2025
@rustbot label S-bug-has-test