Skip to content

ICE: generic_const_exprs on 1.85.0-nightly #134044

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

Open
peter-lyons-kehl opened this issue Dec 8, 2024 · 7 comments
Open

ICE: generic_const_exprs on 1.85.0-nightly #134044

peter-lyons-kehl opened this issue Dec 8, 2024 · 7 comments
Labels
C-bug Category: This is a bug. F-generic_const_exprs `#![feature(generic_const_exprs)]` 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

@peter-lyons-kehl
Copy link
Contributor

peter-lyons-kehl commented Dec 8, 2024

Summary:

  • This is when adding const generics to an existing project (the original author is someone else). So I can't minimize it at the moment, and I most likely have some errors. But:
  • nightly/stable - both are (to be) implemented.
    • stable uses a type alias (in src/trait_flags.rs: pub type TraitFlags = u8;) instead of a custom struct. stable runs all tests fine.
    • nightly (hopes to) use generic_const_exprs. It's behind unstable_generic_const_own_type feature - see the following.

Surprisingly, even though it mentions ICE, the problem shows up

  • only when RUNNING tests cargo +nightly test --features unstable_generic_const_own_type
  • but NOT when running a check on tests with cargo +nightly check --tests --features unstable_generic_const_own_type.

To replicate:

git clone https://github.com/peter-lyons-kehl/phantom-newtype-rs
cd phantom-newtype-rs
git checkout aaf428c25ef3f7fb1de5aa290b38e9908390fad3
cargo +nightly test --features unstable_generic_const_own_type

Code

See above.

Meta

# on current Manjaro x64
uname -a
Linux spectre 6.12.1-4-MANJARO #1 SMP PREEMPT_DYNAMIC Mon, 25 Nov 2024 05:36:03 +0000 x86_64 GNU/Linux

Rustup installed as a Manjaro (Arch) package. Both nightly and stable installed with rustup and current:

rustc --version --verbose:

rustc 1.85.0-nightly (9c707a8b7 2024-12-07)
binary: rustc
commit-hash: 9c707a8b769523bb6768bf58e74fa2c39cc24844
commit-date: 2024-12-07
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.5

Error output

See also attached ICE TXT files.

<output>
(SKIPPED WARNINGS)

running 2 tests
test instant::tests::test_complex_instant_arithmetics ... ok
test trait_flag::test_flags::all ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests phantom_newtype

running 32 tests
test src/amount.rs - amount::Amount (line 138) ... FAILED
test src/amount.rs - amount::Amount (line 126) ... FAILED
test src/amount.rs - amount::Amount (line 31) - compile fail ... ok
test src/amount.rs - amount::Amount (line 108) ... ok
test src/amount.rs - amount::Amount (line 47) ... FAILED
test src/amount.rs - amount::Amount (line 65) ... FAILED
test src/amount.rs - amount::Amount (line 82) ... FAILED
test src/amount.rs - amount::Amount (line 96) ... FAILED
test src/amount.rs - amount::Amount<TF,Unit,Repr>::get (line 157) ... FAILED
test src/amount.rs - amount::Amount<TF,Unit,Repr>::display (line 206) ... FAILED
test src/amount.rs - amount::Amount<TF,Unit,Repr>::unit (line 185) ... FAILED
test src/id.rs - id::Id (line 48) - compile fail ... ok
test src/id.rs - id::Id (line 127) ... ok
test src/id.rs - id::Id (line 30) ... ok
test src/id.rs - id::Id (line 113) ... ok
test src/id.rs - id::Id (line 62) ... ok
test src/id.rs - id::Id (line 76) ... ok
test src/id.rs - id::Id<Entity,Repr>::get (line 145) ... ok
test src/id.rs - id::Id<Entity,Repr>::display (line 182) ... ok
test src/id.rs - id::Id<Entity,Repr>::new (line 161) ... ok
test src/id.rs - id::Id (line 95) ... ok
test src/instant.rs - instant::Instant (line 100) ... ok
test src/instant.rs - instant::Instant (line 132) ... FAILED
test src/instant.rs - instant::Instant (line 120) ... FAILED
test src/instant.rs - instant::Instant (line 53) ... FAILED
test src/instant.rs - instant::Instant (line 33) ... FAILED
test src/instant.rs - instant::Instant<TF,Unit,Repr>::display (line 200) ... FAILED
test src/instant.rs - instant::Instant (line 73) ... FAILED
test src/instant.rs - instant::Instant (line 88) ... FAILED
test src/to.rs - to::As (line 25) ... ignored
test src/instant.rs - instant::Instant<TF,Unit,Repr>::get (line 153) ... FAILED
test src/instant.rs - instant::Instant<TF,Unit,Repr>::unit (line 179) ... FAILED

failures:

---- src/amount.rs - amount::Amount (line 138) stdout ----
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: Encountered anon const with inference variable args but no error reported
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/mod.rs:605:27 - disabled backtrace

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/share/pkehl/GIT/phantom-newtype-rs/rustc-ice-2024-12-08T20_05_46-2074664.txt` to your bug report

query stack during panic:
end of query stack
Couldn't compile the test.
---- src/amount.rs - amount::Amount (line 126) stdout ----
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: Encountered anon const with inference variable args but no error reported
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/mod.rs:605:27 - disabled backtrace

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/share/pkehl/GIT/phantom-newtype-rs/rustc-ice-2024-12-08T20_05_46-2074666.txt` to your bug report

query stack during panic:
end of query stack
Couldn't compile the test.
---- src/amount.rs - amount::Amount (line 47) stdout ----
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: Encountered anon const with inference variable args but no error reported
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/mod.rs:605:27 - disabled backtrace

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/share/pkehl/GIT/phantom-newtype-rs/rustc-ice-2024-12-08T20_05_46-2074683.txt` to your bug report

query stack during panic:
end of query stack
Couldn't compile the test.
---- src/amount.rs - amount::Amount (line 65) stdout ----
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: Encountered anon const with inference variable args but no error reported
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/mod.rs:605:27 - disabled backtrace

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/share/pkehl/GIT/phantom-newtype-rs/rustc-ice-2024-12-08T20_05_46-2074687.txt` to your bug report

query stack during panic:
end of query stack
Couldn't compile the test.
---- src/amount.rs - amount::Amount (line 82) stdout ----
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: Encountered anon const with inference variable args but no error reported
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/mod.rs:605:27 - disabled backtrace

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/share/pkehl/GIT/phantom-newtype-rs/rustc-ice-2024-12-08T20_05_46-2074695.txt` to your bug report

query stack during panic:
end of query stack
Couldn't compile the test.
---- src/amount.rs - amount::Amount (line 96) stdout ----
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: Encountered anon const with inference variable args but no error reported
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/mod.rs:605:27 - disabled backtrace

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/share/pkehl/GIT/phantom-newtype-rs/rustc-ice-2024-12-08T20_05_46-2074703.txt` to your bug report

query stack during panic:
end of query stack
Couldn't compile the test.
---- src/amount.rs - amount::Amount<TF,Unit,Repr>::get (line 157) stdout ----
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: Encountered anon const with inference variable args but no error reported
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/mod.rs:605:27 - disabled backtrace

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/share/pkehl/GIT/phantom-newtype-rs/rustc-ice-2024-12-08T20_05_47-2074712.txt` to your bug report

query stack during panic:
end of query stack
Couldn't compile the test.
---- src/amount.rs - amount::Amount<TF,Unit,Repr>::display (line 206) stdout ----
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: Encountered anon const with inference variable args but no error reported
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/mod.rs:605:27 - disabled backtrace

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/share/pkehl/GIT/phantom-newtype-rs/rustc-ice-2024-12-08T20_05_47-2074709.txt` to your bug report

query stack during panic:
end of query stack
Couldn't compile the test.
---- src/amount.rs - amount::Amount<TF,Unit,Repr>::unit (line 185) stdout ----
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: Encountered anon const with inference variable args but no error reported
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/mod.rs:605:27 - disabled backtrace

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/share/pkehl/GIT/phantom-newtype-rs/rustc-ice-2024-12-08T20_05_47-2074714.txt` to your bug report

query stack during panic:
end of query stack
Couldn't compile the test.
---- src/instant.rs - instant::Instant (line 132) stdout ----
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: Encountered anon const with inference variable args but no error reported
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/mod.rs:605:27 - disabled backtrace

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/share/pkehl/GIT/phantom-newtype-rs/rustc-ice-2024-12-08T20_05_48-2074907.txt` to your bug report

query stack during panic:
end of query stack
Couldn't compile the test.
---- src/instant.rs - instant::Instant (line 120) stdout ----
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: Encountered anon const with inference variable args but no error reported
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/mod.rs:605:27 - disabled backtrace

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/share/pkehl/GIT/phantom-newtype-rs/rustc-ice-2024-12-08T20_05_48-2074892.txt` to your bug report

query stack during panic:
end of query stack
Couldn't compile the test.
---- src/instant.rs - instant::Instant (line 53) stdout ----
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: Encountered anon const with inference variable args but no error reported
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/mod.rs:605:27 - disabled backtrace

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/share/pkehl/GIT/phantom-newtype-rs/rustc-ice-2024-12-08T20_05_48-2074915.txt` to your bug report

query stack during panic:
end of query stack
Couldn't compile the test.
---- src/instant.rs - instant::Instant (line 33) stdout ----
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: Encountered anon const with inference variable args but no error reported
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/mod.rs:605:27 - disabled backtrace

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/share/pkehl/GIT/phantom-newtype-rs/rustc-ice-2024-12-08T20_05_48-2074913.txt` to your bug report

query stack during panic:
end of query stack
Couldn't compile the test.
---- src/instant.rs - instant::Instant<TF,Unit,Repr>::display (line 200) stdout ----
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: Encountered anon const with inference variable args but no error reported
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/mod.rs:605:27 - disabled backtrace

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/share/pkehl/GIT/phantom-newtype-rs/rustc-ice-2024-12-08T20_05_48-2074927.txt` to your bug report

query stack during panic:
end of query stack
Couldn't compile the test.
---- src/instant.rs - instant::Instant (line 73) stdout ----
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: Encountered anon const with inference variable args but no error reported
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/mod.rs:605:27 - disabled backtrace

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/share/pkehl/GIT/phantom-newtype-rs/rustc-ice-2024-12-08T20_05_48-2074921.txt` to your bug report

query stack during panic:
end of query stack
Couldn't compile the test.
---- src/instant.rs - instant::Instant (line 88) stdout ----
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: Encountered anon const with inference variable args but no error reported
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/mod.rs:605:27 - disabled backtrace

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/share/pkehl/GIT/phantom-newtype-rs/rustc-ice-2024-12-08T20_05_48-2074923.txt` to your bug report

query stack during panic:
end of query stack
Couldn't compile the test.
---- src/instant.rs - instant::Instant<TF,Unit,Repr>::get (line 153) stdout ----
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: Encountered anon const with inference variable args but no error reported
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/mod.rs:605:27 - disabled backtrace

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/share/pkehl/GIT/phantom-newtype-rs/rustc-ice-2024-12-08T20_05_48-2074934.txt` to your bug report

query stack during panic:
end of query stack
Couldn't compile the test.
---- src/instant.rs - instant::Instant<TF,Unit,Repr>::unit (line 179) stdout ----
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: Encountered anon const with inference variable args but no error reported
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/mod.rs:605:27 - disabled backtrace

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/share/pkehl/GIT/phantom-newtype-rs/rustc-ice-2024-12-08T20_05_48-2074938.txt` to your bug report

query stack during panic:
end of query stack
Couldn't compile the test.

failures:
    src/amount.rs - amount::Amount (line 126)
    src/amount.rs - amount::Amount (line 138)
    src/amount.rs - amount::Amount (line 47)
    src/amount.rs - amount::Amount (line 65)
    src/amount.rs - amount::Amount (line 82)
    src/amount.rs - amount::Amount (line 96)
    src/amount.rs - amount::Amount<TF,Unit,Repr>::display (line 206)
    src/amount.rs - amount::Amount<TF,Unit,Repr>::get (line 157)
    src/amount.rs - amount::Amount<TF,Unit,Repr>::unit (line 185)
    src/instant.rs - instant::Instant (line 120)
    src/instant.rs - instant::Instant (line 132)
    src/instant.rs - instant::Instant (line 33)
    src/instant.rs - instant::Instant (line 53)
    src/instant.rs - instant::Instant (line 73)
    src/instant.rs - instant::Instant (line 88)
    src/instant.rs - instant::Instant<TF,Unit,Repr>::display (line 200)
    src/instant.rs - instant::Instant<TF,Unit,Repr>::get (line 153)
    src/instant.rs - instant::Instant<TF,Unit,Repr>::unit (line 179)

test result: FAILED. 13 passed; 18 failed; 1 ignored; 0 measured; 0 filtered out; finished in 2.50s

error: doctest failed, to rerun pass `--doc`

rustc-ice-2024-12-08T20_05_48-2074938.txt
rustc-ice-2024-12-08T20_05_48-2074934.txt
rustc-ice-2024-12-08T20_05_48-2074923.txt
rustc-ice-2024-12-08T20_05_48-2074927.txt
rustc-ice-2024-12-08T20_05_48-2074921.txt
rustc-ice-2024-12-08T20_05_48-2074913.txt
rustc-ice-2024-12-08T20_05_48-2074915.txt
rustc-ice-2024-12-08T20_05_48-2074907.txt
rustc-ice-2024-12-08T20_05_48-2074892.txt
rustc-ice-2024-12-08T20_05_47-2074709.txt
rustc-ice-2024-12-08T20_05_47-2074714.txt
rustc-ice-2024-12-08T20_05_47-2074712.txt
rustc-ice-2024-12-08T20_05_46-2074703.txt
rustc-ice-2024-12-08T20_05_46-2074683.txt
rustc-ice-2024-12-08T20_05_46-2074687.txt
rustc-ice-2024-12-08T20_05_46-2074695.txt
rustc-ice-2024-12-08T20_05_46-2074666.txt
rustc-ice-2024-12-08T20_05_46-2074664.txt

@peter-lyons-kehl peter-lyons-kehl 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 Dec 8, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 8, 2024
@peter-lyons-kehl peter-lyons-kehl changed the title const-generics 1.85.0-nightly ICE: generic_const_exprs on 1.85.0-nightly Dec 8, 2024
@cyrgani
Copy link
Contributor

cyrgani commented Dec 8, 2024

Here is a reduction:

#![feature(adt_const_params, generic_const_exprs)]

pub struct Instant<const TF: (), Repr>(Repr);

impl Instant<{}, u64> {
    pub fn new() -> Self {
        todo!()
    }
}

impl<Repr: Copy> Clone for Instant<{}, Repr> {
    fn clone(&self) -> Self {
        todo!()
    }
}

impl<Repr: Copy> Copy for Instant<{}, Repr> {}

and a binary:

use phantom_newtype::Instant;

fn main() {
    let _x = Instant::<{}, u64>::new();
}

As is often the case with generic_const_exprs ICEs, they need to be different crates and the ICE disappears if ![feature(generic_const_exprs)] is added to the binary. Interestingly, the reduced code doesn't actually need GCE and compiles fine if the feature gate is removed from the library file.

I assume this is #133199 once again.

@peter-lyons-kehl
Copy link
Contributor Author

Thank you so much @cyrgani.

  1. I confirm that adding generic_const_exprs to the consumer crate makes this build. In case of doc tests it's like:
/// ```
/// #![cfg_attr(
///     feature = "unstable_generic_const_own_type",
///     feature(generic_const_exprs)
/// )]
/// // The actual test comes here.
  1. "the reduced code doesn't actually need GCE and compiles fine if the feature gate is removed from the library" - are you sure, or do you still have the code that did build without GCE gate feature?
    Plain pub struct Instant<const TF: (), Repr>(Repr); with no feature gate fails: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=e6d199daa0d3179062ae255b6ff00520.

@cyrgani
Copy link
Contributor

cyrgani commented Dec 8, 2024

What I meant with 2. was that my reduction only needs #![feature(adt_const_params)], but not #![feature(generic_const_exprs)] to compile fine (https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=1e0f54c9ffb4144406908fc71d28a4a5), so generic_const_exprs itself is not needed but still the ICE cause.

@jieyouxu
Copy link
Member

jieyouxu commented Dec 9, 2024

I assume this is #133199 once again.

This looks most plausible to me.

@jieyouxu jieyouxu closed this as completed Dec 9, 2024
@jieyouxu jieyouxu added F-generic_const_exprs `#![feature(generic_const_exprs)]` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Dec 9, 2024
@peter-lyons-kehl
Copy link
Contributor Author

A subset of my original ICE's reported in this GitHub issue looks different to #133199 (at least to me, and only based on a quick look at the stderr, but also based on a fact that here an ICE actually hides a real compile error).

Contrary to the above fix/workaround identified by @cyrgani, for the below subset REMOVING #![feature(generic_const_exprs)] from the consumer crate (in my instance it's in the inline test) prevents the ICE (and then rustc shows an actual compile error) - while for the subset minimized above the fix was to ADD #![feature(generic_const_exprs)].

Minimized at https://github.com/peter-lyons-kehl/phantom-newtype-rs branch ICE_minimization_removal_of_copy_and_clone_fixes, also at https://github.com/peter-lyons-kehl/phantom-newtype-rs/blob/ICE_minimization_removal_of_copy_and_clone_fixes/src/lib.rs. (Ignore the branch name, Copy/Clone turned out to be irrelevant for this subset of ICE's.)

From cargo test:

thread 'rustc' panicked at compiler/rustc_hir_analysis/src/collect/predicates_of.rs:401:60:
DefId::expect_local: `DefId(20:9 ~ phantom_newtype[767d]::IdOne::{constant#0})` isn't local
stack backtrace:
   0:     0x796752330a4a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h2428cf5522890aa9
   1:     0x796752a13e66 - core::fmt::write::he09bc0adde53f273
   2:     0x796753a04e51 - std::io::Write::write_fmt::h8aa4c2751d4272d4
   3:     0x7967523308a2 - std::sys::backtrace::BacktraceLock::print::hcefd2583fd97e6ee
   4:     0x796752332dba - std::panicking::default_hook::{{closure}}::h43d52597303af53b
   5:     0x796752332c03 - std::panicking::default_hook::h5c93d5219b713a62
   6:     0x7967514accd8 - std[384ecadd2dc3f8cb]::panicking::update_hook::<alloc[db4b4cd89b60ab9f]::boxed::Box<rustc_driver_impl[e8fc819e0039f031]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x796752333578 - std::panicking::rust_panic_with_hook::h4f647691f5f64bc8
   8:     0x79675233326a - std::panicking::begin_panic_handler::{{closure}}::h10fb5701d5171b48
   9:     0x796752330ef9 - std::sys::backtrace::__rust_end_short_backtrace::h603cbea6335a690a
  10:     0x796752332f2d - rust_begin_unwind
  11:     0x79674efad900 - core::panicking::panic_fmt::heb55c586d8f2e24d
  12:     0x796751690c70 - <rustc_hir_analysis[46397548448bfa57]::collect::predicates_of::const_evaluatable_predicates_of::{closure#0}::ConstCollector as rustc_type_ir[ff4282bc65b2da30]::visit::TypeVisitor<rustc_middle[e0e03a33c8d7f1f7]::ty::context::TyCtxt>>::visit_const
  13:     0x7967515d7534 - <rustc_middle[e0e03a33c8d7f1f7]::ty::Ty as rustc_type_ir[ff4282bc65b2da30]::visit::TypeSuperVisitable<rustc_middle[e0e03a33c8d7f1f7]::ty::context::TyCtxt>>::super_visit_with::<rustc_hir_analysis[46397548448bfa57]::collect::predicates_of::const_evaluatable_predicates_of::{closure#0}::ConstCollector>
  14:     0x7967515c52d4 - <rustc_middle[e0e03a33c8d7f1f7]::ty::generic_args::GenericArg as rustc_type_ir[ff4282bc65b2da30]::visit::TypeVisitable<rustc_middle[e0e03a33c8d7f1f7]::ty::context::TyCtxt>>::visit_with::<rustc_hir_analysis[46397548448bfa57]::collect::predicates_of::const_evaluatable_predicates_of::{closure#0}::ConstCollector>
  15:     0x79675380a405 - rustc_hir_analysis[46397548448bfa57]::collect::predicates_of::gather_explicit_predicates_of
  16:     0x7967538025ac - rustc_query_impl[98ef067b3bf0a203]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[98ef067b3bf0a203]::query_impl::explicit_predicates_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e0e03a33c8d7f1f7]::query::erase::Erased<[u8; 24usize]>>
  17:     0x796752c040f0 - rustc_query_system[b488039ea52bf9c1]::query::plumbing::try_execute_query::<rustc_query_impl[98ef067b3bf0a203]::DynamicConfig<rustc_query_system[b488039ea52bf9c1]::query::caches::DefIdCache<rustc_middle[e0e03a33c8d7f1f7]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[98ef067b3bf0a203]::plumbing::QueryCtxt, false>
  18:     0x796752c03928 - rustc_query_impl[98ef067b3bf0a203]::query_impl::explicit_predicates_of::get_query_non_incr::__rust_end_short_backtrace
  19:     0x796752c02046 - rustc_hir_analysis[46397548448bfa57]::collect::predicates_of::predicates_of
  20:     0x796752c01f53 - rustc_query_impl[98ef067b3bf0a203]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[98ef067b3bf0a203]::query_impl::predicates_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e0e03a33c8d7f1f7]::query::erase::Erased<[u8; 24usize]>>
  21:     0x796752c040d9 - rustc_query_system[b488039ea52bf9c1]::query::plumbing::try_execute_query::<rustc_query_impl[98ef067b3bf0a203]::DynamicConfig<rustc_query_system[b488039ea52bf9c1]::query::caches::DefIdCache<rustc_middle[e0e03a33c8d7f1f7]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[98ef067b3bf0a203]::plumbing::QueryCtxt, false>
  22:     0x796752c03828 - rustc_query_impl[98ef067b3bf0a203]::query_impl::predicates_of::get_query_non_incr::__rust_end_short_backtrace
  23:     0x796752b44b86 - <rustc_hir_analysis[46397548448bfa57]::collect::CollectItemTypesVisitor as rustc_hir[ba2a02c35fb5c65a]::intravisit::Visitor>::visit_item
  24:     0x79675036d554 - rustc_hir_analysis[46397548448bfa57]::check::wfcheck::check_well_formed
  25:     0x796753407187 - rustc_query_impl[98ef067b3bf0a203]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[98ef067b3bf0a203]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e0e03a33c8d7f1f7]::query::erase::Erased<[u8; 1usize]>>
  26:     0x796753406c29 - rustc_query_system[b488039ea52bf9c1]::query::plumbing::try_execute_query::<rustc_query_impl[98ef067b3bf0a203]::DynamicConfig<rustc_data_structures[d1ce39d1de0b1fa1]::vec_cache::VecCache<rustc_span[1757226b21a7b214]::def_id::LocalDefId, rustc_middle[e0e03a33c8d7f1f7]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[b488039ea52bf9c1]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[98ef067b3bf0a203]::plumbing::QueryCtxt, false>
  27:     0x796753406690 - rustc_query_impl[98ef067b3bf0a203]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7967534073f6 - rustc_hir_analysis[46397548448bfa57]::check::wfcheck::check_mod_type_wf
  29:     0x796753407215 - rustc_query_impl[98ef067b3bf0a203]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[98ef067b3bf0a203]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e0e03a33c8d7f1f7]::query::erase::Erased<[u8; 1usize]>>
  30:     0x79675359afc4 - rustc_query_system[b488039ea52bf9c1]::query::plumbing::try_execute_query::<rustc_query_impl[98ef067b3bf0a203]::DynamicConfig<rustc_query_system[b488039ea52bf9c1]::query::caches::DefaultCache<rustc_span[1757226b21a7b214]::def_id::LocalModDefId, rustc_middle[e0e03a33c8d7f1f7]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[98ef067b3bf0a203]::plumbing::QueryCtxt, false>
  31:     0x79675359ad58 - rustc_query_impl[98ef067b3bf0a203]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  32:     0x796752c3c1dc - rustc_hir_analysis[46397548448bfa57]::check_crate
  33:     0x796752e81ffc - rustc_interface[19e906a0247efa0f]::passes::run_required_analyses
  34:     0x7967539db15e - rustc_interface[19e906a0247efa0f]::passes::analysis
  35:     0x7967539db12f - rustc_query_impl[98ef067b3bf0a203]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[98ef067b3bf0a203]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e0e03a33c8d7f1f7]::query::erase::Erased<[u8; 1usize]>>
  36:     0x7967539ee03a - rustc_query_system[b488039ea52bf9c1]::query::plumbing::try_execute_query::<rustc_query_impl[98ef067b3bf0a203]::DynamicConfig<rustc_query_system[b488039ea52bf9c1]::query::caches::SingleCache<rustc_middle[e0e03a33c8d7f1f7]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[98ef067b3bf0a203]::plumbing::QueryCtxt, false>
  37:     0x7967539edd0e - rustc_query_impl[98ef067b3bf0a203]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  38:     0x796753a64eb9 - rustc_interface[19e906a0247efa0f]::interface::run_compiler::<core[d10d7d384d677628]::result::Result<(), rustc_span[1757226b21a7b214]::ErrorGuaranteed>, rustc_driver_impl[e8fc819e0039f031]::run_compiler::{closure#0}>::{closure#1}
  39:     0x79675392d0a1 - std[384ecadd2dc3f8cb]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[19e906a0247efa0f]::util::run_in_thread_with_globals<rustc_interface[19e906a0247efa0f]::util::run_in_thread_pool_with_globals<rustc_interface[19e906a0247efa0f]::interface::run_compiler<core[d10d7d384d677628]::result::Result<(), rustc_span[1757226b21a7b214]::ErrorGuaranteed>, rustc_driver_impl[e8fc819e0039f031]::run_compiler::{closure#0}>::{closure#1}, core[d10d7d384d677628]::result::Result<(), rustc_span[1757226b21a7b214]::ErrorGuaranteed>>::{closure#0}, core[d10d7d384d677628]::result::Result<(), rustc_span[1757226b21a7b214]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d10d7d384d677628]::result::Result<(), rustc_span[1757226b21a7b214]::ErrorGuaranteed>>
  40:     0x79675392cd48 - <<std[384ecadd2dc3f8cb]::thread::Builder>::spawn_unchecked_<rustc_interface[19e906a0247efa0f]::util::run_in_thread_with_globals<rustc_interface[19e906a0247efa0f]::util::run_in_thread_pool_with_globals<rustc_interface[19e906a0247efa0f]::interface::run_compiler<core[d10d7d384d677628]::result::Result<(), rustc_span[1757226b21a7b214]::ErrorGuaranteed>, rustc_driver_impl[e8fc819e0039f031]::run_compiler::{closure#0}>::{closure#1}, core[d10d7d384d677628]::result::Result<(), rustc_span[1757226b21a7b214]::ErrorGuaranteed>>::{closure#0}, core[d10d7d384d677628]::result::Result<(), rustc_span[1757226b21a7b214]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d10d7d384d677628]::result::Result<(), rustc_span[1757226b21a7b214]::ErrorGuaranteed>>::{closure#1} as core[d10d7d384d677628]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:     0x79675392c47b - std::sys::pal::unix::thread::Thread::new::thread_start::h0add28f288e85e68
  42:     0x79674dc9439d - <unknown>
  43:     0x79674dd1949c - <unknown>
  44:                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: please make sure that you have updated to the latest nightly

note: please attach the file at `/share/pkehl/GIT/phantom-newtype-rs3/rustc-ice-2024-12-09T22_42_14-3000742.txt` to your bug report

query stack during panic:
#0 [explicit_predicates_of] computing explicit predicates of `main::_doctest_main_src_lib_rs_16_0::<impl at src/lib.rs:13:1: 13:35>`
#1 [predicates_of] computing predicates of `main::_doctest_main_src_lib_rs_16_0::<impl at src/lib.rs:13:1: 13:35>`
end of query stack

rustc-ice-2024-12-09T22_42_14-3000742.txt

Please suggest if this subset is likely to be covered by #133199, or if I should open a new issue for it.

@jieyouxu
Copy link
Member

jieyouxu commented Dec 10, 2024

This might be slightly different (but I suspect the same root cause). Gonna reopen this in case it's not quite the same.

@jieyouxu jieyouxu reopened this Dec 10, 2024
peter-lyons-kehl added a commit to peter-lyons-kehl/phantom-newtype-rs that referenced this issue Dec 10, 2024
peter-lyons-kehl added a commit to peter-lyons-kehl/phantom-newtype-rs that referenced this issue Dec 10, 2024
@peter-lyons-kehl
Copy link
Contributor Author

peter-lyons-kehl commented Dec 10, 2024

A new "trigger" (and a painful workaround) for this/similar ICE: While figuring out a workaround for the above subset, it turned out that this (the following ICE branch/path) gets triggered when

  • a library crate defines a type alias that "specializes"/narrows down a const generic-based struct/enum. Below: pub type IdAliasSpecialized<Repr> = IdForFlags<{ TraitFlags::ONE }, Repr>;
  • a consumer crate imports & uses that alias -> ICE. Unsure what exactly is needed, see my minimization below.

But, if, instead, the consumer crate imports the "unspecialized" const generic-based struct/enum, whether

  • "directly" under the name it was defined in the library: IdForFlags, or
  • "indirectly" through that library's pub type alias that does NOT "specialize" that struct/enum: pub type IdAliasNotSpecialized<const TF: TraitFlags, Repr> = IdForFlags<TF, Repr>;,

and then the consumer crate makes a "specialization" alias (respectively to the above choice of use import):

  • type MessageId = phantom_newtype::IdForFlags<{phantom_newtype::TraitFlags::ONE}, ()>; or
  • type MessageId = phantom_newtype::IdAliasNotSpecialized<{phantom_newtype::TraitFlags::ONE}, ()

then no ICE.

https://github.com/peter-lyons-kehl/phantom-newtype-rs/blob/ICE_triggered_by_cross_crate_type_alias/src/lib.rs #6ef07d9 copied here (phantom_newtype is the library crate name in Cargo.toml):

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

#[derive(Eq, PartialEq, core::marker::ConstParamTy)]
pub enum TraitFlags {
    ONE,
}

pub trait DisplayerOf<T> {}

pub struct IdForFlags<const TF: TraitFlags, Repr>(Repr);

impl<const TF: TraitFlags, Repr> IdForFlags<TF, Repr> {
    pub const fn new(repr: Repr) -> Self {
        Self(repr)
    }
}

pub type IdAliasSpecialized<Repr> = IdForFlags<{ TraitFlags::ONE }, Repr>;
pub type IdAliasNotSpecialized<const TF: TraitFlags, Repr> = IdForFlags<TF, Repr>;

/// ```
/// #![feature(generic_const_exprs)]
///
/// use phantom_newtype::DisplayerOf;
///
/// enum Message {}
/// // This causes ICE (with feature `unstable_generic_const_own_type`):
/// type MessageId = phantom_newtype::IdAliasSpecialized<()>;
/// //
/// // No ICE:
/// //type MessageId = phantom_newtype::IdForFlags<{phantom_newtype::TraitFlags::ONE}, ()>;
/// //
/// // No ICE:
/// //type MessageId = phantom_newtype::IdAliasNotSpecialized<{phantom_newtype::TraitFlags::ONE}, ()>;
///
/// impl DisplayerOf<MessageId> for Message {}
///
/// MessageId::new(());
/// ```
pub const SEE_DOC_TEST_FOR_ICE: () = {};

No crate feature needed, just cargo +nightly test.
Output:

.....
thread 'rustc' panicked at compiler/rustc_hir_analysis/src/collect/predicates_of.rs:401:60:
DefId::expect_local: `DefId(20:16 ~ phantom_newtype[e105]::IdAliasSpecialized::{constant#0})` isn't local
stack backtrace:
   0:     0x72fd92530a4a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h2428cf5522890aa9
   1:     0x72fd92c13e66 - core::fmt::write::he09bc0adde53f273
   2:     0x72fd93c04e51 - std::io::Write::write_fmt::h8aa4c2751d4272d4
   3:     0x72fd925308a2 - std::sys::backtrace::BacktraceLock::print::hcefd2583fd97e6ee
   4:     0x72fd92532dba - std::panicking::default_hook::{{closure}}::h43d52597303af53b
   5:     0x72fd92532c03 - std::panicking::default_hook::h5c93d5219b713a62
   6:     0x72fd916accd8 - std[384ecadd2dc3f8cb]::panicking::update_hook::<alloc[db4b4cd89b60ab9f]::boxed::Box<rustc_driver_impl[e8fc819e0039f031]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x72fd92533578 - std::panicking::rust_panic_with_hook::h4f647691f5f64bc8
   8:     0x72fd9253326a - std::panicking::begin_panic_handler::{{closure}}::h10fb5701d5171b48
   9:     0x72fd92530ef9 - std::sys::backtrace::__rust_end_short_backtrace::h603cbea6335a690a
  10:     0x72fd92532f2d - rust_begin_unwind
  11:     0x72fd8f1ad900 - core::panicking::panic_fmt::heb55c586d8f2e24d
  12:     0x72fd91890c70 - <rustc_hir_analysis[46397548448bfa57]::collect::predicates_of::const_evaluatable_predicates_of::{closure#0}::ConstCollector as rustc_type_ir[ff4282bc65b2da30]::visit::TypeVisitor<rustc_middle[e0e03a33c8d7f1f7]::ty::context::TyCtxt>>::visit_const
  13:     0x72fd917d7534 - <rustc_middle[e0e03a33c8d7f1f7]::ty::Ty as rustc_type_ir[ff4282bc65b2da30]::visit::TypeSuperVisitable<rustc_middle[e0e03a33c8d7f1f7]::ty::context::TyCtxt>>::super_visit_with::<rustc_hir_analysis[46397548448bfa57]::collect::predicates_of::const_evaluatable_predicates_of::{closure#0}::ConstCollector>
  14:     0x72fd917c52d4 - <rustc_middle[e0e03a33c8d7f1f7]::ty::generic_args::GenericArg as rustc_type_ir[ff4282bc65b2da30]::visit::TypeVisitable<rustc_middle[e0e03a33c8d7f1f7]::ty::context::TyCtxt>>::visit_with::<rustc_hir_analysis[46397548448bfa57]::collect::predicates_of::const_evaluatable_predicates_of::{closure#0}::ConstCollector>
  15:     0x72fd93a0a405 - rustc_hir_analysis[46397548448bfa57]::collect::predicates_of::gather_explicit_predicates_of
  16:     0x72fd93a025ac - rustc_query_impl[98ef067b3bf0a203]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[98ef067b3bf0a203]::query_impl::explicit_predicates_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e0e03a33c8d7f1f7]::query::erase::Erased<[u8; 24usize]>>
  17:     0x72fd92e040f0 - rustc_query_system[b488039ea52bf9c1]::query::plumbing::try_execute_query::<rustc_query_impl[98ef067b3bf0a203]::DynamicConfig<rustc_query_system[b488039ea52bf9c1]::query::caches::DefIdCache<rustc_middle[e0e03a33c8d7f1f7]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[98ef067b3bf0a203]::plumbing::QueryCtxt, false>
  18:     0x72fd92e03928 - rustc_query_impl[98ef067b3bf0a203]::query_impl::explicit_predicates_of::get_query_non_incr::__rust_end_short_backtrace
  19:     0x72fd92e02046 - rustc_hir_analysis[46397548448bfa57]::collect::predicates_of::predicates_of
  20:     0x72fd92e01f53 - rustc_query_impl[98ef067b3bf0a203]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[98ef067b3bf0a203]::query_impl::predicates_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e0e03a33c8d7f1f7]::query::erase::Erased<[u8; 24usize]>>
  21:     0x72fd92e040d9 - rustc_query_system[b488039ea52bf9c1]::query::plumbing::try_execute_query::<rustc_query_impl[98ef067b3bf0a203]::DynamicConfig<rustc_query_system[b488039ea52bf9c1]::query::caches::DefIdCache<rustc_middle[e0e03a33c8d7f1f7]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[98ef067b3bf0a203]::plumbing::QueryCtxt, false>
  22:     0x72fd92e03828 - rustc_query_impl[98ef067b3bf0a203]::query_impl::predicates_of::get_query_non_incr::__rust_end_short_backtrace
  23:     0x72fd92d44b86 - <rustc_hir_analysis[46397548448bfa57]::collect::CollectItemTypesVisitor as rustc_hir[ba2a02c35fb5c65a]::intravisit::Visitor>::visit_item
  24:     0x72fd9056d554 - rustc_hir_analysis[46397548448bfa57]::check::wfcheck::check_well_formed
  25:     0x72fd93607187 - rustc_query_impl[98ef067b3bf0a203]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[98ef067b3bf0a203]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e0e03a33c8d7f1f7]::query::erase::Erased<[u8; 1usize]>>
  26:     0x72fd93606c29 - rustc_query_system[b488039ea52bf9c1]::query::plumbing::try_execute_query::<rustc_query_impl[98ef067b3bf0a203]::DynamicConfig<rustc_data_structures[d1ce39d1de0b1fa1]::vec_cache::VecCache<rustc_span[1757226b21a7b214]::def_id::LocalDefId, rustc_middle[e0e03a33c8d7f1f7]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[b488039ea52bf9c1]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[98ef067b3bf0a203]::plumbing::QueryCtxt, false>
  27:     0x72fd93606690 - rustc_query_impl[98ef067b3bf0a203]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  28:     0x72fd936073f6 - rustc_hir_analysis[46397548448bfa57]::check::wfcheck::check_mod_type_wf
  29:     0x72fd93607215 - rustc_query_impl[98ef067b3bf0a203]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[98ef067b3bf0a203]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e0e03a33c8d7f1f7]::query::erase::Erased<[u8; 1usize]>>
  30:     0x72fd9379afc4 - rustc_query_system[b488039ea52bf9c1]::query::plumbing::try_execute_query::<rustc_query_impl[98ef067b3bf0a203]::DynamicConfig<rustc_query_system[b488039ea52bf9c1]::query::caches::DefaultCache<rustc_span[1757226b21a7b214]::def_id::LocalModDefId, rustc_middle[e0e03a33c8d7f1f7]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[98ef067b3bf0a203]::plumbing::QueryCtxt, false>
  31:     0x72fd9379ad58 - rustc_query_impl[98ef067b3bf0a203]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  32:     0x72fd92e3c1dc - rustc_hir_analysis[46397548448bfa57]::check_crate
  33:     0x72fd93081ffc - rustc_interface[19e906a0247efa0f]::passes::run_required_analyses
  34:     0x72fd93bdb15e - rustc_interface[19e906a0247efa0f]::passes::analysis
  35:     0x72fd93bdb12f - rustc_query_impl[98ef067b3bf0a203]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[98ef067b3bf0a203]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e0e03a33c8d7f1f7]::query::erase::Erased<[u8; 1usize]>>
  36:     0x72fd93bee03a - rustc_query_system[b488039ea52bf9c1]::query::plumbing::try_execute_query::<rustc_query_impl[98ef067b3bf0a203]::DynamicConfig<rustc_query_system[b488039ea52bf9c1]::query::caches::SingleCache<rustc_middle[e0e03a33c8d7f1f7]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[98ef067b3bf0a203]::plumbing::QueryCtxt, false>
  37:     0x72fd93bedd0e - rustc_query_impl[98ef067b3bf0a203]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  38:     0x72fd93c64eb9 - rustc_interface[19e906a0247efa0f]::interface::run_compiler::<core[d10d7d384d677628]::result::Result<(), rustc_span[1757226b21a7b214]::ErrorGuaranteed>, rustc_driver_impl[e8fc819e0039f031]::run_compiler::{closure#0}>::{closure#1}
  39:     0x72fd93b2d0a1 - std[384ecadd2dc3f8cb]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[19e906a0247efa0f]::util::run_in_thread_with_globals<rustc_interface[19e906a0247efa0f]::util::run_in_thread_pool_with_globals<rustc_interface[19e906a0247efa0f]::interface::run_compiler<core[d10d7d384d677628]::result::Result<(), rustc_span[1757226b21a7b214]::ErrorGuaranteed>, rustc_driver_impl[e8fc819e0039f031]::run_compiler::{closure#0}>::{closure#1}, core[d10d7d384d677628]::result::Result<(), rustc_span[1757226b21a7b214]::ErrorGuaranteed>>::{closure#0}, core[d10d7d384d677628]::result::Result<(), rustc_span[1757226b21a7b214]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d10d7d384d677628]::result::Result<(), rustc_span[1757226b21a7b214]::ErrorGuaranteed>>
  40:     0x72fd93b2cd48 - <<std[384ecadd2dc3f8cb]::thread::Builder>::spawn_unchecked_<rustc_interface[19e906a0247efa0f]::util::run_in_thread_with_globals<rustc_interface[19e906a0247efa0f]::util::run_in_thread_pool_with_globals<rustc_interface[19e906a0247efa0f]::interface::run_compiler<core[d10d7d384d677628]::result::Result<(), rustc_span[1757226b21a7b214]::ErrorGuaranteed>, rustc_driver_impl[e8fc819e0039f031]::run_compiler::{closure#0}>::{closure#1}, core[d10d7d384d677628]::result::Result<(), rustc_span[1757226b21a7b214]::ErrorGuaranteed>>::{closure#0}, core[d10d7d384d677628]::result::Result<(), rustc_span[1757226b21a7b214]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d10d7d384d677628]::result::Result<(), rustc_span[1757226b21a7b214]::ErrorGuaranteed>>::{closure#1} as core[d10d7d384d677628]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:     0x72fd93b2c47b - std::sys::pal::unix::thread::Thread::new::thread_start::h0add28f288e85e68
  42:     0x72fd8dea339d - <unknown>
  43:     0x72fd8df2849c - <unknown>
  44:                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: please make sure that you have updated to the latest nightly

note: please attach the file at `/share/pkehl/GIT/phantom-newtype-rs2/rustc-ice-2024-12-10T18_25_15-344078.txt` to your bug report

query stack during panic:
#0 [explicit_predicates_of] computing explicit predicates of `main::_doctest_main_src_lib_rs_23_0::<impl at src/lib.rs:19:1: 19:40>`
#1 [predicates_of] computing predicates of `main::_doctest_main_src_lib_rs_23_0::<impl at src/lib.rs:19:1: 19:40>`
end of query stack
warning: 1 warning emitted

Couldn't compile the test.

failures:
    src/lib.rs - SEE_DOC_TEST_FOR_ICE (line 23)

rustc-ice-2024-12-10T18_25_15-344078.txt

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. F-generic_const_exprs `#![feature(generic_const_exprs)]` 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

No branches or pull requests

4 participants