-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #113217 - ericmarkmartin:lower-type-relative-ctor-to-…
…adt, r=cjgillot resolve typerelative ctors to adt Associated issue: #110508 r? ``@spastorino``
- Loading branch information
Showing
8 changed files
with
529 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// EMIT_MIR issue_110508.{impl#0}-BAR.built.after.mir | ||
// EMIT_MIR issue_110508.{impl#0}-SELF_BAR.built.after.mir | ||
|
||
enum Foo { | ||
Bar(()), | ||
} | ||
|
||
impl Foo { | ||
const BAR: Foo = Foo::Bar(()); | ||
const SELF_BAR: Foo = Self::Bar(()); | ||
} | ||
|
||
fn main() {} |
14 changes: 14 additions & 0 deletions
14
tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// MIR for `<impl at $DIR/issue_110508.rs:8:1: 8:9>::BAR` after built | ||
|
||
const <impl at $DIR/issue_110508.rs:8:1: 8:9>::BAR: Foo = { | ||
let mut _0: Foo; | ||
let mut _1: (); | ||
|
||
bb0: { | ||
StorageLive(_1); | ||
_1 = (); | ||
_0 = Foo::Bar(move _1); | ||
StorageDead(_1); | ||
return; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// MIR for `<impl at $DIR/issue_110508.rs:8:1: 8:9>::SELF_BAR` after built | ||
|
||
const <impl at $DIR/issue_110508.rs:8:1: 8:9>::SELF_BAR: Foo = { | ||
let mut _0: Foo; | ||
let mut _1: (); | ||
|
||
bb0: { | ||
StorageLive(_1); | ||
_1 = (); | ||
_0 = Foo::Bar(move _1); | ||
StorageDead(_1); | ||
return; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// run-pass | ||
|
||
#[derive(PartialEq, Eq)] | ||
pub enum Foo { | ||
FooA(()), | ||
FooB(Vec<()>), | ||
} | ||
|
||
impl Foo { | ||
const A1: Foo = Foo::FooA(()); | ||
const A2: Foo = Self::FooA(()); | ||
const A3: Self = Foo::FooA(()); | ||
const A4: Self = Self::FooA(()); | ||
} | ||
|
||
fn main() { | ||
let foo = Foo::FooA(()); | ||
|
||
match foo { | ||
Foo::A1 => {}, | ||
_ => {}, | ||
} | ||
|
||
match foo { | ||
Foo::A2 => {}, | ||
_ => {}, | ||
} | ||
|
||
match foo { | ||
Foo::A3 => {}, | ||
_ => {}, | ||
} | ||
|
||
match foo { | ||
Foo::A4 => {}, | ||
_ => {}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// compile-flags: -Z unpretty=thir-flat | ||
// check-pass | ||
|
||
// Previously, the constants with `Self::Bar(())` would be `Call`s instead of | ||
// `Adt`s in THIR. | ||
|
||
pub enum Foo { | ||
Bar(()), | ||
} | ||
|
||
impl Foo { | ||
const BAR1: Foo = Foo::Bar(()); | ||
const BAR2: Foo = Self::Bar(()); | ||
const BAR3: Self = Foo::Bar(()); | ||
const BAR4: Self = Self::Bar(()); | ||
} | ||
|
||
fn main() {} |
Oops, something went wrong.