diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2020-04-12 04:24:25 +0300 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2020-04-16 19:00:30 +0300 |
| commit | d7c4081b18fbf50f2d260ea893b659aec0b1d84a (patch) | |
| tree | 76d84766b5e8784ad5baa65ad2c5e2e240ae8e9c /src/librustc_mir/const_eval | |
| parent | e22d4795d849d2c6a229ccb666db922ae5b76410 (diff) | |
mir/interpret: only use `ErrorHandled::Reported` for `ErrorReported`.
Diffstat (limited to 'src/librustc_mir/const_eval')
| -rw-r--r-- | src/librustc_mir/const_eval/eval_queries.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/librustc_mir/const_eval/eval_queries.rs b/src/librustc_mir/const_eval/eval_queries.rs index 3f0774767fd..8cb0ea91bc2 100644 --- a/src/librustc_mir/const_eval/eval_queries.rs +++ b/src/librustc_mir/const_eval/eval_queries.rs @@ -213,13 +213,10 @@ fn validate_and_turn_into_const<'tcx>( val.map_err(|error| { let err = error_to_const_error(&ecx, error); - match err.struct_error(ecx.tcx, "it is undefined behavior to use this value", |mut diag| { + err.struct_error(ecx.tcx, "it is undefined behavior to use this value", |mut diag| { diag.note(note_on_undefined_behavior_error()); diag.emit(); - }) { - Ok(_) => ErrorHandled::Reported, - Err(err) => err, - } + }) }) } @@ -292,11 +289,10 @@ pub fn const_eval_raw_provider<'tcx>( let cid = key.value; let def_id = cid.instance.def.def_id(); - if def_id.is_local() - && tcx.has_typeck_tables(def_id) - && tcx.typeck_tables_of(def_id).tainted_by_errors - { - return Err(ErrorHandled::Reported); + if def_id.is_local() && tcx.has_typeck_tables(def_id) { + if let Some(error_reported) = tcx.typeck_tables_of(def_id).tainted_by_errors { + return Err(ErrorHandled::Reported(error_reported)); + } } let is_static = tcx.is_static(def_id); |
