diff options
| author | Ariel Ben-Yehuda <ariel.byd@gmail.com> | 2017-01-11 09:50:24 +0200 |
|---|---|---|
| committer | Ariel Ben-Yehuda <ariel.byd@gmail.com> | 2017-01-11 09:50:24 +0200 |
| commit | 61b0b212f9609e56f06a63db8542c3a5288074d8 (patch) | |
| tree | 1dd9d3fb54d20043bfc1ad49c7d14cd173ffbe9c /src/test | |
| parent | 7ef1a69d2e05d86e0893763d2c86677e9c5f3d99 (diff) | |
| download | rust-61b0b212f9609e56f06a63db8542c3a5288074d8.tar.gz rust-61b0b212f9609e56f06a63db8542c3a5288074d8.zip | |
fix function arguments in constant promotion
we can't create the target block until *after* we promote the arguments - otherwise the arguments will be promoted into the target block. oops. Fixes #38985.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-pass/issue-37991.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/test/run-pass/issue-37991.rs b/src/test/run-pass/issue-37991.rs index cacc653871a..9bdde02d006 100644 --- a/src/test/run-pass/issue-37991.rs +++ b/src/test/run-pass/issue-37991.rs @@ -14,7 +14,14 @@ const fn foo() -> i64 { 3 } +const fn bar(x: i64) -> i64 { + x*2 +} + fn main() { let val = &(foo() % 2); assert_eq!(*val, 1); + + let val2 = &(bar(1+1) % 3); + assert_eq!(*val2, 1); } |
