Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: panicked at 'expected statement', compiler/rustc_expand/src/base.rs:201:18 #83469

Closed
chengniansun opened this issue Mar 25, 2021 · 1 comment · Fixed by #83486
Closed
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@chengniansun
Copy link

Code

fn outer() {
    #[global_allocator]
    fn inner() {}
}

Meta

rustc --version --verbose:

rustc 1.53.0-nightly (07e0e2ec2 2021-03-24)
binary: rustc
commit-hash: 07e0e2ec268c140e607e1ac7f49f145612d0f597
commit-date: 2021-03-24
host: x86_64-unknown-linux-gnu
release: 1.53.0-nightly
LLVM version: 12.0.0

Error output

error: allocators must be statics
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:5
  |
3 |     fn inner() {}
  |     ^^^^^^^^^^^^^

thread 'rustc' panicked at 'expected statement', compiler/rustc_expand/src/base.rs:201:18
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.53.0-nightly (07e0e2ec2 2021-03-24) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to previous error
Backtrace

error: allocators must be statics
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:5
  |
3 |     fn inner() {}
  |     ^^^^^^^^^^^^^

thread 'rustc' panicked at 'expected statement', compiler/rustc_expand/src/base.rs:201:18
stack backtrace:
   0: std::panicking::begin_panic
   1: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
   2: rustc_expand::expand::AstFragmentKind::expect_from_annotatables
   3: rustc_expand::expand::MacroExpander::fully_expand_fragment
   4: rustc_expand::expand::MacroExpander::expand_crate
   5: rustc_session::utils::<impl rustc_session::session::Session>::time
   6: rustc_interface::passes::configure_and_expand_inner
   7: rustc_interface::passes::configure_and_expand::{{closure}}
   8: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
   9: rustc_interface::passes::configure_and_expand
  10: rustc_interface::queries::Queries::expansion
  11: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  12: rustc_span::with_source_map
  13: rustc_interface::interface::create_compiler_and_run
  14: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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.53.0-nightly (07e0e2ec2 2021-03-24) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to previous error

@chengniansun chengniansun added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 25, 2021
@petrochenkov
Copy link
Contributor

@Aaron1011
Do you have time to look at this?
If not, then I'll try to fix it this weekend - it's likely a regression requiring a backport.

@Aaron1011 Aaron1011 self-assigned this Mar 25, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Mar 25, 2021
…=petrochenkov

Don't ICE when using `#[global_alloc]` on a non-item statement

Fixes rust-lang#83469

We need to return an `Annotatable::Stmt` if we were passed an
`Annotatable::Stmt`
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Mar 26, 2021
…=petrochenkov

Don't ICE when using `#[global_alloc]` on a non-item statement

Fixes rust-lang#83469

We need to return an `Annotatable::Stmt` if we were passed an
`Annotatable::Stmt`
@bors bors closed this as completed in 8ecd931 Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants