]> git.lizzy.rs Git - rust.git/blob - src/test/ui/retslot-cast.rs
Auto merge of #55052 - newpavlov:patch-2, r=alexcrichton
[rust.git] / src / test / ui / retslot-cast.rs
1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11
12 #![allow(warnings)]
13
14 pub fn fail(x: Option<&(Iterator<Item=()>+Send)>)
15             -> Option<&Iterator<Item=()>> {
16     // This call used to trigger an LLVM assertion because the return
17     // slot had type "Option<&Iterator>"* instead of
18     // "Option<&(Iterator+Send)>"* -- but this now yields a
19     // compilation error and I'm not sure how to create a comparable
20     // test. To ensure that this PARTICULAR failure doesn't occur
21     // again, though, I've left this test here, so if this ever starts
22     // to compile again, we can adjust the test appropriately (clearly
23     // it should never ICE...). -nmatsakis
24     inner(x) //~ ERROR mismatched types
25 }
26
27 pub fn inner(x: Option<&(Iterator<Item=()>+Send)>)
28              -> Option<&(Iterator<Item=()>+Send)> {
29     x
30 }
31
32
33 fn main() {}