Skip to content

debug ice if we pass superfluous args after panic to fn: no errors reported for args #112437

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

#![feature(never_type)]
fn f(a: !) {}

fn main() {
    f(panic!(), 1);
}

Meta

rustc --version --verbose:

rustc 1.72.0-nightly (a97c36dd2 2023-06-07)
binary: rustc
commit-hash: a97c36dd2e6f711949fc9b790476e93bd9e6d1f4
commit-date: 2023-06-07
host: x86_64-unknown-linux-gnu
release: 1.72.0-nightly
LLVM version: 16.0.5

Error output

warning: unreachable expression
 --> g.rs:5:17
  |
5 |     f(panic!(), 1);
  |       --------  ^ unreachable expression
  |       |
  |       any code following this expression is unreachable
  |
  = note: `#[warn(unreachable_code)]` on by default

error[E0061]: this function takes 1 argument but 2 arguments were supplied
 --> g.rs:5:5
  |
5 |     f(panic!(), 1);
  |     ^         - - unexpected argument of type `{integer}`
  |               |
  |               help: remove the extra argument
  |
note: function defined here
 --> g.rs:2:4
  |
2 | fn f(a: !) {}
  |    ^ ----

error: aborting due to previous error; 1 warning emitted
Backtrace

too long

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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