-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
forbid mutable references in all constant contexts except for const-fns #72934
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
My question is how this works, which will need more than a single line 😄. |
@ecstatic-morse I reutilized |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to improve diagnostics a bit.
Error messages look good to me now. Can you add an error code and description for this like oli mentioned? After that I think this is ready. |
@ecstatic-morse @oli-obk I think we are ready then. |
r=me with the documentation suggestion or something similarly expanatory. @bors delegate+ |
✌️ @christianpoveda can now approve this pull request |
@bors r+ |
📌 Commit 5302bd755d5a2a150083fc616e24361ee45d887b has been approved by |
you need to write @bors r+ |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit 5302bd755d5a2a150083fc616e24361ee45d887b has been approved by |
heh, thanks I've never used bors before :P |
☔ The latest upstream changes (presumably #73504) made this pull request unmergeable. Please resolve the merge conflicts. |
@bors r+ |
📌 Commit 6eb7a2dc0f0df32c2ef380d8a06086db5bdcfc20 has been approved by |
@bors r=oli-obk |
📌 Commit 96031e2 has been approved by |
…arth Rollup of 16 pull requests Successful merges: - rust-lang#71420 (Specialization is unsound) - rust-lang#71899 (Refactor `try_find` a little) - rust-lang#72689 (add str to common types) - rust-lang#72791 (update coerce docs and unify relevant tests) - rust-lang#72934 (forbid mutable references in all constant contexts except for const-fns) - rust-lang#73027 (Make `need_type_info_err` more conservative) - rust-lang#73347 (Diagnose use of incompatible sanitizers) - rust-lang#73359 (shim.rs: avoid creating `Call` terminators calling `Self`) - rust-lang#73399 (Clean up E0668 explanation) - rust-lang#73436 (Clean up E0670 explanation) - rust-lang#73440 (Add src/librustdoc as an alias for src/tools/rustdoc) - rust-lang#73442 (pretty/mir: const value enums with no variants) - rust-lang#73452 (Unify region variables when projecting associated types) - rust-lang#73458 (Use alloc::Layout in DroplessArena API) - rust-lang#73484 (Update the doc for std::prelude to the correct behavior) - rust-lang#73506 (Bump Rustfmt and RLS) Failed merges: r? @ghost
This commit includes work-arounds for the following changes in the compiler: - Raw pointers as const generic parameters are now forbidden. <rust-lang/rust#73398> This means the work-around for ICE caused by `&'static [_]` const generic parameters doesn't work anymore. An alternative work-around is yet to be implemented. - Mutable references are now forbidden in all constant contexts except for `const fn`s. <rust-lang/rust#72934> Working around this change was as easy as mechanically replacing `const` with `const fn` for most cases. The only tricky case was the definition of `id_map` inside `build!`, which is a macro meant to be called inside a `const` item. The type of `id_map` isn't explicitly specified but is rather implied by a given configuration function, so this couldn't be mechanically replaced with a `const` item. To resolve this problem, I added an explicit type to `build!`'s signature.
PR to address #71212
cc: @ecstatic-morse