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

ICE when generating docs with generic_const_exprs feature #92859

Closed
jimpo opened this issue Jan 13, 2022 · 3 comments · Fixed by #98535
Closed

ICE when generating docs with generic_const_exprs feature #92859

jimpo opened this issue Jan 13, 2022 · 3 comments · Fixed by #98535
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-generic_const_exprs `#![feature(generic_const_exprs)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jimpo
Copy link

jimpo commented Jan 13, 2022

With the experimental generic_const_exprs feature (#76560), there's a compiler issue that surfaces during documentation generation but not a regular build. In the code example below, cargo build produces an unhelpful error message.

Code

#![feature(generic_const_exprs)]

pub trait Foo: Sized {
	const WIDTH: usize;

	fn arrayify(self) -> [Self; Self::WIDTH];
}

impl<T: Sized> Foo for T {
	const WIDTH: usize = 1;

	fn arrayify(self) -> [Self; Self::WIDTH] {
		[self]
	}
}

Meta

rustc --version --verbose:

rustc 1.60.0-nightly (1bd4fdc94 2022-01-12)

Error output

The error on running cargo +nightly doc is:

error: internal compiler error: Encountered errors `[FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<T as std::marker::Sized>, polarity:Positive), []), depth=1),Unimplemented)]` resolving bounds after type-checking
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/codegen.rs:125:24
Backtrace

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1188:13
stack backtrace:
   0: rust_begin_unwind
             at /rustc/1bd4fdc943513e1004f498bbf289279c9784fc6f/library/std/src/panicking.rs:498:5
   1: core::panicking::panic_fmt
             at /rustc/1bd4fdc943513e1004f498bbf289279c9784fc6f/library/core/src/panicking.rs:110:14
   2: core::panicking::panic_display::<&str>
   3: <rustc_errors::HandlerInner>::flush_delayed
   4: <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop
   5: core::ptr::drop_in_place::<rustc_session::parse::ParseSess>
   6: <alloc::rc::Rc<rustc_session::session::Session> as core::ops::drop::Drop>::drop
   7: core::ptr::drop_in_place::<rustc_interface::interface::Compiler>
   8: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorReported>, rustdoc::main_options::{closure#0}>::{closure#1}>
   9: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorReported>, rustdoc::main_options::{closure#0}>
  10: rustdoc::main_options
  11: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustdoc::main_args::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@jimpo jimpo 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 Jan 13, 2022
@camelid camelid added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. F-generic_const_exprs `#![feature(generic_const_exprs)]` and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 25, 2022
@camelid camelid changed the title cargo doc generation with generic_const_exprs feature ICE when running rustdoc with generic_const_exprs feature Jan 25, 2022
@camelid camelid changed the title ICE when running rustdoc with generic_const_exprs feature ICE when generating docs with generic_const_exprs feature Jan 25, 2022
@GuillaumeGomez
Copy link
Member

Isn't it the same as #93882?

@workingjubilee
Copy link
Member

workingjubilee commented Feb 15, 2022

No, I don't think so, that initial instance did not require #![feature(generic_const_exprs)] to be enabled (we controlled for that variable using cfg_attr).

@lcnr
Copy link
Contributor

lcnr commented Jun 24, 2022

looks fixed to me, marking as needs-test

@lcnr lcnr added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Jun 24, 2022
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jun 26, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 26, 2022
…9, r=lcnr

Add regression test for generic const in rustdoc

Fixes rust-lang#92859.

r? `@lcnr`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 26, 2022
…9, r=lcnr

Add regression test for generic const in rustdoc

Fixes rust-lang#92859.

r? ``@lcnr``
@bors bors closed this as completed in 50b6e7d Jun 26, 2022
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. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-generic_const_exprs `#![feature(generic_const_exprs)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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.

5 participants