Skip to content

Commit eff958c

Browse files
committed
Auto merge of #120926 - fmease:astconv-no-mo, r=oli-obk
[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. Please consult the following *normative* list of changes here: https://fmease.dev/rustc-dev/astconv-no-mo.html ([2024-03-22 archive link](https://web.archive.org/web/20240322054711/https://fmease.dev/rustc-dev/astconv-no-mo.html)).
2 parents eb80be2 + 5e73a8b commit eff958c

Some content is hidden

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

57 files changed

+875
-830
lines changed

Diff for: compiler/rustc_ast/src/ast.rs

-4
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,6 @@ impl TraitBoundModifiers {
303303
};
304304
}
305305

306-
/// The AST represents all type param bounds as types.
307-
/// `typeck::collect::compute_bounds` matches these against
308-
/// the "special" built-in traits (see `middle::lang_items`) and
309-
/// detects `Copy`, `Send` and `Sync`.
310306
#[derive(Clone, Encodable, Decodable, Debug)]
311307
pub enum GenericBound {
312308
Trait(PolyTraitRef, TraitBoundModifiers),

Diff for: 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 => {}

Diff for: 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()

Diff for: compiler/rustc_ast_lowering/src/item.rs

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

Diff for: compiler/rustc_hir/src/hir.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -428,10 +428,6 @@ pub enum TraitBoundModifier {
428428
MaybeConst,
429429
}
430430

431-
/// The AST represents all type param bounds as types.
432-
/// `typeck::collect::compute_bounds` matches these against
433-
/// the "special" built-in traits (see `middle::lang_items`) and
434-
/// detects `Copy`, `Send` and `Sync`.
435431
#[derive(Clone, Copy, Debug, HashStable_Generic)]
436432
pub enum GenericBound<'hir> {
437433
Trait(PolyTraitRef<'hir>, TraitBoundModifier),
@@ -1860,7 +1856,7 @@ pub enum ExprKind<'hir> {
18601856
/// Wraps the expression in a terminating scope.
18611857
/// This makes it semantically equivalent to `{ let _t = expr; _t }`.
18621858
///
1863-
/// This construct only exists to tweak the drop order in HIR lowering.
1859+
/// This construct only exists to tweak the drop order in AST lowering.
18641860
/// An example of that is the desugaring of `for` loops.
18651861
DropTemps(&'hir Expr<'hir>),
18661862
/// A `let $pat = $expr` expression.
@@ -2293,7 +2289,7 @@ pub enum ImplItemKind<'hir> {
22932289
/// Bind a type to an associated type (i.e., `A = Foo`).
22942290
///
22952291
/// Bindings like `A: Debug` are represented as a special type `A =
2296-
/// $::Debug` that is understood by the astconv code.
2292+
/// $::Debug` that is understood by the HIR ty lowering code.
22972293
///
22982294
/// FIXME(alexreg): why have a separate type for the binding case,
22992295
/// wouldn't it be better to make the `ty` field an enum like the

Diff for: 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};

Diff for: compiler/rustc_hir_analysis/src/check/check.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,8 @@ fn check_opaque_meets_bounds<'tcx>(
382382
Ok(()) => {}
383383
Err(ty_err) => {
384384
// Some types may be left "stranded" if they can't be reached
385-
// from an astconv'd bound but they're mentioned in the HIR. This
386-
// will happen, e.g., when a nested opaque is inside of a non-
385+
// from a lowered rustc_middle bound but they're mentioned in the HIR.
386+
// This will happen, e.g., when a nested opaque is inside of a non-
387387
// existent associated type, like `impl Trait<Missing = impl Trait>`.
388388
// See <tests/ui/impl-trait/stranded-opaque.rs>.
389389
let ty_err = ty_err.to_string(tcx);

Diff for: 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) {

Diff for: 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) {

Diff for: compiler/rustc_hir_analysis/src/check/wfcheck.rs

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

0 commit comments

Comments
 (0)