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

Add a forever unstable opt-out of const qualification checks #56123

Open
wants to merge 7 commits into
base: master
from

Conversation

Projects
None yet
9 participants
@oli-obk
Contributor

oli-obk commented Nov 21, 2018

r? @eddyb

cc @RalfJung @Centril

basically a forever unstable way to screw with const things in horribly unsafe, unsound and incoherent ways.

Note that this does not affect miri except by maybe violating assumptions that miri makes. But there's no change in how miri evaluates things.

@rust-highfive

This comment was marked as resolved.

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:01036c3a:start=1542794324618965122,finish=1542794381413467134,duration=56794502012
$ 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
---
travis_time:start:tidy
tidy check
[00:03:52] * 568 error codes
[00:03:52] * highest error code: E0721
[00:03:52] tidy error: libsyntax/feature_gate.rs:236: no tracking issue for feature unleash_the_miri_inside_of_you
[00:03:52] Expected a gate test for the feature 'unleash_the_miri_inside_of_you'.
[00:03:52] Hint: create a failing test file named 'feature-gate-unleash_the_miri_inside_of_you.rs'
[00:03:52]       in the 'ui' test suite, with its failures due to
[00:03:52]       missing usage of #![feature(unleash_the_miri_inside_of_you)].
[00:03:52] Hint: If you already have such a test and don't want to rename it,
[00:03:52]       you can also add a // gate-test-unleash_the_miri_inside_of_you line to the test file.
[00:03:52] tidy error: Found 1 features without a gate test.
[00:03:52] tidy error: libsyntax/feature_gate.rs:236: no tracking issue for feature unleash_the_miri_inside_of_you
[00:03:53] some tidy checks failed
[00:03:53] 
[00:03:53] 
[00:03: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:03:53] 
[00:03:53] 
[00:03:53] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:03:53] Build completed unsuccessfully in 0:00:56
[00:03:53] Build completed unsuccessfully in 0:00:56
[00:03:53] Makefile:79: recipe for target 'tidy' failed
[00:03:53] make: *** [tidy] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0ca495c8
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Wed Nov 21 10:03:43 UTC 2018
---
travis_time:end:1f56b742:start=1542794624411797059,finish=1542794624417458025,duration=5660966
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0b6d6dfc
$ 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:259e7aa9
travis_time:start:259e7aa9
$ 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:1ace1e30
$ 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)

@eddyb

This comment has been minimized.

Member

eddyb commented Nov 21, 2018

--> $DIR/assoc_const_2.rs:27:13
|
LL | let y = <String as Bar<String>>::F; //~ ERROR erroneous constant
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors

This comment has been minimized.

@RalfJung

RalfJung Nov 21, 2018

Member

"Has errors" is not very precise, why does it not show an actual miri error?

This comment has been minimized.

@oli-obk

oli-obk Nov 21, 2018

Contributor

because of allow(const_err) silencing the lint that reports the error on a constant

@@ -230,6 +230,11 @@ declare_features! (
// Allows panicking during const eval (produces compile-time errors)
(active, const_panic, "1.30.0", Some(51999), None),
// Don't run any static analyses on constants and `const fn` and just "let miri handle it"
// NOT meant to ever be stabilized, this is solely for being able to demonstrate problems with
// features of alternative RFCs when writing RFCs that would allow more const features.

This comment has been minimized.

@RalfJung

RalfJung Nov 21, 2018

Member

Also sounds useful for test cases.

@varkor

This comment has been minimized.

Member

varkor commented Nov 21, 2018

Would it be reasonable to add this as a -Zunleash_the_miri_inside_of_you (or similar) instead of #[feature(unleash_the_miri_inside_of_you)]? The idea of people deciding to include the feature simply because it's convenient to do so isn't a nice one.

@oli-obk

This comment has been minimized.

Contributor

oli-obk commented Nov 21, 2018

I'm not particularly bound to using features. Do we have any other -Z flags that change language rules?

@RalfJung

This comment has been minimized.

Member

RalfJung commented Nov 21, 2018

I'd count these:

    -Z                  two-phase-borrows -- use two-phase reserved/active distinction for `&mut` borrows in MIR borrowck
    -Z           two-phase-beyond-autoref -- when using two-phase-borrows, allow two phases even for non-autoref `&mut` borrows
    -Z       disable-nll-user-type-assert -- disable user provided type assertion in NLL
    -Z       nll-dont-emit-read-for-match -- in match codegen, do not include FakeRead statements (used by mir-borrowck)

@Centril

This comment has been minimized.

Contributor

Centril commented Nov 22, 2018

@varkor The main nice thing about features is that it becomes easy to test stuff out in the playground and such so if it's not too much of a problem using features would be nice.

Show resolved Hide resolved src/librustc_mir/transform/qualify_consts.rs Outdated
Show resolved Hide resolved src/libsyntax/feature_gate.rs Outdated
@RalfJung

This comment has been minimized.

Member

RalfJung commented Nov 22, 2018

TBH I also feel like a -Z flag is more suited. Maybe we can get @shepmaster to support arbitrary additional flags on playground, similar to godbolt? :D

@nagisa

This comment has been minimized.

Contributor

nagisa commented Nov 22, 2018

NB: nll had both a flag and a "feature". Either one of them would enable the feature for testing.

@oli-obk

This comment has been minimized.

Contributor

oli-obk commented Nov 22, 2018

Discussed in compiler meeting. A flag is definitely better because

making this feature a flag would make it impossible to misuse within libstd
or most of the code, really

@pnkfelix

This comment has been minimized.

Member

pnkfelix commented Nov 29, 2018

This was discussed a week ago in T-compiler. Reviewing the discussion now, it seems like there was consensus that the feature should be a -Z flag. I don't think there's anything more to discuss, and the nomination tag was just accidentally left on.)

Un-nominating.

@pnkfelix pnkfelix removed the I-nominated label Nov 29, 2018

@oli-obk oli-obk force-pushed the oli-obk:import_miri_from_future branch from 0377cc4 to 051fcd9 Nov 29, 2018

@bors

This comment was marked as outdated.

Contributor

bors commented Nov 30, 2018

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

@oli-obk oli-obk force-pushed the oli-obk:import_miri_from_future branch from 051fcd9 to 2e102ca Dec 6, 2018

@rust-highfive

This comment was marked as outdated.

Collaborator

rust-highfive commented Dec 6, 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:18f807f1:start=1544087150515670062,finish=1544087151505841241,duration=990171179
$ 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:05:15]    Compiling rustc_errors v0.0.0 (/checkout/src/librustc_errors)
[00:06:38]    Compiling syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
[00:12:23]    Compiling rustc_mir v0.0.0 (/checkout/src/librustc_mir)
[00:12:23]    Compiling rustc_typeck v0.0.0 (/checkout/src/librustc_typeck)
[00:12:26] error[E0425]: cannot find value `unleash` in this scope
[00:12:26]    --> src/librustc_mir/transform/qualify_consts.rs:991:68
[00:12:26]     |
[00:12:26] 991 |                                 if self.tcx.is_const_fn(def_id) || unleash {
[00:12:26] 
[00:12:40] error: aborting due to previous error
[00:12:40] 
[00:12:40] For more information about this error, try `rustc --explain E0425`.

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)

@bors

This comment was marked as outdated.

Contributor

bors commented Dec 8, 2018

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

@oli-obk oli-obk force-pushed the oli-obk:import_miri_from_future branch from bfea651 to 2747960 Dec 10, 2018

@rust-highfive

This comment was marked as resolved.

Collaborator

rust-highfive commented Dec 10, 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:06426496:start=1544456872056486514,finish=1544456873489662873,duration=1433176359
$ 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:47:28] .................................................................................................... 400/5170
[00:47:31] .................................................................................................... 500/5170
[00:47:34] ..............................i..................................................................... 600/5170
[00:47:38] .................................................................................................... 700/5170
[00:47:43] .....................................................................................F.............. 800/5170
[00:47:50] ...........................iiiii.................................................................... 1000/5170
[00:47:53] .................................................................................................... 1100/5170
[00:47:55] .................................................................................................... 1200/5170
[00:47:57] .................................................................................................... 1300/5170
---
[00:50:04] .................................................................................................... 5100/5170
[00:50:05] .........i............................................................
[00:50:05] failures:
[00:50:05] 
[00:50:05] ---- [ui] ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs stdout ----
[00:50:05] 
[00:50:05] 
[00:50:05] 10 LL |     const X: Vec<u32> = Vec::new(); //~ ERROR not yet stable as a const fn
[00:50:05] 12    |
[00:50:05] 12    |
[00:50:05] -    = help: in Nightly builds, add `#![feature(const_vec_new)]` to the crate attributes to enable
[00:50:05] +    = help: add `#![feature(const_vec_new)]` to the crate attributes to enable
[00:50:05] 15 error: aborting due to 2 previous errors
[00:50:05] 16 
[00:50:05] 
[00:50:05] 
[00:50:05] 
[00:50:05] The actual stderr differed from the expected stderr.
[00:50:05] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you/feature-gate-unleash_the_miri_inside_of_you.stderr
[00:50:05] To update references, rerun the tests and pass the `--bless` flag
[00:50:05] To only update this specific test, also pass `--test-args consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs`
[00:50:05] error: 1 errors occurred comparing output.
[00:50:05] status: exit code: 1
[00:50:05] status: exit code: 1
[00:50:05] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.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/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you/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/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you/auxiliary" "-A" "unused"
[00:50:05] ------------------------------------------
[00:50:05] 
[00:50:05] ------------------------------------------
[00:50:05] stderr:
[00:50:05] stderr:
[00:50:05] ------------------------------------------
[00:50:05] {"message":"destructors cannot be evaluated at compile-time","code":{"code":"E0493","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs","byte_start":246,"byte_end":256,"line_start":11,"line_end":11,"column_start":20,"column_end":30,"is_primary":true,"text":[{"text":"    const F: u32 = (U::X, 42).1; //~ ERROR destructors cannot be evaluated at compile-time","highlight_start":20,"highlight_end":30}],"label":"constants cannot evaluate destructors","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0493]: destructors cannot be evaluated at compile-time\n  --> /checkout/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs:11:20\n   |\nLL |     const F: u32 = (U::X, 42).1; //~ ERROR destructors cannot be evaluated at compile-time\n   |                    ^^^^^^^^^^ constants cannot evaluate destructors\n\n"}
[00:50:05] {"message":"`<std::vec::Vec<T>>::new` is not yet stable as a const fn","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs","byte_start":425,"byte_end":435,"line_start":18,"line_end":18,"column_start":25,"column_end":35,"is_primary":true,"text":[{"text":"    const X: Vec<u32> = Vec::new(); //~ ERROR not yet stable as a const fn","highlight_start":25,"highlight_end":35}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"add `#![feature(const_vec_new)]` to the crate attributes to enable","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error: `<std::vec::Vec<T>>::new` is not yet stable as a const fn\n  --> /checkout/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs:18:25\n   |\nLL |     const X: Vec<u32> = Vec::new(); //~ ERROR not yet stable as a const fn\n   |                         ^^^^^^^^^^\n   |\n   = help: add `#![feature(const_vec_new)]` to the crate attributes to enable\n\n"}
[00:50:05] {"message":"aborting due to 2 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 2 previous errors\n\n"}
[00:50:05] {"message":"For more information about this error, try `rustc --explain E0493`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0493`.\n"}
[00:50:05] ------------------------------------------
[00:50:05] 
[00:50:05] 
[00:50:05] thread '[ui] ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3252:9
[00:50:05] 
[00:50:05] 
[00:50:05] failures:
[00:50:05] failures:
[00:50:05]     [ui] ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs
[00:50:05] test result: FAILED. 5145 passed; 1 failed; 24 ignored; 0 measured; 0 filtered out
[00:50:05] 
[00:50:05] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:503:22
[00:50:05] 
[00:50:05] 
[00:50:05] 
[00:50:05] 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  -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" "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:50:05] 
[00:50:05] 
[00:50:05] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:50:05] Build completed unsuccessfully in 0:03:54
[00:50:05] Build completed unsuccessfully in 0:03:54
[00:50:05] make: *** [check] Error 1
[00:50:05] Makefile:58: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:00b6fdc3
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Mon Dec 10 16:38:07 UTC 2018
---
travis_time:end:14364c3c:start=1544459889135129306,finish=1544459889139501247,duration=4371941
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:014e4580
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|o

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:import_miri_from_future branch from 2747960 to 8a949a3 Dec 11, 2018

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