Skip to content

rustc_borrowck: Stop suggesting the invalid syntax &mut raw const - #134244

Merged
bors merged 4 commits into
rust-lang:masterfrom
Enselic:no-mut-hint-for-raw-ref
Dec 14, 2024
Merged

rustc_borrowck: Stop suggesting the invalid syntax &mut raw const#134244
bors merged 4 commits into
rust-lang:masterfrom
Enselic:no-mut-hint-for-raw-ref

Conversation

@Enselic

Copy link
Copy Markdown
Member

A legitimate suggestion would be to change from

&raw const val

to

&raw mut val

But until we have figured out how to make that happen we should at least
stop suggesting invalid syntax.

I recommend review commit-by-commit.

Part of #127562

@rustbot

Copy link
Copy Markdown
Collaborator

r? @jieyouxu

rustbot has assigned @jieyouxu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 13, 2024

@jieyouxujieyouxu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I left some feedback, but looks good otherwise.

Comment threadcompiler/rustc_borrowck/src/diagnostics/mutability_errors.rs Outdated
Comment threadcompiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
@jieyouxu

Copy link
Copy Markdown
Member

@rustbot author

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 13, 2024
So that it becomes easy for a later commit to return `None`.
The test fails in this commit. The next commit fixes it.
A legitimate suggestion would be to change from
&raw const val
to
&raw mut val
But until we have figured out how to make that happen we should at least
stop suggesting invalid syntax.
@Enselic
Enselicforce-pushed the no-mut-hint-for-raw-ref branch from f1baf80 to f6cb227CompareDecember 13, 2024 15:38
@EnselicEnselic changed the title rustc_borrowck: Stop suggesting invalid syntax &mut raw construstc_borrowck: Stop suggesting the invalid syntax &mut raw constDec 13, 2024

@jieyouxujieyouxu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment threadcompiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
@jieyouxu

Copy link
Copy Markdown
Member

@bors r+ rollup

@bors

bors commented Dec 13, 2024

Copy link
Copy Markdown
Collaborator

📌 Commit f6cb227 has been approved by jieyouxu

It is now in the queue for this repository.

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 13, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 13, 2024
…=jieyouxu
rustc_borrowck: Stop suggesting the invalid syntax `&mut raw const`
A legitimate suggestion would be to change from
&raw const val
to
&raw mut val
But until we have figured out how to make that happen we should at least
stop suggesting invalid syntax.
I recommend review commit-by-commit.
Part of rust-lang#127562
This was referenced Dec 13, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 14, 2024
…=jieyouxu
rustc_borrowck: Stop suggesting the invalid syntax `&mut raw const`
A legitimate suggestion would be to change from
&raw const val
to
&raw mut val
But until we have figured out how to make that happen we should at least
stop suggesting invalid syntax.
I recommend review commit-by-commit.
Part of rust-lang#127562
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 14, 2024
…iaskrgr
Rollup of 8 pull requests
Successful merges:
- rust-lang#134181 (Tweak multispan rendering to reduce output length)
- rust-lang#134209 (validate `--skip` and `--exclude` paths)
- rust-lang#134231 (rustdoc-search: fix mismatched path when parent re-exported twice)
- rust-lang#134236 (crashes: more tests v2)
- rust-lang#134240 (Only dist `llvm-objcopy` if llvm tools are enabled)
- rust-lang#134244 (rustc_borrowck: Stop suggesting the invalid syntax `&mut raw const`)
- rust-lang#134251 (A bunch of cleanups (part 2))
- rust-lang#134256 (Use a more precise span in placeholder_type_error_diag)
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 34e6075 into rust-lang:masterDec 14, 2024
@rustbotrustbot added this to the 1.85.0 milestone Dec 14, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 14, 2024
Rollup merge of rust-lang#134244 - Enselic:no-mut-hint-for-raw-ref, r=jieyouxu
rustc_borrowck: Stop suggesting the invalid syntax `&mut raw const`
A legitimate suggestion would be to change from
&raw const val
to
&raw mut val
But until we have figured out how to make that happen we should at least
stop suggesting invalid syntax.
I recommend review commit-by-commit.
Part of rust-lang#127562
@Enselic
Enselic deleted the no-mut-hint-for-raw-ref branch December 14, 2024 09:12
jhpratt added a commit to jhpratt/rust that referenced this pull request Dec 17, 2024
rustc_borrowck: Suggest changing `&raw const` to `&raw mut` if applicable
Closesrust-lang#127562
For reference, here is the diff compared to the original error reported in that issue before rust-lang#134244 stopped suggesting the invalid syntax:
```
diff --git a/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr b/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr
index 0da5d15..dbe834b 100644
--- a/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr
+++ b/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr
`@@` -6,8 +6,8 `@@` LL | unsafe { *ptr = 3; }
|
help: consider changing this to be a mutable pointer
|
-LL | let ptr = &mut raw const val;
- | +++
+LL | let ptr = &raw mut val;
+ | ~~~
error: aborting due to 1 previous error
```
jhpratt added a commit to jhpratt/rust that referenced this pull request Dec 17, 2024
rustc_borrowck: Suggest changing `&raw const` to `&raw mut` if applicable
Closesrust-lang#127562
For reference, here is the diff compared to the original error reported in that issue before rust-lang#134244 stopped suggesting the invalid syntax:
```
diff --git a/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr b/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr
index 0da5d15..dbe834b 100644
--- a/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr
+++ b/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr
``@@`` -6,8 +6,8 ``@@`` LL | unsafe { *ptr = 3; }
|
help: consider changing this to be a mutable pointer
|
-LL | let ptr = &mut raw const val;
- | +++
+LL | let ptr = &raw mut val;
+ | ~~~
error: aborting due to 1 previous error
```
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 17, 2024
Rollup merge of rust-lang#134397 - Enselic:raw-mut, r=compiler-errors
rustc_borrowck: Suggest changing `&raw const` to `&raw mut` if applicable
Closesrust-lang#127562
For reference, here is the diff compared to the original error reported in that issue before rust-lang#134244 stopped suggesting the invalid syntax:
```
diff --git a/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr b/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr
index 0da5d15..dbe834b 100644
--- a/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr
+++ b/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr
``@@`` -6,8 +6,8 ``@@`` LL | unsafe { *ptr = 3; }
|
help: consider changing this to be a mutable pointer
|
-LL | let ptr = &mut raw const val;
- | +++
+LL | let ptr = &raw mut val;
+ | ~~~
error: aborting due to 1 previous error
```
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@Enselic@rustbot@jieyouxu@bors