Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5dadfd5

Browse files
committed
Auto merge of #140918 - pietroalbini:pa-backport-140902, r=pietroalbini
Backport #140902 to beta This PR backports #140902 to the beta branch, to unblock the stage0 bump. r? `@ghost`
2 parents 1960d28 + b166e65 commit 5dadfd5

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

‎compiler/rustc_middle/src/ty/mod.rs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1924,6 +1924,9 @@ impl<'tcx> TyCtxt<'tcx> {
19241924
def_id: DefId,
19251925
args: GenericArgsRef<'tcx>,
19261926
) -> Option<&'tcx CoroutineLayout<'tcx>> {
1927+
if args[0].has_placeholders() || args[0].has_non_region_param() {
1928+
return None;
1929+
}
19271930
let instance = InstanceKind::AsyncDropGlue(def_id, Ty::new_coroutine(self, def_id, args));
19281931
self.mir_shims(instance).coroutine_layout_raw()
19291932
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//@ compile-flags: -Zmir-enable-passes=+DataflowConstProp
2+
//@ edition: 2021
3+
//@ build-pass
4+
#![feature(async_drop)]
5+
#![allow(incomplete_features)]
6+
7+
use std::mem::ManuallyDrop;
8+
use std::{
9+
future::async_drop_in_place,
10+
pin::{pin, Pin},
11+
};
12+
fn main() {
13+
a(b)
14+
}
15+
fn b() {}
16+
fn a<C>(d: C) {
17+
let e = pin!(ManuallyDrop::new(d));
18+
let f = unsafe { Pin::map_unchecked_mut(e, |g| &mut **g) };
19+
let h = unsafe { async_drop_in_place(f.get_unchecked_mut()) };
20+
h;
21+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /