forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#102284 - compiler-errors:missing-type-in-ra…
…w-ptr, r=davidtwco Structured suggestion for missing `mut`/`const` in raw pointer Fixes rust-lang#102261
- Loading branch information
Showing
5 changed files
with
38 additions
and
8 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
fn foo(_: *()) { | ||
//~^ ERROR expected mut or const in raw pointer type | ||
//~^ ERROR expected `mut` or `const` keyword in raw pointer type | ||
} | ||
|
||
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 |
---|---|---|
@@ -1,10 +1,15 @@ | ||
error: expected mut or const in raw pointer type | ||
error: expected `mut` or `const` keyword in raw pointer type | ||
--> $DIR/bad-pointer-type.rs:1:11 | ||
| | ||
LL | fn foo(_: *()) { | ||
| ^ expected mut or const in raw pointer type | ||
| ^ | ||
| | ||
= help: use `*mut T` or `*const T` as appropriate | ||
help: add `mut` or `const` here | ||
| | ||
LL | fn foo(_: *const ()) { | ||
| +++++ | ||
LL | fn foo(_: *mut ()) { | ||
| +++ | ||
|
||
error: aborting due to previous error | ||
|
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,7 @@ | ||
fn main() { | ||
let x: i32 = 5; | ||
let ptr: *const i32 = &x; | ||
let dptr: **const i32 = &ptr; | ||
//~^ ERROR expected `mut` or `const` keyword in raw pointer type | ||
//~| HELP add `mut` or `const` here | ||
} |
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: expected `mut` or `const` keyword in raw pointer type | ||
--> $DIR/double-pointer.rs:4:15 | ||
| | ||
LL | let dptr: **const i32 = &ptr; | ||
| ^ | ||
| | ||
help: add `mut` or `const` here | ||
| | ||
LL | let dptr: *const *const i32 = &ptr; | ||
| +++++ | ||
LL | let dptr: *mut *const i32 = &ptr; | ||
| +++ | ||
|
||
error: aborting due to previous error | ||
|