Skip to content

Commit 6af8e46

Browse files
committed
Finished const_eval module migration, moving onto sibling folders
1 parent 0b71ffc commit 6af8e46

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

compiler/rustc_const_eval/src/const_eval/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
// Not in interpret to make sure we do not use private implementation details
22

3+
use crate::errors::MaxNumNodesExceeded;
4+
use crate::interpret::{
5+
intern_const_alloc_recursive, ConstValue, InternKind, InterpCx, InterpResult, MemPlaceMeta,
6+
Scalar,
7+
};
38
use rustc_hir::Mutability;
49
use rustc_middle::mir;
510
use rustc_middle::mir::interpret::{EvalToValTreeResult, GlobalId};
611
use rustc_middle::ty::{self, TyCtxt};
712
use rustc_span::{source_map::DUMMY_SP, symbol::Symbol};
813

9-
use crate::interpret::{
10-
intern_const_alloc_recursive, ConstValue, InternKind, InterpCx, InterpResult, MemPlaceMeta,
11-
Scalar,
12-
};
13-
1414
mod error;
1515
mod eval_queries;
1616
mod fn_queries;
@@ -77,7 +77,7 @@ pub(crate) fn eval_to_valtree<'tcx>(
7777
ValTreeCreationError::NodesOverflow => {
7878
let msg = format!("maximum number of nodes exceeded in constant {}", &s);
7979
let mut diag = match tcx.hir().span_if_local(did) {
80-
Some(span) => tcx.sess.struct_span_err(span, &msg),
80+
Some(span) => tcx.sess.create_err(MaxNumNodesExceeded { span, s }),
8181
None => tcx.sess.struct_err(&msg),
8282
};
8383
diag.emit();

compiler/rustc_const_eval/src/errors.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,11 @@ pub(crate) struct TransientMutBorrowErrRaw {
8787
pub span: Span,
8888
pub kind: ConstContext,
8989
}
90+
91+
#[derive(SessionDiagnostic)]
92+
#[error(const_eval::const_evaL_max_num_nodes_exceeded)]
93+
pub(crate) struct MaxNumNodesExceeded {
94+
#[primary_span]
95+
pub span: Span,
96+
pub s: String,
97+
}

compiler/rustc_error_messages/locales/en-US/const_eval.ftl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ const_eval_mut_deref =
2929
const_eval_transient_mut_borrow = mutable references are not allowed in {$kind}s
3030
3131
const_eval_transient_mut_borrow_raw = raw mutable references are not allowed in {$kind}s
32+
33+
const_evaL_max_num_nodes_exceeded = maximum number of nodes exceeded in constant {$s}

0 commit comments

Comments
 (0)