Skip to content

Commit d82789d

Browse files
committed
wip
1 parent 0cbef48 commit d82789d

File tree

42 files changed

+317
-321
lines changed

Some content is hidden

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

42 files changed

+317
-321
lines changed

compiler/rustc_ast/src/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ pub fn walk_use_tree<'a, V: Visitor<'a>>(visitor: &mut V, use_tree: &'a UseTree,
466466
visitor.visit_path(&use_tree.prefix, id);
467467
match &use_tree.kind {
468468
UseTreeKind::Simple(rename) => {
469-
// The extra IDs are handled during HIR lowering.
469+
// The extra IDs are handled during AST lowering.
470470
if let &Some(rename) = rename {
471471
visitor.visit_ident(rename);
472472
}

compiler/rustc_ast_lowering/src/delegation.rs

Lines changed: 4 additions & 3 deletions
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 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 lowering.
3738
3839
use crate::{ImplTraitPosition, ResolverAstLoweringExt};
3940

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

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,8 +1413,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
14131413
// Error if `?Trait` bounds in where clauses don't refer directly to type parameters.
14141414
// Note: we used to clone these bounds directly onto the type parameter (and avoid lowering
14151415
// these into hir when we lower thee where clauses), but this makes it quite difficult to
1416-
// keep track of the Span info. Now, `add_implicitly_sized` in `AstConv` checks both param bounds and
1417-
// where clauses for `?Sized`.
1416+
// keep track of the Span info. Now, `<dyn HirLowerer>::add_implicitly_sized` checks both
1417+
// param bounds and where clauses for `?Sized`.
14181418
for pred in &generics.where_clause.predicates {
14191419
let WherePredicate::BoundPredicate(bound_pred) = pred else {
14201420
continue;

compiler/rustc_hir/src/hir.rs

Lines changed: 2 additions & 2 deletions
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 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/astconv/bounds.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ use rustc_trait_selection::traits;
1010
use smallvec::SmallVec;
1111

1212
use crate::astconv::{
13-
AstConv, ConvertedBinding, ConvertedBindingKind, OnlySelfBounds, PredicateFilter,
13+
ConvertedBinding, ConvertedBindingKind, HirLowerer, OnlySelfBounds, PredicateFilter,
1414
};
1515
use crate::bounds::Bounds;
1616
use crate::errors;
1717

18-
impl<'tcx> dyn AstConv<'tcx> + '_ {
18+
impl<'tcx> dyn HirLowerer<'tcx> + '_ {
1919
/// Sets `implicitly_sized` to true on `Bounds` if necessary
2020
pub(crate) fn add_implicitly_sized(
2121
&self,
@@ -156,7 +156,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
156156
);
157157
}
158158
hir::GenericBound::Outlives(lifetime) => {
159-
let region = self.ast_region_to_region(lifetime, None);
159+
let region = self.lower_region(lifetime, None);
160160
bounds.push_region_bound(
161161
self.tcx(),
162162
ty::Binder::bind_with_vars(
@@ -234,7 +234,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
234234
/// `trait_ref` here will be `for<'a> T: Iterator`. The `binding` data however is from *inside*
235235
/// the binder (e.g., `&'a u32`) and hence may reference bound regions.
236236
#[instrument(level = "debug", skip(self, bounds, speculative, dup_bindings, path_span))]
237-
pub(super) fn add_predicates_for_ast_type_binding(
237+
pub(super) fn lower_type_bindings_to_predicates(
238238
&self,
239239
hir_ref_id: hir::HirId,
240240
trait_ref: ty::PolyTraitRef<'tcx>,
@@ -274,7 +274,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
274274
ty::AssocKind::Type
275275
};
276276

277-
let candidate = if self.trait_defines_associated_item_named(
277+
let candidate = if self.trait_defines_assoc_item_named(
278278
trait_ref.def_id(),
279279
assoc_kind,
280280
binding.item_name,
@@ -420,7 +420,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
420420
infer_args: false,
421421
};
422422

423-
let args_trait_ref_and_assoc_item = self.create_args_for_associated_item(
423+
let args_trait_ref_and_assoc_item = self.lower_args_for_assoc_item(
424424
path_span,
425425
assoc_item.def_id,
426426
&item_segment,

compiler/rustc_hir_analysis/src/astconv/errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::astconv::{AstConv, ConvertedBindingKind};
1+
use crate::astconv::{ConvertedBindingKind, HirLowerer};
22
use crate::errors::{
33
self, AssocTypeBindingNotAllowed, ManualImplementation, MissingTypeParams,
44
ParenthesizedFnTraitExpansion,
@@ -22,7 +22,7 @@ use rustc_span::symbol::{sym, Ident};
2222
use rustc_span::{Span, Symbol, DUMMY_SP};
2323
use rustc_trait_selection::traits::object_safety_violations_for_assoc_item;
2424

25-
impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
25+
impl<'o, 'tcx> dyn HirLowerer<'tcx> + 'o {
2626
/// On missing type parameters, emit an E0393 error and provide a structured suggestion using
2727
/// the type parameter's name as a placeholder.
2828
pub(crate) fn complain_about_missing_type_params(

compiler/rustc_hir_analysis/src/astconv/generics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::IsMethodCall;
22
use crate::astconv::{
3-
errors::prohibit_assoc_ty_binding, CreateSubstsForGenericArgsCtxt, ExplicitLateBound,
4-
GenericArgCountMismatch, GenericArgCountResult, GenericArgPosition,
3+
errors::prohibit_assoc_ty_binding, ExplicitLateBound, GenericArgCountMismatch,
4+
GenericArgCountResult, GenericArgPosition, GenericArgsLowerer,
55
};
66
use crate::structured_errors::{GenericArgsInfo, StructuredDiagnostic, WrongNumberOfGenericArgs};
77
use rustc_ast::ast::ParamKindOrd;
@@ -177,7 +177,7 @@ pub fn create_args_for_parent_generic_args<'tcx: 'a, 'a>(
177177
has_self: bool,
178178
self_ty: Option<Ty<'tcx>>,
179179
arg_count: &GenericArgCountResult,
180-
ctx: &mut impl CreateSubstsForGenericArgsCtxt<'a, 'tcx>,
180+
ctx: &mut impl GenericArgsLowerer<'a, 'tcx>,
181181
) -> GenericArgsRef<'tcx> {
182182
// Collect the segments of the path; we need to substitute arguments
183183
// for parameters throughout the entire path (wherever there are

compiler/rustc_hir_analysis/src/astconv/lint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ use rustc_lint_defs::{builtin::BARE_TRAIT_OBJECTS, Applicability};
66
use rustc_span::Span;
77
use rustc_trait_selection::traits::error_reporting::suggestions::NextTypeParamName;
88

9-
use super::AstConv;
9+
use super::HirLowerer;
1010

11-
impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
11+
impl<'o, 'tcx> dyn HirLowerer<'tcx> + 'o {
1212
/// Make sure that we are in the condition to suggest the blanket implementation.
1313
pub(super) fn maybe_lint_blanket_trait_impl(
1414
&self,

0 commit comments

Comments
 (0)