|
1 | 1 | error[E0599]: `*const u8` doesn't implement `std::fmt::Display`
|
2 |
| - --> $DIR/issue-21596.rs:4:22 |
| 2 | + --> $DIR/suggest-convert-ptr-to-ref.rs:5:22 |
3 | 3 | |
|
4 | 4 | LL | println!("{}", z.to_string());
|
5 | 5 | | ^^^^^^^^^ `*const u8` cannot be formatted with the default formatter
|
6 | 6 | |
|
7 |
| - = note: try using `<*const T>::as_ref()` to get a reference to the type behind the pointer: https://doc.rust-lang.org/std/primitive.pointer.html#method.as_ref |
8 |
| - = note: using `<*const T>::as_ref()` on a pointer which is unaligned or points to invalid or uninitialized memory is undefined behavior |
| 7 | +note: the method `to_string` exists on the type `&u8` |
| 8 | + --> $SRC_DIR/alloc/src/string.rs:LL:COL |
| 9 | + = note: you might want to use the unsafe method `<*const T>::as_ref` to get an optional reference to the value behind the pointer |
| 10 | + = note: read the documentation for `<*const T>::as_ref` and ensure you satisfy its safety preconditions before calling it to avoid undefined behavior: https://doc.rust-lang.org/std/primitive.pointer.html#method.as_ref |
9 | 11 | = note: the following trait bounds were not satisfied:
|
10 | 12 | `*const u8: std::fmt::Display`
|
11 | 13 | which is required by `*const u8: ToString`
|
12 | 14 |
|
13 |
| -error: aborting due to 1 previous error |
| 15 | +error[E0599]: `*mut u8` doesn't implement `std::fmt::Display` |
| 16 | + --> $DIR/suggest-convert-ptr-to-ref.rs:8:22 |
| 17 | + | |
| 18 | +LL | println!("{}", t.to_string()); |
| 19 | + | ^^^^^^^^^ `*mut u8` cannot be formatted with the default formatter |
| 20 | + | |
| 21 | +note: the method `to_string` exists on the type `&&mut u8` |
| 22 | + --> $SRC_DIR/alloc/src/string.rs:LL:COL |
| 23 | + = note: you might want to use the unsafe method `<*mut T>::as_ref` to get an optional reference to the value behind the pointer |
| 24 | + = note: read the documentation for `<*mut T>::as_ref` and ensure you satisfy its safety preconditions before calling it to avoid undefined behavior: https://doc.rust-lang.org/std/primitive.pointer.html#method.as_ref-1 |
| 25 | + = note: the following trait bounds were not satisfied: |
| 26 | + `*mut u8: std::fmt::Display` |
| 27 | + which is required by `*mut u8: ToString` |
| 28 | + |
| 29 | +error[E0599]: no method named `make_ascii_lowercase` found for raw pointer `*mut u8` in the current scope |
| 30 | + --> $DIR/suggest-convert-ptr-to-ref.rs:9:7 |
| 31 | + | |
| 32 | +LL | t.make_ascii_lowercase(); |
| 33 | + | ^^^^^^^^^^^^^^^^^^^^ method not found in `*mut u8` |
| 34 | + | |
| 35 | +note: the method `make_ascii_lowercase` exists on the type `&mut u8` |
| 36 | + --> $SRC_DIR/core/src/num/mod.rs:LL:COL |
| 37 | + = note: you might want to use the unsafe method `<*mut T>::as_mut` to get an optional reference to the value behind the pointer |
| 38 | + = note: read the documentation for `<*mut T>::as_mut` and ensure you satisfy its safety preconditions before calling it to avoid undefined behavior: https://doc.rust-lang.org/std/primitive.pointer.html#method.as_mut |
| 39 | + |
| 40 | +error[E0599]: no method named `as_mut_ref` found for raw pointer `*mut u8` in the current scope |
| 41 | + --> $DIR/suggest-convert-ptr-to-ref.rs:12:15 |
| 42 | + | |
| 43 | +LL | let _ = t.as_mut_ref(); |
| 44 | + | ^^^^^^^^^^ |
| 45 | + | |
| 46 | +help: there is a method `as_mut` with a similar name |
| 47 | + | |
| 48 | +LL | let _ = t.as_mut(); |
| 49 | + | ~~~~~~ |
| 50 | + |
| 51 | +error[E0599]: no method named `as_ref_mut` found for raw pointer `*mut u8` in the current scope |
| 52 | + --> $DIR/suggest-convert-ptr-to-ref.rs:13:15 |
| 53 | + | |
| 54 | +LL | let _ = t.as_ref_mut(); |
| 55 | + | ^^^^^^^^^^ |
| 56 | + | |
| 57 | +help: there is a method `as_mut` with a similar name |
| 58 | + | |
| 59 | +LL | let _ = t.as_mut(); |
| 60 | + | ~~~~~~ |
| 61 | + |
| 62 | +error[E0599]: no method named `make_ascii_lowercase` found for raw pointer `*const u8` in the current scope |
| 63 | + --> $DIR/suggest-convert-ptr-to-ref.rs:16:7 |
| 64 | + | |
| 65 | +LL | z.make_ascii_lowercase(); |
| 66 | + | ^^^^^^^^^^^^^^^^^^^^ method not found in `*const u8` |
| 67 | + |
| 68 | +error: aborting due to 6 previous errors |
14 | 69 |
|
15 | 70 | For more information about this error, try `rustc --explain E0599`.
|
0 commit comments