mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-15 20:45:45 +03:00
query-fy type_name
This commit is contained in:
@@ -2684,7 +2684,6 @@ dependencies = [
|
||||
"rustc_errors 0.0.0",
|
||||
"rustc_fs_util 0.0.0",
|
||||
"rustc_incremental 0.0.0",
|
||||
"rustc_mir 0.0.0",
|
||||
"rustc_target 0.0.0",
|
||||
"serialize 0.0.0",
|
||||
"syntax 0.0.0",
|
||||
|
||||
@@ -441,6 +441,15 @@
|
||||
no_force
|
||||
desc { "extract field of const" }
|
||||
}
|
||||
|
||||
/// Produces an absolute path representation of the given type. See also the documentation
|
||||
/// on `std::any::type_name`.
|
||||
query type_name(key: Ty<'tcx>) -> &'tcx ty::Const<'tcx> {
|
||||
eval_always
|
||||
no_force
|
||||
desc { "get absolute path of type" }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TypeChecking {
|
||||
|
||||
@@ -212,7 +212,7 @@ fn codegen_intrinsic_call(
|
||||
}
|
||||
"type_name" => {
|
||||
let tp_ty = substs.type_at(0);
|
||||
let ty_name = rustc_mir::interpret::type_name(self.tcx, tp_ty);
|
||||
let ty_name = self.tcx.type_name(tp_ty);
|
||||
OperandRef::from_const(self, ty_name).immediate_or_packed_pair(self)
|
||||
}
|
||||
"type_id" => {
|
||||
|
||||
@@ -33,4 +33,4 @@
|
||||
|
||||
pub use self::validity::RefTracking;
|
||||
|
||||
pub use self::intrinsics::type_name;
|
||||
pub(super) use self::intrinsics::type_name;
|
||||
|
||||
@@ -67,6 +67,7 @@ pub fn provide(providers: &mut Providers<'_>) {
|
||||
let (param_env, (value, field)) = param_env_and_value.into_parts();
|
||||
const_eval::const_field(tcx, param_env, None, field, value)
|
||||
};
|
||||
providers.type_name = interpret::type_name;
|
||||
}
|
||||
|
||||
__build_diagnostic_array! { librustc_mir, DIAGNOSTICS }
|
||||
|
||||
Reference in New Issue
Block a user