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

Introduce ConstValue and use it instead of miri's Value for constant values #50249

Merged
merged 2 commits into from
May 12, 2018

Conversation

Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Apr 26, 2018

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

The job x86_64-gnu-llvm-3.9 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:04:46] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:46] tidy error: /checkout/src/librustc_mir/hair/pattern/mod.rs:1068: trailing whitespace
[00:04:46] tidy error: /checkout/src/librustc_mir/hair/pattern/mod.rs:1162: trailing whitespace
[00:04:47] some tidy checks failed
[00:04:47] 
[00:04:47] 
[00:04: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:04:47] 
[00:04:47] 
[00:04:47] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:47] Build completed unsuccessfully in 0:01:53
[00:04:47] Build completed unsuccessfully in 0:01:53
[00:04:47] Makefile:79: recipe for target 'tidy' failed
[00:04:47] make: *** [tidy] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:00bac7f5
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

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-3.9 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:04:44] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:45] tidy error: /checkout/src/librustc_mir/hair/pattern/mod.rs:1068: trailing whitespace
[00:04:45] tidy error: /checkout/src/librustc_mir/hair/pattern/mod.rs:1162: trailing whitespace
[00:04:46] some tidy checks failed
[00:04:46] 
[00:04:46] 
[00:04:46] 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:46] 
[00:04:46] 
[00:04:46] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:46] Build completed unsuccessfully in 0:01:52
[00:04:46] Build completed unsuccessfully in 0:01:52
[00:04:46] Makefile:79: recipe for target 'tidy' failed
[00:04:46] make: *** [tidy] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:08bdb4e8
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

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)

Copy link
Contributor

@oli-obk oli-obk left a comment

Choose a reason for hiding this comment

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

left some comments, will review more later

Some(b)
pub fn to_bits<'gcx>(&self, tcx: TyCtxt<'_, 'gcx, '_>, ty: Ty<'gcx>) -> Option<u128> {
let primval = match self {
ConstVal::Value(ref alloc) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

you should be able to just call the to_bits method of Allocation here

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 now gone.

if self.bytes.len() as u64 != size {
return None;
}
// This mirrors the logic of rustc_mir::interpret::memory::Memory::read_primval
Copy link
Contributor

Choose a reason for hiding this comment

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

can Memory::read_primval just forward to this function?

Copy link
Contributor

Choose a reason for hiding this comment

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

That question also applies to the other functions here. Can we move functionality from memory here by forwarding from the memory calls?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

can Memory::read_primval just forward to this function?

This doesn't not read from an offset, so no. The other way around could work though.

I want to split Allocation into two types though, one for constant which is interned and read-only and one for Miri to use, so I don't think we should do this refactoring.

Copy link
Contributor

Choose a reason for hiding this comment

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

So the deduplication of code will happen with the split into two types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it just won't be possible to deduplicate it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can't you create a function that takes an offset, and have this function forward to it by filling out the offset with 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We might be able to use Miri methods here if we move the rest of the compiler away from using Value and PrimVal.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm I don't understand this argument. Can't miri call this method or the hypothetical one with offsets?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Miri has callbacks into the machine for locks on the memory. That makes it tricky to factor it out.

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 code is now gone.

@@ -393,6 +403,15 @@ macro_rules! implement_ty_decoder {
decode_const(self)
}
}

impl<$($typaram),*> SpecializedDecoder<&'tcx $crate::mir::interpret::Allocation>
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't this conflict with the derive on Allocation? IIRC this produces runtime issues if done incorrectly. Have a look at what AllocId does

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so. This decodes a pointer to an Allocation, while the derive is for Allocation itself.

}

pub fn to_bits<'gcx>(&self, tcx: TyCtxt<'_, 'gcx, '_>, ty: Ty<'gcx>) -> Option<u128> {
if self.ty != ty {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be an assertion? In what cases to we actually return None due to a type mismatch?

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 just tries to convert a value to an u128 if it is of the correct type ty. It is used as an replacement for matching in many cases. An example is the to_usize method.

@@ -381,28 +377,24 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {

// Helper to get a `-1` value of the appropriate type
fn neg_1_literal(&mut self, span: Span, ty: Ty<'tcx>) -> Operand<'tcx> {
let ty = self.hir.tcx().lift_to_global(&ty).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not too happy with all the lift_to_global calls. Can we make the lifetime annotations on from_bits and friends work out so we don't need that anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need global types here since we must compute their layout (which requires Ty<'gcx>).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The lift_to_global calls have been removed.

kind: box PatternKind::Constant {
value: tcx.mk_const(
ty::Const::from_bits(tcx,
*b as u128,
Copy link
Contributor

Choose a reason for hiding this comment

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

weird indent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 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.
Check compiletest suite=ui mode=ui (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:46:18] 
[00:46:18] running 1376 tests
[00:46:22] ..................................................................................i.................
[00:46:28] .........F.F...F....F.F...F...i.....................................................................
[00:46:35] ....................................................................................................
[00:46:39] ....................................................................................................
[00:46:43] ....................................................................................................
[00:46:48] ....................................................................................................
---
[00:47:27] failures:
[00:47:27] 
[00:47:27] ---- [ui] ui/const-eval-overflow-4.rs stdout ----
[00:47:27]  
[00:47:27] error: /checkout/src/test/ui/const-eval-overflow-4.rs:23: expected warning not found: attempt to add with overflow
[00:47:27] 
[00:47:27] error: 0 unexpected errors found, 1 expected errors not found
[00:47:27] status: exit code: 101
[00:47:27] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/const-eval-overflow-4.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--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/const-eval-overflow-4.stage2-x86_64-unknown-linux-gnu" "-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/const-eval-overflow-4.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[00:47:27] not found errors (from test file): [
[00:47:27]     Error {
[00:47:27]         line_num: 23,
[00:47:27]         kind: Some(
[00:47:27]             Warning
[00:47:27]         ),
[00:47:27]         msg: "attempt to add with overflow"
[00:47:27] ]
[00:47:27] 
[00:47:27] thread '[ui] ui/const-eval-overflow-4.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:1278:13
[00:47:27] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:47:27] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:47:27] 
[00:47:27] ---- [ui] ui/const-eval/conditional_array_execution.rs stdout ----
[00:47:27]  
[00:47:27] error: /checkout/src/test/ui/const-eval/conditional_array_execution.rs:15: expected warning not found: attempt to subtract with overflow
[00:47:27] 
[00:47:27] error: 0 unexpected errors found, 1 expected errors not found
[00:47:27] status: exit code: 0
[00:47:27] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/const-eval/conditional_array_execution.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--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/const-eval/conditional_array_execution.stage2-x86_64-unknown-linux-gnu" "-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/const-eval/conditional_array_execution.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[00:47:27] not found errors (from test file): [
[00:47:27]     Error {
[00:47:27]         line_num: 15,
[00:47:27]         kind: Some(
[00:47:27]             Warning
[00:47:27]         ),
[00:47:27]         msg: "attempt to subtract with overflow"
[00:47:27] ]
[00:47:27] 
[00:47:27] thread '[ui] ui/const-eval/conditional_array_execution.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:1278:13
[00:47:27] 
[00:47:27] 
[00:47:27] ---- [ui] ui/const-eval/issue-43197.rs stdout ----
[00:47:27]  
[00:47:27] error: /checkout/src/test/ui/const-eval/issue-43197.rs:20: expected warning not found: attempt to subtract with overflow
[00:47:27] 
[00:47:27] error: /checkout/src/test/ui/const-eval/issue-43197.rs:23: expected warning not found: attempt to subtract with overflow
[00:47:27] 
[00:47:27] error: 0 unexpected errors found, 2 expected errors not found
[00:47:27] status: exit code: 0
[00:47:27] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/const-eval/issue-43197.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--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/const-eval/issue-43197.stage2-x86_64-unknown-linux-gnu" "-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/const-eval/issue-43197.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[00:47:27] not found errors (from test file): [
[00:47:27]     Error {
[00:47:27]         line_num: 20,
[00:47:27]         kind: Some(
[00:47:27]             Warning
[00:47:27]         ),
[00:47:27]         msg: "attempt to subtract with overflow"
[00:47:27]     Error {
[00:47:27]         line_num: 23,
[00:47:27]         kind: Some(
[00:47:27]             Warning
[00:47:27]             Warning
[00:47:27]         ),
[00:47:27]         msg: "attempt to subtract with overflow"
[00:47:27] ]
[00:47:27] 
[00:47:27] thread '[ui] ui/const-eval/issue-43197.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:1278:13
[00:47:27] 
[00:47:27] 
[00:47:27] ---- [ui] ui/const-eval/pub_const_err.rs stdout ----
[00:47:27]  
[00:47:27] error: /checkout/src/test/ui/const-eval/pub_const_err.rs:15: expected warning not found: attempt to subtract with overflow
[00:47:27] 
[00:47:27] error: /checkout/src/test/ui/const-eval/pub_const_err.rs:19: expected warning not found: attempt to subtract with overflow
[00:47:27] 
[00:47:27] error: 0 unexpected errors found, 2 expected errors not found
[00:47:27] status: exit code: 0
[00:47:27] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/const-eval/pub_const_err.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--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/const-eval/pub_const_errget=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/const-eval/pub_const_err_bin.stage2-x86_64-unknown-linux-gnu" "-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/const-eval/pub_const_err_bin.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[00:47:27] not found errors (from test file): [
[00:47:27]     Error {
[00:47:27]         line_num: 13,
[00:47:27]         kind: Some(
[00:47:27]             Warning
[00:47:27]         ),
[00:47:27]         msg: "attempt to subtract with overflow"
[00:47:27]     Error {
[00:47:27]         line_num: 17,
[00:47:27]         kind: Some(
[00:47:27]             Warning
[00:47:27]             Warning
[00:47:27] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:488:22
[00:47:27]         ),
[00:47:27]         msg: "attempt to subtract with overflow"
[00:47:27] ]
[00:47:27] 
[00:47:27] thread '[ui] ui/const-eval/pub_const_err_bin.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:1278:13
[00:47:27] 
[00:47:27] 
[00:47:27] ---- [ui] ui/const-len-underflow-separate-spans.rs stdout ----
[00:47:27]  
[00:47:27] error: /checkout/src/test/ui/const-len-underflow-separate-spans.rs:17: expected warning not found: attempt to subtract with overflow
[00:47:27] 
[00:47:27] error: 0 unexpected errors found, 1 expected errors not found
[00:47:27] status: exit code: 101
[00:47:27] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/const-len-underflow-separate-spans.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--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/const-len-underflow-separate-spans.stage2-x86_64-unknown-linux-gnu" "-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/const-len-underflow-separate-spans.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[00:47:27] not found errors (from test file): [
[00:47:27]     Error {
[00:47:27]         line_num: 17,
[00:47:27]         kind: Some(
[00:47:27]             Warning
[00:47:27]         ),
[00:47:27]         msg: "attempt to subtract with overflow"
[00:47:27] ]
[00:47:27] 
[00:47:27] thread '[ui] ui/const-len-underflow-separate-spans.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:1278:13
[00:47:27] 
---
[00:47:27] test result: FAILED. 1363 passed; 6 failed; 7 ignored; 0 measured; 0 filtered out
[00:47:27] 
[00:47:27] 
[00:47:27] 
[00:47:27] 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-3.9/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" "3.9.1\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:47:27] 
[00:47:27] 
[00:47:27] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:47:27] Build completed unsuccessfully in 0:02:18
[00:47:27] Build completed unsuccessfully in 0:02:18
[00:47:27] Makefile:58: recipe for target 'check' failed
[00:47:27] make: *** [check] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:002b1b68
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

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 Apr 27, 2018

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

@@ -115,16 +115,21 @@ pub struct ValTy<'tcx> {
pub value: Value,
pub ty: Ty<'tcx>,
}

/*
impl<'tcx> ValTy<'tcx> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this since it seems to be unused?

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 removed.

@@ -15,12 +15,12 @@
use rustc::hir::def::Def;
use rustc::mir::{Constant, Literal, Location, Place, Mir, Operand, Rvalue, Local};
use rustc::mir::{NullOp, StatementKind, Statement, BasicBlock, LocalKind};
use rustc::mir::{TerminatorKind, ClearCrossCrate, SourceInfo, BinOp, ProjectionElem};
use rustc::mir::{TerminatorKind, ClearCrossCrate, SourceInfo, BinOp/*, ProjectionElem*/};
Copy link
Contributor

Choose a reason for hiding this comment

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

Commented out code

@@ -60,7 +60,7 @@ impl MirPass for ConstProp {
}
}

type Const<'tcx> = (Value, ty::Ty<'tcx>, Span);
type Const<'tcx> = (&'tcx Allocation, ty::Ty<'tcx>, Span);

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this needs to stay Value. Or where was it necessary to move to allocation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think const_prop should just create one Miri context, then it can create as many Values as it likes and it will all be freed when it's done.

@@ -334,7 +343,8 @@ impl<'b, 'a, 'tcx:'b> ConstPropagator<'b, 'a, 'tcx> {
}
Value::ByVal(val)
};
Some((val, place_ty, span))

Some((const_value_to_alloc(self.tcx, val, place_ty), place_ty, span))
Copy link
Contributor

Choose a reason for hiding this comment

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

His interns an intermediate/temp value. Won't that slowly fill up memory without really using it

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 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.
Check compiletest suite=ui mode=ui (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:43:46] 
[00:43:46] running 1376 tests
[00:43:51] ..................................................................................i.................
[00:43:57] ......................F.......i.....................................................................
[00:44:05] ....................................................................................................
[00:44:09] ....................................................................................................
[00:44:13] ....................................................................................................
[00:44:18] ....................................................................................................
[00:44:18] ....................................................................................................
[00:44:24] ......................................F...........................................................F.
[00:44:30] ..F.................................................................................................
[00:44:37] ..................................i....................................F.F....F....F.F.F..F.........
[00:44:48] ..........................ii........................................................................
[00:44:55] ....................................................................................................
[00:45:00] .......i....................................................................
[00:45:00] failures:
[00:45:00] failures:
[00:45:00] 
[00:45:00] ---- [ui] ui/const-eval/promoted_errors.rs stdout ----
[00:45:00]  diff of stderr:
[00:45:00] 
[00:45:00] 15 warning: constant evaluation error
[00:45:00] 16   --> $DIR/promoted_errors.rs:17:14
[00:45:00] 17    |
[00:45:00] + LL |     println!("{}", 0u32 - 1);
[00:45:00] +    |     ------------------------- attempted to do overflowing math
[00:45:00] + ...
[00:45:00] 18 LL |     let _x = 0u32 - 1;
[00:45:00] -    |              ^^^^^^^^ attempted to do overflowing math
[00:45:00] +    |
[00:45:00] +    |
[00:45:00] +    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backd":64,"is_primary":false,"text":[{"text":"( $ ( $ arg : tt ) * ) => (","highlight_start":1,"highlight_end":28},{"text":"$ crate :: io :: _print ( format_args ! ( $ ( $ arg ) * ) ) ) ;","highlight_start":1,"highlight_end":64}],"label":null,"suggested_replacement":null,"expansion":null}}},"macro_decl_name":"format_args!","def_site_span":null}},{"file_name":"/checkout/src/test/ui/const-eval/promoted_errors.rs","byte_start":731,"byte_end":738,"line_start":22,"line_end":22,"column_start":14,"column_end":21,"is_primary":true,"text":[{"text":"    let _x = 1/(1-1);","highlight_start":14,"highlight_end":21}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":"warning: constant evaluation error\n  --> /checkout/src/test/ui/const-eval/promoted_errors.rs:22:14\n   |\nLL |     println!(\"{}\", 1/(1-1));\n   |     ------------------------ attempted to do overflowing math\n...\nLL |     let _x = 1/(1-1);\n   |              ^^^^^^^\n   |\n   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)\n\n"}
[00:45:00] {"message":"constant evaluation error","code":{"code":"const_err","explanation":null},"level":"warning","spans":[{"file_name":"/checkout/src/test/ui/const-eval/promoted_errors.rs","byte_start":807,"byte_end":823,"line_start":25,"line_end":25,"column_start":20,"column_end":36,"is_primary":true,"text":[{"text":"    println!(\"{}\", 1/(false as u32));","highlight_start":20,"highlight_end":36}],"label":"attempted to do overflowing math","suggested_replacement":null,"expansion":null}],"children":[],"rendered":"warning_64-unknown-linux-gnu/test/ui/nll/decl-macro-illegal-copy.stage2-x86_64-unknown-linux-gnu" "-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/nll/decl-macro-illegal-copy.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[00:45:00] ------------------------------------------
[00:45:00] 
[00:45:00] ------------------------------------------
[00:45:00] stderr:
[00:45:00] stderr:
[00:45:00] ------------------------------------------
[00:45:00] thread 'main' panicked at 'constants cannot have local types', libcore/option.rs:914:5
[00:45:00] 
[00:45:00] ------------------------------------------
[00:45:00] 
[00:45:00] thread '[ui] ui/nll/decl-macro-illegal-copy.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2965:9
[00:45:00] thread '[ui] ui/nll/decl-macro-illegal-copy.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2965:9
[00:45:00] 
[00:45:00] ---- [ui] ui/nll/issue-16223.rs stdout ----
[00:45:00]  
[00:45:00] error: test compilation failed although it shouldn't!
[00:45:00] status: signal: 4
[00:45:00] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/nll/issue-16223.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--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/nll/issue-16223.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:31aa69e1
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

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-3.9 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:50:11] .............................................................................ii.....................
[00:50:58] .........................................i....................................................i.ii..
[00:51:09] .............................test [run-pass] run-pass/saturating-float-casts.rs has been running for over 60 seconds
[00:51:37] .......................................................................
[00:51:53] ..iiiiiii...........................................................................................
[00:52:32] ....................................................................................................
[00:52:48] ..........................................................................
[00:52:48] test result: ok. 2955 passed; 0 failed; 19 ignored; 0 measured; 0 filtered out
[00:52:48] 
---
Check compiletest suite=run-make-fulldeps mode=run-make (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:22:40] 
[01:22:40] running 182 tests
[01:23:22] ....................................................................................................
[01:24:13] ................................F................................................test [run-make] run-make-fulldeps/long-linker-command-lines has been running for over 60 seconds
lvm-filecheck" "/usr/lib/llvm-3.9/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" "3.9.1\n" "--system-llvm" "--cc" "cc" "--cxx" "c++" "--cflags" "-ffunction-sections -fdata-sections -fPIC -m64" "--llvm-components" "aarch64 aarch64asmparser aarch64asmprinter aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils all all-targets amdgpu amdgpuasmparser amdgpuasmprinter amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armasmprinter armcodegen armdesc armdisassembler arminfo asmparser asmprinter bitreader bitwriter bpf bpfasmprinter bpfcodegen bpfdesc bpfinfo codegen core coverage debuginfocodeview debuginfodwarf debuginfopdb engine executionengine globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader libdriver lineeditor linker lto mc mcdisassembler mcjit mcparser mips mipsasmparser mipsasmprinter mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmprinter msp430codegen msp430desc msp430info native nativecodegen nvptx nvptxasmprinter nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit passes powerpc powerpcasmparser powerpcasmprinter powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata runtimedyld scalaropts selectiondag sparc sparcasmparser sparcasmprinter sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzasmprinter systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target transformutils vectorize x86 x86asmparser x86asmprinter x86codegen x86desc x86disassembler x86info x86utils xcore xcoreasmprinter xcorecodegen xcoredesc xcoredisassembler xcoreinfo" "--llvm-cxxflags" "-I/usr/lib/llvm-3.9/include -std=c++0x -gsplit-dwarf -Wl,-fuse-ld=gold -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -Werror=date-time -std=c++11 -ffunction-sections -fdata-sections -O2 -g -DNDEBUG  -fno-exceptions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS" "--ar" "ar" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:25:27] 
[01:25:27] 
[01:25:27] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:25:27] Build completed unsuccessfully in 0:46:03
[01:25:27] Build completed unsuccessfully in 0:46:03
[01:25:27] Makefile:58: recipe for target 'check' failed
[01:25:27] make: *** [check] Error 1
obj/build/bootstrap/debug/incremental/bootstrap-1wl4zjaz72e5d
123688 ./obj/build/bootstrap/debug/incremental/bootstrap-1wl4zjaz72e5d/s-f0kd98txie-1uj3pes-6gvofocobazn
116684 ./obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/incremental
111752 ./obj/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu
111748 ./obj/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release
107428 ./obj/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release/deps
107428 ./obj/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release/deps
102820 ./obj/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends
102808 ./obj/build/bootstrap/debug/incremental/bootstrap-2wettvttcntnm
102804 ./obj/build/bootstrap/debug/incremental/bootstrap-2wettvttcntnm/s-f0keaopyz6-vmio0f-v7hez0f2m5v0
90976 ./obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/incremental/core-31lccp6wy7orz
90976 ./obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/incremental/core-31lccp6wy7orz
90972 ./obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/incremental/core-31lccp6wy7orz/s-f0ke8bnw02-1ixgbi3-1063n3gacp23l
89684 ./src/llvm/test/CodeGen
89616 ./obj/build/x86_64-unknown-linux-gnu/stage1
89592 ./obj/build/x86_64-unknown-linux-gnu/stage1/lib
86660 ./obj/build/x86_64-unknown-linux-gnu/doc/core

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-3.9 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:50:42] .............................................................................ii.....................
[00:51:29] .........................................i....................................................i.ii..
[00:51:40] .............................test [run-pass] run-pass/saturating-float-casts.rs has been running for over 60 seconds
[00:52:09] .......................................................................
[00:52:25] ..iiiiiii...........................................................................................
[00:53:04] ....................................................................................................
[00:53:20] ..........................................................................
[00:53:20] test result: ok. 2955 passed; 0 failed; 19 ignored; 0 measured; 0 filtered out
[00:53:20] 
---
travis_time:start:test_codegen
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:56:57] 
[00:56:57] running 77 tests
[00:57:01] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:488:22
[00:57:01] i...ii..ii....i.............ii........Fiii......i..i...i...ii..i..i...ii.....
[00:57:01] 
[00:57:01] ---- [codegen] codegen/link_section.rs stdout ----
[00:57:01]  
[00:57:01]  
[00:57:01] error: verification with 'FileCheck' failed
[00:57:01] status: exit code: 1
[00:57:01] command: "/usr/lib/llvm-3.9/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/link_section.ll" "/checkout/src/test/codegen/link_section.rs"
[00:57:01] ------------------------------------------
[00:57:01] 
[00:57:01] ------------------------------------------
[00:57:01] stderr:
[00:57:01] stderr:
[00:57:01] ------------------------------------------
[00:57:01] /checkout/src/test/codegen/link_section.rs:15:11: error: expected string not found in input
[00:57:01] // CHECK: @VAR1 = constant <{ [4 x i8] }> <{ [4 x i8] c"\01\00\00\00" }>, section ".test_one"
[00:57:01]           ^
[00:57:01] /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/link_section.ll:1:1: note: scanning from here
[00:57:01] ; ModuleID = 'link_section0-8787f43e282added376259c1adb08b80.rs'
[00:57:01] ^
[00:57:01] /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/link_section.ll:8:7: note: possible intended match here
[00:57:01] @VAR3 = constant <{ [8 x i8] }> <{ [8 x i8] c"\01\00\00\00\00\00\80?" }>, section ".test_three", align 4
[00:57:01] 
[00:57:01] ------------------------------------------
[00:57:01] 
[00:57:01] thread '[codegen] codegen/link_section.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2965:9
---
[00:57:01] test result: FAILED. 56 passed; 1 failed; 20 ignored; 0 measured; 0 filtered out
[00:57:01] 
[00:57:01] 
[00:57:01] 
[00:57:01] 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/codegen" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "codegen" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-3.9/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" "3.9.1\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:57:01] 
[00:57:01] 
[00:57:01] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:57:01] Build completed unsuccessfully in 0:16:43
[00:57:01] Build completed unsuccessfully in 0:16:43
[00:57:01] Makefile:58: recipe for target 'check' failed
[00:57:01] make: *** [check] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:00a6b4a0
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

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)

@Zoxc
Copy link
Contributor Author

Zoxc commented Apr 30, 2018

@bors try

@bors
Copy link
Contributor

bors commented Apr 30, 2018

⌛ Trying commit cd5230f5c5183f3af61b895b599502da867b9511 with merge 750791559018389ae7bae476053c1a162d40ecdf...

@Zoxc
Copy link
Contributor Author

Zoxc commented Apr 30, 2018

I've changed this to add a ConstValue type which is closer to Miri's Value which allows for easy conversion between them:

pub enum ConstValue<'tcx> {
    // Used only for types with layout::abi::Scalar ABI and ZSTs which use PrimVal::Undef
    ByVal(PrimVal),
    // Used only for types with layout::abi::ScalarPair
    ByValPair(PrimVal, PrimVal),
    // Used only for the remaining cases
    ByRef(&'tcx Allocation),
}

const_prop.rs now keeps an single EvalContext around so the Values it uses are not freed. This also ensures that allocations from uses of constants there are freed when the EvalContext is.

@Zoxc Zoxc changed the title [WIP] Use &'tcx Allocation instead of Value for constant values [WIP] Introduce ConstValue and use it instead of miri's Value for constant values Apr 30, 2018
@@ -12,17 +12,11 @@

#![crate_type = "lib"]

// CHECK: @VAR1 = constant <{ [4 x i8] }> <{ [4 x i8] c"\01\00\00\00" }>, section ".test_one"
// CHECK: @VAR1 = constant i32 1, section ".test_one"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eddyb The types of static are changed for some values. I assume all uses of statics use bitcasts anyway?

Copy link
Member

Choose a reason for hiding this comment

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

This seems wrong, why would a static go through anything other than an Allocation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is the code which converts constants into LLVM values: https://github.com/rust-lang/rust/pull/50249/files#diff-823b4422fff3f3018e53dfb6dc0a1fb3R84

It does not seem useful to convert these back into an Allocation.

Copy link
Member

Choose a reason for hiding this comment

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

statics should never be anything other than Allocation, so this seems wrong. Evaluating the initializer of a static should not be done the same way as evaluating a const. Only the former should produce a value, whereas a static should already have an allocation, and the evaluation should "fill it in"

Hang on, I got a bit turned around. The value in this case is the initializer, so ByRef indicates not the "allocation of the static" but the "contents" - it just happens to use &Allocation, which has become confusing.

In which case, if no information is obtained from that Allocation other than the bytes and the relocations, it seems fine (I just checked and this is indeed the case).

Can you inline the body of global_initializer into const_value_to_llvm and rename the latter to global_initializer? At least that way it can't be easily confused with the case where ByRef actually requires indirection.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

global_initializer is still used elsewhere. I've renamed it to const_alloc_to_llvm.

@bors
Copy link
Contributor

bors commented Apr 30, 2018

☀️ Test successful - status-travis
State: approved= try=True

@Zoxc
Copy link
Contributor Author

Zoxc commented Apr 30, 2018

@Mark-Simulacrum I'd like a perf run here

@Zoxc Zoxc changed the title [WIP] Introduce ConstValue and use it instead of miri's Value for constant values Introduce ConstValue and use it instead of miri's Value for constant values Apr 30, 2018
@Mark-Simulacrum
Copy link
Member

Perf queued.

@@ -384,6 +384,30 @@ for ::middle::const_val::ConstVal<'gcx> {
}
}

impl<'a, 'gcx> HashStable<StableHashingContext<'a>>
for ::middle::const_val::ConstValue<'gcx> {
Copy link
Member

Choose a reason for hiding this comment

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

Please do not add more things to that module. It should be removed already. Everything constant belongs in miri.

Copy link
Member

Choose a reason for hiding this comment

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

It almost seems like you should be able to make miri's Value generic over the allocation information in the ByRef case.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. Also it would probably suffice to return the Allocation directly instead of an interned one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please do not add more things to that module. It should be removed already. Everything constant belongs in miri.

Do you want to move ty::Const, ConstVal and ConstValue to a new module librustc\mir\interpret\const.rs?

It almost seems like you should be able to make miri's Value generic over the allocation information in the ByRef case.

I don't think there's anything to be gained by doing that. I'd rather just get rid of miri's Value type. Representing values by pointers to values in some cases and just values in other cases is confusing.

Also it would probably suffice to return the Allocation directly instead of an interned one.

I don't know what you mean here, but ConstValue can't store an Allocation directly, since it constants are in the dropless interner. Interning here also makes type folding cheaper.

Copy link
Member

Choose a reason for hiding this comment

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

@Zoxc ConstValue should be right next to the existing miri Value, while ConstVal should be ConstKind right next to the definition of ty::Const.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've moved ConstValue next to Value. I don't want to move the other types in this PR, it is large enough already.

@bors
Copy link
Contributor

bors commented May 1, 2018

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

@Zoxc Zoxc force-pushed the allocation-const branch 2 times, most recently from db253de to 3f4cb4d Compare May 9, 2018 11:13
@bors
Copy link
Contributor

bors commented May 10, 2018

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

@Zoxc Zoxc force-pushed the allocation-const branch 3 times, most recently from 774a5a7 to 84244fc Compare May 10, 2018 19:36
@oli-obk
Copy link
Contributor

oli-obk commented May 11, 2018

@bors r+

let's not make this PR any bigger. There's already a followup PR and FIXMEs are in place where applicable.

@bors
Copy link
Contributor

bors commented May 11, 2018

📌 Commit 0aa92ac has been approved by oli-obk

@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 May 11, 2018
@bors
Copy link
Contributor

bors commented May 12, 2018

⌛ Testing commit 0aa92ac with merge c705877...

bors added a commit that referenced this pull request May 12, 2018
Introduce ConstValue and use it instead of miri's Value for constant values

r? @oli-obk
@bors
Copy link
Contributor

bors commented May 12, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: oli-obk
Pushing c705877 to master...

@bors bors merged commit 0aa92ac into rust-lang:master May 12, 2018
@bors bors mentioned this pull request May 12, 2018
@kennytm-githubbot
Copy link

📣 Toolstate changed by #50249!

Tested on commit c705877.
Direct link to PR: #50249

💔 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-githubbot added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request May 12, 2018
Tested on commit rust-lang/rust@c705877.
Direct link to PR: <rust-lang/rust#50249>

💔 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).
@Zoxc Zoxc deleted the allocation-const branch May 12, 2018 22:36
bors added a commit that referenced this pull request May 22, 2018
Misc changes related to Miri allocations

This builds on top of #50249

r? @oli-obk
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.

8 participants