Skip to content

OOM while printing query stack during panic after ICE #112522

Open

Description

Code

You need debug assertions to trigger the original ice, I think

#![warn(unused_lifetimes)]

fn november<'a, 'b>(f: &fn<'a>(x: &'a i32) -> R) -> &'a str {
    s
}

fn main() {}

Meta

rustc --version --verbose:

788c98df5995c9fe360ba9ba5efb103ee69d05c4

Error output

error: function pointer types may not have generic parameters
 --> 05DD2C37BBA733B3F6B0EB64115884B7807B8E04CE5AC7C775132DBCBC88E72F.rs:3:27
  |
3 | fn november<'a, 'b>(f: &fn<'a>(x: &'a i32) -> R) -> &'a str {
  |                           ^^^^
  |
help: consider moving the lifetime parameter to a `for` parameter list
  |
3 - fn november<'a, 'b>(f: &fn<'a>(x: &'a i32) -> R) -> &'a str {
3 + fn november<'a, 'b>(f: &for<'a> fn(x: &'a i32) -> R) -> &'a str {
  |

error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope
 --> 05DD2C37BBA733B3F6B0EB64115884B7807B8E04CE5AC7C775132DBCBC88E72F.rs:3:28
  |
3 | fn november<'a, 'b>(f: &fn<'a>(x: &'a i32) -> R) -> &'a str {
  |             --             ^^ lifetime `'a` already in scope
  |             |
  |             first declared here

error[E0412]: cannot find type `R` in this scope
 --> 05DD2C37BBA733B3F6B0EB64115884B7807B8E04CE5AC7C775132DBCBC88E72F.rs:3:47
  |
3 | fn november<'a, 'b>(f: &fn<'a>(x: &'a i32) -> R) -> &'a str {
  |                                               ^ not found in this scope
  |
help: you might be missing a type parameter
  |
3 | fn november<'a, 'b, R>(f: &fn<'a>(x: &'a i32) -> R) -> &'a str {
  |                   +++

error[E0425]: cannot find value `s` in this scope
 --> 05DD2C37BBA733B3F6B0EB64115884B7807B8E04CE5AC7C775132DBCBC88E72F.rs:4:5
  |
4 |     s
  |     ^ help: a local variable with a similar name exists: `f`

warning: lifetime parameter `'b` never used
 --> 05DD2C37BBA733B3F6B0EB64115884B7807B8E04CE5AC7C775132DBCBC88E72F.rs:3:17
  |
3 | fn november<'a, 'b>(f: &fn<'a>(x: &'a i32) -> R) -> &'a str {
  |               --^^
  |               |
  |               help: elide the unused lifetime
  |
note: the lint level is defined here
 --> 05DD2C37BBA733B3F6B0EB64115884B7807B8E04CE5AC7C775132DBCBC88E72F.rs:1:9
  |
1 | #![warn(unused_lifetimes)]
  |         ^^^^^^^^^^^^^^^^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️I-compilememIssue: Problems and improvements with respect to memory usage during compilation.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.T-compilerRelevant 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 way

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions