Skip to content
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

Merged
merged 4 commits into from
Jun 20, 2020
Merged

forbid mutable references in all constant contexts except for const-fns #72934

merged 4 commits into from
Jun 20, 2020

Conversation

pvdrz
Copy link
Contributor

@pvdrz pvdrz commented Jun 3, 2020

PR to address #71212

cc: @ecstatic-morse

@rust-highfive
Copy link
Collaborator

r? @matthewjasper

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 3, 2020
@ecstatic-morse
Copy link
Contributor

ecstatic-morse commented Jun 3, 2020

My question is how this works, which will need more than a single line 😄. HasMutInterior is meant specifically for immutable borrows of Cells, so modifying it in this way is suspicious to me. What error messages are emitted for the examples in #71212, specifically the ones with raw pointers?

@ecstatic-morse
Copy link
Contributor

r? @ecstatic-morse

@pvdrz pvdrz changed the title include mutable borrows in HasMutInterior forbid mutable references in all constant contexts except for const-fns Jun 7, 2020
@pvdrz
Copy link
Contributor Author

pvdrz commented Jun 7, 2020

@ecstatic-morse I reutilized MutBorrow for this because it is only triggered on rvalues.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-8 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
##[section]Starting: Linux x86_64-gnu-llvm-8
##[section]Starting: Initialize job
Agent name: 'Azure Pipelines 3'
Agent machine name: 'fv-az578'
Current agent version: '2.169.1'
##[group]Operating System
16.04.6
LTS
LTS
##[endgroup]
##[group]Virtual Environment
Environment: ubuntu-16.04
Version: 20200517.1
Included Software: https://github.com/actions/virtual-environments/blob/ubuntu16/20200517.1/images/linux/Ubuntu1604-README.md
##[endgroup]
Agent running as: 'vsts'
Prepare build directory.
Set build variables.
Download all required tasks.
Download all required tasks.
Downloading task: Bash (3.163.3)
Checking job knob settings.
   Knob: AgentToolsDirectory = /opt/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY} 
   Knob: AgentPerflog = /home/vsts/perflog Source: ${VSTS_AGENT_PERFLOG} 
Start tracking orphan processes.
##[section]Finishing: Initialize job
##[section]Starting: Configure Job Name
==============================================================================
---
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /home/vsts/work/_temp/4e7e3fb0-72ac-4d66-a02d-442464ee3f4a.sh

##[section]Finishing: Disable git automatic line ending conversion
##[section]Starting: Checkout rust-lang/rust@refs/pull/72934/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
---
##[command]git remote add origin https://github.com/rust-lang/rust
##[command]git config gc.auto 0
##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
##[command]git config --get-all http.proxy
##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/72934/merge:refs/remotes/pull/72934/merge
---
 ---> cb2676f08729
Step 5/8 : ENV RUST_CONFIGURE_ARGS       --build=x86_64-unknown-linux-gnu       --llvm-root=/usr/lib/llvm-8       --enable-llvm-link-shared       --set rust.thin-lto-import-instr-limit=10
 ---> Using cache
 ---> df25ce111862
Step 6/8 : ENV SCRIPT python2.7 ../x.py test --exclude src/tools/tidy &&            python2.7 ../x.py test src/test/mir-opt --pass=build                                   --target=armv5te-unknown-linux-gnueabi &&            python2.7 ../x.py test src/tools/tidy
 ---> 599b9ac96b27
Step 7/8 : ENV NO_DEBUG_ASSERTIONS=1
 ---> Using cache
 ---> 091087e35a36
---
   Compiling rustc_parse_format v0.0.0 (/checkout/src/librustc_parse_format)
   Compiling chalk-rust-ir v0.10.0
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-solve v0.10.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
   Compiling rustc_parse_format v0.0.0 (/checkout/src/librustc_parse_format)
   Compiling chalk-rust-ir v0.10.0
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-solve v0.10.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
............................i...............i....................................................... 5200/10285
.................................................................................................... 5300/10285
............................................................................i....................... 5400/10285
......................................................................i............................. 5500/10285
.......................................................................................ii.ii........ 5600/10285
i...i............................................................................................... 5700/10285
......................................i............................................................. 5900/10285
............................................................................................ii...... 6000/10285
...............................i.................................................................... 6100/10285
.................................................................................................... 6200/10285
.................................................................................................... 6200/10285
.................................................................................................... 6300/10285
......................................................ii...i..ii...........i........................ 6400/10285
.................................................................................................... 6600/10285
.................................................................................................... 6700/10285
.................................................................................................... 6700/10285
.......................................................................................i..ii........ 6800/10285
.................................................................................................... 7000/10285
.................................................................................................... 7100/10285
.........................................i.......................................................... 7200/10285
.................................................................................................... 7300/10285
---
.................................................................................................... 8200/10285
.................................................................................................... 8300/10285
................................................................................i................... 8400/10285
.................................................................................................... 8500/10285
..................................iiiiii.iiiiii.i................................................... 8600/10285
.................................................................................................... 8800/10285
.................................................................................................... 8900/10285
.................................................................................................... 9000/10285
.................................................................................................... 9100/10285
---
---- [ui] ui/consts/const-mut-refs/const_mut_address_of.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/consts/const-mut-refs/const_mut_address_of.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-mut-refs/const_mut_address_of" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-mut-refs/const_mut_address_of/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0658]: references in constants may only refer to immutable values
  --> /checkout/src/test/ui/consts/const-mut-refs/const_mut_address_of.rs:26:5
   |
LL |     foo().bar();
   |     ^^^^^ constants require immutable values
   |
   = note: see issue #57349 <***/issues/57349> for more information
   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0658]: references in constants may only refer to immutable values
  --> /checkout/src/test/ui/consts/const-mut-refs/const_mut_address_of.rs:27:9
   |
LL |     baz(&mut foo());
LL |     baz(&mut foo());
   |         ^^^^^^^^^^ constants require immutable values
   |
   = note: see issue #57349 <***/issues/57349> for more information
   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.


------------------------------------------


---- [ui] ui/consts/const-mut-refs/const_mut_refs.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/consts/const-mut-refs/const_mut_refs.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-mut-refs/const_mut_refs/a" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-mut-refs/const_mut_refs/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0658]: references in constants may only refer to immutable values
  --> /checkout/src/test/ui/consts/const-mut-refs/const_mut_refs.rs:33:17
   |
LL |     let _: [(); foo().bar()] = [(); 1];
   |                 ^^^^^ constants require immutable values
   |
   = note: see issue #57349 <***/issues/57349> for more information
   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0658]: references in constants may only refer to immutable values
  --> /checkout/src/test/ui/consts/const-mut-refs/const_mut_refs.rs:34:21
   |
   |
LL |     let _: [(); baz(&mut foo())] = [(); 2];
   |                     ^^^^^^^^^^ constants require immutable values
   |
   = note: see issue #57349 <***/issues/57349> for more information
   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0658]: references in constants may only refer to immutable values
  --> /checkout/src/test/ui/consts/const-mut-refs/const_mut_refs.rs:35:22
   |
   |
LL |     let _: [(); bazz(&mut foo())] = [(); 3];
   |                      ^^^^^^^^^^ constants require immutable values
   |
   = note: see issue #57349 <***/issues/57349> for more information
   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0658`.

---

+ error[E0658]: references in constants may only refer to immutable values
+   --> $DIR/projection_qualif.rs:10:27
+    |
+ LL |         let b: *mut u32 = &mut a;
+    |                           ^^^^^^ constants require immutable values
+    |
+    = note: see issue #57349 <***/issues/57349> for more information
+    = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
1 error[E0658]: dereferencing raw pointers in constants is unstable
2   --> $DIR/projection_qualif.rs:11:18
3    |


7    = note: see issue #51911 <***/issues/51911> for more information
9 
- error: aborting due to previous error
+ error: aborting due to 2 previous errors
11 
11 
12 For more information about this error, try `rustc --explain E0658`.
13 


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/projection_qualif.mut_refs/projection_qualif.mut_refs.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args consts/projection_qualif.rs`

error in revision `mut_refs`: 1 errors occurred comparing output.
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/consts/projection_qualif.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--cfg" "mut_refs" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/projection_qualif.mut_refs" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/projection_qualif.mut_refs/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0658]: references in constants may only refer to immutable values
  --> /checkout/src/test/ui/consts/projection_qualif.rs:10:27
   |
LL |         let b: *mut u32 = &mut a; //[stock]~ ERROR may only refer to immutable values
   |                           ^^^^^^ constants require immutable values
   |
   = note: see issue #57349 <***/issues/57349> for more information
   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0658]: dereferencing raw pointers in constants is unstable
  --> /checkout/src/test/ui/consts/projection_qualif.rs:11:18
   |
   |
LL |         unsafe { *b = 5; } //~ ERROR dereferencing raw pointers in constants
   |
   |
   = note: see issue #51911 <***/issues/51911> for more information

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.
---
---- [ui] ui/consts/read_from_static_mut_ref.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/consts/read_from_static_mut_ref.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/read_from_static_mut_ref/a" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/read_from_static_mut_ref/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0658]: references in statics may only refer to immutable values
  --> /checkout/src/test/ui/consts/read_from_static_mut_ref.rs:5:27
   |
LL | static OH_YES: &mut i32 = &mut 42;
   |                           ^^^^^^^ statics require immutable values
   |
   = note: see issue #57349 <***/issues/57349> for more information
   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.

---
-   --> $DIR/static_mut_containing_mut_ref2.rs:7:45
+ error[E0658]: references in statics may only refer to immutable values
+   --> $DIR/static_mut_containing_mut_ref2.rs:7:46
3    |
4 LL | pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; };
-    |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ modifying a static's initial value from another static's initializer
+    |                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^ statics require immutable values
+    |
+    = note: see issue #57349 <***/issues/57349> for more information
+    = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
7 error: aborting due to previous error
8 

- For more information about this error, try `rustc --explain E0080`.
- For more information about this error, try `rustc --explain E0080`.
+ For more information about this error, try `rustc --explain E0658`.
10 


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/static_mut_containing_mut_ref2.mut_refs/static_mut_containing_mut_ref2.mut_refs.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args consts/static_mut_containing_mut_ref2.rs`

error in revision `mut_refs`: 1 errors occurred comparing output.
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/consts/static_mut_containing_mut_ref2.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--cfg" "mut_refs" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/static_mut_containing_mut_ref2.mut_refs" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/static_mut_containing_mut_ref2.mut_refs/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0658]: references in statics may only refer to immutable values
  --> /checkout/src/test/ui/consts/static_mut_containing_mut_ref2.rs:7:46
   |
LL | pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; };
   |                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^ statics require immutable values
   |
   = note: see issue #57349 <***/issues/57349> for more information
   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.

---
thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:348:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-8/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "8.0.0" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --exclude src/tools/tidy
Build completed unsuccessfully in 0:52:07
Build completed unsuccessfully in 0:52:07
== clock drift check ==
  local time: Sun Jun  7 01:22:31 UTC 2020
  network time: Sun, 07 Jun 2020 01:22:31 GMT
== end clock drift check ==

##[error]Bash exited with code '1'.
##[section]Finishing: Run build
##[section]Starting: Checkout rust-lang/rust@refs/pull/72934/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
Author       : Microsoft
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Cleaning any cached credential from repository: rust-lang/rust (GitHub)
##[section]Finishing: Checkout rust-lang/rust@refs/pull/72934/merge to s
Cleaning up task key
Start cleaning up orphan processes.
Terminate orphan process: pid (3815) (python)
##[section]Finishing: Finalize Job

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 @rust-lang/infra. (Feature Requests)

@pvdrz pvdrz marked this pull request as ready for review June 9, 2020 01:45
Copy link
Contributor

@ecstatic-morse ecstatic-morse left a 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.

@ecstatic-morse
Copy link
Contributor

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.

@pvdrz
Copy link
Contributor Author

pvdrz commented Jun 18, 2020

@ecstatic-morse @oli-obk I think we are ready then.

@oli-obk
Copy link
Contributor

oli-obk commented Jun 19, 2020

r=me with the documentation suggestion or something similarly expanatory.

@bors delegate+

@bors
Copy link
Contributor

bors commented Jun 19, 2020

✌️ @christianpoveda can now approve this pull request

@pvdrz
Copy link
Contributor Author

pvdrz commented Jun 19, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Jun 19, 2020

📌 Commit 5302bd755d5a2a150083fc616e24361ee45d887b has been approved by christianpoveda

@bors bors 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-review Status: Awaiting review from the assignee but also interested parties. labels Jun 19, 2020
@oli-obk
Copy link
Contributor

oli-obk commented Jun 19, 2020

you need to write bors r=oli-obk in order for the review to be able to be blamed on me ;) r+ is just shorthand for r=yourself

@bors r+

@bors
Copy link
Contributor

bors commented Jun 19, 2020

💡 This pull request was already approved, no need to approve it again.

@bors
Copy link
Contributor

bors commented Jun 19, 2020

📌 Commit 5302bd755d5a2a150083fc616e24361ee45d887b has been approved by oli-obk

@pvdrz
Copy link
Contributor Author

pvdrz commented Jun 19, 2020

heh, thanks I've never used bors before :P

@bors
Copy link
Contributor

bors commented Jun 19, 2020

☔ The latest upstream changes (presumably #73504) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 19, 2020
@oli-obk
Copy link
Contributor

oli-obk commented Jun 19, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Jun 19, 2020

📌 Commit 6eb7a2dc0f0df32c2ef380d8a06086db5bdcfc20 has been approved by oli-obk

@bors bors 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 Jun 19, 2020
@pvdrz
Copy link
Contributor Author

pvdrz commented Jun 20, 2020

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Jun 20, 2020

📌 Commit 96031e2 has been approved by oli-obk

bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 20, 2020
…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
@bors bors merged commit dac512e into rust-lang:master Jun 20, 2020
@pvdrz pvdrz deleted the mut-borrows-in-consts branch June 20, 2020 14:12
yvt added a commit to r3-os/r3 that referenced this pull request Jun 25, 2020
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants