mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
18 lines
307 B
Rust
18 lines
307 B
Rust
// run-rustfix
|
|
use std::ops::Deref;
|
|
|
|
struct Foo(u8);
|
|
|
|
impl Deref for Foo {
|
|
type Target = u8;
|
|
fn deref(&self) -> &Self::Target {
|
|
&self.0
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let a = Foo(0);
|
|
// Should suggest `&*` when coercing &ty to *const ty
|
|
let _: *const u8 = &a; //~ ERROR mismatched types
|
|
}
|