Skip to content

Commit abd9002

Browse files
committed
Rename thir::cx::Cx to ThirBuildCx
1 parent c4888de commit abd9002

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

compiler/rustc_mir_build/src/thir/cx/block.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ use rustc_middle::ty;
66
use rustc_middle::ty::CanonicalUserTypeAnnotation;
77
use tracing::debug;
88

9-
use crate::thir::cx::Cx;
9+
use crate::thir::cx::ThirBuildCx;
1010

11-
impl<'tcx> Cx<'tcx> {
11+
impl<'tcx> ThirBuildCx<'tcx> {
1212
pub(crate) fn mirror_block(&mut self, block: &'tcx hir::Block<'tcx>) -> BlockId {
1313
// We have to eagerly lower the "spine" of the statements
1414
// in order to get the lexical scoping correctly.

compiler/rustc_mir_build/src/thir/cx/expr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ use rustc_middle::{bug, span_bug};
2121
use rustc_span::{Span, sym};
2222
use tracing::{debug, info, instrument, trace};
2323

24-
use crate::thir::cx::Cx;
24+
use crate::thir::cx::ThirBuildCx;
2525

26-
impl<'tcx> Cx<'tcx> {
26+
impl<'tcx> ThirBuildCx<'tcx> {
2727
/// Create a THIR expression for the given HIR expression. This expands all
2828
/// adjustments and directly adds the type information from the
2929
/// `typeck_results`. See the [dev-guide] for more details.

compiler/rustc_mir_build/src/thir/cx/mod.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ use tracing::instrument;
1717

1818
use crate::thir::pattern::pat_from_hir;
1919

20+
/// Query implementation for [`TyCtxt::thir_body`].
2021
pub(crate) fn thir_body(
2122
tcx: TyCtxt<'_>,
2223
owner_def: LocalDefId,
2324
) -> Result<(&Steal<Thir<'_>>, ExprId), ErrorGuaranteed> {
2425
let hir = tcx.hir();
2526
let body = hir.body_owned_by(owner_def);
26-
let mut cx = Cx::new(tcx, owner_def);
27+
let mut cx = ThirBuildCx::new(tcx, owner_def);
2728
if let Some(reported) = cx.typeck_results.tainted_by_errors {
2829
return Err(reported);
2930
}
@@ -51,8 +52,10 @@ pub(crate) fn thir_body(
5152
Ok((tcx.alloc_steal_thir(cx.thir), expr))
5253
}
5354

54-
struct Cx<'tcx> {
55+
/// Context for lowering HIR to THIR for a single function body (or other kind of body).
56+
struct ThirBuildCx<'tcx> {
5557
tcx: TyCtxt<'tcx>,
58+
/// The THIR data that this context is building.
5659
thir: Thir<'tcx>,
5760

5861
typing_env: ty::TypingEnv<'tcx>,
@@ -68,8 +71,8 @@ struct Cx<'tcx> {
6871
body_owner: DefId,
6972
}
7073

71-
impl<'tcx> Cx<'tcx> {
72-
fn new(tcx: TyCtxt<'tcx>, def: LocalDefId) -> Cx<'tcx> {
74+
impl<'tcx> ThirBuildCx<'tcx> {
75+
fn new(tcx: TyCtxt<'tcx>, def: LocalDefId) -> Self {
7376
let typeck_results = tcx.typeck(def);
7477
let hir = tcx.hir();
7578
let hir_id = tcx.local_def_id_to_hir_id(def);
@@ -93,7 +96,7 @@ impl<'tcx> Cx<'tcx> {
9396
BodyTy::Const(typeck_results.node_type(hir_id))
9497
};
9598

96-
Cx {
99+
Self {
97100
tcx,
98101
thir: Thir::new(body_type),
99102
// FIXME(#132279): We're in a body, we should use a typing

0 commit comments

Comments
 (0)