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

Allow assignments in const contexts #56070

Merged
merged 15 commits into from Nov 26, 2018

Conversation

Projects
None yet
6 participants
@oli-obk
Contributor

oli-obk commented Nov 19, 2018

fixes #54098
fixes #51251
fixes #52613

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Nov 19, 2018

r? @petrochenkov

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

@rust-highfive

This comment was marked as resolved.

Collaborator

rust-highfive commented Nov 19, 2018

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (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.
travis_time:end:0c1771d4:start=1542631860797261003,finish=1542631862372432762,duration=1575171759
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-5.0
---
[00:52:09] .............................i...................................................................... 600/5041
[00:52:12] .................................................................................................... 700/5041
[00:52:19] .......................................................................................i...........i 800/5041
[00:52:22] .................................................................................................... 900/5041
[00:52:26] ......iiiii......................................................................................... 1000/5041
[00:52:28] .......................F............................................................................ 1100/5041
[00:52:31] .................................................F.................................................. 1200/5041
[00:52:36] .................................................................................................... 1400/5041
[00:52:38] .................................................................................................... 1500/5041
[00:52:41] .......i....................................................................i....................... 1600/5041
[00:52:45] .................................................................................................... 1700/5041
---
[00:54:27] ..........i......................................................................................... 4700/5041
[00:54:31] .................................................................................................... 4800/5041
[00:54:34] .................................................................................................... 4900/5041
[00:54:36] ................................................................................i................... 5000/5041
[00:54:37] .................................F.......
[00:54:37] 
[00:54:37] ---- [ui] ui/error-codes/E0017.rs stdout ----
[00:54:37] diff of stderr:
[00:54:37] 
[00:54:37] 
[00:54:37] 4 LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017
[00:54:37] 5    |                              ^^^^^^ constants require immutable values
[00:54:37] 6 
[00:54:37] + error: cannot mutate statics in the initializer of another static
[00:54:37] +   --> $DIR/E0017.rs:15:39
[00:54:37] +    |
[00:54:37] + LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
[00:54:37] + 
[00:54:37] + 
[00:54:37] 7 error[E0017]: references in statics may only refer to immutable values
[00:54:37] 8   --> $DIR/E0017.rs:15:39
[00:54:37] 
[00:54:37] 
[00:54:37] 22 LL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
[00:54:37] 23    |                                      ^^^^^^ statics require immutable values
[00:54:37] - error: aborting due to 4 previous errors
[00:54:37] + error: aborting due to 5 previous errors
[00:54:37] 26 
[00:54:37] 27 Some errors occurred: E0017, E0596.
[00:54:37] 27 Some errors occurred: E0017, E0596.
[00:54:37] 28 For more information about an error, try `rustc --explain E0017`.
[00:54:37] 
[00:54:37] 
[00:54:37] The actual stderr differed from the expected stderr.
[00:54:37] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/error-codes/E0017/E0017.stderr
[00:54:37] To update references, rerun the tests and pass the `--bless` flag
[00:54:37] To only update this specific test, also pass `--test-args error-codes/E0017.rs`
[00:54:37] error: 1 errors occurred comparing output.
[00:54:37] status: exit code: 1
[00:54:37] status: exit code: 1
[00:54:37] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/error-codes/E0017.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/error-codes/E0017/a" "-Crpath" "-O" "-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/error-codes/E0017/auxiliary" "-A" "unused"
[00:54:37] ------------------------------------------
[00:54:37] 
[00:54:37] ------------------------------------------
[00:54:37] stderr:
[00:54:37] stderr:
[00:54:37] ------------------------------------------
[00:54:37] {"message":"references in constants may only refer to immutable values","code":{"code":"E0017","explanation":"\nReferences in statics and constants may only refer to immutable values.\nErroneous code example:\n\n```compile_fail,E0017\nstatic X: i32 = 1;\nconst C: i32 = 2;\n\n// these three are not allowed:\nconst CR: &'static mut i32 = &mut C;\nstatic STATIC_REF: &'static mut i32 = &mut X;\nstatic CONST_REF: &'static mut i32 = &mut C;\n```\n\nStatics are shared everywhere, and if they refer to mutable data one might\nviolate memory safety since holding multiple mutable references to shared data\nis not allowed.\n\nIf you really want global mutable state, try using `static mut` or a global\n`UnsafeCell`.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/error-codes/E0017.rs","byte_start":534,"byte_end":540,"line_start":14,"line_end":14,"column_start":30,"column_end":36,"is_primary":true,"text":[{"text":"const CR: &'static mut i32 = &mut C; //~ ERROR E0017","highlight_start":30,"highlight_end":36}],"label":"constants require immutable values","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0017]: references in constants may only refer to immutable values\n  --> /checkout/src/test/ui/error-codes/E0017.rs:14:30\n   |\nLL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017\n   |                              ^^^^^^ constants require immutable values\n\n"}
[00:54:37] {"message":"cannot mutate statics in the initializer of another static","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/error-codes/E0017.rs","byte_start":596,"byte_end":602,"line_start":15,"line_end":15,"column_start":39,"column_end":45,"is_primary":true,"text":[{"text":"static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017","highlight_start":39,"highlight_end":45}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: cannot mutate statics in the initializer of another static\n  --> /checkout/src/test/ui/error-codes/E0017.rs:15:39\n   |\nLL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017\n   |                                       ^^^^^^\n\n"}
[00:54:37] {"message":"references in statics may only refer to immutable values","code":{"code":"E0017","explanation":"\nReferences in statics and constants may only refer to immutable values.\nErroneous code example:\n\n```compile_fail,E0017\nstatic X: i32 = 1;\nconst C: i32 = 2;\n\n// these three are not allowed:\nconst CR: &'static mut i32 = &mut C;\nstatic STATIC_REF: &'static mut i32 = &mut X;\nstatic CONST_REF: &'static mut i32 = &mut C;\n```\n\nStatics are shared everywhere, and if they refer to mutable data one might\nviolate memory safety since holding multiple mutable references to shared data\nis not allowed.\n\nIf you really want global mutable state, try using `static mut` or a global\n`UnsafeCell`.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/error-codes/E0017.rs","byte_start":596,"byte_end":602,"line_start":15,"line_end":15,"column_start":39,"column_end":45,"is_primary":true,"text":[{"text":"static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017","highlight_start":39,"highlight_end":45}],"label":"statics require immutable values","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0017]: references in statics may only refer to immutable values\n  --> /checkout/src/test/ui/error-codes/E0017.rs:15:39\n   |\nLL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017\n   |                                       ^^^^^^ statics require immutable values\n\n"}
[00:54:37] {"message":"cannot borrow immutable static item as mutable","code":{"code":"E0596","explanation":"\nThis error occurs because you tried to mutably borrow a non-mutable variable.\n\nExample of erroneous code:\n\n```compile_fail,E0596\nlet x = 1;\nlet y = &mut x; // error: cannot borrow mutably\n```\n\nIn here, `x` isn't mutable, so when we try to mutably borrow it in `y`, it\nfails. To fix this error, you need to make `x` mutable:\n\n```\nlet mut x = 1;\nlet y = &mut x; // ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/error-codes/E0017.rs","byte_start":601,"byte_end":602,"line_start":15,"line_end":15,"column_start":44,"column_end":45,"is_primary":true,"text":[{"text":"static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017","highlight_start":44,"highlight_end":45}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0596]: cannot borrow immutable static item as mutable\n  --> /checkout/src/test/ui/error-codes/E0017.rs:15:44\n   |\nLL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017\n   |                                            ^\n\n"}
[00:54:37] {"message":"references in statics may only refer to immutable values","code":{"code":"E0017","explanation":"\nReferences in statics and constants may only refer to immutable values.\nErroneous code example:\n\n```compile_fail,E0017\nstatic X: i32 = 1;\nconst C: i32 = 2;\n\n// these three are not allowed:\nconst CR: &'static mut i32 = &mut C;\nstatic STATIC_REF: &'static mut i32 = &mut X;\nstatic CONST_REF: &'static mut i32 = &mut C;\n```\n\nStatics are shared everywhere, and if they refer to mutable data one might\nviolate memory safety since holding multiple mutable references to shared data\nis not allowed.\n\nIf you really want global mutable state, try using `static mut` or a global\n`UnsafeCell`.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/error-codes/E0017.rs","byte_start":728,"byte_end":734,"line_start":17,"line_end":17,"column_start":38,"column_end":44,"is_primary":true,"text":[{"text":"static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017","highlight_start":38,"highlight_end":44}],"label":"statics require immutable values","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0017]: references in statics may only refer to immutable values\n  --> /checkout/src/test/ui/error-codes/E0017.rs:17:38\n   |\nLL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017\n   |                                      ^^^^^^ statics require immutable values\n\n"}
[00:54:37] {"message":"aborting due to 5 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 5 previous errors\n\n"}
[00:54:37] {"message":"Some errors occurred: E0017, E0596.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0017, E0596.\n"}
[00:54:37] {"message":"For more information about an error, try `rustc --explain E0017`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about an error, try `rustc --explain E0017`.\n"}
[00:54:37] ------------------------------------------
[00:54:37] 
[00:54:37] thread '[ui] ui/error-codes/E0017.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3282:9
[00:54:37] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:54:37] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:54:37] 
[00:54:37] ---- [ui] ui/error-codes/E0388.rs stdout ----
[00:54:37] diff of stderr:
[00:54:37] 
[00:54:37] 4 LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017
[00:54:37] 5    |                              ^^^^^^ constants require immutable values
[00:54:37] 6 
[00:54:37] + error: cannot mutate statics in the initializer of another static
[00:54:37] +   --> $DIR/E0388.rs:15:39
[00:54:37] +    |
[00:54:37] + LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
[00:54:37] + 
[00:54:37] + 
[00:54:37] 7 error[E0017]: references in statics may only refer to immutable values
[00:54:37] 8   --> $DIR/E0388.rs:15:39
[00:54:37] 
[00:54:37] 
[00:54:37] 22 LL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
[00:54:37] 23    |                                      ^^^^^^ statics require immutable values
[00:54:37] - error: aborting due to 4 previous errors
[00:54:37] + error: aborting due to 5 previous errors
[00:54:37] 26 
[00:54:37] 27 Some errors occurred: E0017, E0596.
[00:54:37] 27 Some errors occurred: E0017, E0596.
[00:54:37] 28 For more information about an error, try `rustc --explain E0017`.
[00:54:37] 
[00:54:37] 
[00:54:37] The actual stderr differed from the expected stderr.
[00:54:37] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/error-codes/E0388/E0388.stderr
[00:54:37] To update references, rerun the tests and pass the `--bless` flag
[00:54:37] To only update this specific test, also pass `--test-args error-codes/E0388.rs`
[00:54:37] error: 1 errors occurred comparing output.
[00:54:37] status: exit code: 1
[00:54:37] status: exit code: 1
[00:54:37] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/error-codes/E0388.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/error-codes/E0388/a" "-Crpath" "-O" "-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/error-codes/E0388/auxiliary" "-A" "unused"
[00:54:37] ------------------------------------------
[00:54:37] 
[00:54:37] ------------------------------------------
[00:54:37] stderr:
[00:54:37] stderr:
[00:54:37] ------------------------------------------
[00:54:37] {"message":"references in constants may only refer to immutable values","code":{"code":"E0017","explanation":"\nReferences in statics and constants may only refer to immutable values.\nErroneous code example:\n\n```compile_fail,E0017\nstatic X: i32 = 1;\nconst C: i32 = 2;\n\n// these three are not allowed:\nconst CR: &'static mut i32 = &mut C;\nstatic STATIC_REF: &'static mut i32 = &mut X;\nstatic CONST_REF: &'static mut i32 = &mut C;\n```\n\nStatics are shared everywhere, and if they refer to mutable data one might\nviolate memory safety since holding multiple mutable references to shared data\nis not allowed.\n\nIf you really want global mutable state, try using `static mut` or a global\n`UnsafeCell`.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/error-codes/E0388.rs","byte_start":534,"byte_end":540,"line_start":14,"line_end":14,"column_start":30,"column_end":36,"is_primary":true,"text":[{"text":"const CR: &'static mut i32 = &mut C; //~ ERROR E0017","highlight_start":30,"highlight_end":36}],"label":"constants require immutable values","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0017]: references in constants may only refer to immutable values\n  --> /checkout/src/test/ui/error-codes/E0388.rs:14:30\n   |\nLL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017\n   |                              ^^^^^^ constants require immutable values\n\n"}
[00:54:37] {"message":"cannot mutate statics in the initializer of another static","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/error-codes/E0388.rs","byte_start":596,"byte_end":602,"line_start":15,"line_end":15,"column_start":39,"column_end":45,"is_primary":true,"text":[{"text":"static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017","highlight_start":39,"highlight_end":45}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: cannot mutate statics in the initializer of another static\n  --> /checkout/src/test/ui/error-codes/E0388.rs:15:39\n   |\nLL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017\n   |                                       ^^^^^^\n\n"}
[00:54:37] {"message":"references in statics may only refer to immutable values","code":{"code":"E0017","explanation":"\nReferences in statics and constants may only refer to immutable values.\nErroneous code example:\n\n```compile_fail,E0017\nstatic X: i32 = 1;\nconst C: i32 = 2;\n\n// these three are not allowed:\nconst CR: &'static mut i32 = &mut C;\nstatic STATIC_REF: &'static mut i32 = &mut X;\nstatic CONST_REF: &'static mut i32 = &mut C;\n```\n\nStatics are shared everywhere, and if they refer to mutable data one might\nviolate memory safety since holding multiple mutable references to shared data\nis not allowed.\n\nIf you really want global mutable state, try using `static mut` or a global\n`UnsafeCell`.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/error-codes/E0388.rs","byte_start":596,"byte_end":602,"line_start":15,"line_end":15,"column_start":39,"column_end":45,"is_primary":true,"text":[{"text":"static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017","highlight_start":39,"highlight_end":45}],"label":"statics require immutable values","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0017]: references in statics may only refer to immutable values\n  --> /checkout/src/test/ui/error-codes/E0388.rs:15:39\n   |\nLL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017\n   |                                       ^^^^^^ statics require immutable values\n\n"}
[00:54:37] {"message":"cannot borrow immutable static item as mutable","code":{"code":"E0596","explanation":"\nThis error occurs because you tried to mutably borrow a non-mutable variable.\n\nExample of erroneous code:\n\n```compile_fail,E0596\nlet x = 1;\nlet y = &mut x; // error: cannot borrow mutably\n```\n\nIn here, `x` isn't mutable, so when we try to mutably borrow it in `y`, it\nfails. To fix this error, you need to make `x` mutable:\n\n```\nlet mut x = 1;\nlet y = &mut x; // ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/error-codes/E0388.rs","byte_start":601,"byte_end":602,"line_start":15,"line_end":15,"column_start":44,"column_end":45,"is_primary":true,"text":[{"text":"static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017","highlight_start":44,"highlight_end":45}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0596]: cannot borrow immutable static item as mutable\n  --> /checkout/src/test/ui/error-codes/E0388.rs:15:44\n   |\nLL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017\n   |                                            ^\n\n"}
[00:54:37] {"message":"references in statics may only refer to immutable values","code":{"code":"E0017","explanation":"\nReferences in statics and constants may only refer to immutable values.\nErroneous code example:\n\n```compile_fail,E0017\nstatic X: i32 = 1;\nconst C: i32 = 2;\n\n// these three are not allowed:\nconst CR: &'static mut i32 = &mut C;\nstatic STATIC_REF: &'static mut i32 = &mut X;\nstatic CONST_REF: &'static mut i32 = &mut C;\n```\n\nStatics are shared everywhere, and if they refer to mutable data one might\nviolate memory safety since holding multiple mutable references to shared data\nis not allowed.\n\nIf you really want global mutable state, try using `static mut` or a global\n`UnsafeCell`.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/error-codes/E0388.rs","byte_start":728,"byte_end":734,"line_start":17,"line_end":17,"column_start":38,"column_end":44,"is_primary":true,"text":[{"text":"static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017","highlight_start":38,"highlight_end":44}],"label":"statics require immutable values","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0017]: references in statics may only refer to immutable values\n  --> /checkout/src/test/ui/error-codes/E0388.rs:17:38\n   |\nLL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017\n   |                                      ^^^^^^ statics require immutable values\n\n"}
[00:54:37] {"message":"aborting due to 5 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 5 previous errors\n\n"}
[00:54:37] {"message":"Some errors occurred: E0017, E0596.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0017, E0596.\n"}
[00:54:37] {"message":"For more information about an error, try `rustc --explain E0017`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about an error, try `rustc --explain E0017`.\n"}
[00:54:37] ------------------------------------------
[00:54:37] 
[00:54:37] thread '[ui] ui/error-codes/E0388.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3282:9
[00:54:37] 
[00:54:37] 
[00:54:37] ---- [ui] ui/write-to-static-mut-in-static.rs stdout ----
[00:54:37] diff of stderr:
[00:54:37] 
[00:54:37] - error[E0658]: statements in statics are unstable (see issue #48821)
[00:54:37] + error: cannot mutate statics in the initializer of another static
[00:54:37] 3    |
[00:54:37] 3    |
[00:54:37] 4 LL | pub static mut B: () = unsafe { A = 1; };
[00:54:37] 5    |                                 ^^^^^
[00:54:37] -    |
[00:54:37] -    = help: add #![feature(const_let)] to the crate attributes to enable
[00:54:37] 8 
[00:54:37] 8 
[00:54:37] - error[E0658]: statements in statics are unstable (see issue #48821)
[00:54:37] + error: cannot mutate statics in the initializer of another static
[00:54:37] 11    |
[00:54:37] 11    |
[00:54:37] 12 LL | pub static mut C: u32 = unsafe { C = 1; 0 };
[00:54:37] 13    |                                  ^^^^^
[00:54:37] -    |
[00:54:37] -    = help: add #![feature(const_let)] to the crate attributes to enable
[00:54:37] 16 
---
[00:54:37] 20 
[00:54:37] 
[00:54:37] 
[00:54:37] The actual stderr differed from the expected stderr.
[00:54:37] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/write-to-static-mut-in-static/write-to-static-mut-in-static.stderr
[00:54:37] To update references, rerun the tests and pass the `--bless` flag
[00:54:37] To only update this specific test, also pass `--test-args write-to-static-mut-in-static.rs`
[00:54:37] error: 1 errors occurred comparing output.
[00:54:37] status: exit code: 1
[00:54:37] status: exit code: 1
[00:54:37] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/write-to-static-mut-in-static.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/write-to-static-mut-in-static/a" "-Crpath" "-O" "-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/write-to-static-mut-in-static/auxiliary" "-A" "unused"
[00:54:37] ------------------------------------------
[00:54:37] 
[00:54:37] ------------------------------------------
[00:54:37] stderr:
[00:54:37] stderr:
[00:54:37] ------------------------------------------
[00:54:37] {"message":"cannot mutate statics in the initializer of another static","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/write-to-static-mut-in-static.rs","byte_start":550,"byte_end":555,"line_start":14,"line_end":14,"column_start":33,"column_end":38,"is_primary":true,"text":[{"text":"pub static mut B: () = unsafe { A = 1; };","highlight_start":33,"highlight_end":38}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: cannot mutate statics in the initializer of another static\n  --> /checkout/src/test/ui/write-to-static-mut-in-static.rs:14:33\n   |\nLL | pub static mut B: () = unsafe { A = 1; };\n   |                                 ^^^^^\n\n"}
[00:54:37] {"message":"cannot mutate statics in the initializer of another static","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/write-to-static-mut-in-static.rs","byte_start":640,"byte_end":645,"line_start":17,"line_end":17,"column_start":34,"column_end":39,"is_primary":true,"text":[{"text":"pub static mut C: u32 = unsafe { C = 1; 0 };","highlight_start":34,"highlight_end":39}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: cannot mutate statics in the initializer of another static\n  --> /checkout/src/test/ui/write-to-static-mut-in-static.rs:17:34\n   |\nLL | pub static mut C: u32 = unsafe { C = 1; 0 };\n   |                                  ^^^^^\n\n"}
[00:54:37] {"message":"aborting due to 2 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 2 previous errors\n\n"}
[00:54:37] ------------------------------------------
[00:54:37] 
[00:54:37] thread '[ui] ui/write-to-static-mut-in-static.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3282:9
[00:54:37] 
---
[00:54:37] 
[00:54:37] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:503:22
[00:54:37] 
[00:54:37] 
[00:54:37] 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-5.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -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" "5.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:54:37] 
[00:54:37] 
[00:54:37] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:54:37] Build completed unsuccessfully in 0:03:52
[00:54:37] Build completed unsuccessfully in 0:03:52
[00:54:37] make: *** [check] Error 1
[00:54:37] Makefile:58: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:03838076
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Mon Nov 19 13:45:49 UTC 2018
---
travis_time:end:0ef77106:start=1542635151099701050,finish=1542635151105064874,duration=5363824
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:19a46870
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:01d63bd6
travis_time:start:01d63bd6
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:0bc72349
$ dmesg | grep -i kill

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 @TimNN. (Feature Requests)

@oli-obk oli-obk force-pushed the oli-obk:const_let branch from 393684d to 59eff14 Nov 19, 2018

@rust-highfive

This comment was marked as resolved.

Collaborator

rust-highfive commented Nov 19, 2018

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (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.
travis_time:end:06f90f88:start=1542643563869916028,finish=1542643567238871105,duration=3368955077
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-5.0
---
[00:49:21] 
[00:49:21] running 5041 tests
[00:49:24] .................................................................................................... 100/5041
[00:49:26] .................................................................................................... 200/5041
[00:49:29] .............................ii............................................ii...................ii.. 300/5041
[00:49:32] ...............................................................................................iii.. 400/5041
[00:49:34] .....iiiiiiii.iii............................iii...........................................i........ 500/5041
[00:49:41] .................................................................................................... 700/5041
[00:49:47] .......................................................................................i...........i 800/5041
[00:49:50] .................................................................................................... 900/5041
[00:49:53] ......iiiii..................ii.iiii................................................................ 1000/5041
[00:49:53] ......iiiii..................ii.iiii................................................................ 1000/5041
[00:49:55] ........................F........................................................iiiiiiii........... 1100/5041
[00:49:58] ................................................F................................................... 1200/5041
[00:50:03] .................................................................................................... 1400/5041
[00:50:05] ......................................i............................................................. 1500/5041
[00:50:08] .......i.........ii..........................................................i...................... 1600/5041
[00:50:11] .................................................................................................... 1700/5041
---
[00:50:28] .................................................................................................... 2200/5041
[00:50:32] .................................................................................................... 2300/5041
[00:50:35] .................................................................................................... 2400/5041
[00:50:39] .................................................................................................... 2500/5041
[00:50:42] ..........................................................................................iiiiiiiii. 2600/5041
[00:50:49] ........................................................ii.......................................... 2800/5041
[00:50:52] .................................................................................................... 2900/5041
[00:50:56] .................................................................................................... 3000/5041
[00:50:59] ...................................................i................................................ 3100/5041
---
[00:51:44] ..........i......................................................................................... 4700/5041
[00:51:48] .................................................................................................... 4800/5041
[00:51:50] .................................................................................................... 4900/5041
[00:51:53] ................................................................................i................... 5000/5041
0:51:54] 23    |                                      ^^^^^^ statics require immutable values
[00:51:54] 24 
[00:51:54] - error: aborting due to 4 previous errors
[00:51:54] + error: aborting due to 5 previous errors
[00:51:54] 26 
[00:51:54] 26 
[00:51:54] 27 Some errors occurred: E0017, E0596.
[00:51:54] 28 For more information about an error, try `rustc --explain E0017`.
[00:51:54] 
[00:51:54] 
[00:51:54] The actual stderr differed from the expected stderr.
[00:51:54] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/error-codes/E0017.nll/E0017.nll.stderr
[00:51:54] To update references, rerun the tests and pass the `--bless` flag
[00:51:54] To only update this specific test, also pass `--test-args error-codes/E0017.rs`
[00:51:54] error: 1 errors occurred comparing output.
[00:51:54] status: exit code: 1
[00:51:54] status: exit code: 1
[00:51:54] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/error-codes/E0017.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/error-codes/E0017.nll/a" "-Zborrowck=migrate" "-Ztwo-phase-borrows" "-Crpath" "-O" "-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/error-codes/E0017.nll/auxiliary" "-A" "unused"
[00:51:54] ------------------------------------------
[00:51:54] 
[00:51:54] ------------------------------------------
[00:51:54] stderr:
[00:51:54] stderr:
[00:51:54] -------------------------------.rs","byte_start":596,"byte_end":602,"line_start":15,"line_end":15,"column_start":39,"column_end":45,"is_primary":true,"text":[{"text":"static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017","highlight_start":39,"highlight_end":45}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: cannot mutate statics in the initializer of another static\n  --> /checkout/src/test/ui/error-codes/E0017.rs:15:39\n   |\nLL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017\n   |                                       ^^^^^^\n\n"}
[00:51:54] {"message":"references in statics may only refer to immutable values","code":{"code":"E0017","explanation":"\nReferences in statics and constants may only refer to immutable values.\nErroneous code example:\n\n```compile_fail,E0017\nstatic X: i32 = 1;\nconst C: i32 = 2;\n\n// these three are not allowed:\nconst CR: &'static mut i32 = &mut C;\nstatic STATIC_REF: &'static mut i32 = &mut X;\nstatic CONST_REF: &'static mut i32 = &mut C;\n```\n\nStatics are shared everywhere, and if they refer to mutable data one might\nviolate memory safety since holding multiple mutable references to shared data\nis not allowed.\n\nIf you really want global mutable state, try using `static mut` or a global\n`UnsafeCell`.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/error-codes/E0017.rs","byte_start":596,"byte_end":602,"line_start":15,"line_end":15,"column_start":39,"column_end":45,"is_primary":true,"text":[{"text":"static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017","highlight_start":39,"highlight_end":45}],"label":"statics require immutable values","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0017]: references in statics may only refer to immutable values\n  --> /checkout/src/test/ui/error-codes/E0017.rs:15:39\n   |\nLL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017\n   |                                       ^^^^^^ statics require immutable values\n\n"}
[00:51:54] {"message":"cannot borrow immutable static item `X` as mutable","code":{"code":"E0596","explanation":"\nThis error occurs because you tried to mutably borrow a non-mutable variable.\n\nExample of erroneous code:\n\n```compile_fail,E0596\nlet x = 1;\nlet y = &mut x; // error: cannot borrow mutably\n```\n\nIn here, `x` isn't mutable, so when we try to mutably borrow it in `y`, it\nfails. To fix this error, you need to make `x` mutable:\n\n```\nlet mut x = 1;\nlet y = &mut x; // ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/error-codes/E0017.rs","byte_start":596,"byte_end":602,"line_start":15,"line_end":15,"column_start":39,"column_end":45,"is_primary":true,"text":[{"text":"static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017","highlight_start":39,"highlight_end":45}],"label":"cannot borrow as mutable","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0596]: cannot borrow immutable static item `X` as mutable\n  --> /checkout/src/test/ui/error-codes/E0017.rs:15:39\n   |\nLL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017\n   |                                       ^^^^^^ cannot borrow as mutable\n\n"}
[00:51:54] {"message":"references in statics may only refer to immutable values","code":{"code":"E0017","explanation":"\nReferences in statics and constants may only refer to immutable values.\nErroneous code example:\n\n```compile_fail,E0017\nstatic X: i32 = 1;\nconst C: i32 = 2;\n\n// these three are not allowed:\nconst CR: &'static mut i32 = &mut C;\nstatic STATIC_REF: &'static mut i32 = &mut X;\nstatic CONST_REF: &'static mut i32 = &mut C;\n```\n\nStatics are shared everywhere, and if they refer to mutable data one might\nviolate memory safety since holding multiple mutable references to shared data\nis not allowed.\n\nIf you really want global mutable state, try using `static mut` or a global\n`UnsafeCell`.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/error-codes/E0017.rs","byte_start":807,"byte_end":813,"line_start":18,"line_end":18,"column_start":38,"column_end":44,"is_primary":true,"text":[{"text":"static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017","highlight_start":38,"highlight_end":44}],"label":"statics require immutable values","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0017]: references in statics may only refer to immutable values\n  --> /checkout/src/test/ui/error-codes/E0017.rs:18:38\n   |\nLL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017\n   |                                      ^^^^^^ statics require immutable values\n\n"}
[00:51:54] {"message":"aborting due to 5 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 5 previous errors\n\n"}
[00:51:54] {"message":"Some errors occurred: E0017, E0596.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0017, E0596.\n"}
[00:51:54] {"message":"For more information about an error, try `rustc --explain E0017`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about an error, try `rustc --explain E0017`.\n"}
[00:51:54] ------------------------------------------
[00:51:54] 
[00:51:54] thread '[ui (nll)] ui/error-codes/E0017.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3282:9
[00:51:54] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:51:54] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:51:54] 
[00:51:54] ---- [ui (nll)] ui/error-codes/E0388.rs stdout ----
[00:51:54] diff of stderr:
[00:51:54] 
[00:51:54] 4 LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017
[00:51:54] 5    |                              ^^^^^^ constants require immutable values
[00:51:54] 6 
[00:51:54] + error: cannot mutate statics in the initializer of another static
[00:51:54] +   --> $DIR/E0388.rs:15:39
[00:51:54] +    |
[00:51:54] + LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
[00:51:54] + 
[00:51:54] + 
[00:51:54] 7 error[E0017]: references in statics may only refer to immutable values
[00:51:54] 8   --> $DIR/E0388.rs:15:39
[00:51:54] 
[00:51:54] 17    |                                       ^^^^^^ cannot borrow as mutable
[00:51:54] 18 
[00:51:54] 18 
[00:51:54] 19 error[E0017]: references in statics may only refer to immutable values
[00:51:54] -   --> $DIR/E0388.rs:17:38
[00:51:54] +   --> $DIR/E0388.rs:18:38
[00:51:54] 21    |
[00:51:54] 22 LL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
[00:51:54] 23    |                                      ^^^^^^ statics require immutable values
[00:51:54] 24 
[00:51:54] - error: aborting due to 4 previous errors
[00:51:54] + error: aborting due to 5 previous errors
[00:51:54] 26 
[00:51:54] 26 
[00:51:54] 27 Some errors occurred: E0017, E0596.
[00:51:54] 28 For more information about an error, try `rustc --explain E0017`.
[00:51:54] 
[00:51:54] 
[00:51:54] The actual stderr differed from the expected stderr.
[00:51:54] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/error-codes/E0388.nll/E0388.nll.stderr
[00:51:54] To update references, rerun the tests and pass the `--bless` flag
[00:51:54] To only update this specific test, also pass `--test-args error-codes/E0388.rs`
[00:51:54] error: 1 errors occurred comparing output.
[00:51:54] status: exit code: 1
[00:51:54] status: exit code: 1
[00:51:54] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/error-codes/E0388.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/error-codes/E0388.nll/a" "-Zborrowck=migrate" "-Ztwo-phase-borrows" "-Crpath" "-O" "-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/error-codes/E0388.nll/auxiliary" "-A" "unused"
[00:51:54] stdout:
[00:51:54] ----------- {"message":"cannot mutate statics in the initializer of another static","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/error-codes/E0388.rs","byte_start":596,"byte_end":602,"line_start":15,"line_end":15,"column_start":39,"column_end":45,"is_primary":true,"text":[{"text":"static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017","highlight_start":39,"highlight_end":45}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: cannot mutate statics in the initializer of another static\n  --> /checkout/src/test/ui/error-codes/E0388.rs:15:39\n   |\nLL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017\n   |                                       ^^^^^^\n\n"}
[00:51:54] {"message":"references in statics may only refer to immutable values","code":{"code":"E0017","explanation":"\nReferences in statics and constants may only refer to immutable values.\nErroneous code example:\n\n```compile_fail,E0017\nstatic X: i32 = 1;\nconst C: i32 = 2;\n\n// these three are not allowed:\nconst CR: &'static mut i32 = &mut C;\nstatic STATIC_REF: &'static mut i32 = &mut X;\nstatic CONST_REF: &'static mut i32 = &mut C;\n```\n\nStatics are shared everywhere, and if they refer to mutable data one might\nviolate memory safety since holding multiple mutable references to shared data\nis not allowed.\n\nIf you really want global mutable state, try using `static mut` or a global\n`UnsafeCell`.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/error-codes/E0388.rs","byte_start":596,"byte_end":602,"line_start":15,"line_end":15,"coluout/src/test/ui/error-codes/E0388.rs:15:39\n   |\nLL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017\n   |                                       ^^^^^^ cannot borrow as mutable\n\n"}
[00:51:54] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:503:22
[00:51:54] {"message":"references in statics may only refer to immutable values","code":{"code":"E0017","explanation":"\nReferences in statics and constants may only refer to immutable values.\nErroneous code example:\n\n```compile_fail,E0017\nstatic X: i32 = 1;\nconst C: i32 = 2;\n\n// these three are not allowed:\nconst CR: &'static mut i32 = &mut C;\nstatic STATIC_REF: &'static mut i32 = &mut X;\nstatic CONST_REF: &'static mut i32 = &mut C;\n```\n\nStatics are shared everywhere, and if they refer to mutable data one might\nviolate memory safety since holding multiple mutable references to shared data\nis not allowed.\n\nIf you really want global mutable state, try using `static mut` or a global\n`UnsafeCell`.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/error-codes/E0388.rs","byte_start":807,"byte_end":813,"line_start":18,"line_end":18,"column_start":38,"column_end":44,"is_primary":true,"text":[{"text":"static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017","highlight_start":38,"highlight_end":44}],"label":"statics require immutable values","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0017]: references in statics may only refer to immutable values\n  --> /checkout/src/test/ui/error-codes/E0388.rs:18:38\n   |\nLL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017\n   |                                      ^^^^^^ statics require immutable values\n\n"}
[00:51:54] {"message":"aborting due to 5 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 5 previous errors\n\n"}
[00:51:54] {"message":"Some errors occurred: E0017, E0596.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0017, E0596.\n"}
[00:51:54] {"message":"For more information about an error, try `rustc --explain E0017`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about an error, try `rustc --explain E0017`.\n"}
[00:51:54] ------------------------------------------
[00:51:54] 
[00:51:54] thread '[ui (nll)] ui/error-codes/E0388.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3282:9
[00:51:54] 
---
[00:51:54] test result: FAILED. 4953 passed; 2 failed; 86 ignored; 0 measured; 0 filtered out
[00:51:54] 
[00:51:54] 
[00:51:54] 
[00:51:54] 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-5.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -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" "5.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always" "--compare-mode" "nll"
[00:51:54] 
[00:51:54] 
[00:51:54] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:51:54] Build completed unsuccessfully in 0:06:11
[00:51:54] Build completed unsuccessfully in 0:06:11
[00:51:54] Makefile:58: recipe for target 'check' failed
[00:51:54] make: *** [check] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:005199f0
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Mon Nov 19 16:58:10 UTC 2018

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 @TimNN. (Feature Requests)

@petrochenkov

This comment has been minimized.

Contributor

petrochenkov commented Nov 19, 2018

@rust-highfive

This comment was marked as resolved.

Collaborator

rust-highfive commented Nov 20, 2018

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (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.
travis_time:end:03713b74:start=1542710313539734588,finish=1542710368635514524,duration=55095779936
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-5.0
---

[00:03:46] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:03:46] tidy error: /checkout/src/test/ui/consts/promote_const_let.rs: missing trailing newline
[00:03:47] some tidy checks failed
[00:03:47] 
[00:03:47] 
[00:03:47] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:03:47] 
[00:03:47] 
[00:03:47] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:03:47] Build completed unsuccessfully in 0:00:47
[00:03:47] Build completed unsuccessfully in 0:00:47
[00:03:47] make: *** [tidy] Error 1
[00:03:47] Makefile:79: recipe for target 'tidy' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:223dacbe
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Tue Nov 20 10:43:25 UTC 2018
---
travis_time:end:1fa39f6b:start=1542710605992526148,finish=1542710605997783133,duration=5256985
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:116efc03
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:15587fb8
travis_time:start:15587fb8
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:08c1f4ac
$ dmesg | grep -i kill

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 @TimNN. (Feature Requests)

oli-obk added some commits Nov 20, 2018

@RalfJung

This comment has been minimized.

Member

RalfJung commented Nov 20, 2018

r=me with tidy happy:

[00:03:46] tidy error: /checkout/src/test/ui/consts/promote_const_let.rs: missing trailing newline
[00:03:47] some tidy checks failed
@oli-obk

This comment has been minimized.

Contributor

oli-obk commented Nov 20, 2018

@bors r=RalfJung

@bors

This comment has been minimized.

Contributor

bors commented Nov 20, 2018

📌 Commit 37fcd5c has been approved by RalfJung

Place::Local(index) => break *index,
// projections are transparent for assignments
// we qualify the entire destination at once, even if just a field would have
// stricter qualification

This comment has been minimized.

@eddyb

eddyb Nov 21, 2018

Member

This doesn't seem correct - if you assign something with less qualifications to a field of a value with more, you turn those bits off.

@eddyb

This comment has been minimized.

Member

eddyb commented Nov 21, 2018

In the future, please cc me on qualify_consts changes.

@bors r-

// projections are transparent for assignments
// we qualify the entire destination at once, even if just a field would have
// stricter qualification
Place::Projection(proj) => dest = &proj.base,

This comment has been minimized.

@oli-obk

oli-obk Nov 21, 2018

Contributor

Continuing with

the mindset when dealing with [const qualif] should be "how do I break this?"

Projections would include Deref, which isn't a problem because we can't have mutable references at all inside const contexts. Still something to think about.

Downcast also can't happen, because we'd need match for that.

Maybe we should just whitelist field projections for now.

This comment has been minimized.

@eddyb

eddyb Nov 21, 2018

Member

The problem is something like this:

const FOO: &(Cell<usize>, bool) = &{
    let mut foo = (Cell::new(0), false);
    foo.1 = true; // resets `qualif(foo)` to `qualif(true)`
    foo
};

I suspect that will actually compile with this PR, although I'd like a confirmation.

We could add this as a testcase, but you might be able to come up with something simpler/more general.

This comment has been minimized.

@oli-obk

oli-obk Nov 21, 2018

Contributor

This indeed compiles successfully with this PR

This comment has been minimized.

@eddyb

eddyb Nov 21, 2018

Member

My suggestion is field (or projections in general) assignment should combine qualifications (i.e. |=) instead of replacing them.

This comment has been minimized.

@oli-obk

oli-obk Nov 21, 2018

Contributor

I now reuse the existing projection checks for reading values. These checks replace the qualification with NOT_CONST, so there's no real use in combining I think?

@RalfJung

This comment has been minimized.

Member

RalfJung commented Nov 21, 2018

In the future, please cc me on qualify_consts changes.

I'll happily hand them over to you. ;)

r? @eddyb

@rust-highfive rust-highfive assigned eddyb and unassigned RalfJung Nov 21, 2018

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Nov 21, 2018

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (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.
travis_time:end:065e7ce8:start=1542793454701620808,finish=1542793512762261299,duration=58060640491
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-5.0
---

[00:04:52] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:52] tidy error: /checkout/src/test/ui/consts/projection_qualif.rs: missing trailing newline
[00:04:52] tidy error: /checkout/src/test/ui/consts/partial_qualif.rs: missing trailing newline
[00:04:53] some tidy checks failed
[00:04:53] 
[00:04:53] 
[00:04:53] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:04:53] 
[00:04:53] 
[00:04:53] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:53] Build completed unsuccessfully in 0:01:02
[00:04:53] Build completed unsuccessfully in 0:01:02
[00:04:53] Makefile:79: recipe for target 'tidy' failed
[00:04:53] make: *** [tidy] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:2218e2ff
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Wed Nov 21 09:50:16 UTC 2018
---
travis_time:end:22c719fc:start=1542793817090665327,finish=1542793817095606984,duration=4941657
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0497bbba
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:00f12be8
travis_time:start:00f12be8
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:0ef37a6f
$ dmesg | grep -i kill

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 @TimNN. (Feature Requests)

@oli-obk

This comment has been minimized.

Contributor

oli-obk commented Nov 21, 2018

@bors r=eddyb

@bors

This comment has been minimized.

Contributor

bors commented Nov 21, 2018

📌 Commit 6db8c6c has been approved by eddyb

@bors

This comment has been minimized.

Contributor

bors commented Nov 26, 2018

⌛️ Testing commit 6db8c6c with merge b51632e...

bors added a commit that referenced this pull request Nov 26, 2018

Auto merge of #56070 - oli-obk:const_let, r=eddyb
Allow assignments in const contexts

fixes #54098
fixes #51251
fixes #52613
@bors

This comment has been minimized.

Contributor

bors commented Nov 26, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: eddyb
Pushing b51632e to master...

@bors bors merged commit 6db8c6c into rust-lang:master Nov 26, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@bors bors referenced this pull request Nov 26, 2018

Merged

avoid features_untracked #56021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment