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

Don't emit `Unevaluated` from `const_eval` #56723

Merged
merged 16 commits into from Jan 4, 2019

Conversation

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

oli-obk commented Dec 11, 2018

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Dec 11, 2018

r? @matthewjasper

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

@matthewjasper

This comment has been minimized.

Copy link
Contributor

matthewjasper commented Dec 11, 2018

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Dec 11, 2018

The job mingw-check 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:04b9a33c:start=1544558344989913189,finish=1544558420352388686,duration=75362475497
$ 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=mingw-check
---
[00:07:07] configure: build.locked-deps    := True
[00:07:07] configure: llvm.ccache          := sccache
[00:07:07] configure: build.cargo-native-static := True
[00:07:07] configure: dist.missing-tools   := True
[00:07:07] configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
[00:07:07] configure: writing `config.toml` in current directory
[00:07:07] configure: 
[00:07:07] configure: run `python /checkout/x.py --help`
[00:07:07] configure: 
---
[00:09:44]     Checking syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
[00:11:09] error[E0080]: could not evaluate static initializer
[00:11:09]     --> src/librustc/ty/sty.rs:1989:1
[00:11:09]      |
[00:11:09] 1989 | static_assert!(MEM_SIZE_OF_LAZY_CONST: ::std::mem::size_of::<LazyConst<'_>>() == 24);
[00:11:09]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the len is 1 but the index is 1
[00:11:09]      = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
[00:11:09] 
[00:11:10] error: aborting due to previous error
[00:11:10] 
[00:11:10] 
[00:11:10] For more information about this error, try `rustc --explain E0080`.
[00:11:10] error: Could not compile `rustc`.
[00:11:10] 
[00:11:10] To learn more, run the command again with --verbose.
[00:11:10] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "i686-pc-windows-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:11:10] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu
[00:11:10] Build completed unsuccessfully in 0:02:54
travis_time:end:0e63e16a:start=1544558428984192020,finish=1544559099453644431,duration=670469452411
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 1.
---
travis_time:end:02ca9624:start=1544559099902914048,finish=1544559099909545488,duration=6631440
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0ba53794
$ 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:1441e3ec
travis_time:start:1441e3ec
$ 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:07329432
$ 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)

"_Self".to_owned(),
Some(format!("[{}; _]", self.tcx.type_of(def.did).to_string())),
));
}

This comment has been minimized.

@RalfJung

RalfJung Dec 12, 2018

Member

So we don't print anything when it is not evaluated? That is different from the previous code.

I have no idea where this code is called, just pointing out a functional change. ;)

This comment has been minimized.

@oli-obk

oli-obk Dec 12, 2018

Contributor

oops indeed. This is just for producing more diagnostics, but still. I found a nice way to fix it without more duplication.

@RalfJung

This comment has been minimized.

Copy link
Member

RalfJung commented Dec 12, 2018

Were Const interned before? Does this mean we now intern both Const and LazyConst?

Show resolved Hide resolved src/librustc/ty/sty.rs Outdated
@oli-obk

This comment has been minimized.

Copy link
Contributor

oli-obk commented Dec 12, 2018

Were Const interned before? Does this mean we now intern both Const and LazyConst?

Yes they were interned before. Yes we now intern twice. I'll check if we can get away with not interning Const anymore. It's just a size optimization of various enums, but we might not have any Const left, so...

@@ -376,6 +376,11 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {
constant, location
);

let literal = match constant.literal {
ty::LazyConst::Evaluated(lit) => lit,
ty::LazyConst::Unevaluated(..) => return,

This comment has been minimized.

@RalfJung

RalfJung Dec 12, 2018

Member

Is it really correct to return early here in case of Unevaluated?

This comment has been minimized.

@oli-obk

oli-obk Dec 13, 2018

Contributor

This is #46702

I don't believe this PR makes the situation any more problematic than it was.

This comment has been minimized.

@RalfJung

RalfJung Dec 19, 2018

Member

Okay.

Cc @eddyb would be good if you could take a quick look at some point, I have no idea what this is doing.^^

@RalfJung

This comment has been minimized.

Copy link
Member

RalfJung commented Dec 12, 2018

we might not have any Const left

If we don't, that makes me wonder about whether this refactoring is worth it. :/

@oli-obk

This comment has been minimized.

Copy link
Contributor

oli-obk commented Dec 13, 2018

If we don't, that makes me wonder about whether this refactoring is worth it. :/

Sorry, I misspoke: We might not have any Const left in the HIR or the MIR, we'd still be using it extensively everywhere else (at least I think so, I wanted to do larger refactorings like that in a separate PR, but I'll do them here now)

@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

rust-highfive commented Dec 13, 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:1238a880:start=1544696482751451188,finish=1544696575885165187,duration=93133713999
$ 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:15] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:03:16] tidy error: /checkout/src/librustc_mir/transform/const_prop.rs:33: line longer than 100 chars
[00:03:17] some tidy checks failed
[00:03:17] 
[00:03:17] 
[00:03:17] 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:17] 
[00:03:17] 
[00:03:17] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:03:17] Build completed unsuccessfully in 0:00:56
[00:03:17] Build completed unsuccessfully in 0:00:56
[00:03:17] Makefile:79: recipe for target 'tidy' failed
[00:03:17] make: *** [tidy] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:066e2f4c
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Thu Dec 13 10:26:22 UTC 2018
---
travis_time:end:0f85a5c2:start=1544696782831326893,finish=1544696782837830570,duration=6503677
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:1a1142c2
$ 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:03632020
travis_time:start:03632020
$ 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:140ac59a
$ 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.

Copy link
Contributor

oli-obk commented Dec 14, 2018

This should theoretically not have a negative perf impact, but I've guessed wrong with this kind of change before.

let's see what perf says

@bors try

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 14, 2018

⌛️ Trying commit b01765f with merge 6ab2e74...

bors added a commit that referenced this pull request Dec 14, 2018

Auto merge of #56723 - oli-obk:lazy_const, r=<try>
Don't emit `Unevaluated` from `const_eval`

cc @eddyb @RalfJung
@oli-obk

This comment has been minimized.

Copy link
Contributor

oli-obk commented Dec 14, 2018

@rust-timer

This comment has been minimized.

Copy link

rust-timer commented Dec 14, 2018

Success: Queued 6ab2e74 with parent 7d03617, comparison URL.

@rust-timer

This comment has been minimized.

Copy link

rust-timer commented Dec 14, 2018

Finished benchmarking try commit 6ab2e74

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 14, 2018

💥 Test timed out

@bors

This comment was marked as resolved.

Copy link
Contributor

bors commented Dec 15, 2018

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

@oli-obk oli-obk force-pushed the oli-obk:lazy_const branch from b01765f to 5cbcab2 Dec 15, 2018

@bors

This comment was marked as resolved.

Copy link
Contributor

bors commented Dec 16, 2018

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

@oli-obk oli-obk force-pushed the oli-obk:lazy_const branch from 5cbcab2 to 17fafa5 Dec 17, 2018

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Jan 2, 2019

r=me modulo rebase

@oli-obk oli-obk force-pushed the oli-obk:lazy_const branch from db98682 to 03b8928 Jan 3, 2019

@oli-obk

This comment has been minimized.

Copy link
Contributor

oli-obk commented Jan 3, 2019

@bors r=nikomatsakis

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 3, 2019

📌 Commit 03b8928 has been approved by nikomatsakis

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Jan 3, 2019

Rollup merge of rust-lang#56723 - oli-obk:lazy_const, r=nikomatsakis
Don't emit `Unevaluated` from `const_eval`

cc @eddyb @RalfJung
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 4, 2019

⌛️ Testing commit 03b8928 with merge d6d32ac...

bors added a commit that referenced this pull request Jan 4, 2019

Auto merge of #56723 - oli-obk:lazy_const, r=nikomatsakis
Don't emit `Unevaluated` from `const_eval`

cc @eddyb @RalfJung
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 4, 2019

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

@bors bors merged commit 03b8928 into rust-lang:master Jan 4, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
impl<'a, 'tcx> Lift<'tcx> for &'a List<$ty> {
type Lifted = &'tcx List<$lifted>;
fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> {
if self.is_empty() {

This comment has been minimized.

@bjorn3

bjorn3 Jan 5, 2019

Contributor

Wrong indentation.

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