]>
Commit | Line | Data |
---|---|---|
9346a6ac AL |
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 | // Regression test for #24356 | |
12 | ||
13 | // ignore-tidy-linelength | |
14 | ||
15 | fn main() { | |
16 | { | |
17 | use std::ops::Deref; | |
18 | ||
19 | struct Thing(i8); | |
20 | ||
21 | /* | |
22 | // Correct impl | |
23 | impl Deref for Thing { | |
24 | type Target = i8; | |
25 | fn deref(&self) -> &i8 { &self.0 } | |
26 | } | |
27 | */ | |
28 | ||
29 | // Causes ICE | |
30 | impl Deref for Thing { | |
5bcae85e SL |
31 | //~^ ERROR E0046 |
32 | //~| NOTE missing `Target` in implementation | |
9346a6ac | 33 | fn deref(&self) -> i8 { self.0 } |
9346a6ac AL |
34 | } |
35 | ||
36 | let thing = Thing(72); | |
37 | ||
38 | *thing | |
39 | }; | |
40 | } |