mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 11:07:42 +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
|
// 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_hir::Mutability;
|
||||||
use rustc_middle::mir;
|
use rustc_middle::mir;
|
||||||
use rustc_middle::mir::interpret::{EvalToValTreeResult, GlobalId};
|
use rustc_middle::mir::interpret::{EvalToValTreeResult, GlobalId};
|
||||||
use rustc_middle::ty::{self, TyCtxt};
|
use rustc_middle::ty::{self, TyCtxt};
|
||||||
use rustc_span::{source_map::DUMMY_SP, symbol::Symbol};
|
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 error;
|
||||||
mod eval_queries;
|
mod eval_queries;
|
||||||
mod fn_queries;
|
mod fn_queries;
|
||||||
@ -77,7 +77,7 @@ pub(crate) fn eval_to_valtree<'tcx>(
|
|||||||
ValTreeCreationError::NodesOverflow => {
|
ValTreeCreationError::NodesOverflow => {
|
||||||
let msg = format!("maximum number of nodes exceeded in constant {}", &s);
|
let msg = format!("maximum number of nodes exceeded in constant {}", &s);
|
||||||
let mut diag = match tcx.hir().span_if_local(did) {
|
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),
|
None => tcx.sess.struct_err(&msg),
|
||||||
};
|
};
|
||||||
diag.emit();
|
diag.emit();
|
||||||
|
@ -87,3 +87,11 @@ pub(crate) struct TransientMutBorrowErrRaw {
|
|||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub kind: ConstContext,
|
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 = 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_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