Porting 'compiler/rustc_trait_selection' to translatable diagnostics - Part 1

This commit is contained in:
Gabriel Bustamante 2022-08-26 13:08:58 -05:00
parent fb888117da
commit 8e82200277
12 changed files with 180 additions and 87 deletions

View file

@ -3,6 +3,7 @@
use super::*;
use crate::errors::UnableToConstructConstantValue;
use crate::infer::region_constraints::{Constraint, RegionConstraintData};
use crate::infer::InferCtxt;
use crate::traits::project::ProjectAndUnifyResult;
@ -830,8 +831,11 @@ impl<'tcx> AutoTraitFinder<'tcx> {
Ok(None) => {
let tcx = self.tcx;
let def_id = unevaluated.def.did;
let reported = tcx.sess.struct_span_err(tcx.def_span(def_id), &format!("unable to construct a constant value for the unevaluated constant {:?}", unevaluated)).emit();
let reported =
tcx.sess.emit_err(UnableToConstructConstantValue {
span: tcx.def_span(def_id),
unevaluated,
});
Err(ErrorHandled::Reported(reported))
}
Err(err) => Err(err),