-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
struct Concrete(u32); impl Concrete { fn m(self: &Box<Self>) -> &u32 { &self.0 } } resulted in a confusing error. impl Concrete { fn n(self: &Box<&Self>) -> &u32 { &self.0 } } resulted in no error or warning, despite apparent ambiguity over the elided lifetime. Fixes #117715
- Loading branch information
Showing
5 changed files
with
76 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#![feature(arbitrary_self_types)] | ||
#![allow(non_snake_case)] | ||
|
||
use std::marker::PhantomData; | ||
use std::ops::Deref; | ||
use std::pin::Pin; | ||
|
||
struct Struct { } | ||
|
||
struct Wrap<T, P>(T, PhantomData<P>); | ||
|
||
impl<T, P> Deref for Wrap<T, P> { | ||
type Target = T; | ||
fn deref(&self) -> &T { &self.0 } | ||
} | ||
|
||
impl Struct { | ||
fn ref_box_ref_Self(self: &Box<&Self>, f: &u32) -> &u32 { | ||
f | ||
//~^ ERROR missing lifetime specifier | ||
} | ||
} | ||
|
||
fn main() { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
error[E0106]: missing lifetime specifier | ||
--> $DIR/ref-self-multi.rs:18:56 | ||
| | ||
LL | fn ref_box_ref_Self(self: &Box<&Self>, f: &u32) -> &u32 { | ||
| ----------- ---- ^ expected named lifetime parameter | ||
| | ||
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from one of `self`'s 2 lifetimes or `f` | ||
help: consider introducing a named lifetime parameter | ||
| | ||
LL | fn ref_box_ref_Self<'a>(self: &'a Box<&'a Self>, f: &'a u32) -> &'a u32 { | ||
| ++++ ++ ++ ++ ++ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0106`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters