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

[WIP] Make interning explicitly care about types and the mutability of memory #58351

Open
wants to merge 12 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@oli-obk
Copy link
Contributor

oli-obk commented Feb 10, 2019

r? @RalfJung

This implementation is incomplete out of multiple reasons

  • add -Zunleash_the_miri_inside_of_you tests
  • find the all hands notes again
    • reread the all hands notes
  • everything behind immutable references is treated as immutable (even if it has interior mutability)
  • validity checks do not actually test whether the mutability of their allocations match what they see in the type
@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

rust-highfive commented Feb 10, 2019

The job x86_64-gnu-llvm-6.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:0c53cb56:start=1549808284890182275,finish=1549808385897884384,duration=101007702109
$ 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-6.0
---
[00:11:49]    Compiling rustc_typeck v0.0.0 (/checkout/src/librustc_typeck)
[00:11:51] error[E0432]: unresolved import `const_eval`
[00:11:51]   --> src/librustc_mir/interpret/intern.rs:21:5
[00:11:51]    |
[00:11:51] 21 | use const_eval::{CompileTimeInterpreter, CompileTimeEvalContext};
[00:11:51]    |     ^^^^^^^^^^ did you mean `crate::const_eval`?
[00:11:51]    |
[00:11:51]    = note: `use` statements changed in Rust 2018; read more at <https://doc.rust-lang.org/edition-guide/rust-2018/module-system/path-clarity.html>
[00:11:51] 
[00:11:54] error[E0392]: parameter `'a` is never used
[00:11:54]   --> src/librustc_mir/interpret/intern.rs:23:27
[00:11:54]    |
[00:11:54] 23 | struct InternVisitor<'rt, 'a: 'rt, 'mir: 'rt, 'tcx: 'a+'rt+'mir> {
[00:11:54]    |                           ^^ unused type parameter
[00:11:54]    |
[00:11:54]    = help: consider removing `'a` or using a marker such as `std::marker::PhantomData`
[00:11:54] 
[00:11:54] error[E0392]: parameter `'mir` is never used
[00:11:54]   --> src/librustc_mir/interpret/intern.rs:23:36
[00:11:54]    |
[00:11:54] 23 | struct InternVisitor<'rt, 'a: 'rt, 'mir: 'rt, 'tcx: 'a+'rt+'mir> {
[00:11:54]    |                                    ^^^^ unused type parameter
[00:11:54]    |
[00:11:54]    = help: consider removing `'mir` or using a marker such as `std::marker::PhantomData`
[00:11:55] error: aborting due to 3 previous errors
[00:11:55] 
[00:11:55] Some errors occurred: E0392, E0432.
[00:11:55] For more information about an error, try `rustc --explain E0392`.
[00:11:55] For more information about an error, try `rustc --explain E0392`.
[00:11:55] error: Could not compile `rustc_mir`.
[00:11:55] warning: build failed, waiting for other jobs to finish...
[00:14:40] error: build failed
[00:14:40] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:14:40] expected success, got: exit code: 101
[00:14:40] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:14:40] Build completed unsuccessfully in 0:11:23
[00:14:40] make: *** [all] Error 1
[00:14:40] Makefile:18: recipe for target 'all' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:08ee4fb3
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Sun Feb 10 14:34:36 UTC 2019
---
travis_fold:end:after_failure.1
travis_fold:start:after_failure.2
travis_time:start:1b39cc28
$ ls -lat $HOME/Library/Logs/DiagnosticReports/
ls: cannot access '/home/travis/Librarers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:1dd2e398
$ 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)

DUMMY_SP,
&format!("missing allocation {:?}", ptr.alloc_id),
);
return self.const_undef(llty);

This comment has been minimized.

@RalfJung

RalfJung Feb 10, 2019

Member

Under which circumstances should we not abort immediately here?

@@ -56,12 +57,12 @@ pub struct Memory<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'a, 'mir, 'tcx>> {
/// the wrong type), so we let the machine override this type.
/// Either way, if the machine allows writing to a static, doing so will
/// create a copy of the static allocation here.
alloc_map: M::MemoryMap,
crate alloc_map: M::MemoryMap,

This comment has been minimized.

@RalfJung

RalfJung Feb 10, 2019

Member

Why is this needed?

@bors

This comment was marked as outdated.

Copy link
Contributor

bors commented Feb 12, 2019

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

@oli-obk oli-obk force-pushed the oli-obk:double_check_const_eval branch from 7d53e06 to 11518e2 Feb 13, 2019

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

rust-highfive commented Feb 13, 2019

The job x86_64-gnu-llvm-6.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:02bbcc50:start=1550073528021582722,finish=1550074103376909768,duration=575355327046
$ 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-6.0
---
[01:15:56] failures:
[01:15:56] 
[01:15:56] ---- [run-pass] run-pass/statics/static-recursive.rs stdout ----
[01:15:56] 
[01:15:56] error: test compilation failed although it shouldn't!
[01:15:56] status: exit code: 1
[01:15:56] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/run-pass/statics/static-recursive.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass/statics/static-recursive/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/run-pass/statics/static-recursive/auxiliary"
[01:15:56] ------------------------------------------
[01:15:56] 
[01:15:56] ------------------------------------------
[01:15:56] stderr:
[01:15:56] stderr:
[01:15:56] ------------------------------------------
[01:15:56] {"message":"cycle detected when const-evaluating `L1`","code":{"code":"E0391","explanation":"\nThis error indicates that some types or traits depend on each other\nand therefore cannot be constructed.\n\nThe following example contains a circular dependency between two traits:\n\n```compile_fail,E0391\ntrait FirstTrait : SecondTrait {\n\n}\n\ntrait SecondTrait : FirstTrait {\n\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/run-pass/statics/static-recursive.rs","byte_start":226,"byte_end":276,"line_start":11,"line_end":11,"column_start":1,"column_end":51,"is_primary":true,"text":[{"text":"static L1: StaticDoubleLinked = StaticDoubleLinked{prev: &L3, next: &L2, data: 1, head: true};","highlight_start":1,"highlight_end":51}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"...which requires const-evaluating `L2`...","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/run-pass/statics/static-recursive.rs","byte_start":321,"byte_end":371,"line_start":12,"line_end":12,"column_start":1,"column_end":51,"is_primary":true,"text":[{"text":"static L2: StaticDoubleLinked = StaticDoubleLinked{prev: &L1, next: &L3, data: 2, head: false};","highlight_start":1,"highlight_end":51}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"...which requires const-evaluating `L2`...","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/run-pass/statics/static-recursive.rs","byte_start":321,"byte_end":371,"line_start":12,"line_end":12,"column_start":1,"column_end":51,"is_primary":true,"text":[{"text":"static L2: StaticDoubleLinked = StaticDoubleLinked{prev: &L1, next: &L3, data: 2, head: false};","highlight_start":1,"highlight_end":51}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"...which requires const-evaluating `L3`...","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/run-pass/statics/static-recursive.rs","byte_start":417,"byte_end":467,"line_start":13,"line_end":13,"column_start":1,"column_end":51,"is_primary":true,"text":[{"text":"static L3: StaticDoubleLinked = StaticDoubleLinked{prev: &L2, next: &L1, data: 3, head: false};","highlight_start":1,"highlight_end":51}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"...which requires const-evaluating `L3`...","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/run-pass/statics/static-recursive.rs","byte_start":417,"byte_end":467,"line_start":13,"line_end":13,"column_start":1,"column_end":51,"is_primary":true,"text":[{"text":"static L3: StaticDoubleLinked = StaticDoubleLinked{prev: &L2, next: &L1, data: 3, head: false};","highlight_start":1,"highlight_end":51}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"...which requires const-evaluating `L1`...","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/run-pass/statics/static-recursive.rs","byte_start":226,"byte_end":276,"line_start":11,"line_end":11,"column_start":1,"column_end":51,"is_primary":true,"text":[{"text":"static L1: StaticDoubleLinked = StaticDoubleLinked{prev: &L3, next: &L2, data: 1, head: true};","highlight_start":1,"highlight_end":51}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"...which again requires const-evaluating `L1`, completing the cycle","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"cycle used when const-evaluating + checking `L1`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/run-pass/statics/static-recursive.rs","byte_start":226,"byte_end":276,"line_start":11,"line_end":11,"column_start":1,"column_end":51,"is_primary":true,"text":[{"text":"static L1: StaticDoubleLinked = StaticDoubleLinked{prev: &L3, next: &L2, data: 1, head: true};","highlight_start":1,"highlight_end":51}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0391]: cycle detected when const-evaluating `L1`\n  --> /checkout/src/test/run-pass/statics/static-recursive.rs:11:1\n   |\nLL | static L1: StaticDoubleLinked = StaticDoubleLinked{prev: &L3, next: &L2, data: 1, head: true};\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n   |\nnote: ...which requires const-evaluating `L2`...\n  --> /checkout/src/test/run-pass/statics/static-recursive.rs:12:1\n   |\nLL | static L2: StaticDoubleLinked = StaticDoubleLinked{prev: &L1, next: &L3, data: 2, head: false};\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nnote: ...which requires const-evaluating `L2`...\n  --> /checkout/src/test/run-pass/statics/static-recursive.rs:12:1\n   |\nLL | static L2: StaticDoubleLinked = StaticDoubleLinked{prev: &L1, next: &L3, data: 2, head: false};\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nnote: ...which requires const-evaluating `L3`...\n  --> /checkout/src/test/run-pass/statics/static-recursive.rs:13:1\n   |\nLL | static L3: StaticDoubleLinked = StaticDoubleLinked{prev: &L2, next: &L1, data: 3, head: false};\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nnote: ...which requires const-evaluating `L3`...\n  --> /checkout/src/test/run-pass/statics/static-recursive.rs:13:1\n   |\nLL | static L3: StaticDoubleLinked = StaticDoubleLinked{prev: &L2, next: &L1, data: 3, head: false};\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nnote: ...which requires const-evaluating `L1`...\n  --> /checkout/src/test/run-pass/statics/static-recursive.rs:11:1\n   |\nLL | static L1: StaticDoubleLinked = StaticDoubleLinked{prev: &L3, next: &L2, data: 1, head: true};\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n   = note: ...which again requires const-evaluating `L1`, completing the cycle\nnote: cycle used when const-evaluating + checking `L1`\n  --> /checkout/src/test/run-pass/statics/static-recursive.rs:11:1\n   |\nLL | static L1: StaticDoubleLinked = StaticDoubleLinked{prev: &L3, next: &L2, data: 1, head: true};\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
[01:15:56] {"message":"For more information about this error, try `rustc --explain E0391`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0391`.\n"}
[01:15:56] 
[01:15:56] ------------------------------------------
[01:15:56] 
---
[01:15:56] 
[01:15:56] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:496:22
[01:15:56] 
[01:15:56] 
[01:15:56] 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/run-pass" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "run-pass" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--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" "6.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"
[01:15:56] 
[01:15:56] 
[01:15:56] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:15:56] Build completed unsuccessfully in 0:11:13
[01:15:56] Build completed unsuccessfully in 0:11:13
[01:15:56] make: *** [check] Error 1
[01:15:56] Makefile:48: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0936a626
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Wed Feb 13 17:24:29 UTC 2019

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)

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

rust-highfive commented Feb 13, 2019

The job x86_64-gnu-llvm-6.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:106f9710:start=1550082706667581869,finish=1550082783207166205,duration=76539584336
$ 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-6.0
---
[01:12:03] .................................................................................................... 2100/2949
[01:12:21] ........................................................test [run-pass] run-pass/mpsc_stress.rs has been running for over 60 seconds
[01:12:26] ............................................ 2200/2949
[01:12:37] .....................................................................ii............................. 2300/2949
[01:12:54] .......................................i.........................................................F.. 2400/2949
[01:13:40] .................................................................................................... 2600/2949
[01:13:52] .................................................................................................... 2700/2949
[01:14:03] .................................................................................................... 2800/2949
[01:14:15] .................................................................................................... 2900/2949
[01:14:15] .................................................................................................... 2900/2949
[01:14:22] .................................................
[01:14:22] failures:
[01:14:22] 
[01:14:22] ---- [run-pass] run-pass/statics/static-recursive.rs stdout ----
[01:14:22] 
[01:14:22] error: test compilation failed although it shouldn't!
[01:14:22] status: exit code: 1
[01:14:22] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/run-pass/statics/static-recursive.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass/statics/static-recursive/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/run-pass/statics/static-recursive/auxiliary"
[01:14:22] ------------------------------------------
[01:14:22] 
[01:14:22] ------------------------------------------
[01:14:22] stderr:
[01:14:22] stderr:
[01:14:22] ------------------------------------------
[01:14:22] {"message":"cycle detected when const-evaluating `L1`","code":{"code":"E0391","explanation":"\nThis error indicates that some types or traits depend on each other\nand therefore cannot be constructed.\n\nThe following example contains a circular dependency between two traits:\n\n```compile_fail,E0391\ntrait FirstTrait : SecondTrait {\n\n}\n\ntrait SecondTrait : FirstTrait {\n\n}\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/run-pass/statics/static-recursive.rs","byte_start":226,"byte_end":276,"line_start":11,"line_end":11,"column_start":1,"column_end":51,"is_primary":true,"text":[{"text":"static L1: StaticDoubleLinked = StaticDoubleLinked{prev: &L3, next: &L2, data: 1, head: true};","highlight_start":1,"highlight_end":51}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"...which requires const-evaluating `L2`...","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/run-pass/statics/static-recursive.rs","byte_start":321,"byte_end":371,"line_start":12,"line_end":12,"column_start":1,"column_end":51,"is_primary":true,"text":[{"text":"static L2: StaticDoubleLinked = StaticDoubleLinked{prev: &L1, next: &L3, data: 2, head: false};","highlight_start":1,"highlight_end":51}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"...which requires const-evaluating `L2`...","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/run-pass/statics/static-recursive.rs","byte_start":321,"byte_end":371,"line_start":12,"line_end":12,"column_start":1,"column_end":51,"is_primary":true,"text":[{"text":"static L2: StaticDoubleLinked = StaticDoubleLinked{prev: &L1, next: &L3, data: 2, head: false};","highlight_start":1,"highlight_end":51}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"...which requires const-evaluating `L3`...","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/run-pass/statics/static-recursive.rs","byte_start":417,"byte_end":467,"line_start":13,"line_end":13,"column_start":1,"column_end":51,"is_primary":true,"text":[{"text":"static L3: StaticDoubleLinked = StaticDoubleLinked{prev: &L2, next: &L1, data: 3, head: false};","highlight_start":1,"highlight_end":51}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"...which requires const-evaluating `L3`...","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/run-pass/statics/static-recursive.rs","byte_start":417,"byte_end":467,"line_start":13,"line_end":13,"column_start":1,"column_end":51,"is_primary":true,"text":[{"text":"static L3: StaticDoubleLinked = StaticDoubleLinked{prev: &L2, next: &L1, data: 3, head: false};","highlight_start":1,"highlight_end":51}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"...which requires const-evaluating `L1`...","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/run-pass/statics/static-recursive.rs","byte_start":226,"byte_end":276,"line_start":11,"line_end":11,"column_start":1,"column_end":51,"is_primary":true,"text":[{"text":"static L1: StaticDoubleLinked = StaticDoubleLinked{prev: &L3, next: &L2, data: 1, head: true};","highlight_start":1,"highlight_end":51}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"...which again requires const-evaluating `L1`, completing the cycle","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"cycle used when const-evaluating + checking `L1`","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/run-pass/statics/static-recursive.rs","byte_start":226,"byte_end":276,"line_start":11,"line_end":11,"column_start":1,"column_end":51,"is_primary":true,"text":[{"text":"static L1: StaticDoubleLinked = StaticDoubleLinked{prev: &L3, next: &L2, data: 1, head: true};","highlight_start":1,"highlight_end":51}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0391]: cycle detected when const-evaluating `L1`\n  --> /checkout/src/test/run-pass/statics/static-recursive.rs:11:1\n   |\nLL | static L1: StaticDoubleLinked = StaticDoubleLinked{prev: &L3, next: &L2, data: 1, head: true};\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n   |\nnote: ...which requires const-evaluating `L2`...\n  --> /checkout/src/test/run-pass/statics/static-recursive.rs:12:1\n   |\nLL | static L2: StaticDoubleLinked = StaticDoubleLinked{prev: &L1, next: &L3, data: 2, head: false};\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nnote: ...which requires const-evaluating `L2`...\n  --> /checkout/src/test/run-pass/statics/static-recursive.rs:12:1\n   |\nLL | static L2: StaticDoubleLinked = StaticDoubleLinked{prev: &L1, next: &L3, data: 2, head: false};\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nnote: ...which requires const-evaluating `L3`...\n  --> /checkout/src/test/run-pass/statics/static-recursive.rs:13:1\n   |\nLL | static L3: StaticDoubleLinked = StaticDoubleLinked{prev: &L2, next: &L1, data: 3, head: false};\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nnote: ...which requires const-evaluating `L3`...\n  --> /checkout/src/test/run-pass/statics/static-recursive.rs:13:1\n   |\nLL | static L3: StaticDoubleLinked = StaticDoubleLinked{prev: &L2, next: &L1, data: 3, head: false};\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nnote: ...which requires const-evaluating `L1`...\n  --> /checkout/src/test/run-pass/statics/static-recursive.rs:11:1\n   |\nLL | static L1: StaticDoubleLinked = StaticDoubleLinked{prev: &L3, next: &L2, data: 1, head: true};\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n   = note: ...which again requires const-evaluating `L1`, completing the cycle\nnote: cycle used when const-evaluating + checking `L1`\n  --> /checkout/src/test/run-pass/statics/static-recursive.rs:11:1\n   |\nLL | static L1: StaticDoubleLinked = StaticDoubleLinked{prev: &L3, next: &L2, data: 1, head: true};\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
[01:14:22] {"message":"For more information about this error, try `rustc --explain E0391`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0391`.\n"}
[01:14:22] 
[01:14:22] ------------------------------------------
[01:14:22] 
---
[01:14:22] 
[01:14:22] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:496:22
[01:14:22] 
[01:14:22] 
[01:14:22] 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/run-pass" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "run-pass" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--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" "6.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"
[01:14:22] 
[01:14:22] 
[01:14:22] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:14:22] Build completed unsuccessfully in 0:11:15
[01:14:22] Build completed unsuccessfully in 0:11:15
[01:14:22] make: *** [check] Error 1
[01:14:22] Makefile:48: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:044aa1d2
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Wed Feb 13 19:47:35 UTC 2019

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)

@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

rust-highfive commented Feb 14, 2019

The job x86_64-gnu-llvm-6.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:0e3f8ca4:start=1550143897751002962,finish=1550144212822620668,duration=315071617706
$ 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-6.0
---
[01:07:43] .................................................................................i.................. 200/2949
[01:07:51] .................................................................................................... 300/2949
[01:08:02] .................................................................................................... 400/2949
[01:08:11] .................................................................................................... 500/2949
[01:08:23] ...F...F............................................................................................ 600/2949
[01:08:49] .................................................................................................... 800/2949
[01:08:58] .................................................................................................... 900/2949
[01:09:15] .................................................................................................... 1000/2949
[01:09:27] .................................................................................................... 1100/2949
---
[01:13:53] ------------------------------------------
[01:13:53] stderr:
[01:13:53] ------------------------------------------
[01:13:53] thread 'main' panicked at 'assertion failed: `(left == right)`
[01:13:53]   left: `0x5616ededb008`,
[01:13:53]  right: `0x5616ededb048`', /checkout/src/test/run-pass/consts/const-region-ptrs-noncopy.rs:11:5
[01:13:53] 
[01:13:53] ------------------------------------------
[01:13:53] 
[01:13:53] thread '[run-pass] run-pass/consts/const-region-ptrs-noncopy.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3295:9
---
[01:13:53] ------------------------------------------
[01:13:53] stderr:
[01:13:53] ------------------------------------------
[01:13:53] thread 'main' panicked at 'assertion failed: `(left == right)`
[01:13:53]   left: `0x55acf3872c6d`,
[01:13:53]  right: `0x55acf3a74008`', /checkout/src/test/run-pass/consts/const-str-ptr.rs:12:9
[01:13:53] 
[01:13:53] ------------------------------------------
[01:13:53] 
[01:13:53] thread '[run-pass] run-pass/consts/const-str-ptr.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3295:9
---
[01:13:53] 
[01:13:53] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:496:22
[01:13:53] 
[01:13:53] 
[01:13:53] 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/run-pass" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "run-pass" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--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" "6.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"
[01:13:53] 
[01:13:53] 
[01:13:53] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:13:53] Build completed unsuccessfully in 0:10:47
[01:13:53] Build completed unsuccessfully in 0:10:47
[01:13:53] make: *** [check] Error 1
[01:13:53] Makefile:48: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:01da6c66
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Thu Feb 14 12:50:56 UTC 2019
---
travis_time:end:189c1932:start=1550148657458448616,finish=1550148657464234182,duration=5785566
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:06fde980
$ 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:1e89a44f
travis_time:start:1e89a44f
$ 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:065fd4e2
$ 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:double_check_const_eval branch 2 times, most recently from 98039de to 7e8dc45 Feb 14, 2019

@RalfJung

This comment has been minimized.

Copy link
Member

RalfJung commented Feb 20, 2019

op_to_const still says

// FIXME shouldn't it be the case that `mark_static_initialized` has already
// interned this?  I thought that is the entire point of that `FinishStatic` stuff?

I guess this is a good time to fix that as well?

// Check if we have encountered this pointer+layout combination
// before. Proceed recursively even for integer pointers, no
// reason to skip them! They are (recursively) valid for some ZST,
// but not for others (e.g., `!` is a ZST).

This comment has been minimized.

@RalfJung

RalfJung Feb 20, 2019

Member

For interning I don't think it makes sense to recurse below integer pointers.

This comment has been minimized.

@RalfJung

RalfJung Feb 20, 2019

Member

I expected there to be a call to intern here -- as in, the visitor walks a value and then interns all the pointers. It seems you do the interning somehow together with the recursion tracking? That's very hard to follow.

This comment has been minimized.

@oli-obk

oli-obk Feb 21, 2019

Author Contributor

The reason for that is that I want to intern the outer most allocation, too. I guess I could special case it.

@oli-obk oli-obk force-pushed the oli-obk:double_check_const_eval branch from 7e8dc45 to 99d3e10 Feb 21, 2019

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