-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add -Zunpretty=stable-mir output test #118375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,15 @@ | ||
// compile-flags: -Z unpretty=stable-mir -Z mir-opt-level=3 | ||
// check-pass | ||
// only-x86_64 | ||
|
||
fn foo(i:i32) -> i32 { | ||
i + 1 | ||
} | ||
|
||
fn bar(vec: &mut Vec<i32>) -> Vec<i32> { | ||
let mut new_vec = vec.clone(); | ||
new_vec.push(1); | ||
new_vec | ||
} | ||
|
||
fn main(){} |
This file contains hidden or 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,234 @@ | ||
// WARNING: This is highly experimental output it's intended for stable-mir developers only. | ||
// If you find a bug or want to improve the output open a issue at https://github.com/rust-lang/project-stable-mir. | ||
fn foo(_0: i32) -> i32 { | ||
let mut _0: (i32, bool); | ||
} | ||
bb0: { | ||
_2 = 1 Add const 1_i32 | ||
assert(!move _2 bool),"attempt to compute `{} + {}`, which would overflow", 1, const 1_i32) -> [success: bb1, unwind continue] | ||
} | ||
bb1: { | ||
_0 = move _2 | ||
return | ||
} | ||
fn bar(_0: &mut Ty { | ||
id: 10, | ||
kind: RigidTy( | ||
Adt( | ||
celinval marked this conversation as resolved.
Show resolved
Hide resolved
|
||
AdtDef( | ||
DefId { | ||
id: 3, | ||
name: "std::vec::Vec", | ||
}, | ||
), | ||
GenericArgs( | ||
[ | ||
Type( | ||
Ty { | ||
id: 11, | ||
kind: Param( | ||
ParamTy { | ||
index: 0, | ||
name: "T", | ||
}, | ||
), | ||
}, | ||
), | ||
Type( | ||
Ty { | ||
id: 12, | ||
kind: Param( | ||
ParamTy { | ||
index: 1, | ||
name: "A", | ||
}, | ||
), | ||
}, | ||
), | ||
], | ||
), | ||
), | ||
), | ||
}) -> Ty { | ||
id: 10, | ||
kind: RigidTy( | ||
Adt( | ||
AdtDef( | ||
DefId { | ||
id: 3, | ||
name: "std::vec::Vec", | ||
}, | ||
), | ||
GenericArgs( | ||
[ | ||
Type( | ||
Ty { | ||
id: 11, | ||
kind: Param( | ||
ParamTy { | ||
index: 0, | ||
name: "T", | ||
}, | ||
), | ||
}, | ||
), | ||
Type( | ||
Ty { | ||
id: 12, | ||
kind: Param( | ||
ParamTy { | ||
index: 1, | ||
name: "A", | ||
}, | ||
), | ||
}, | ||
), | ||
], | ||
), | ||
), | ||
), | ||
} { | ||
let mut _0: Ty { | ||
id: 10, | ||
kind: RigidTy( | ||
Adt( | ||
AdtDef( | ||
DefId { | ||
id: 3, | ||
name: "std::vec::Vec", | ||
}, | ||
), | ||
GenericArgs( | ||
[ | ||
Type( | ||
Ty { | ||
id: 11, | ||
kind: Param( | ||
ParamTy { | ||
index: 0, | ||
name: "T", | ||
}, | ||
), | ||
}, | ||
), | ||
Type( | ||
Ty { | ||
id: 12, | ||
kind: Param( | ||
ParamTy { | ||
index: 1, | ||
name: "A", | ||
}, | ||
), | ||
}, | ||
), | ||
], | ||
), | ||
), | ||
), | ||
}; | ||
let mut _1: &Ty { | ||
id: 10, | ||
kind: RigidTy( | ||
Adt( | ||
AdtDef( | ||
DefId { | ||
id: 3, | ||
name: "std::vec::Vec", | ||
}, | ||
), | ||
GenericArgs( | ||
[ | ||
Type( | ||
Ty { | ||
id: 11, | ||
kind: Param( | ||
ParamTy { | ||
index: 0, | ||
name: "T", | ||
}, | ||
), | ||
}, | ||
), | ||
Type( | ||
Ty { | ||
id: 12, | ||
kind: Param( | ||
ParamTy { | ||
index: 1, | ||
name: "A", | ||
}, | ||
), | ||
}, | ||
), | ||
], | ||
), | ||
), | ||
), | ||
}; | ||
let _2: (); | ||
let mut _3: &mut Ty { | ||
id: 10, | ||
kind: RigidTy( | ||
Adt( | ||
AdtDef( | ||
DefId { | ||
id: 3, | ||
name: "std::vec::Vec", | ||
}, | ||
), | ||
GenericArgs( | ||
[ | ||
Type( | ||
Ty { | ||
id: 11, | ||
kind: Param( | ||
ParamTy { | ||
index: 0, | ||
name: "T", | ||
}, | ||
), | ||
}, | ||
), | ||
Type( | ||
Ty { | ||
id: 12, | ||
kind: Param( | ||
ParamTy { | ||
index: 1, | ||
name: "A", | ||
}, | ||
), | ||
}, | ||
), | ||
], | ||
), | ||
), | ||
), | ||
}; | ||
} | ||
bb0: { | ||
_3 = refShared1 | ||
_2 = const <Vec<i32> as Clone>::clone(move _3) -> [return: bb1, unwind continue] | ||
} | ||
bb1: { | ||
_5 = refMut { | ||
kind: TwoPhaseBorrow, | ||
}2 | ||
_4 = const Vec::<i32>::push(move _5, const 1_i32) -> [return: bb2, unwind: bb3] | ||
} | ||
bb2: { | ||
_0 = move _2 | ||
return | ||
} | ||
bb3: { | ||
drop(_2) -> [return: bb4, unwind terminate] | ||
} | ||
bb4: { | ||
resume | ||
} | ||
fn main() -> () { | ||
} | ||
bb0: { | ||
return | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.