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: not a tail expression #121647

Closed
matthiaskrgr opened this issue Feb 26, 2024 · 2 comments · Fixed by #121651
Closed

ICE: not a tail expression #121647

matthiaskrgr opened this issue Feb 26, 2024 · 2 comments · Fixed by #121651
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-parser Area: The parsing of Rust source code to an AST C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Feb 26, 2024

auto-reduced (treereduce-rust):

macro_rules! the_macro {
    ( $foo:stmt ; $bar:stmt ; ) => {
        #[cfg()]
        $foo

        #[cfg(bar)]
        $bar
    };
}

fn the_function() {
    the_macro!( (); (); );
}

original:

macro_rules! the_macro {
    ( $foo:stmt ; $bar:stmt ; ) => {
        #[cfg(incomplete_features)]
        $foo
        
        #[cfg(bar)]
        $bar
    };
}

fn the_function() {
    the_macro!( (); (); );
}

Version information

rustc 1.78.0-nightly (b79db437d 2024-02-26)
binary: rustc
commit-hash: b79db437dccd496948bb1819d36ed51598563a98
commit-date: 2024-02-26
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc --crate-type=lib

Program output

warning: function `the_function` is never used
  --> /tmp/icemaker_global_tempdir.fJLXUZMXByi7/rustc_testrunner_tmpdir_reporting.upzqZTcLzog2/mvce.rs:11:4
   |
11 | fn the_function() {
   |    ^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: 1 warning emitted

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: not a tail expression
  --> /tmp/icemaker_global_tempdir.fJLXUZMXByi7/rustc_testrunner_tmpdir_reporting.upzqZTcLzog2/mvce.rs:12:17
   |
12 |     the_macro!( (); (); );
   |                 ^^
   |
note: delayed at compiler/rustc_parse/src/parser/diagnostics.rs:818:43
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxt>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_parse::parser::Parser>::attr_on_non_tail_expr
         4: <rustc_parse::parser::Parser>::parse_full_stmt
         5: <rustc_expand::mbe::macro_rules::ParserAnyMacro>::make
         6: <rustc_expand::expand::MacroExpander>::fully_expand_fragment
         7: <rustc_expand::expand::MacroExpander>::expand_crate
         8: rustc_interface::passes::resolver_for_lowering
         9: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::resolver_for_lowering::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        11: rustc_query_impl::query_impl::resolver_for_lowering::get_query_non_incr::__rust_end_short_backtrace
        12: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
        13: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        14: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        15: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/b79db437dccd496948bb1819d36ed51598563a98/library/alloc/src/boxed.rs:2016:9
        16: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/b79db437dccd496948bb1819d36ed51598563a98/library/alloc/src/boxed.rs:2016:9
        17: std::sys::pal::unix::thread::Thread::new::thread_start
                   at /rustc/b79db437dccd496948bb1819d36ed51598563a98/library/std/src/sys/pal/unix/thread.rs:108:17
        18: <unknown>
        19: <unknown>
  --> /tmp/icemaker_global_tempdir.fJLXUZMXByi7/rustc_testrunner_tmpdir_reporting.upzqZTcLzog2/mvce.rs:12:17
   |
12 |     the_macro!( (); (); );
   |                 ^^

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.78.0-nightly (b79db437d 2024-02-26) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -Z dump-mir-dir=dir

query stack during panic:
end of query stack

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. labels Feb 26, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 26, 2024
@matthiaskrgr
Copy link
Member Author

It seems the not a tail expression pops up since #120586 cc @ShE3py

The code starts ICEing in general since #117988 cc @estebank

@jieyouxu jieyouxu added A-diagnostics Area: Messages for errors, warnings, and lints A-parser Area: The parsing of Rust source code to an AST A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ and removed I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Feb 26, 2024
@ShE3py
Copy link
Contributor

ShE3py commented Feb 26, 2024

@rustbot claim

@bors bors closed this as completed in ec5c5b7 Feb 27, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Feb 27, 2024
Rollup merge of rust-lang#121651 - ShE3py:issue-121647, r=estebank

Properly emit `expected ;` on `#[attr] expr`

Fixes rust-lang#121647

See rust-lang#118182, rust-lang#120586

---
r? estebank
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-parser Area: The parsing of Rust source code to an AST C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue 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.

4 participants