]>
Commit | Line | Data |
---|---|---|
3157f602 XL |
1 | // Copyright 2014 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 | // This test was derived from the wasm and parsell crates. They | |
12 | // stopped compiling when #32330 is fixed. | |
13 | ||
14 | #![allow(dead_code, unused_variables)] | |
15 | #![deny(hr_lifetime_in_assoc_type)] | |
3157f602 XL |
16 | |
17 | use std::str::Chars; | |
18 | ||
19 | pub trait HasOutput<Ch, Str> { | |
20 | type Output; | |
21 | } | |
22 | ||
23 | #[derive(Clone, PartialEq, Eq, Hash, Ord, PartialOrd, Debug)] | |
24 | pub enum Token<'a> { | |
25 | Begin(&'a str) | |
26 | } | |
27 | ||
28 | fn mk_unexpected_char_err<'a>() -> Option<&'a i32> { | |
29 | unimplemented!() | |
30 | } | |
31 | ||
32 | fn foo<'a>(data: &mut Chars<'a>) { | |
33 | bar(mk_unexpected_char_err) | |
34 | //~^ ERROR lifetime parameter `'a` declared on fn `mk_unexpected_char_err` | |
35 | //~| WARNING hard error in a future release | |
36 | } | |
37 | ||
38 | fn bar<F>(t: F) | |
39 | // No type can satisfy this requirement, since `'a` does not | |
40 | // appear in any of the input types: | |
41 | where F: for<'a> Fn() -> Option<&'a i32> | |
42 | //~^ ERROR associated type `Output` references lifetime `'a`, which does not | |
43 | //~| WARNING hard error in a future release | |
44 | { | |
45 | } | |
46 | ||
47 | fn main() { | |
48 | } |