mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-16 17:03:35 +00:00
Finished const_eval module migration, moving onto sibling folders
This commit is contained in:
parent
0b71ffca18
commit
6af8e46a9a
@ -1,16 +1,16 @@
|
||||
// Not in interpret to make sure we do not use private implementation details
|
||||
|
||||
use crate::errors::MaxNumNodesExceeded;
|
||||
use crate::interpret::{
|
||||
intern_const_alloc_recursive, ConstValue, InternKind, InterpCx, InterpResult, MemPlaceMeta,
|
||||
Scalar,
|
||||
};
|
||||
use rustc_hir::Mutability;
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::mir::interpret::{EvalToValTreeResult, GlobalId};
|
||||
use rustc_middle::ty::{self, TyCtxt};
|
||||
use rustc_span::{source_map::DUMMY_SP, symbol::Symbol};
|
||||
|
||||
use crate::interpret::{
|
||||
intern_const_alloc_recursive, ConstValue, InternKind, InterpCx, InterpResult, MemPlaceMeta,
|
||||
Scalar,
|
||||
};
|
||||
|
||||
mod error;
|
||||
mod eval_queries;
|
||||
mod fn_queries;
|
||||
@ -77,7 +77,7 @@ pub(crate) fn eval_to_valtree<'tcx>(
|
||||
ValTreeCreationError::NodesOverflow => {
|
||||
let msg = format!("maximum number of nodes exceeded in constant {}", &s);
|
||||
let mut diag = match tcx.hir().span_if_local(did) {
|
||||
Some(span) => tcx.sess.struct_span_err(span, &msg),
|
||||
Some(span) => tcx.sess.create_err(MaxNumNodesExceeded { span, s }),
|
||||
None => tcx.sess.struct_err(&msg),
|
||||
};
|
||||
diag.emit();
|
||||
|
@ -87,3 +87,11 @@ pub(crate) struct TransientMutBorrowErrRaw {
|
||||
pub span: Span,
|
||||
pub kind: ConstContext,
|
||||
}
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
#[error(const_eval::const_evaL_max_num_nodes_exceeded)]
|
||||
pub(crate) struct MaxNumNodesExceeded {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub s: String,
|
||||
}
|
||||
|
@ -29,3 +29,5 @@ const_eval_mut_deref =
|
||||
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_exceeded = maximum number of nodes exceeded in constant {$s}
|
||||
|
Loading…
Reference in New Issue
Block a user