Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promoteds are statics and statics have a place, not just a value #52597

Merged
merged 7 commits into from
Jul 24, 2018

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jul 21, 2018

r? @eddyb

This makes everything around promoteds a little simpler

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 21, 2018
@rust-highfive
Copy link
Collaborator

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.

[00:03:42] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:03:43] tidy error: /checkout/src/librustc_codegen_llvm/mir/place.rs:464: line longer than 100 chars
[00:03:44] some tidy checks failed
[00:03:44] 
[00:03:44] 
[00:03:44] 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:44] 
[00:03:44] 
[00:03:44] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:03:44] Build completed unsuccessfully in 0:00:48
[00:03:44] Build completed unsuccessfully in 0:00:48
[00:03:44] make: *** [tidy] Error 1
[00:03:44] Makefile:79: recipe for target 'tidy' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:26927b50
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:18f4906e:start=1532214629368554868,finish=1532214629377598960,duration=9044092
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0020ae18
$ 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 -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:012ee5c0
travis_time:start:012ee5c0
$ 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:233ed93e
$ 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)

promoted: Some(index),
};
let c = bx.tcx().const_eval(param_env.and(cid));
let (llval, ty) = self.simd_shuffle_indices(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the point of this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SIMD shuffle indices are an array, which usually is specified inline, and not via an explicit constant. so the array is promoted and we need to read it here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. A comment to that effect would be great.

@@ -2030,6 +2039,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
}),
}
}
// promoteds may never be mutated
Place::Promoted(_) => Err(place),
Copy link
Member

@nagisa nagisa Jul 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be a bug!()? I can’t think of any case where you’d genuinely want to report an error to the user if you somehow end up with a &mut promoted at this point in code.

@@ -326,6 +327,9 @@ fn place_element_conflict<'a, 'gcx: 'tcx, 'tcx>(
Overlap::EqualOrDisjoint
}
}
(Place::Promoted(_), Place::Promoted(_)) |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t this also return an EqualOrDisjoint if the two promoteds are the same?

@nagisa
Copy link
Member

nagisa commented Jul 22, 2018

This is r=me once #52571 lands and the issues are fixed.

@rust-highfive
Copy link
Collaborator

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.
[00:06:20]    Compiling proc_macro v0.0.0 (file:///checkout/src/libproc_macro)
[00:06:29]    Compiling syntax_ext v0.0.0 (file:///checkout/src/libsyntax_ext)
[00:11:40]    Compiling rustc_typeck v0.0.0 (file:///checkout/src/librustc_typeck)
[00:11:40]    Compiling rustc_mir v0.0.0 (file:///checkout/src/librustc_mir)
[00:11:58] error[E0004]: non-exhaustive patterns: `&Promoted(_)` not covered
[00:11:58]   --> librustc_mir/borrow_check/mutability_errors.rs:43:15
[00:11:58] 43 |         match the_place_err {
[00:11:58] 43 |         match the_place_err {
[00:11:58]    |               ^^^^^^^^^^^^^ pattern `&Promoted(_)` not covered
[00:12:16] error: aborting due to previous error
[00:12:16] 
[00:12:16] For more information about this error, try `rustc --explain E0004`.
[00:12:16] error: Could not compile `rustc_mir`.
[00:12:16] error: Could not compile `rustc_mir`.
[00:12:16] 
[00:12:16] Caused by:
[00:12:16]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name rustc_mir librustc_mir/lib.rs --color always --error-format json --crate-type dylib --emit=dep-info,link -C prefer-dynamic -C opt-level=2 -C metadata=57fa3592deeb7523 -C extra-filename=-57fa3592deeb7523 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps --extern arena=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libarena-5d5d2990686c15ff.so --extern bitflags=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libbitflags-693c666d349ae1b6.rlib --extern byteorder=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libbyteorder-35cd99699a8927a8.rlib --extern either=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libeither-47f1035d3ed29af7.rlib --extern graphviz=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libgraphviz-09a8465c475acbfe.so --extern log=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog-96863e4e4a7d8742.rlib --extern log_settings=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog_settings-198e5b153954954c.rlib --extern polonius_engine=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libpolonius_engine-7f18c5c76091a313.rlib --extern rustc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc-3531a50c702021e6.so --extern rustc_apfloat=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_apfloat-f1825829e8a26bad.rlib --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-6755b57849a2d1c7.so --extern rustc_errors=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-2792a41a3401596f.so --extern rustc_target=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_target-5aa06a687b1a439d.so --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-5615a04cb21f88e7.so --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-5615a04cb21f88e7.rlib --extern syntax=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax-62c7dbd871cbb630.so --extern syntax_pos=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax_pos-04bbe800f5e81b33.so -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/backtrace-sys-7205e6adb9d66e6b/out -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/miniz-sys-27571ee36438df44/out` (exit code: 101)

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
Copy link
Collaborator

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:start:test_mir-opt
Check compiletest suite=mir-opt mode=mir-opt (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:54:12] 
[00:54:12] running 46 tests
[00:54:17] ERROR 2018-07-22T12:26:19Z: compiletest::runtest: None
[00:54:20] ERROR 2018-07-22T12:26:22Z: compiletest::runtest: None
     _14 = promoted[1];
[00:54:29]      _4 = &(*_14);
[00:54:29]      _9 = discriminant(_2);
[00:54:29]      switchInt(move _9) -> [0isize: bb5, 1isize: bb3, otherwise: bb7];
[00:54:29]  }
[00:54:29]  bb1: {
[00:54:29]      resume;
[00:54:29]  }
[00:54:29]  bb2: {  // arm1
[00:54:29]      _1 = (const 3i32, const 3i32);
[00:54:29]      goto -> bb13;
[00:54:29]  }
[00:54:29]  bb3: { // binding3(empty) and arm3
[00:54:29]      ReadForMatch(_4);
[00:54:29]      falseEdges -> [real: bb8, imaginary: bb4]; //pre_binding1
[00:54:29]  }
[00:54:29]  bb4: {
[00:54:29]      ReadForMatch(_4);
[00:54:29]      falseEdges -> [real: bb12, imaginary: bb5]; //pre_binding2
[00:54:29]  }
[00:54:29]  bb5: {
[00:54:29]      ReadForMatch(_4);
[00:54:29]      falseEdges -> [real: bb2, imaginary: bb6]; //pre_binding3
[00:54:29]  }
[00:54:29]  bb6: {
[00:54:29]  }
[00:54:29]  bb7: {
[00:54:29]      unreachable;
[00:54:29]  }
[00:54:29]  }
[00:54:29]  bb8: { // binding1 and guard
[00:54:29]      StorageLive(_7);
[00:54:29]      _13 = promoted[0];
[00:54:29]      _7 = &(((*_13) as Some).0: i32);
[00:54:29]      StorageLive(_10);
[00:54:29]      _10 = const guard() -> [return: bb9, unwind: bb1];
[00:54:29]  }
[00:54:29]  bb9: {
[00:54:29]      switchInt(move _10) -> [false: bb10, otherwise: bb11];
[00:54:29]  }
[00:54:29]  bb10: { // to pre_binding2
[00:54:29]      falseEdges -> [real: bb4, imaginary: bb4];
[00:54:29]  }
[00:54:29]  bb11: { // bindingNoLandingPads.before.mir2 and arm2
[00:54:29]      StorageLive(_5);
[00:54:29]      _5 = ((_2 as Some).0: i32);
[00:54:29]      StorageLive(_11);
, const 3i32);
[00:54:29]         goto -> bb13;
[00:54:29]     }
[00:54:29]     bb3: {                              
[00:54:29]         ReadForMatch(_4);
[00:54:29]         falseEdges -> [real: bb8, imaginary: bb4];
[00:54:29]     }
[00:54:29]     bb4: {                              
[00:54:29]         ReadForMatch(_4);
[00:54:29]         falseEdges -> [real: bb12, imaginary: bb5];
[00:54:29]     }
[00:54:29]     bb5: {                              
[00:54:29]         ReadForMatch(_4);
[00:54:29]         falseEdges -> [real: bb2, imaginary: bb6];
[00:54:29]     }
[00:54:29]     bb6: {                              
[00:54:29]     }
[00:54:29]     }
[00:54:29]     bb7: {                              
[00:54:29]     }
[00:54:29]     }
[00:54:29]     bb8: {                              
[00:54:29]         StorageLive(_7);
[00:54:29]         _7 = &(((promoted[0]: std::option::Option<i32>) as Some).0: i32);
[00:54:29]         StorageLive(_10);
[00:54:29]         _10 = const guard() -> [return: bb9, unwind: bb1];
[00:54:29]     }
[00:54:29]     bb9: {                              
[00:54:29]         switchInt(move _10) -> [false: bb10, otherwise: bb11];
[00:54:29]     }
[00:54:29]     bb10: {                             
[00:54:29]         falseEdges -> [real: bb4, imaginary: bb4];
[00:54:29]     }
[00:54:29]     bb11: {                             
[00:54:29]         StorageLive(_5);
[00:54:29]         _5 = ((_2 as Some).0: i32);
[00:54:29]         StorageLive(_11);
[00:54:29]         _11 = _5;
[00:54:29]         _1 = (const 1i32, move _11);
[00:54:29]         StorageDead(_11);
[00:54:29]         goto -> bb13;
[00:54:29]     }
[00:54:29]     bb12: {                             
[00:54:29]         StorageLive(_8);
[00:54:29]         _8 = ((_2 as Some).0: i32);
[00:54:29]         StorageLive(_12);
[00:54:29]         _12 = _8;
[00:54:29]         _1 = (const 2i32, move _12);
[00:54:29]         StorageDead(_12);
[00:54:29]         goto -> bb13;
[00:54:29]     }
[00:54:29]     bb13: {                             
[00:54:29]         StorageDead(_8);
[00:54:29]         StorageDead(_5);
[00:54:29]         StorageDead(_10);
[00:54:29]         StorageDead(_7);
[00:54:29]         StorageDead(_1);
[00:54:29]         StorageDead(_2);
[00:54:29]         _0 = ();
[00:54:29]         return;
[00:54:29] }', tools/compiletest/src/runtest.rs:2813:13
[00:54:29] 
[00:54:29] 
[00:54:29] failures:
[00:54:29] failures:
[00:54:29]     [mir-opt] mir-opt/end_region_destruction_extents_1.rs
[00:54:29]     [mir-opt] mir-opt/match_false_edges.rs
[00:54:29] 
[00:54:29] test result: FAILED. 44 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out
[00:54:29] 
[00:54:29] 
[00:54:29] 
[00:54:29] 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/mir-opt" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "mir-opt" "--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:29] 
[00:54:29] 
[00:54:29] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:54:29] Build completed unsuccessfully in 0:09:44
[00:54:29] Build completed unsuccessfully in 0:09:44
[00:54:29] make: *** [check] Error 1
[00:54:29] Makefile:58: recipe for target 'check' failed
121696 ./obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps
113392 ./obj/build/x86_64-unknown-linux-gnu/test/mir-opt
111276 ./obj/build/x86_64-unknown-linux-gnu/stage1-std
107600 ./src/llvm/test/CodeGen

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
Copy link
Contributor

bors commented Jul 23, 2018

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

"could not evaluate constant operand",
);
// Allow RalfJ to sleep soundly knowing that even refactorings that remove
// the above error (or silence it under some conditions) will not cause UB
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 24, 2018

@bors r=nagisa

@bors
Copy link
Contributor

bors commented Jul 24, 2018

📌 Commit cbd4274 has been approved by nagisa

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 24, 2018
@bors
Copy link
Contributor

bors commented Jul 24, 2018

⌛ Testing commit cbd4274 with merge 6a3db03...

bors added a commit that referenced this pull request Jul 24, 2018
Promoteds are statics and statics have a place, not just a value

r? @eddyb

This makes everything around promoteds a little simpler
@bors
Copy link
Contributor

bors commented Jul 24, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: nagisa
Pushing 6a3db03 to master...

@bors bors merged commit cbd4274 into rust-lang:master Jul 24, 2018
@rust-highfive
Copy link
Collaborator

📣 Toolstate changed by #52597!

Tested on commit 6a3db03.
Direct link to PR: #52597

💔 miri on windows: test-pass → build-fail (cc @oli-obk @RalfJung @eddyb, @rust-lang/infra).
💔 miri on linux: test-pass → build-fail (cc @oli-obk @RalfJung @eddyb, @rust-lang/infra).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Jul 24, 2018
Tested on commit rust-lang/rust@6a3db03.
Direct link to PR: <rust-lang/rust#52597>

💔 miri on windows: test-pass → build-fail (cc @oli-obk @RalfJung @eddyb, @rust-lang/infra).
💔 miri on linux: test-pass → build-fail (cc @oli-obk @RalfJung @eddyb, @rust-lang/infra).
@kennytm
Copy link
Member

kennytm commented Jul 24, 2018

[01:30:33] error[E0004]: non-exhaustive patterns: `Promoted(_)` not covered
[01:30:33]    --> tools/miri/src/validation.rs:138:18
[01:30:33]     |
[01:30:33] 138 |         Ok(match *place {
[01:30:33]     |                  ^^^^^^ pattern `Promoted(_)` not covered

// and we can then extract the value by evaluating the promoted.
mir::Operand::Copy(mir::Place::Promoted(box(index, ty))) |
mir::Operand::Move(mir::Place::Promoted(box(index, ty))) => {
let param_env = ty::ParamEnv::reveal_all();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be something like self.param_env (minor future hazard if we start deduplicating instances).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR already landed.Does anyone take care of fixing this?^^

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is rustc_codegen_llvm... we don't have a param env, everything is monomorphized

let type_checker = &mut self.cx;

// FIXME -- For now, use the substitutions from
// `value.ty` rather than `value.val`. The
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, value.val mention here is outdated (cc @nikomatsakis).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants