Skip to content

ICE instead of syntax error while calling super() #82156

Closed
@plazmoid

Description

@plazmoid

I tried to call default trait implementation from overriden method. Googling was not so useful as wanted so I started playing with "super" keyword and found this bug.

Code

fn main() {
    super();
}

Meta

Bug appears both on stable and nightly

rustc --version --verbose:

rustc 1.50.0 (cb75ad5db 2021-02-10)
binary: rustc
commit-hash: cb75ad5db02783e8b0222fee363c5f63f7e2cf5b
commit-date: 2021-02-10
host: x86_64-unknown-linux-gnu
release: 1.50.0

rustc 1.52.0-nightly (e9920ef77 2021-02-11)
binary: rustc
commit-hash: e9920ef7749d11fc71cc32ca4ba055bcfeaab945
commit-date: 2021-02-11
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 11.0.1

Error output

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_resolve/src/late/diagnostics.rs:138:36
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.50.0 (cb75ad5db 2021-02-10) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
Backtrace

stack backtrace:
   0: rust_begin_unwind
             at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:50:5
   3: rustc_resolve::late::diagnostics::<impl rustc_resolve::late::LateResolutionVisitor>::smart_resolve_report_errors
   4: rustc_resolve::late::LateResolutionVisitor::smart_resolve_path_fragment
   5: rustc_resolve::late::LateResolutionVisitor::resolve_expr
   6: rustc_resolve::late::LateResolutionVisitor::resolve_expr
   7: <rustc_resolve::late::LateResolutionVisitor as rustc_ast::visit::Visitor>::visit_block
   8: <rustc_resolve::late::LateResolutionVisitor as rustc_ast::visit::Visitor>::visit_fn
   9: rustc_ast::visit::walk_item
  10: rustc_resolve::late::LateResolutionVisitor::resolve_item
  11: rustc_resolve::Resolver::resolve_crate
  12: rustc_interface::passes::configure_and_expand_inner
  13: rustc_interface::passes::configure_and_expand::{{closure}}
  14: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
  15: rustc_interface::passes::configure_and_expand
  16: rustc_interface::queries::Queries::expansion
  17: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  18: rustc_span::with_source_map
  19: rustc_interface::interface::create_compiler_and_run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Metadata

Metadata

Assignees

Labels

A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions