about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2018-04-26 13:42:22 -0400
committerNiko Matsakis <niko@alum.mit.edu>2018-04-26 13:42:22 -0400
commit86e9a7ac43b7fc2de4fdc2127de568d523ce5284 (patch)
treef84cbf10b84ec4fca14907fe336f7d42f5768873 /src
parent0361e5938c17ca8761f955767756f972df018926 (diff)
downloadrust-86e9a7ac43b7fc2de4fdc2127de568d523ce5284.tar.gz
rust-86e9a7ac43b7fc2de4fdc2127de568d523ce5284.zip
add regression test
Fixes #49685
Diffstat (limited to 'src')
-rw-r--r--src/test/run-pass/issue-49685.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/run-pass/issue-49685.rs b/src/test/run-pass/issue-49685.rs
new file mode 100644
index 00000000000..1e4e7955323
--- /dev/null
+++ b/src/test/run-pass/issue-49685.rs
@@ -0,0 +1,22 @@
+// Copyright 2014 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.
+
+// Regression test for #49685: drop elaboration was not revealing the
+// value of `impl Trait` returns, leading to an ICE.
+
+fn main() {
+    let _ = Some(())
+        .into_iter()
+        .flat_map(|_| Some(()).into_iter().flat_map(func));
+}
+
+fn func(_: ()) -> impl Iterator<Item = ()> {
+    Some(()).into_iter().flat_map(|_| vec![])
+}