Repository navigation
ICE: rustdoc on issue-70453-generics-in-discr-ice-2.rs: enum discriminant depends on generics #79495
Copy link
Copy link
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-lowLow priorityLow priorityT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.
Description
Activity
- addedC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
on Nov 28, 2020 @rustbot label -T-compiler +T-rustdoc
- addedT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.and removedT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
on Nov 28, 2020 MCVE:
#[repr(usize)] enum MyWeirdOption<T> { None, Some = std::mem::size_of::<T>(), //~^ ERROR constant expression depends on a generic parameter }Rustc gives the correct error:
error: constant expression depends on a generic parameter --> enum.rs:4:12 | 4 | Some = std::mem::size_of::<T>(), | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this may fail depending on what value the parameter takesI expect this is the same sort of issue as #73566 (comment) where rustdoc ignores errors that the compiler requires to be emitted.
Adding P-low by the same rationale as #79496 (comment).
Appears to be fixed 🎉
error: generic parameters may not be used in const operations --> out.rs:9:35 | 9 | Some(T) = std::mem::size_of::<T>(), | ^ cannot perform const operation using `T` | = note: type parameters may not be used in const expressions = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions- addedE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
on Feb 18, 2022 Adding
#![feature(generic_const_exprs)]still causes the same ICE.warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes --> src/main.rs:1:58 | 1 | #![feature(arbitrary_enum_discriminant, core_intrinsics, generic_const_exprs)] | ^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(incomplete_features)]` on by default = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information error: internal compiler error: no errors encountered even though `delay_span_bug` issued error: internal compiler error: enum discriminant depends on generics --> src/main.rs:9:15 | 9 | Some(T) = std::mem::size_of::<T>(), | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: delayed at /rust/compiler/rustc_middle/src/ty/adt.rs:459:26Reacted by Matthias Krüger- removedE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
on Jul 19, 2022 - addedglacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.
on Mar 3, 2023 Fixed by #111215
Reacted by jyn
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-lowLow priorityLow priorityT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.
Code
code from
./src/test/ui/enum-discriminant/issue-70453-generics-in-discr-ice-2.rsMeta
rustc --version --verbose:Error output
Backtrace