diff options
| author | Ralf Jung <post@ralfj.de> | 2018-11-17 15:45:09 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2018-11-19 23:02:28 +0100 |
| commit | 612febcc4bec60dba58472269c2cf30860315a3d (patch) | |
| tree | 74fda6c1666e7846eff83e03769a5453e0e8288f | |
| parent | c462e44c13ce33359dc50dbeb4f60ef552acd438 (diff) | |
| download | rust-612febcc4bec60dba58472269c2cf30860315a3d.tar.gz rust-612febcc4bec60dba58472269c2cf30860315a3d.zip | |
explain why we can use raw
| -rw-r--r-- | src/librustc_mir/interpret/eval_context.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index 1d7eae50e71..59083413582 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -597,6 +597,10 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc } else { self.param_env }; + // We use `const_eval_raw` here, and get an unvalidated result. That is okay: + // Our result will later be validated anyway, and there seems no good reason + // to have to fail early here. This is also more consistent with + // `Memory::get_static_alloc` which has to use `const_eval_raw` to avoid cycles. let val = self.tcx.const_eval_raw(param_env.and(gid)).map_err(|err| { match err { ErrorHandled::Reported => EvalErrorKind::ReferencedConstant, |
