-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Comments
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 I assume this is #133199 once again. |
Thank you so much @cyrgani.
|
What I meant with 2. was that my reduction only needs |
This looks most plausible to me. |
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 Contrary to the above fix/workaround identified by @cyrgani, for the below subset REMOVING Minimized at https://github.com/peter-lyons-kehl/phantom-newtype-rs branch From
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. |
This might be slightly different (but I suspect the same root cause). Gonna reopen this in case it's not quite the same. |
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
But, if, instead, the consumer crate imports the "unspecialized"
and then the consumer crate makes a "specialization" alias (respectively to the above choice of
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 ( #![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
|
Summary:
stable
uses a type alias (insrc/trait_flags.rs:
pub type TraitFlags = u8;
) instead of a custom struct.stable
runs all tests fine.nightly
(hopes to) usegeneric_const_exprs
. It's behindunstable_generic_const_own_type
feature - see the following.Surprisingly, even though it mentions ICE, the problem shows up
cargo +nightly test --features unstable_generic_const_own_type
cargo +nightly check --tests --features unstable_generic_const_own_type
.To replicate:
Code
See above.
Meta
Rustup installed as a Manjaro (Arch) package. Both
nightly
andstable
installed withrustup
and current:rustc --version --verbose
:Error output
See also attached ICE TXT files.
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
The text was updated successfully, but these errors were encountered: