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: "expected to convert valtree to raw bytes for type u8" compiler/rustc_middle/src/ty/print/pretty.rs with issue-70408.rs and -Zunpretty=mir #99325

Closed
matthiaskrgr opened this issue Jul 16, 2022 · 0 comments · Fixed by #99358
Assignees
Labels
A-valtree Area: Value trees or fixed by value trees C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. 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

./src/test/ui/const-generics/issue-70408.rs

Code

// build-pass

#![feature(adt_const_params)]
#![allow(incomplete_features)]

pub fn function_with_bytes<const BYTES: &'static [u8; 4]>() -> &'static [u8] {
    BYTES
}

pub fn main() {
    assert_eq!(function_with_bytes::<b"AAAA">(), &[0x41, 0x41, 0x41, 0x41]);
    assert_eq!(function_with_bytes::<{ &[0x41, 0x41, 0x41, 0x41] }>(), b"AAAA");
}

Meta

rustc --version --verbose:

rustc 1.64.0-nightly (87588a2af 2022-07-13)
binary: rustc
commit-hash: 87588a2afd9ca903366f0deaf84d805f34469384
commit-date: 2022-07-13
host: x86_64-unknown-linux-gnu
release: 1.64.0-nightly
LLVM version: 14.0.6

Error output

rustc ./src/test/ui/const-generics/issue-70408.rs -Zunpretty=mir

Backtrace

error: internal compiler error: compiler/rustc_middle/src/ty/print/pretty.rs:1454:21: expected to convert valtree to raw bytes for type u8

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/87588a2afd9ca903366f0deaf84d805f34469384/compiler/rustc_errors/src/lib.rs:1391:9
stack backtrace:
   0:     0x7f6f968a2850 - std::backtrace_rs::backtrace::libunwind::trace::h546e34b136647819
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7f6f968a2850 - std::backtrace_rs::backtrace::trace_unsynchronized::h76e576fe0a1ec65e
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f6f968a2850 - std::sys_common::backtrace::_print_fmt::h3489fbb9d5d01094
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f6f968a2850 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h401cfc97a3c2f247
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f6f968fbe2c - core::fmt::write::h327c921ac5532dc9
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/core/src/fmt/mod.rs:1198:17
   5:     0x7f6f96893e15 - std::io::Write::write_fmt::h334c1fe5d85b41a9
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/io/mod.rs:1672:15
   6:     0x7f6f968a54e1 - std::sys_common::backtrace::_print::hddc5656bc817cc55
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f6f968a54e1 - std::sys_common::backtrace::print::h46adcb0dcb6fbe81
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f6f968a54e1 - std::panicking::default_hook::{{closure}}::h7e55301ce91fa17d
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/panicking.rs:295:22
   9:     0x7f6f968a51b3 - std::panicking::default_hook::he24b412fa8dea167
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/panicking.rs:314:9
  10:     0x7f6f97147e04 - rustc_driver[24990f24c5f9557a]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f6f968a5cb6 - std::panicking::rust_panic_with_hook::hd6be56b55800f278
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/panicking.rs:702:17
  12:     0x7f6f98138d41 - std[66dc708de7974585]::panicking::begin_panic::<rustc_errors[7a9b9cc96f052d83]::ExplicitBug>::{closure#0}
  13:     0x7f6f98135fb6 - std[66dc708de7974585]::sys_common::backtrace::__rust_end_short_backtrace::<std[66dc708de7974585]::panicking::begin_panic<rustc_errors[7a9b9cc96f052d83]::ExplicitBug>::{closure#0}, !>
  14:     0x7f6f98183436 - std[66dc708de7974585]::panicking::begin_panic::<rustc_errors[7a9b9cc96f052d83]::ExplicitBug>
  15:     0x7f6f98133fc6 - std[66dc708de7974585]::panic::panic_any::<rustc_errors[7a9b9cc96f052d83]::ExplicitBug>
  16:     0x7f6f98132d85 - <rustc_errors[7a9b9cc96f052d83]::HandlerInner>::bug::<&alloc[66d1c5d1fabcc843]::string::String>
  17:     0x7f6f98132ae0 - <rustc_errors[7a9b9cc96f052d83]::Handler>::bug::<&alloc[66d1c5d1fabcc843]::string::String>
  18:     0x7f6f981c9fbd - rustc_middle[911aaa7bc28cd14c]::ty::context::tls::with_context_opt::<rustc_middle[911aaa7bc28cd14c]::ty::context::tls::with_opt<rustc_middle[911aaa7bc28cd14c]::util::bug::opt_span_bug_fmt<rustc_span[b8cb56592c4d9b67]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  19:     0x7f6f981cbb36 - rustc_middle[911aaa7bc28cd14c]::util::bug::opt_span_bug_fmt::<rustc_span[b8cb56592c4d9b67]::span_encoding::Span>
  20:     0x7f6f981cbab3 - rustc_middle[911aaa7bc28cd14c]::util::bug::bug_fmt
  21:     0x7f6f98177c81 - <rustc_middle[911aaa7bc28cd14c]::ty::print::pretty::FmtPrinter as rustc_middle[911aaa7bc28cd14c]::ty::print::pretty::PrettyPrinter>::pretty_print_const_valtree
  22:     0x7f6f981779e9 - <rustc_middle[911aaa7bc28cd14c]::ty::print::pretty::FmtPrinter as rustc_middle[911aaa7bc28cd14c]::ty::print::pretty::PrettyPrinter>::pretty_print_const_valtree
  23:     0x7f6f98175588 - <rustc_middle[911aaa7bc28cd14c]::ty::print::pretty::FmtPrinter as rustc_middle[911aaa7bc28cd14c]::ty::print::pretty::PrettyPrinter>::pretty_print_const
  24:     0x7f6f99b45772 - <rustc_middle[911aaa7bc28cd14c]::ty::print::pretty::FmtPrinter as rustc_middle[911aaa7bc28cd14c]::ty::print::Printer>::print_def_path
  25:     0x7f6f98179424 - <rustc_middle[911aaa7bc28cd14c]::ty::print::pretty::FmtPrinter as rustc_middle[911aaa7bc28cd14c]::ty::print::pretty::PrettyPrinter>::print_value_path
  26:     0x7f6f981de7f7 - rustc_middle[911aaa7bc28cd14c]::ty::context::tls::with_context::<rustc_middle[911aaa7bc28cd14c]::ty::context::tls::with<rustc_middle[911aaa7bc28cd14c]::mir::pretty_print_const_value::{closure#0}, core[734affb1a3eaf053]::result::Result<(), core[734affb1a3eaf053]::fmt::Error>>::{closure#0}, core[734affb1a3eaf053]::result::Result<(), core[734affb1a3eaf053]::fmt::Error>>::{closure#0}
  27:     0x7f6f981da399 - <rustc_middle[911aaa7bc28cd14c]::mir::ConstantKind as core[734affb1a3eaf053]::fmt::Display>::fmt
  28:     0x7f6f968fbe2c - core::fmt::write::h327c921ac5532dc9
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/core/src/fmt/mod.rs:1198:17
  29:     0x7f6f968fcd34 - core::fmt::Formatter::write_fmt::hf38f1b393ccdcc09
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/core/src/fmt/mod.rs:1652:9
  30:     0x7f6f981da261 - <rustc_middle[911aaa7bc28cd14c]::mir::Constant as core[734affb1a3eaf053]::fmt::Debug>::fmt
  31:     0x7f6f968fbe2c - core::fmt::write::h327c921ac5532dc9
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/core/src/fmt/mod.rs:1198:17
  32:     0x7f6f968fcd34 - core::fmt::Formatter::write_fmt::hf38f1b393ccdcc09
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/core/src/fmt/mod.rs:1652:9
  33:     0x7f6f981c670b - <rustc_middle[911aaa7bc28cd14c]::mir::syntax::Operand as core[734affb1a3eaf053]::fmt::Debug>::fmt
  34:     0x7f6f968fbe2c - core::fmt::write::h327c921ac5532dc9
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/core/src/fmt/mod.rs:1198:17
  35:     0x7f6f968fcd34 - core::fmt::Formatter::write_fmt::hf38f1b393ccdcc09
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/core/src/fmt/mod.rs:1652:9
  36:     0x7f6f981c4333 - <rustc_middle[911aaa7bc28cd14c]::mir::syntax::TerminatorKind as core[734affb1a3eaf053]::fmt::Debug>::fmt
  37:     0x7f6f968fbdab - core::fmt::run::he8439e514cab33ef
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/core/src/fmt/mod.rs:1246:5
  38:     0x7f6f968fbdab - core::fmt::write::h327c921ac5532dc9
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/core/src/fmt/mod.rs:1214:26
  39:     0x7f6f968ee7f5 - core::fmt::Write::write_fmt::h76e3ebb460982542
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/core/src/fmt/mod.rs:188:9
  40:     0x7f6f968ee7f5 - alloc::fmt::format::format_inner::h74f55ded98ffe87b
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/alloc/src/fmt.rs:612:9
  41:     0x7f6f98226a07 - rustc_middle[911aaa7bc28cd14c]::mir::pretty::write_mir_pretty::{closure#0}
  42:     0x7f6f982252b1 - rustc_middle[911aaa7bc28cd14c]::mir::pretty::write_mir_pretty
  43:     0x7f6f97138c57 - rustc_driver[24990f24c5f9557a]::pretty::print_after_hir_lowering
  44:     0x7f6f971223ba - <rustc_interface[d9e16a24b5464548]::passes::QueryContext>::enter::<rustc_driver[24990f24c5f9557a]::run_compiler::{closure#1}::{closure#2}::{closure#1}, core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>>
  45:     0x7f6f992ea90f - <rustc_interface[d9e16a24b5464548]::interface::Compiler>::enter::<rustc_driver[24990f24c5f9557a]::run_compiler::{closure#1}::{closure#2}, core[734affb1a3eaf053]::result::Result<core[734affb1a3eaf053]::option::Option<rustc_interface[d9e16a24b5464548]::queries::Linker>, rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>>
  46:     0x7f6f992e676f - rustc_span[b8cb56592c4d9b67]::with_source_map::<core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>, rustc_interface[d9e16a24b5464548]::interface::create_compiler_and_run<core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>, rustc_driver[24990f24c5f9557a]::run_compiler::{closure#1}>::{closure#1}>
  47:     0x7f6f99302880 - rustc_interface[d9e16a24b5464548]::interface::create_compiler_and_run::<core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>, rustc_driver[24990f24c5f9557a]::run_compiler::{closure#1}>
  48:     0x7f6f99316a02 - <scoped_tls[93927b52d599628f]::ScopedKey<rustc_span[b8cb56592c4d9b67]::SessionGlobals>>::set::<rustc_interface[d9e16a24b5464548]::interface::run_compiler<core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>, rustc_driver[24990f24c5f9557a]::run_compiler::{closure#1}>::{closure#0}, core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>>
  49:     0x7f6f992e8cff - std[66dc708de7974585]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[d9e16a24b5464548]::util::run_in_thread_pool_with_globals<rustc_interface[d9e16a24b5464548]::interface::run_compiler<core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>, rustc_driver[24990f24c5f9557a]::run_compiler::{closure#1}>::{closure#0}, core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>>::{closure#0}, core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>>
  50:     0x7f6f99302cd9 - <<std[66dc708de7974585]::thread::Builder>::spawn_unchecked_<rustc_interface[d9e16a24b5464548]::util::run_in_thread_pool_with_globals<rustc_interface[d9e16a24b5464548]::interface::run_compiler<core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>, rustc_driver[24990f24c5f9557a]::run_compiler::{closure#1}>::{closure#0}, core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>>::{closure#0}, core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>>::{closure#1} as core[734affb1a3eaf053]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  51:     0x7f6f968af703 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h332a3f23c5b3d8bc
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/alloc/src/boxed.rs:1934:9
  52:     0x7f6f968af703 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h33b3da7f4496df00
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/alloc/src/boxed.rs:1934:9
  53:     0x7f6f968af703 - std::sys::unix::thread::Thread::new::thread_start::hf48274d01b2ded65
                               at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/sys/unix/thread.rs:108:17
  54:     0x7f6f9668054d - <unknown>
  55:     0x7f6f96705874 - clone
  56:                0x0 - <unknown>

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.64.0-nightly (87588a2af 2022-07-13) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unpretty=mir

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

@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. A-valtree Area: Value trees or fixed by value trees labels Jul 16, 2022
@matthiaskrgr matthiaskrgr changed the title ICE: "to convert valtree to raw bytes for type u8" compiler/rustc_middle/src/ty/print/pretty.rs with issue-70408.rs and -Zunpretty=mir ICE: "expected to convert valtree to raw bytes for type u8" compiler/rustc_middle/src/ty/print/pretty.rs with issue-70408.rs and -Zunpretty=mir Jul 16, 2022
@compiler-errors compiler-errors self-assigned this Jul 17, 2022
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jul 17, 2022
@bors bors closed this as completed in 4ce1b0f Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-valtree Area: Value trees or fixed by value trees C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. 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