-
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
Duplicate definition of type for rustc::mir::Constant #56137
Comments
These types aren't always equal. e.g. the lifetimes often differ, and I think around impl trait some inconsistencies can happen, too. we should probably document this much better and/or figure out whether we need the duplication |
Looks like #61041 is blocked on fixing this. EDIT: to expand on that, this example: trait Zero {
type Repr;
const ZERO: Self::Repr;
}
impl Zero for char {
type Repr = u32;
const ZERO: u32 = 0;
}
const ONE: u32 = char::ZERO + 1; Has this for the // mir::Constant
// + span: src/lib.rs:11:18: 11:28
// + ty: u32
// + literal: Const { ty: <Self as Zero>::Repr, val: Unevaluated(DefId(0:14 ~ playground[5f8c]::Zero[0]::ZERO[0]), [char]) } Note the |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@RalfJung All of that is fine. I'm already fixing this. MIR construction is just wrong and likely has been since forever. |
Huh, looks like the bug is pretty recent: 5cd2806#diff-c599d3d6879ad974960a24abd4e4bdb6R953 |
Remove redundant `ty` fields from `mir::Constant` and `hair::pattern::PatternRange`. Fixes rust-lang#56137. As a side-effect, associated const literals have the correct type now, which should make things easier for rust-lang#61041. r? @oli-obk / @matthewjasper cc @davidtwco @varkor
Remove redundant `ty` fields from `mir::Constant` and `hair::pattern::PatternRange`. Fixes rust-lang#56137. As a side-effect, associated const literals have the correct type now, which should make things easier for rust-lang#61041. r? @oli-obk / @matthewjasper cc @davidtwco @varkor
Remove redundant `ty` fields from `mir::Constant` and `hair::pattern::PatternRange`. Fixes rust-lang#56137. As a side-effect, associated const literals have the correct type now, which should make things easier for rust-lang#61041. r? @oli-obk / @matthewjasper cc @davidtwco @varkor
Remove redundant `ty` fields from `mir::Constant` and `hair::pattern::PatternRange`. Fixes rust-lang#56137. As a side-effect, associated const literals have the correct type now, which should make things easier for rust-lang#61041. r? @oli-obk / @matthewjasper cc @davidtwco @varkor
Remove redundant `ty` fields from `mir::Constant` and `hair::pattern::PatternRange`. Fixes rust-lang#56137. As a side-effect, associated const literals have the correct type now, which should make things easier for rust-lang#61041. r? @oli-obk / @matthewjasper cc @davidtwco @varkor
rustc::mir::Constant
has a fieldty
, but its fieldliteral
contains aConst
which itself already contains aTy
.The text was updated successfully, but these errors were encountered: