Skip suggestions for the AsRef trait
This commit is contained in:
parent
37f70a0e1e
commit
e2151497bf
3 changed files with 30 additions and 0 deletions
|
@ -1251,6 +1251,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
self.tcx.lang_items().deref_trait(),
|
||||
self.tcx.lang_items().deref_mut_trait(),
|
||||
self.tcx.lang_items().drop_trait(),
|
||||
self.tcx.get_diagnostic_item(sym::AsRef),
|
||||
];
|
||||
// Try alternative arbitrary self types that could fulfill this call.
|
||||
// FIXME: probe for all types that *could* be arbitrary self-types, not
|
||||
|
|
3
src/test/ui/typeck/issue-89806.rs
Normal file
3
src/test/ui/typeck/issue-89806.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
0u8.as_ref(); //~ ERROR no method named `as_ref` found for type `u8` in the current scope
|
||||
}
|
26
src/test/ui/typeck/issue-89806.stderr
Normal file
26
src/test/ui/typeck/issue-89806.stderr
Normal file
|
@ -0,0 +1,26 @@
|
|||
error[E0599]: no method named `as_ref` found for type `u8` in the current scope
|
||||
--> $DIR/issue-89806.rs:2:9
|
||||
|
|
||||
LL | 0u8.as_ref();
|
||||
| ^^^^^^ method not found in `u8`
|
||||
|
|
||||
::: $SRC_DIR/core/src/pin.rs:LL:COL
|
||||
|
|
||||
LL | pub fn as_ref(&self) -> Pin<&P::Target> {
|
||||
| ------
|
||||
| |
|
||||
| the method is available for `Pin<&mut u8>` here
|
||||
| the method is available for `Pin<&u8>` here
|
||||
|
|
||||
help: consider wrapping the receiver expression with the appropriate type
|
||||
|
|
||||
LL | Pin::new(&mut 0u8).as_ref();
|
||||
| +++++++++++++ +
|
||||
help: consider wrapping the receiver expression with the appropriate type
|
||||
|
|
||||
LL | Pin::new(&0u8).as_ref();
|
||||
| ++++++++++ +
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0599`.
|
Loading…
Add table
Reference in a new issue