Skip to content

ICE None privacy #121455

Closed
Closed
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

fn test(s: &Self::Id) {
    match &s[0..3] {}
}

fn main() {}

original:

fn test(s: &Self::Id) {
    match &s[0..3] {
        b"aba" => {}
        _ => {}
    }
}

fn main() {}

Version information

rustc 1.78.0-nightly (f70f19fef 2024-02-22)
binary: rustc
commit-hash: f70f19fef41cfdda75c92f163434c29ad046cf09
commit-date: 2024-02-22
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

Command:
/home/gh-matthiaskrgr/.rustup/toolchains/master/bin/rustc

Program output

warning: function `test` is never used
 --> /tmp/icemaker_global_tempdir.Lv2nHaQbve2G/rustc_testrunner_tmpdir_reporting.1yfawIGP80kJ/mvce.rs:1:4
  |
1 | fn test(s: &Self::Id) {
  |    ^^^^
  |
  = note: `#[warn(dead_code)]` on by default

thread 'rustc' panicked at compiler/rustc_privacy/src/lib.rs:991:72:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x7fe17104baf6 - std::backtrace_rs::backtrace::libunwind::trace::hef019eae7250a090
                               at /rustc/f70f19fef41cfdda75c92f163434c29ad046cf09/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7fe17104baf6 - std::backtrace_rs::backtrace::trace_unsynchronized::h163c9c558e7f1e4e
                               at /rustc/f70f19fef41cfdda75c92f163434c29ad046cf09/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fe17104baf6 - std::sys_common::backtrace::_print_fmt::h84a7f2dbeae8e017
                               at /rustc/f70f19fef41cfdda75c92f163434c29ad046cf09/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7fe17104baf6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf7737af35c1403cd
                               at /rustc/f70f19fef41cfdda75c92f163434c29ad046cf09/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fe17109ca7c - core::fmt::rt::Argument::fmt::h027f33016919ab54
                               at /rustc/f70f19fef41cfdda75c92f163434c29ad046cf09/library/core/src/fmt/rt.rs:142:9
   5:     0x7fe17109ca7c - core::fmt::write::hed9b631feef55974
                               at /rustc/f70f19fef41cfdda75c92f163434c29ad046cf09/library/core/src/fmt/mod.rs:1120:17
   6:     0x7fe1710404bf - std::io::Write::write_fmt::h3b1c8483aebfcef8
                               at /rustc/f70f19fef41cfdda75c92f163434c29ad046cf09/library/std/src/io/mod.rs:1846:15
   7:     0x7fe17104b8a4 - std::sys_common::backtrace::_print::h526b95c0b60f4650
                               at /rustc/f70f19fef41cfdda75c92f163434c29ad046cf09/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fe17104b8a4 - std::sys_common::backtrace::print::h3322d8b0a1d6207a
                               at /rustc/f70f19fef41cfdda75c92f163434c29ad046cf09/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fe17104e5eb - std::panicking::default_hook::{{closure}}::h9f07e6147b1c8a2e
  10:     0x7fe17104e339 - std::panicking::default_hook::h395b386ace4fbcb6
                               at /rustc/f70f19fef41cfdda75c92f163434c29ad046cf09/library/std/src/panicking.rs:292:9
  11:     0x7fe16dc7073c - std[d26ecb90c771e100]::panicking::update_hook::<alloc[100d4e65626f4394]::boxed::Box<rustc_driver_impl[ab901dc85bea4c82]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7fe17104ed50 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h1a188bbe7a6bf646
                               at /rustc/f70f19fef41cfdda75c92f163434c29ad046cf09/library/alloc/src/boxed.rs:2030:9
  13:     0x7fe17104ed50 - std::panicking::rust_panic_with_hook::h1eec7c1097026ee4
                               at /rustc/f70f19fef41cfdda75c92f163434c29ad046cf09/library/std/src/panicking.rs:786:13
  14:     0x7fe17104ea59 - std::panicking::begin_panic_handler::{{closure}}::h4a05c0337f2d10b0
                               at /rustc/f70f19fef41cfdda75c92f163434c29ad046cf09/library/std/src/panicking.rs:652:13
  15:     0x7fe17104bfd6 - std::sys_common::backtrace::__rust_end_short_backtrace::h8e493856f2567f06
                               at /rustc/f70f19fef41cfdda75c92f163434c29ad046cf09/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7fe17104e7c4 - rust_begin_unwind
                               at /rustc/f70f19fef41cfdda75c92f163434c29ad046cf09/library/std/src/panicking.rs:648:5
  17:     0x7fe171098f95 - core::panicking::panic_fmt::h3ada378d4b3e4e06
                               at /rustc/f70f19fef41cfdda75c92f163434c29ad046cf09/library/core/src/panicking.rs:72:14
  18:     0x7fe171099053 - core::panicking::panic::hf686bd38e73a6fb0
                               at /rustc/f70f19fef41cfdda75c92f163434c29ad046cf09/library/core/src/panicking.rs:144:5
  19:     0x7fe171098d26 - core::option::unwrap_failed::hfcdeaccb62b77869
                               at /rustc/f70f19fef41cfdda75c92f163434c29ad046cf09/library/core/src/option.rs:1983:5
  20:     0x7fe16f06a5ff - <rustc_privacy[80d2fffb773ca6d2]::NamePrivacyVisitor as rustc_hir[c73f1de04e7d2c16]::intravisit::Visitor>::visit_expr
  21:     0x7fe16f069ae5 - <rustc_privacy[80d2fffb773ca6d2]::NamePrivacyVisitor as rustc_hir[c73f1de04e7d2c16]::intravisit::Visitor>::visit_expr
  22:     0x7fe16f0699a1 - <rustc_privacy[80d2fffb773ca6d2]::NamePrivacyVisitor as rustc_hir[c73f1de04e7d2c16]::intravisit::Visitor>::visit_expr
  23:     0x7fe16f069beb - <rustc_privacy[80d2fffb773ca6d2]::NamePrivacyVisitor as rustc_hir[c73f1de04e7d2c16]::intravisit::Visitor>::visit_expr
  24:     0x7fe16f0699e2 - <rustc_privacy[80d2fffb773ca6d2]::NamePrivacyVisitor as rustc_hir[c73f1de04e7d2c16]::intravisit::Visitor>::visit_expr
  25:     0x7fe16f733bce - rustc_privacy[80d2fffb773ca6d2]::check_mod_privacy
  26:     0x7fe16f7339ad - rustc_query_impl[9d2321c4f9b7ef6e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d2321c4f9b7ef6e]::query_impl::check_mod_privacy::dynamic_query::{closure#2}::{closure#0}, rustc_middle[771c523b66a87e77]::query::erase::Erased<[u8; 0usize]>>
  27:     0x7fe16fba4cad - rustc_query_system[1927276894a91dd8]::query::plumbing::try_execute_query::<rustc_query_impl[9d2321c4f9b7ef6e]::DynamicConfig<rustc_query_system[1927276894a91dd8]::query::caches::DefaultCache<rustc_span[4d20b27f335b5d92]::def_id::LocalModDefId, rustc_middle[771c523b66a87e77]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[9d2321c4f9b7ef6e]::plumbing::QueryCtxt, false>
  28:     0x7fe16fba077f - rustc_query_impl[9d2321c4f9b7ef6e]::query_impl::check_mod_privacy::get_query_non_incr::__rust_end_short_backtrace
  29:     0x7fe16fb9cb7c - rustc_interface[863afa250f767019]::passes::analysis
  30:     0x7fe16fb9b759 - rustc_query_impl[9d2321c4f9b7ef6e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d2321c4f9b7ef6e]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[771c523b66a87e77]::query::erase::Erased<[u8; 1usize]>>
  31:     0x7fe16fd45303 - rustc_query_system[1927276894a91dd8]::query::plumbing::try_execute_query::<rustc_query_impl[9d2321c4f9b7ef6e]::DynamicConfig<rustc_query_system[1927276894a91dd8]::query::caches::SingleCache<rustc_middle[771c523b66a87e77]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[9d2321c4f9b7ef6e]::plumbing::QueryCtxt, false>
  32:     0x7fe16fd4507f - rustc_query_impl[9d2321c4f9b7ef6e]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7fe16fd54556 - rustc_interface[863afa250f767019]::interface::run_compiler::<core[17d6b7ce805ba05e]::result::Result<(), rustc_span[4d20b27f335b5d92]::ErrorGuaranteed>, rustc_driver_impl[ab901dc85bea4c82]::run_compiler::{closure#0}>::{closure#0}
  34:     0x7fe16ffbe305 - std[d26ecb90c771e100]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[863afa250f767019]::util::run_in_thread_with_globals<rustc_interface[863afa250f767019]::util::run_in_thread_pool_with_globals<rustc_interface[863afa250f767019]::interface::run_compiler<core[17d6b7ce805ba05e]::result::Result<(), rustc_span[4d20b27f335b5d92]::ErrorGuaranteed>, rustc_driver_impl[ab901dc85bea4c82]::run_compiler::{closure#0}>::{closure#0}, core[17d6b7ce805ba05e]::result::Result<(), rustc_span[4d20b27f335b5d92]::ErrorGuaranteed>>::{closure#0}, core[17d6b7ce805ba05e]::result::Result<(), rustc_span[4d20b27f335b5d92]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[17d6b7ce805ba05e]::result::Result<(), rustc_span[4d20b27f335b5d92]::ErrorGuaranteed>>
  35:     0x7fe16ffbe132 - <<std[d26ecb90c771e100]::thread::Builder>::spawn_unchecked_<rustc_interface[863afa250f767019]::util::run_in_thread_with_globals<rustc_interface[863afa250f767019]::util::run_in_thread_pool_with_globals<rustc_interface[863afa250f767019]::interface::run_compiler<core[17d6b7ce805ba05e]::result::Result<(), rustc_span[4d20b27f335b5d92]::ErrorGuaranteed>, rustc_driver_impl[ab901dc85bea4c82]::run_compiler::{closure#0}>::{closure#0}, core[17d6b7ce805ba05e]::result::Result<(), rustc_span[4d20b27f335b5d92]::ErrorGuaranteed>>::{closure#0}, core[17d6b7ce805ba05e]::result::Result<(), rustc_span[4d20b27f335b5d92]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[17d6b7ce805ba05e]::result::Result<(), rustc_span[4d20b27f335b5d92]::ErrorGuaranteed>>::{closure#1} as core[17d6b7ce805ba05e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  36:     0x7fe171058725 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1e27cc9781dd2875
                               at /rustc/f70f19fef41cfdda75c92f163434c29ad046cf09/library/alloc/src/boxed.rs:2016:9
  37:     0x7fe171058725 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4e0d9eddec111fd1
                               at /rustc/f70f19fef41cfdda75c92f163434c29ad046cf09/library/alloc/src/boxed.rs:2016:9
  38:     0x7fe171058725 - std::sys::pal::unix::thread::Thread::new::thread_start::h8ca0c4b428df1792
                               at /rustc/f70f19fef41cfdda75c92f163434c29ad046cf09/library/std/src/sys/pal/unix/thread.rs:108:17
  39:     0x7fe16aa94ac3 - start_thread
                               at ./nptl/pthread_create.c:442:8
  40:     0x7fe16ab26850 - __GI___clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  41:                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 (f70f19fef 2024-02-22) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_mod_privacy] checking privacy in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions
 --> /tmp/icemaker_global_tempdir.Lv2nHaQbve2G/rustc_testrunner_tmpdir_reporting.1yfawIGP80kJ/mvce.rs:1:13
  |
1 | fn test(s: &Self::Id) {
  |             ^^^^ `Self` is only available in impls, traits, and type definitions

error: aborting due to 1 previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0433`.

Metadata

Metadata

Assignees

Labels

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.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions