about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorLuqman Aden <laden@csclub.uwaterloo.ca>2016-07-05 03:44:26 -0400
committerLuqman Aden <laden@csclub.uwaterloo.ca>2016-07-05 03:48:12 -0400
commitfd3b4646cc505dad8ecf97fe0bb541b058a981ce (patch)
treeb32bd12c641d6d425eb1a6dbd91c5d519a19815f /src/test
parent0f4c4f8c2910d717044a041039a1a1aa914ff59e (diff)
downloadrust-fd3b4646cc505dad8ecf97fe0bb541b058a981ce.tar.gz
rust-fd3b4646cc505dad8ecf97fe0bb541b058a981ce.zip
Just pass in NodeId to FunctionContext::new instead of looking it up.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/auxiliary/xcrate_generic_fn_nested_return.rs26
-rw-r--r--src/test/run-pass/xcrate_generic_fn_nested_return.rs17
2 files changed, 43 insertions, 0 deletions
diff --git a/src/test/run-pass/auxiliary/xcrate_generic_fn_nested_return.rs b/src/test/run-pass/auxiliary/xcrate_generic_fn_nested_return.rs
new file mode 100644
index 00000000000..48fb05f7779
--- /dev/null
+++ b/src/test/run-pass/auxiliary/xcrate_generic_fn_nested_return.rs
@@ -0,0 +1,26 @@
+// Copyright 2016 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.
+
+pub struct Request {
+    pub id: String,
+    pub arg: String,
+}
+
+pub fn decode<T>() -> Result<Request, ()> {
+    (|| {
+        Ok(Request {
+            id: "hi".to_owned(),
+            arg: match Err(()) {
+                Ok(v) => v,
+                Err(e) => return Err(e)
+            },
+        })
+    })()
+}
diff --git a/src/test/run-pass/xcrate_generic_fn_nested_return.rs b/src/test/run-pass/xcrate_generic_fn_nested_return.rs
new file mode 100644
index 00000000000..181c9168682
--- /dev/null
+++ b/src/test/run-pass/xcrate_generic_fn_nested_return.rs
@@ -0,0 +1,17 @@
+// Copyright 2016 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.
+
+// aux-build:xcrate_generic_fn_nested_return.rs
+
+extern crate xcrate_generic_fn_nested_return as test;
+
+pub fn main() {
+    assert!(test::decode::<()>().is_err());
+}