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

Complex generic constants cause 'not user writable' panic when invoked by rustdoc #77647

Closed
zeyonaut opened this issue Oct 7, 2020 · 6 comments · Fixed by #86242
Closed

Complex generic constants cause 'not user writable' panic when invoked by rustdoc #77647

zeyonaut opened this issue Oct 7, 2020 · 6 comments · Fixed by #86242
Assignees
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. F-const_generics `#![feature(const_generics)]` F-generic_const_exprs `#![feature(generic_const_exprs)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@zeyonaut
Copy link

zeyonaut commented Oct 7, 2020

Code

#![feature(const_generics, const_evaluatable_checked)]
#![allow(incomplete_features)]
struct A<T, const N: core::num::NonZeroUsize>([T; N.get()]) where [T; N.get()]: Sized;

Meta

rustc --version --verbose:

rustc 1.49.0-nightly (98edd1fbf 2020-10-06)
binary: rustc
commit-hash: 98edd1fbf8a68977a2a7c1312eb1ebff80515a92
commit-date: 2020-10-06
host: x86_64-pc-windows-msvc
release: 1.49.0-nightly
LLVM version: 11.0

Error output

cargo doc

thread 'rustc' panicked at 'not user writable', src\librustdoc\clean\mod.rs:512:63
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

error: Unrecognized option: 'crate-version'

error: could not document `bugtest`
Backtrace

stack backtrace:
   0:     0x7ff948f79859 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc20a26e0f7659afd
   1:     0x7ff948fa6f8b - core::fmt::write::h435be716304d26a1
   2:     0x7ff948f6b1d8 - <std::io::IoSlice as core::fmt::Debug>::fmt::h997d94c78f1ba97b
   3:     0x7ff948f7ec44 - std::panicking::take_hook::hbf7e33d26fc3ca30
   4:     0x7ff948f7e828 - std::panicking::take_hook::hbf7e33d26fc3ca30
   5:     0x7ff903296257 - rustc_driver::report_ice::hf0a13013cc3176ab
   6:     0x7ff948f7f6a0 - std::panicking::rust_panic_with_hook::h19068ccbe4b337a1
   7:     0x7ff6e4f92ca4 - <unknown>
   8:     0x7ff6e4f921bf - <unknown>
   9:     0x7ff6e4df193d - <unknown>
  10:     0x7ff6e5060f92 - <unknown>
  11:     0x7ff6e5090644 - <unknown>
  12:     0x7ff6e50629ac - <unknown>
  13:     0x7ff6e4ebc376 - <unknown>
  14:     0x7ff6e4ed8b14 - <unknown>
  15:     0x7ff6e4f3ae47 - <unknown>
  16:     0x7ff6e4e9d692 - <unknown>
  17:     0x7ff6e509632d - <unknown>
  18:     0x7ff6e50cd1b8 - <unknown>
  19:     0x7ff6e4ddeb6c - <unknown>
  20:     0x7ff6e508f0a7 - <unknown>
  21:     0x7ff6e4dce6c0 - <unknown>
  22:     0x7ff6e4dde7bf - <unknown>
  23:     0x7ff6e4dd8c1f - <unknown>
  24:     0x7ff6e4d95ea8 - <unknown>
  25:     0x7ff6e4ee10c9 - <unknown>
  26:     0x7ff6e4e975f5 - <unknown>
  27:     0x7ff6e4ee2fe4 - <unknown>
  28:     0x7ff6e4de6488 - <unknown>
  29:     0x7ff6e4ed575c - <unknown>
  30:     0x7ff6e4f9284b - <unknown>
  31:     0x7ff6e50b7413 - <unknown>
  32:     0x7ff948f8f577 - std::sys::windows::thread::Thread::new::h04914a10b014a9d7
  33:     0x7ff99b6c7bd4 - BaseThreadInitThunk
  34:     0x7ff99d2ace51 - RtlUserThreadStart

@zeyonaut zeyonaut 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 Oct 7, 2020
@jonas-schievink jonas-schievink added F-generic_const_exprs `#![feature(generic_const_exprs)]` F-const_generics `#![feature(const_generics)]` requires-nightly This issue requires a nightly compiler in some way. labels Oct 7, 2020
@ghost
Copy link

ghost commented Oct 7, 2020

Related: #77645

@jyn514
Copy link
Member

jyn514 commented Oct 7, 2020

@lcnr do you know what's going on here? The rustdoc code is

ty::PredicateAtom::Subtype(..)
| ty::PredicateAtom::WellFormed(..)
| ty::PredicateAtom::ObjectSafe(..)
| ty::PredicateAtom::ClosureKind(..)
| ty::PredicateAtom::ConstEvaluatable(..)
| ty::PredicateAtom::ConstEquate(..)
| ty::PredicateAtom::TypeWellFormedFromEnv(..) => panic!("not user writable"),

@jyn514 jyn514 added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Oct 7, 2020
@lcnr
Copy link
Contributor

lcnr commented Oct 7, 2020

Yeah, that one's somewhat expected. const_evaluatable_checked adds ConstEvaluatable predicates to predicates_of, so we now have to deal with them in rustdoc, can fix this myself next week

@varkor varkor added the A-const-generics Area: const generics (parameters and arguments) label Oct 9, 2020
fanninpm added a commit to fanninpm/glacier that referenced this issue Feb 16, 2021
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Feb 16, 2021
@androm3da
Copy link
Contributor

I minimized the failure I'm seeing in rustdoc and it looks like it's this issue and not a separate one. Is there any workaround or is any const_evaluatable_checked expected to see this breakage w/rustdoc?

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

const fn a() -> usize {
    0
}
struct B
where
    [(); a()]: ;

@jyn514
Copy link
Member

jyn514 commented Apr 4, 2021

No, there's no workaround that I know of. I don't understand the implementation of const generics very well, nor does anyone else on the team.

@PiDelport
Copy link

Does anyone know what would be needed to fix this, or at least work around it enough to stop rustdoc from crashing?

(This is currently disabling rustdoc for our project, which relies on some const_evaluatable_checked code.)

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Jun 16, 2021
…ce, r=oli-obk

rustdoc- dont ICE on `ConstEvaluatable` predicates

Fixes rust-lang#77647

rustdoc doesn't need to be handling these as you cant write them, they just get added implicitly when you write a where clause containing an expression.
@bors bors closed this as completed in 9fcbbbb Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. F-const_generics `#![feature(const_generics)]` F-generic_const_exprs `#![feature(generic_const_exprs)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants