Skip to content

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

Closed

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.

Activity

  1. added
    C-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.
    on Feb 15, 2021
  2. added
    A-resolveArea: Name/path resolution done by `rustc_resolve` specifically
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Feb 15, 2021
  3. hameerabbasi commented on Feb 15, 2021

    @hameerabbasi
    Contributor

    Bisected:

    ********************************************************************************
    Regression in nightly-2020-06-05
    ********************************************************************************
    
    fetching https://static.rust-lang.org/dist/2020-06-04/channel-rust-nightly-git-commit-hash.txt
    nightly manifest 2020-06-04: 40 B / 40 B [===============] 100.00 % 720.31 KB/s converted 2020-06-04 to 56daaf669ebc3d5083db5cded719f780dc31104e
    fetching https://static.rust-lang.org/dist/2020-06-05/channel-rust-nightly-git-commit-hash.txt
    nightly manifest 2020-06-05: 40 B / 40 B [===============] 100.00 % 778.59 KB/s converted 2020-06-05 to 47c3158c3d797f75f0f7b2b2a977179668919dab
    looking for regression commit between 2020-06-04 and 2020-06-05
    opening existing repository at "rust.git"
    refreshing repository
    fetching (via local git) commits from 56daaf669ebc3d5083db5cded719f780dc31104e to 47c3158c3d797f75f0f7b2b2a977179668919dab
    opening existing repository at "rust.git"
    refreshing repository
    looking up first commit
    looking up second commit
    checking that commits are by bors and thus have ci artifacts...
    finding bors merge commits
    found 6 bors merge commits in the specified range
      commit[0] 2020-06-03UTC: Auto merge of #72948 - Dylan-DPC:rollup-fazhw00, r=Dylan-DPC
      commit[1] 2020-06-03UTC: Auto merge of #72754 - lcnr:predicate-fold, r=nikomatsakis
      commit[2] 2020-06-04UTC: Auto merge of #72618 - Aaron1011:feature/early-sourcemap, r=petrochenkov
      commit[3] 2020-06-04UTC: Auto merge of #72975 - Dylan-DPC:rollup-6zvco5x, r=Dylan-DPC
      commit[4] 2020-06-04UTC: Auto merge of #72882 - marmeladema:save-analysis-hir-tree, r=Xanewok
      commit[5] 2020-06-04UTC: Auto merge of #72995 - Dylan-DPC:rollup-7gsyb8x, r=Dylan-DPC
    ERROR: no commits between 56daaf669ebc3d5083db5cded719f780dc31104e and 47c3158c3d797f75f0f7b2b2a977179668919dab within last 167 days
    
  4. jyn514 commented on Feb 16, 2021

    @jyn514
    Member

    Relevant code:

    let item_str = path.last().unwrap().ident;

    In case it helps, the merges in nightly-2020-06-05 were #72948, #72754, #72618, #72975, #72882, and #72995.

    Playground: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=0ccab6c6b67a5c848dffdd6a369f2438

  5. camelid commented on Feb 16, 2021

    @camelid
    Member

    Error from just before the regression was introduced (run with nightly-2020-06-01):

    error[E0433]: failed to resolve: there are too many leading `super` keywords
     --> <anon>:2:5
      |
    2 |     super();
      |     ^^^^^ there are too many leading `super` keywords
    
    error: aborting due to previous error
    
    For more information about this error, try `rustc --explain E0433`.
    
  6. camelid commented on Feb 16, 2021

    @camelid
    Member

    Assigning P-medium and removing I-prioritize as discussed in the prioritization working group.

  7. added and removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Feb 16, 2021
  8. added a commit that references this issue on Feb 16, 2021
  9. osa1 commented on Feb 18, 2021

    @osa1
    Contributor

    @rustbot claim

  10. added a commit that references this issue on Feb 19, 2021
    cc01bbe
  11. added a commit that references this issue on Mar 10, 2021
    c10902e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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