Skip to content

Commit df71c4f

Browse files
committed
Auto merge of rust-lang#120926 - fmease:astconv-no-mo, r=<try>
[WIP] [MCP 723] Rename `astconv::AstConv` and related items See rust-lang/compiler-team#723. Corresponding rustc-dev-guide PR: rust-lang/rustc-dev-guide#1916. DO NOT REVIEW THIS JUST YET: I still need to finalize it: Renaming & adding/updating more (doc) comments! r? ghost
2 parents c2fbe40 + 1fa7d95 commit df71c4f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+842
-884
lines changed

compiler/rustc_ast/src/visit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ pub fn walk_use_tree<'a, V: Visitor<'a>>(
480480
try_visit!(visitor.visit_path(&use_tree.prefix, id));
481481
match use_tree.kind {
482482
UseTreeKind::Simple(rename) => {
483-
// The extra IDs are handled during HIR lowering.
483+
// The extra IDs are handled during AST lowering.
484484
visit_opt!(visitor, visit_ident, rename);
485485
}
486486
UseTreeKind::Glob => {}

compiler/rustc_ast_lowering/src/delegation.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@
2929
//! item id (`item_id`) in case of impl trait or path resolution id (`path_id`) otherwise.
3030
//!
3131
//! Since we do not have a proper way to obtain function type information by path resolution
32-
//! in AST, we mark each function parameter type as `InferDelegation` and inherit it in `AstConv`.
32+
//! in AST, we mark each function parameter type as `InferDelegation` and inherit it during
33+
//! HIR ty lowering.
3334
//!
3435
//! Similarly generics, predicates and header are set to the "default" values.
3536
//! In case of discrepancy with callee function the `NotSupportedDelegation` error will
36-
//! also be emitted in `AstConv`.
37+
//! also be emitted during HIR ty lowering.
3738
3839
use crate::{ImplTraitPosition, ResolverAstLoweringExt};
3940

@@ -129,7 +130,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
129130
) -> &'hir hir::FnDecl<'hir> {
130131
let args_count = if let Some(local_sig_id) = sig_id.as_local() {
131132
// Map may be filled incorrectly due to recursive delegation.
132-
// Error will be emmited later in astconv.
133+
// Error will be emitted later during HIR ty lowering.
133134
self.resolver.fn_parameter_counts.get(&local_sig_id).cloned().unwrap_or_default()
134135
} else {
135136
self.tcx.fn_arg_names(sig_id).len()

compiler/rustc_ast_lowering/src/item.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1429,8 +1429,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
14291429
// Error if `?Trait` bounds in where clauses don't refer directly to type parameters.
14301430
// Note: we used to clone these bounds directly onto the type parameter (and avoid lowering
14311431
// these into hir when we lower thee where clauses), but this makes it quite difficult to
1432-
// keep track of the Span info. Now, `add_implicitly_sized` in `AstConv` checks both param bounds and
1433-
// where clauses for `?Sized`.
1432+
// keep track of the Span info. Now, `<dyn HirTyLowerer>::add_implicit_sized_bound`
1433+
// checks both param bounds and where clauses for `?Sized`.
14341434
for pred in &generics.where_clause.predicates {
14351435
let WherePredicate::BoundPredicate(bound_pred) = pred else {
14361436
continue;

compiler/rustc_hir/src/hir.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,7 @@ pub enum ExprKind<'hir> {
18451845
/// Wraps the expression in a terminating scope.
18461846
/// This makes it semantically equivalent to `{ let _t = expr; _t }`.
18471847
///
1848-
/// This construct only exists to tweak the drop order in HIR lowering.
1848+
/// This construct only exists to tweak the drop order in AST lowering.
18491849
/// An example of that is the desugaring of `for` loops.
18501850
DropTemps(&'hir Expr<'hir>),
18511851
/// A `let $pat = $expr` expression.
@@ -2278,7 +2278,7 @@ pub enum ImplItemKind<'hir> {
22782278
/// Bind a type to an associated type (i.e., `A = Foo`).
22792279
///
22802280
/// Bindings like `A: Debug` are represented as a special type `A =
2281-
/// $::Debug` that is understood by the astconv code.
2281+
/// $::Debug` that is understood by the HIR ty lowering code.
22822282
///
22832283
/// FIXME(alexreg): why have a separate type for the binding case,
22842284
/// wouldn't it be better to make the `ty` field an enum like the

compiler/rustc_hir_analysis/src/bounds.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//! Bounds are restrictions applied to some types after they've been converted into the
2-
//! `ty` form from the HIR.
1+
//! Bounds are restrictions applied to some types after they've been lowered from the HIR to the
2+
//! [`rustc_middle::ty`] form.
33
44
use rustc_hir::LangItem;
55
use rustc_middle::ty::{self, ToPredicate, Ty, TyCtxt};

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
746746

747747
// We may not collect all RPITITs that we see in the HIR for a trait signature
748748
// because an RPITIT was located within a missing item. Like if we have a sig
749-
// returning `-> Missing<impl Sized>`, that gets converted to `-> [type error]`,
749+
// returning `-> Missing<impl Sized>`, that gets converted to `-> {type error}`,
750750
// and when walking through the signature we end up never collecting the def id
751751
// of the `impl Sized`. Insert that here, so we don't ICE later.
752752
for assoc_item in tcx.associated_types_for_impl_traits_in_associated_fn(trait_m.def_id) {

compiler/rustc_hir_analysis/src/check/region.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ impl<'tcx> RegionResolutionVisitor<'tcx> {
760760

761761
fn enter_node_scope_with_dtor(&mut self, id: hir::ItemLocalId) {
762762
// If node was previously marked as a terminating scope during the
763-
// recursive visit of its parent node in the AST, then we need to
763+
// recursive visit of its parent node in the HIR, then we need to
764764
// account for the destruction scope representing the scope of
765765
// the destructors that run immediately after it completes.
766766
if self.terminating_scopes.contains(&id) {

compiler/rustc_hir_analysis/src/check/wfcheck.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<()
271271
}
272272
Some(ty::ImplPolarity::Negative) => {
273273
let ast::ImplPolarity::Negative(span) = impl_.polarity else {
274-
bug!("impl_polarity query disagrees with impl's polarity in AST");
274+
bug!("impl_polarity query disagrees with impl's polarity in HIR");
275275
};
276276
// FIXME(#27579): what amount of WF checking do we need for neg impls?
277277
if let hir::Defaultness::Default { .. } = impl_.defaultness {
@@ -1860,7 +1860,7 @@ fn check_variances_for_type_defn<'tcx>(
18601860
.iter()
18611861
.filter_map(|predicate| match predicate {
18621862
hir::WherePredicate::BoundPredicate(predicate) => {
1863-
match icx.to_ty(predicate.bounded_ty).kind() {
1863+
match icx.lower_ty(predicate.bounded_ty).kind() {
18641864
ty::Param(data) => Some(Parameter(data.index)),
18651865
_ => None,
18661866
}

0 commit comments

Comments
 (0)