Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5510a69
Stabilize `#![feature(mixed_integer_ops)]`
jhpratt Sep 8, 2022
c19daa4
make invalid_value lint a bit smarter around enums
RalfJung Sep 25, 2022
3fac709
rustdoc: remove no-op CSS `.srclink { font-weight; font-size }`
notriddle Sep 26, 2022
35adb36
Avoid LLVM-deprecated `Optional::hasValue`
cuviper Sep 26, 2022
594134d
Structured suggestion for missing mut/const in pointer
compiler-errors Sep 25, 2022
2286888
session: remove now-unnecessary lint `#[allow]`s
davidtwco Sep 27, 2022
67fd09d
also query type_uninhabited_from
RalfJung Sep 27, 2022
8846c08
rustdoc: use CSS containment to speed up render
jsha Sep 27, 2022
b5b77a2
Update src/test/rustdoc-gui/sidebar-mobile-scroll.goml
jsha Sep 27, 2022
3bbb328
rustdoc: remove redundant `#help-button` CSS
notriddle Sep 27, 2022
ef410f1
Fix regression for results colors
GuillaumeGomez Sep 27, 2022
a925e20
Add GUI regression test for search results colors
GuillaumeGomez Sep 27, 2022
ad57d5f
Rollup merge of #101555 - jhpratt:stabilize-mixed_integer_ops, r=josh…
matthiaskrgr Sep 27, 2022
4cef648
Rollup merge of #102253 - jsha:css-contain, r=notriddle
matthiaskrgr Sep 27, 2022
8d2faa2
Rollup merge of #102281 - RalfJung:invalid-enums, r=cjgillot
matthiaskrgr Sep 27, 2022
8b635cb
Rollup merge of #102284 - compiler-errors:missing-type-in-raw-ptr, r=…
matthiaskrgr Sep 27, 2022
b32ce95
Rollup merge of #102330 - notriddle:notriddle/srclink, r=GuillaumeGomez
matthiaskrgr Sep 27, 2022
e1fb698
Rollup merge of #102337 - cuviper:llvm-optional-bool, r=nikic
matthiaskrgr Sep 27, 2022
3ca0cd0
Rollup merge of #102356 - davidtwco:translation-bootstrap-bump-allow-…
matthiaskrgr Sep 27, 2022
5971b1a
Rollup merge of #102367 - notriddle:notriddle/help-text-align, r=Guil…
matthiaskrgr Sep 27, 2022
f28ac30
Rollup merge of #102369 - GuillaumeGomez:results-colors, r=notriddle
matthiaskrgr Sep 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Structured suggestion for missing mut/const in pointer
  • Loading branch information
compiler-errors committed Sep 27, 2022
commit 594134d873a1020947da9b73803dcce76b6f5cf1
11 changes: 7 additions & 4 deletions compiler/rustc_parse/src/parser/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,13 @@ impl<'a> Parser<'a> {
fn parse_ty_ptr(&mut self) -> PResult<'a, TyKind> {
let mutbl = self.parse_const_or_mut().unwrap_or_else(|| {
let span = self.prev_token.span;
let msg = "expected mut or const in raw pointer type";
self.struct_span_err(span, msg)
.span_label(span, msg)
.help("use `*mut T` or `*const T` as appropriate")
self.struct_span_err(span, "expected `mut` or `const` keyword in raw pointer type")
.span_suggestions(
span.shrink_to_hi(),
"add `mut` or `const` here",
["mut ".to_string(), "const ".to_string()].into_iter(),
Applicability::HasPlaceholders,
)
.emit();
Mutability::Not
});
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/bad-pointer-type.rs
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() {}
11 changes: 8 additions & 3 deletions src/test/ui/parser/bad-pointer-type.stderr
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

7 changes: 7 additions & 0 deletions src/test/ui/parser/double-pointer.rs
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
}
15 changes: 15 additions & 0 deletions src/test/ui/parser/double-pointer.stderr
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