17905 also no longer errors, thanks to IHLE
But its test was written in an outdated way that hits a different error despite IHLE, so keep a variant around for that case.
This commit is contained in:
parent
ae130b0889
commit
4ab691ac2c
4 changed files with 76 additions and 12 deletions
26
src/test/ui/issues/issue-17905-2.rs
Normal file
26
src/test/ui/issues/issue-17905-2.rs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// Copyright 2014 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.
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
struct Pair<T, V> (T, V);
|
||||||
|
|
||||||
|
impl Pair<
|
||||||
|
&str,
|
||||||
|
isize
|
||||||
|
> {
|
||||||
|
fn say(self: &Pair<&str, isize>) {
|
||||||
|
println!("{:?}", self);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let result = &Pair("shane", 1);
|
||||||
|
result.say();
|
||||||
|
}
|
45
src/test/ui/issues/issue-17905-2.stderr
Normal file
45
src/test/ui/issues/issue-17905-2.stderr
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
error[E0308]: mismatched method receiver
|
||||||
|
--> $DIR/issue-17905-2.rs:18:18
|
||||||
|
|
|
||||||
|
LL | fn say(self: &Pair<&str, isize>) {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
||||||
|
|
|
||||||
|
= note: expected type `Pair<&'_ str, _>`
|
||||||
|
found type `Pair<&str, _>`
|
||||||
|
note: the anonymous lifetime #2 defined on the method body at 18:5...
|
||||||
|
--> $DIR/issue-17905-2.rs:18:5
|
||||||
|
|
|
||||||
|
LL | / fn say(self: &Pair<&str, isize>) {
|
||||||
|
LL | | println!("{:?}", self);
|
||||||
|
LL | | }
|
||||||
|
| |_____^
|
||||||
|
note: ...does not necessarily outlive the lifetime '_ as defined on the impl at 15:5
|
||||||
|
--> $DIR/issue-17905-2.rs:15:5
|
||||||
|
|
|
||||||
|
LL | &str,
|
||||||
|
| ^
|
||||||
|
|
||||||
|
error[E0308]: mismatched method receiver
|
||||||
|
--> $DIR/issue-17905-2.rs:18:18
|
||||||
|
|
|
||||||
|
LL | fn say(self: &Pair<&str, isize>) {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
||||||
|
|
|
||||||
|
= note: expected type `Pair<&'_ str, _>`
|
||||||
|
found type `Pair<&str, _>`
|
||||||
|
note: the lifetime '_ as defined on the impl at 15:5...
|
||||||
|
--> $DIR/issue-17905-2.rs:15:5
|
||||||
|
|
|
||||||
|
LL | &str,
|
||||||
|
| ^
|
||||||
|
note: ...does not necessarily outlive the anonymous lifetime #2 defined on the method body at 18:5
|
||||||
|
--> $DIR/issue-17905-2.rs:18:5
|
||||||
|
|
|
||||||
|
LL | / fn say(self: &Pair<&str, isize>) {
|
||||||
|
LL | | println!("{:?}", self);
|
||||||
|
LL | | }
|
||||||
|
| |_____^
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0308`.
|
|
@ -8,15 +8,17 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
// run-pass
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct Pair<T, V> (T, V);
|
struct Pair<T, V> (T, V);
|
||||||
|
|
||||||
impl Pair<
|
impl Pair<
|
||||||
&str, //~ ERROR missing lifetime specifier
|
&str,
|
||||||
isize
|
isize
|
||||||
> {
|
> {
|
||||||
fn say(self: &Pair<&str, isize>) {
|
fn say(&self) {
|
||||||
println!("{}", self);
|
println!("{:?}", self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
error[E0106]: missing lifetime specifier
|
|
||||||
--> $DIR/issue-17905.rs:15:5
|
|
||||||
|
|
|
||||||
LL | &str, //~ ERROR missing lifetime specifier
|
|
||||||
| ^ expected lifetime parameter
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0106`.
|
|
Loading…
Add table
Add a link
Reference in a new issue