-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
#[rustc_layout(debug)]
ICEs when applied to some type aliases
#85103
Comments
Minimized further: #![feature(rustc_attrs)]
trait Foo {
type Bar;
}
#[rustc_layout(debug)]
type Edges<E> = <E as Foo>::Bar; |
Bisection seems to point to somewhere to an old nightly-2019-01-27
|
Hmm, shouldn't this be |
There are issues with computing layout for type aliases; see rust-lang#85103. Once the issues are fixed, we should re-enable layout docs for them.
ah yes, definitively. I think it's just a typo copying the command here 😅 because with |
Also got the same results with |
Oh, |
From the little evidence I gathered, I think I know why this ICEs. Here's an example that makes this obvious: // () does not implement Foo
type AlwaysInvalid = <() as Foo>::Bar; // no error...
struct Baz {
baz: AlwaysInvalid // ...until it is used: only now will the compiler complain about (): Foo not being satisfied
} By applying #[rustc_layout(debug)]
type Tea<'a> = <&'a [u32] as IntoIterator>::IntoIter; @camelid For your use case in rustdoc, I'm assuming you'd want to have a "layout error" instead of an ICE for things like |
Ah, that makes sense! Thanks for looking into this :) And yes, I think it would be helpful for my use case if it gave a layout error instead of an ICE. If I write a struct with the appropriate constraint, I get a #[rustc_layout(debug)]
struct Edges<'a, E>(Cow<'a, [E]>) where [E]: ToOwned;
Though for the normalization error maybe we should have a new |
Assigning priority as discussed in the Zulip thread of the Prioritization Working Group. @rustbot label -I-prioritize +P-medium edit: better a @rustbot label +P-high -P-medium |
I'll try to work on this. |
I'm moving this back down to P-medium, this only blocks new features and isn't a regression. |
Code
(Playground)
ICE
Backtrace
Background information
This is a minimization of a bug encountered in #83501. Rustdoc wants to show memory layout info for type aliases (see 78d4b453ad2e19d44011b26fc55c949bff5dba3d for an explanation of why we want to show it for type aliases in particular), but building the compiler docs failed (which probably means that many other crates would fail as well). The type alias that caused the ICE is
rustc_graphviz::Edges
, which (fortunately) can be extracted into an MCVE without any other dependencies. That is the MCVE that I used for this issue.The text was updated successfully, but these errors were encountered: