-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop doing weird index stuff in ElaborateBoxDerefs
- Loading branch information
1 parent
f82eb4d
commit 2e52d61
Showing
4 changed files
with
77 additions
and
8 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
13 changes: 13 additions & 0 deletions
13
tests/mir-opt/elaborate_box_deref_in_debuginfo.pointee.ElaborateBoxDerefs.diff
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 @@ | ||
- // MIR for `pointee` before ElaborateBoxDerefs | ||
+ // MIR for `pointee` after ElaborateBoxDerefs | ||
|
||
fn pointee(_1: Box<i32>) -> () { | ||
- debug foo => (*_1); | ||
+ debug foo => (*(((_1.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32)); | ||
let mut _0: (); | ||
|
||
bb0: { | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// skip-filecheck | ||
//@ test-mir-pass: ElaborateBoxDerefs | ||
|
||
#![feature(custom_mir, core_intrinsics)] | ||
|
||
extern crate core; | ||
use core::intrinsics::mir::*; | ||
|
||
// EMIT_MIR elaborate_box_deref_in_debuginfo.pointee.ElaborateBoxDerefs.diff | ||
#[custom_mir(dialect = "built")] | ||
fn pointee(opt: Box<i32>) { | ||
mir!( | ||
debug foo => *opt; | ||
{ | ||
Return() | ||
} | ||
) | ||
} | ||
|
||
fn main() {} |
35 changes: 35 additions & 0 deletions
35
tests/ui/async-await/async-closures/box-deref-in-debuginfo.rs
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,35 @@ | ||
//@ aux-build:block-on.rs | ||
//@ edition:2021 | ||
//@ run-pass | ||
|
||
#![feature(async_closure)] | ||
|
||
extern crate block_on; | ||
|
||
pub trait Trait { | ||
fn callback(&mut self); | ||
} | ||
impl Trait for (i32,) { | ||
fn callback(&mut self) { | ||
println!("hi {}", self.0); | ||
self.0 += 1; | ||
} | ||
} | ||
|
||
async fn call_once(f: impl async FnOnce()) { | ||
f().await; | ||
} | ||
|
||
async fn run(mut loader: Box<dyn Trait>) { | ||
let f = async move || { | ||
loader.callback(); | ||
loader.callback(); | ||
}; | ||
call_once(f).await; | ||
} | ||
|
||
fn main() { | ||
block_on::block_on(async { | ||
run(Box::new((42,))).await; | ||
}); | ||
} |