forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Work around opaque types hiding needs_drop
When building the MIR we sometimes try to unschedule drops. In this we assert that the drop has already been scheduled. Opaque types however may be initialized with an expression kind that we know doesn't have a type that needs to be dropped. To fix this we don't panic if we can't find the drop of a variable with an opaque type.
- Loading branch information
1 parent
0a726b6
commit 5c356c7
Showing
2 changed files
with
26 additions
and
0 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,22 @@ | ||
//@ check-pass | ||
|
||
fn if_else(c: bool) -> impl Sized { | ||
if c { () } else { () } | ||
} | ||
|
||
fn if_no_else(c: bool) -> impl Sized { | ||
if c {} | ||
} | ||
|
||
fn matches(c: bool) -> impl Sized { | ||
match c { | ||
true => (), | ||
_ => (), | ||
} | ||
} | ||
|
||
fn tuple_tuple(c: bool) -> (impl Sized,) { | ||
if c { ((),) } else { ((),) } | ||
} | ||
|
||
fn main() {} |