diff options
| author | kennytm <kennytm@gmail.com> | 2018-05-03 23:42:36 +0800 |
|---|---|---|
| committer | kennytm <kennytm@gmail.com> | 2018-05-04 02:12:55 +0800 |
| commit | dfb32af87d9524caae3edb2c74d6165380eda063 (patch) | |
| tree | 1d3ca26cccc27c85a97c5dda718fee02239689d7 /src/test | |
| parent | 5976e8ac6b62cb77e9f299c46557e61fd4588d2f (diff) | |
| parent | 83c45051f83e7dac6f5cb2d53f00f42b574d8165 (diff) | |
| download | rust-dfb32af87d9524caae3edb2c74d6165380eda063.tar.gz rust-dfb32af87d9524caae3edb2c74d6165380eda063.zip | |
Rollup merge of #50421 - kennytm:fix-50415-ice-when-returning-range-inclusive-from-closure, r=michaelwoerister
Fix ICE when using a..=b in a closure. Fix #50415.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-pass/issue-50415.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/test/run-pass/issue-50415.rs b/src/test/run-pass/issue-50415.rs new file mode 100644 index 00000000000..aa493ce0321 --- /dev/null +++ b/src/test/run-pass/issue-50415.rs @@ -0,0 +1,27 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + // -------- Simplified test case -------- + + let _ = || 0..=1; + + // -------- Original test case -------- + + let full_length = 1024; + let range = { + // do some stuff, omit here + None + }; + + let range = range.map(|(s, t)| s..=t).unwrap_or(0..=(full_length-1)); + + assert_eq!(range, 0..=1023); +} |
