Addressing last comment on PR review

This commit is contained in:
nidnogg 2022-08-22 12:14:49 -03:00
parent 13abae2deb
commit 649749c7b0
3 changed files with 5 additions and 5 deletions

View File

@ -72,12 +72,12 @@ pub(crate) fn eval_to_valtree<'tcx>(
Ok(valtree) => Ok(Some(valtree)),
Err(err) => {
let did = cid.instance.def_id();
let s = cid.display(tcx);
let global_const_id = cid.display(tcx);
match err {
ValTreeCreationError::NodesOverflow => {
let msg = format!("maximum number of nodes exceeded in constant {}", &s);
let msg = format!("maximum number of nodes exceeded in constant {}", &global_const_id);
let mut diag = match tcx.hir().span_if_local(did) {
Some(span) => tcx.sess.create_err(MaxNumNodesInConstErr { span, s }),
Some(span) => tcx.sess.create_err(MaxNumNodesInConstErr { span, global_const_id }),
None => tcx.sess.struct_err(&msg),
};
diag.emit();

View File

@ -93,7 +93,7 @@ pub(crate) struct TransientMutBorrowErrRaw {
pub(crate) struct MaxNumNodesInConstErr {
#[primary_span]
pub span: Span,
pub s: String,
pub global_const_id: String,
}
#[derive(SessionDiagnostic)]

View File

@ -30,7 +30,7 @@ const_eval_transient_mut_borrow = mutable references are not allowed in {$kind}s
const_eval_transient_mut_borrow_raw = raw mutable references are not allowed in {$kind}s
const_eval_max_num_nodes_in_const = maximum number of nodes exceeded in constant {$s}
const_eval_max_num_nodes_in_const = maximum number of nodes exceeded in constant {$global_const_id}
const_eval_unallowed_fn_pointer_call = function pointer calls are not allowed in {$kind}s