]> git.lizzy.rs Git - rust.git/blob - tests/ui/issues/issue-10412.rs
Rollup merge of #106752 - sulami:master, r=estebank
[rust.git] / tests / ui / issues / issue-10412.rs
1 trait Serializable<'self, T> {
2     //~^ ERROR lifetimes cannot use keyword names
3     fn serialize(val: &'self T) -> Vec<u8>; //~ ERROR lifetimes cannot use keyword names
4     fn deserialize(repr: &[u8]) -> &'self T; //~ ERROR lifetimes cannot use keyword names
5 }
6
7 impl<'self> Serializable<str> for &'self str {
8     //~^ ERROR lifetimes cannot use keyword names
9     //~| ERROR lifetimes cannot use keyword names
10     //~| ERROR implicit elided lifetime not allowed here
11     //~| ERROR the size for values of type `str` cannot be known at compilation time [E0277]
12     fn serialize(val: &'self str) -> Vec<u8> {
13         //~^ ERROR lifetimes cannot use keyword names
14         vec![1]
15     }
16     fn deserialize(repr: &[u8]) -> &'self str {
17         //~^ ERROR lifetimes cannot use keyword names
18         "hi"
19     }
20 }
21
22 fn main() {
23     println!("hello");
24     let x = "foo".to_string();
25     let y = x;
26     println!("{}", y);
27 }