Skip to content

Struct as method ICE #20714

Closed
Closed
@andrewyli

Description

@andrewyli
struct G;
fn main() {
    let g = G();
}

results in

RUST_BACKTRACE=1 rustc derp.rs
derp.rs:3:13: 3:16 error: expected function, found `G`
derp.rs:3     let g = G();
                      ^~~
derp.rs:3:13: 3:14 error: internal compiler error: unexpected callee type G
derp.rs:3     let g = G();
                      ^
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:123

stack backtrace:
   1:     0x7f08db5c52d0 - sys::backtrace::write::h8532e701ef86014f4it
   2:     0x7f08db5eab00 - failure::on_fail::h7532e1f79d134d5dzvz
   3:     0x7f08db5501c0 - rt::unwind::begin_unwind_inner::h97b151606151d62deaz
   4:     0x7f08d63ffc60 - rt::unwind::begin_unwind::h15809447133099964284
   5:     0x7f08d63ffbf0 - diagnostic::SpanHandler::span_bug::he8142ababcc30c39DFF
   6:     0x7f08d956b230 - session::Session::span_bug::h57171ee4a68318521qq
   7:     0x7f08dabe36f0 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_expr::h9199988789662482206
   8:     0x7f08dabe3200 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_block::h5221501447364338274
   9:     0x7f08dabdab00 - check::upvar::AdjustBorrowKind<'a, 'tcx>::analyze_fn::h19f586a28eb33d19TUh
  10:     0x7f08dac46b40 - check::check_bare_fn::h592fda8aa741d710Qtj
  11:     0x7f08dac3e170 - check::check_item::h9827005a9cde6421CMj
  12:     0x7f08daddefe0 - check_crate::unboxed_closure.40162
  13:     0x7f08dadd9c30 - check_crate::h19fb6dea5733566ajsx
  14:     0x7f08dbb16640 - driver::phase_3_run_analysis_passes::h46b1604d9f9f5633Tva
  15:     0x7f08dbb04ae0 - driver::compile_input::h68b8602933aad8d7wba
  16:     0x7f08dbbcfeb0 - thunk::F.Invoke<A, R>::invoke::h18029802347644288836
  17:     0x7f08dbbcec60 - rt::unwind::try::try_fn::h6518866316425934196
  18:     0x7f08db651400 - rust_try_inner
  19:     0x7f08db6513f0 - rust_try
  20:     0x7f08dbbcefb0 - thunk::F.Invoke<A, R>::invoke::h15513809553472565307
  21:     0x7f08db5d6e40 - sys::thread::thread_start::h5ea7ba97235331d5a9v
  22:     0x7f08d5c23ea0 - start_thread
  23:     0x7f08db1f4999 - __clone
  24:                0x0 - <unknown>


Compilation exited abnormally with code 101 at Wed Jan  7 16:21:51

I think it should just result in the first error if fixed. Hopefully not duplicate.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions