Skip to content

Unused parentheses in parameters causes internal compiler error #2886

Open
@0xn4utilus

Description

@0xn4utilus

The unused parentheses in parameters causes internal compiler error however it is perfectly fine in the body.
rustc provides a nice warning and compiles the code.

Code

https://godbolt.org/z/xM4Mnvohr

// error
fn increment(x: i32) -> i32{
    ((x+1))
}

fn increment1((x): (i32)) -> (i32){
    ((x+1))
}

fn increment2(x: i32) -> (i32){
    ((x+1))
}

// correct
fn increment3(x: i32) -> i32{
    ((x+1))
}
Backtrace

crab1: internal compiler error: in resolve_path_to_trait, at rust/typecheck/rust-hir-trait-resolve.cc:128
0x236776c internal_error(char const*, ...)
  ???:0
0x9fc178 fancy_abort(char const*, int, char const*)
  ???:0
0xcfb1b7 Rust::Resolver::TraitResolver::Resolve(Rust::HIR::TypePath&)
  ???:0
0xcf4c17 Rust::Resolver::TypeCheckBase::get_predicate_from_bound(Rust::HIR::TypePath&, Rust::HIR::Type*, Rust::BoundPolarity)
  ???:0
0xd0eda4 Rust::Resolver::TypeCheckType::visit(Rust::HIR::TraitObjectType&)
  ???:0
0xd0b675 Rust::Resolver::TypeCheckType::Resolve(Rust::HIR::Type*)
  ???:0
0xd07352 Rust::Resolver::TypeCheckItem::visit(Rust::HIR::Function&)
  ???:0
0xd00b90 Rust::Resolver::TypeCheckItem::Resolve(Rust::HIR::Item&)
  ???:0
0xcc16bb Rust::Resolver::TypeResolution::Resolve(Rust::HIR::Crate&)
  ???:0
0xb37894 Rust::Session::compile_crate(char const*)
  ???:0
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions