Skip to content

Compiler Unexpectedly Panicked, call function with wrong number of arguments #47706

Closed
@adrian-budau

Description

@adrian-budau

First of all, this only happens on nightly

rustc --version --verbose
binary: rustc
commit-hash: 97520ccb101609af63f29919bb0a39115269c89e
commit-date: 2018-01-21
host: x86_64-unknown-linux-gnu
release: 1.25.0-nightly
LLVM version: 4.0

I tried to make the code as simple as possible, so it might look like something no sane person would write

pub struct Foo {
    foo: Option<i32>,
}

impl Foo {
    pub fn new(foo: Option<i32>, _: ()) -> Foo {
        Foo { foo }
    }

    pub fn map(self) -> Option<Foo> {
        self.foo.map(Foo::new)
    }
}

This is what i get as output

thread 'rustc' panicked at 'non-FnLike node found: NodeImplItem(ImplItem { id: NodeId(14), name: new, hir_id: HirId { owner: DefIndex(0:6), local_id: ItemLocalId(0) }, vis: Public, defaultness: Final, attrs: [], generics: Generics { params: [], where_clause: WhereClause { id: NodeId(15), predicates: [] }, span: src/lib.rs:1:1: 1:1 }, node: Method(MethodSig { unsafety: Normal, constness: NotConst, abi: Rust, decl: FnDecl { inputs: [type(Option<i32>), type(())], output: Return(type(Foo)), variadic: false, has_implicit_self: false } }, BodyId { node_id: NodeId(41) }), span: src/run_info.rs:6:5: 8:6 })', librustc/traits/error_reporting.rs:837:13
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions