diff options
| author | Wesley Wiser <wwiser@gmail.com> | 2019-12-27 11:44:36 -0500 |
|---|---|---|
| committer | Wesley Wiser <wwiser@gmail.com> | 2019-12-27 13:04:32 -0500 |
| commit | 25a8b5d58e3899084e191ffd9456f39d29c3263b (patch) | |
| tree | 770a1239529778173c709cf29b2826faee379a12 /src/test/mir-opt/inline | |
| parent | 41501a6b03a8f10d8c29dfcb37dbd5ff84b33f34 (diff) | |
| download | rust-25a8b5d58e3899084e191ffd9456f39d29c3263b.tar.gz rust-25a8b5d58e3899084e191ffd9456f39d29c3263b.zip | |
Fix `Instance::resolve()` incorrectly returning specialized instances
We only want to return specializations when `Reveal::All` is passed, not when `Reveal::UserFacing` is. Resolving this fixes several issues with the `ConstProp`, `SimplifyBranches`, and `Inline` MIR optimization passes. Fixes #66901
Diffstat (limited to 'src/test/mir-opt/inline')
| -rw-r--r-- | src/test/mir-opt/inline/inline-specialization.rs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/test/mir-opt/inline/inline-specialization.rs b/src/test/mir-opt/inline/inline-specialization.rs new file mode 100644 index 00000000000..9591019bb4f --- /dev/null +++ b/src/test/mir-opt/inline/inline-specialization.rs @@ -0,0 +1,48 @@ +#![feature(specialization)] + +fn main() { + let x = <Vec::<()> as Foo>::bar(); +} + +trait Foo { + fn bar() -> u32; +} + +impl<T> Foo for Vec<T> { + #[inline(always)] + default fn bar() -> u32 { 123 } +} + +// END RUST SOURCE +// START rustc.main.Inline.before.mir +// let mut _0: (); +// let _1: u32; +// scope 1 { +// debug x => _1; +// } +// bb0: { +// StorageLive(_1); +// _1 = const <std::vec::Vec<()> as Foo>::bar() -> bb1; +// } +// bb1: { +// _0 = (); +// StorageDead(_1); +// return; +// } +// END rustc.main.Inline.before.mir +// START rustc.main.Inline.after.mir +// let mut _0: (); +// let _1: u32; +// scope 1 { +// debug x => _1; +// } +// scope 2 { +// } +// bb0: { +// StorageLive(_1); +// _1 = const 123u32; +// _0 = (); +// StorageDead(_1); +// return; +// } +// END rustc.main.Inline.after.mir |
