rust/tests/ui/methods/suggest-convert-ptr-to-ref.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
487 B
Rust
Raw Normal View History

2019-06-01 23:24:19 +00:00
fn main() {
let mut x = 8u8;
2019-06-01 23:24:19 +00:00
let z: *const u8 = &x;
// issue #21596
println!("{}", z.to_string()); //~ ERROR E0599
let t: *mut u8 = &mut x;
println!("{}", t.to_string()); //~ ERROR E0599
t.make_ascii_lowercase(); //~ ERROR E0599
// suggest `as_mut` simply because the name is similar
let _ = t.as_mut_ref(); //~ ERROR E0599
let _ = t.as_ref_mut(); //~ ERROR E0599
// no ptr-to-ref suggestion
z.make_ascii_lowercase(); //~ ERROR E0599
2019-06-01 23:24:19 +00:00
}