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: error was constructed but not emitted #122345

Closed
matthiaskrgr opened this issue Mar 11, 2024 · 3 comments · Fixed by #122400
Closed

ice: error was constructed but not emitted #122345

matthiaskrgr opened this issue Mar 11, 2024 · 3 comments · Fixed by #122400
Assignees
Labels
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) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Mar 11, 2024

auto-reduced (treereduce-rust):

fn main() {
    unsafe {
        dealloc(ptr2, Layout::(x: !)(1, 1));
    }
}

original:

//@error-in-other-file: /deallocation .* tag does not exist in the borrow stack/
use VecDeque::alloc::{alloc, dealloc, Layout};

fn main() {
    unsafe {
        let x = alloc(Layout::from_size_align_unchecked(1, 1));
        let ptr1 = (&mut *x) as *mut u8;
        let ptr2 = (&mut *ptr1) as *mut u8;
        // Invalidate ptr2 by writing to ptr1.
        ptr1.write(0);
        // Deallocate through ptr2.
        dealloc(ptr2, Layout::(x: !)(1, 1));
    }
}

Version information

rustc 1.78.0-nightly (6554a5645 2024-03-11)
binary: rustc
commit-hash: 6554a5645a13e4d9331fd028960d69be91d7492d
commit-date: 2024-03-11
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error: internal compiler error: the following error was constructed but not emitted

error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `:`
  --> /tmp/icemaker_global_tempdir.zlQSc6l4KgTO/rustc_testrunner_tmpdir_reporting.iH9w1iUnjMbI/mvce.rs:12:33
   |
12 |         dealloc(ptr2, Layout::(x: !)(1, 1));
   |                                 ^ expected one of 8 possible tokens

thread 'rustc' panicked at /rustc/6554a5645a13e4d9331fd028960d69be91d7492d/compiler/rustc_errors/src/diagnostic.rs:1374:17:
error was constructed but not emitted
stack backtrace:
   0:     0x7fdc6df8c6a2 - std::backtrace_rs::backtrace::libunwind::trace::h04b4f3bbfa4a768d
                               at /rustc/6554a5645a13e4d9331fd028960d69be91d7492d/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x7fdc6df8c6a2 - std::backtrace_rs::backtrace::trace_unsynchronized::hf6a64781360b5b60
                               at /rustc/6554a5645a13e4d9331fd028960d69be91d7492d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fdc6df8c6a2 - std::sys_common::backtrace::_print_fmt::hb80301e31516867e
                               at /rustc/6554a5645a13e4d9331fd028960d69be91d7492d/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7fdc6df8c6a2 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4c0b2165bb9f00fd
                               at /rustc/6554a5645a13e4d9331fd028960d69be91d7492d/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fdc6dfdd68c - core::fmt::rt::Argument::fmt::h1fd94ac4335d4c2e
                               at /rustc/6554a5645a13e4d9331fd028960d69be91d7492d/library/core/src/fmt/rt.rs:142:9
   5:     0x7fdc6dfdd68c - core::fmt::write::h36d27d5348ad7082
                               at /rustc/6554a5645a13e4d9331fd028960d69be91d7492d/library/core/src/fmt/mod.rs:1153:17
   6:     0x7fdc6df811af - std::io::Write::write_fmt::he05c57f4b5f640b1
                               at /rustc/6554a5645a13e4d9331fd028960d69be91d7492d/library/std/src/io/mod.rs:1843:15
   7:     0x7fdc6df8c474 - std::sys_common::backtrace::_print::hc63a51f316909c44
                               at /rustc/6554a5645a13e4d9331fd028960d69be91d7492d/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fdc6df8c474 - std::sys_common::backtrace::print::he28e541aa794d67b
                               at /rustc/6554a5645a13e4d9331fd028960d69be91d7492d/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fdc6df8f17b - std::panicking::default_hook::{{closure}}::hf3b65de4f65db9fa
  10:     0x7fdc6df8eed3 - std::panicking::default_hook::h01529c8b2c069046
                               at /rustc/6554a5645a13e4d9331fd028960d69be91d7492d/library/std/src/panicking.rs:292:9
  11:     0x7fdc70e71ae7 - std[631fd172171eed31]::panicking::update_hook::<alloc[c9b7c2961447b50b]::boxed::Box<rustc_driver_impl[5e8d5879b2085a20]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7fdc6df8f8e0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hf9fa03e4c8034cc3
                               at /rustc/6554a5645a13e4d9331fd028960d69be91d7492d/library/alloc/src/boxed.rs:2034:9
  13:     0x7fdc6df8f8e0 - std::panicking::rust_panic_with_hook::h53fe45788d16e6e3
                               at /rustc/6554a5645a13e4d9331fd028960d69be91d7492d/library/std/src/panicking.rs:783:13
  14:     0x7fdc6df8f5e9 - std::panicking::begin_panic_handler::{{closure}}::h40a0338a3263f597
                               at /rustc/6554a5645a13e4d9331fd028960d69be91d7492d/library/std/src/panicking.rs:649:13
  15:     0x7fdc6df8cb76 - std::sys_common::backtrace::__rust_end_short_backtrace::ha3f91ae072ccea19
                               at /rustc/6554a5645a13e4d9331fd028960d69be91d7492d/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7fdc6df8f354 - rust_begin_unwind
                               at /rustc/6554a5645a13e4d9331fd028960d69be91d7492d/library/std/src/panicking.rs:645:5
  17:     0x7fdc6dfd9ba5 - core::panicking::panic_fmt::h17d2d30dafa85036
                               at /rustc/6554a5645a13e4d9331fd028960d69be91d7492d/library/core/src/panicking.rs:72:14
  18:     0x7fdc6f4d7661 - core[f426184f278e30da]::ptr::drop_in_place::<rustc_errors[e20c07c7ad670ae1]::diagnostic::Diag>
  19:     0x7fdc7153c028 - <rustc_parse[db6be81d6c038e49]::parser::Parser>::recover_fn_call_leading_path_sep
  20:     0x7fdc72486810 - <rustc_parse[db6be81d6c038e49]::parser::Parser>::parse_path_segments
  21:     0x7fdc7248fc3e - <rustc_parse[db6be81d6c038e49]::parser::Parser>::parse_expr_dot_or_call
  22:     0x7fdc7248a92a - <rustc_parse[db6be81d6c038e49]::parser::Parser>::parse_expr_prefix
  23:     0x7fdc6f472b4b - <rustc_parse[db6be81d6c038e49]::parser::Parser>::parse_expr_assoc_with
  24:     0x7fdc728ca811 - <rustc_parse[db6be81d6c038e49]::parser::Parser>::parse_delim_comma_seq::<rustc_ast[dc3545ae43aa9a83]::ptr::P<rustc_ast[dc3545ae43aa9a83]::ast::Expr>, <rustc_parse[db6be81d6c038e49]::parser::Parser>::parse_expr_paren_seq::{closure#0}>
  25:     0x7fdc728e855c - <rustc_parse[db6be81d6c038e49]::parser::Parser>::parse_stmt_without_recovery
  26:     0x7fdc728e6491 - <rustc_parse[db6be81d6c038e49]::parser::Parser>::parse_full_stmt
  27:     0x7fdc72de4c17 - <rustc_parse[db6be81d6c038e49]::parser::Parser>::parse_block_common
  28:     0x7fdc72de21e4 - <rustc_parse[db6be81d6c038e49]::parser::Parser>::parse_expr_block
  29:     0x7fdc72494aa8 - <rustc_parse[db6be81d6c038e49]::parser::Parser>::parse_expr_dot_or_call
  30:     0x7fdc7248a92a - <rustc_parse[db6be81d6c038e49]::parser::Parser>::parse_expr_prefix
  31:     0x7fdc6f472b4b - <rustc_parse[db6be81d6c038e49]::parser::Parser>::parse_expr_assoc_with
  32:     0x7fdc728e90b8 - <rustc_parse[db6be81d6c038e49]::parser::Parser>::parse_stmt_without_recovery
  33:     0x7fdc728e5062 - <rustc_parse[db6be81d6c038e49]::parser::Parser>::parse_block_tail
  34:     0x7fdc728e119b - <rustc_parse[db6be81d6c038e49]::parser::Parser>::parse_fn
  35:     0x7fdc72bc28d0 - <rustc_parse[db6be81d6c038e49]::parser::Parser>::parse_item_kind
  36:     0x7fdc72522d48 - <rustc_parse[db6be81d6c038e49]::parser::Parser>::parse_item_common
  37:     0x7fdc72520779 - <rustc_parse[db6be81d6c038e49]::parser::Parser>::parse_mod
  38:     0x7fdc731e730e - rustc_interface[bae53d512d67c20f]::passes::parse
  39:     0x7fdc731e7113 - <rustc_interface[bae53d512d67c20f]::queries::Queries>::parse
  40:     0x7fdc731d91f8 - rustc_interface[bae53d512d67c20f]::interface::run_compiler::<core[f426184f278e30da]::result::Result<(), rustc_span[49d1d936f5fb4509]::ErrorGuaranteed>, rustc_driver_impl[5e8d5879b2085a20]::run_compiler::{closure#0}>::{closure#0}
  41:     0x7fdc732202c5 - std[631fd172171eed31]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[bae53d512d67c20f]::util::run_in_thread_with_globals<rustc_interface[bae53d512d67c20f]::util::run_in_thread_pool_with_globals<rustc_interface[bae53d512d67c20f]::interface::run_compiler<core[f426184f278e30da]::result::Result<(), rustc_span[49d1d936f5fb4509]::ErrorGuaranteed>, rustc_driver_impl[5e8d5879b2085a20]::run_compiler::{closure#0}>::{closure#0}, core[f426184f278e30da]::result::Result<(), rustc_span[49d1d936f5fb4509]::ErrorGuaranteed>>::{closure#0}, core[f426184f278e30da]::result::Result<(), rustc_span[49d1d936f5fb4509]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f426184f278e30da]::result::Result<(), rustc_span[49d1d936f5fb4509]::ErrorGuaranteed>>
  42:     0x7fdc732200f2 - <<std[631fd172171eed31]::thread::Builder>::spawn_unchecked_<rustc_interface[bae53d512d67c20f]::util::run_in_thread_with_globals<rustc_interface[bae53d512d67c20f]::util::run_in_thread_pool_with_globals<rustc_interface[bae53d512d67c20f]::interface::run_compiler<core[f426184f278e30da]::result::Result<(), rustc_span[49d1d936f5fb4509]::ErrorGuaranteed>, rustc_driver_impl[5e8d5879b2085a20]::run_compiler::{closure#0}>::{closure#0}, core[f426184f278e30da]::result::Result<(), rustc_span[49d1d936f5fb4509]::ErrorGuaranteed>>::{closure#0}, core[f426184f278e30da]::result::Result<(), rustc_span[49d1d936f5fb4509]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f426184f278e30da]::result::Result<(), rustc_span[49d1d936f5fb4509]::ErrorGuaranteed>>::{closure#1} as core[f426184f278e30da]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  43:     0x7fdc6df990b5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0835e6cae003a67b
                               at /rustc/6554a5645a13e4d9331fd028960d69be91d7492d/library/alloc/src/boxed.rs:2020:9
  44:     0x7fdc6df990b5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf296cba46eb34679
                               at /rustc/6554a5645a13e4d9331fd028960d69be91d7492d/library/alloc/src/boxed.rs:2020:9
  45:     0x7fdc6df990b5 - std::sys::pal::unix::thread::Thread::new::thread_start::h4796031db2384a5e
                               at /rustc/6554a5645a13e4d9331fd028960d69be91d7492d/library/std/src/sys/pal/unix/thread.rs:108:17
  46:     0x7fdc6dd8055a - <unknown>
  47:     0x7fdc6ddfda3c - <unknown>
  48:                0x0 - <unknown>

error: 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.78.0-nightly (6554a5645 2024-03-11) running on x86_64-unknown-linux-gnu

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


@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 Mar 11, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 11, 2024
@matthiaskrgr
Copy link
Member Author

#122152 cc @wutchzone

@fmease fmease added A-parser Area: The parsing of Rust source code to an AST. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 11, 2024
@fmease
Copy link
Member

fmease commented Mar 11, 2024

Ah, of course, we want to .cancel() the Diag returned by parse_paren_comma_seq.

@wutchzone
Copy link
Contributor

I will try to remedy the situation.

@rustbot claim

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 13, 2024
Fix ICE in diagnostics for parenthesized type arguments

The second time is the charm 🤞 😁

Fixes rust-lang#122345

r? fmease
@bors bors closed this as completed in 1ffa5de Mar 13, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 13, 2024
Rollup merge of rust-lang#122400 - wutchzone:122345, r=fmease

Fix ICE in diagnostics for parenthesized type arguments

The second time is the charm 🤞 😁

Fixes rust-lang#122345

r? fmease
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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) ❄️ 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