From 3e1e308054094d7eee84cd293903164b305ec077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=B3n=20Orell=20Valerian=20Liehr?= Date: Sun, 11 Feb 2024 11:09:25 +0100 Subject: [PATCH] Rename module astconv to lowering --- compiler/rustc_hir_analysis/src/collect.rs | 2 +- compiler/rustc_hir_analysis/src/collect/item_bounds.rs | 2 +- compiler/rustc_hir_analysis/src/collect/predicates_of.rs | 2 +- compiler/rustc_hir_analysis/src/collect/type_of.rs | 2 +- compiler/rustc_hir_analysis/src/lib.rs | 6 +++--- .../rustc_hir_analysis/src/{astconv => lowering}/bounds.rs | 6 +++--- .../rustc_hir_analysis/src/{astconv => lowering}/errors.rs | 2 +- .../src/{astconv => lowering}/generics.rs | 2 +- .../rustc_hir_analysis/src/{astconv => lowering}/lint.rs | 0 .../rustc_hir_analysis/src/{astconv => lowering}/mod.rs | 4 ++-- .../src/{astconv => lowering}/object_safety.rs | 2 +- compiler/rustc_hir_typeck/src/closure.rs | 2 +- compiler/rustc_hir_typeck/src/coercion.rs | 2 +- compiler/rustc_hir_typeck/src/expr.rs | 2 +- compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs | 4 ++-- compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs | 2 +- compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs | 2 +- compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs | 2 +- compiler/rustc_hir_typeck/src/lib.rs | 2 +- compiler/rustc_hir_typeck/src/method/confirm.rs | 4 ++-- 20 files changed, 26 insertions(+), 26 deletions(-) rename compiler/rustc_hir_analysis/src/{astconv => lowering}/bounds.rs (99%) rename compiler/rustc_hir_analysis/src/{astconv => lowering}/errors.rs (99%) rename compiler/rustc_hir_analysis/src/{astconv => lowering}/generics.rs (99%) rename compiler/rustc_hir_analysis/src/{astconv => lowering}/lint.rs (100%) rename compiler/rustc_hir_analysis/src/{astconv => lowering}/mod.rs (99%) rename compiler/rustc_hir_analysis/src/{astconv => lowering}/object_safety.rs (99%) diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs index 5b5c18b236d82..66fbcd9ea92d0 100644 --- a/compiler/rustc_hir_analysis/src/collect.rs +++ b/compiler/rustc_hir_analysis/src/collect.rs @@ -39,9 +39,9 @@ use std::cell::Cell; use std::iter; use std::ops::Bound; -use crate::astconv::HirTyLowerer; use crate::check::intrinsic::intrinsic_operation_unsafety; use crate::errors; +use crate::lowering::HirTyLowerer; pub use type_of::test_opaque_hidden_types; mod generics_of; diff --git a/compiler/rustc_hir_analysis/src/collect/item_bounds.rs b/compiler/rustc_hir_analysis/src/collect/item_bounds.rs index 25544428c3b31..e95d729da636f 100644 --- a/compiler/rustc_hir_analysis/src/collect/item_bounds.rs +++ b/compiler/rustc_hir_analysis/src/collect/item_bounds.rs @@ -1,5 +1,5 @@ use super::ItemCtxt; -use crate::astconv::{HirTyLowerer, PredicateFilter}; +use crate::lowering::{HirTyLowerer, PredicateFilter}; use rustc_hir as hir; use rustc_infer::traits::util; use rustc_middle::ty::GenericArgs; diff --git a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs index ef2df6f03ed0b..582fef2b5ff08 100644 --- a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs @@ -1,7 +1,7 @@ -use crate::astconv::{HirTyLowerer, OnlySelfBounds, PredicateFilter}; use crate::bounds::Bounds; use crate::collect::ItemCtxt; use crate::constrained_generic_params as cgp; +use crate::lowering::{HirTyLowerer, OnlySelfBounds, PredicateFilter}; use hir::{HirId, Node}; use rustc_data_structures::fx::FxIndexSet; use rustc_hir as hir; diff --git a/compiler/rustc_hir_analysis/src/collect/type_of.rs b/compiler/rustc_hir_analysis/src/collect/type_of.rs index 48d15295107ef..26403403d7045 100644 --- a/compiler/rustc_hir_analysis/src/collect/type_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/type_of.rs @@ -9,8 +9,8 @@ use rustc_middle::ty::{self, ImplTraitInTraitData, IsSuggestable, Ty, TyCtxt, Ty use rustc_span::symbol::Ident; use rustc_span::{Span, DUMMY_SP}; -use crate::astconv::HirTyLowerer; use crate::errors::TypeofReservedKeywordUsed; +use crate::lowering::HirTyLowerer; use super::bad_placeholder; use super::ItemCtxt; diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs index 0a064843caeee..9961a3291466c 100644 --- a/compiler/rustc_hir_analysis/src/lib.rs +++ b/compiler/rustc_hir_analysis/src/lib.rs @@ -30,7 +30,7 @@ several major phases: The type checker is defined into various submodules which are documented independently: -- astconv: lowers type-system entities from HIR to `rustc_middle::ty` +- lowering: lowers type-system entities from HIR to `rustc_middle::ty` representation. - collect: computes the types of each top-level item and enters them into @@ -82,11 +82,11 @@ extern crate rustc_middle; // These are used by Clippy. pub mod check; -pub mod astconv; pub mod autoderef; mod bounds; mod check_unused; mod coherence; +pub mod lowering; // FIXME: This module shouldn't be public. pub mod collect; mod constrained_generic_params; @@ -108,8 +108,8 @@ use rustc_span::{symbol::sym, Span, DUMMY_SP}; use rustc_target::spec::abi::Abi; use rustc_trait_selection::traits; -use astconv::{HirTyLowerer, OnlySelfBounds}; use bounds::Bounds; +use lowering::{HirTyLowerer, OnlySelfBounds}; use rustc_hir::def::DefKind; rustc_fluent_macro::fluent_messages! { "../messages.ftl" } diff --git a/compiler/rustc_hir_analysis/src/astconv/bounds.rs b/compiler/rustc_hir_analysis/src/lowering/bounds.rs similarity index 99% rename from compiler/rustc_hir_analysis/src/astconv/bounds.rs rename to compiler/rustc_hir_analysis/src/lowering/bounds.rs index 6ecdcfe30cb05..805f2532a7c36 100644 --- a/compiler/rustc_hir_analysis/src/astconv/bounds.rs +++ b/compiler/rustc_hir_analysis/src/lowering/bounds.rs @@ -9,11 +9,11 @@ use rustc_span::{ErrorGuaranteed, Span}; use rustc_trait_selection::traits; use smallvec::SmallVec; -use crate::astconv::{ - HirTyLowerer, LoweredBinding, LoweredBindingKind, OnlySelfBounds, PredicateFilter, -}; use crate::bounds::Bounds; use crate::errors; +use crate::lowering::{ + HirTyLowerer, LoweredBinding, LoweredBindingKind, OnlySelfBounds, PredicateFilter, +}; impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { /// Adds a `Sized` bound to the list of `bounds` unless the HIR bounds contain any of diff --git a/compiler/rustc_hir_analysis/src/astconv/errors.rs b/compiler/rustc_hir_analysis/src/lowering/errors.rs similarity index 99% rename from compiler/rustc_hir_analysis/src/astconv/errors.rs rename to compiler/rustc_hir_analysis/src/lowering/errors.rs index b4d2d24be6491..b0d713bc0c43a 100644 --- a/compiler/rustc_hir_analysis/src/astconv/errors.rs +++ b/compiler/rustc_hir_analysis/src/lowering/errors.rs @@ -1,9 +1,9 @@ -use crate::astconv::{HirTyLowerer, LoweredBindingKind}; use crate::errors::{ self, AssocTypeBindingNotAllowed, ManualImplementation, MissingTypeParams, ParenthesizedFnTraitExpansion, }; use crate::fluent_generated as fluent; +use crate::lowering::{HirTyLowerer, LoweredBindingKind}; use crate::traits::error_reporting::report_object_safety_error; use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet}; use rustc_data_structures::sorted_map::SortedMap; diff --git a/compiler/rustc_hir_analysis/src/astconv/generics.rs b/compiler/rustc_hir_analysis/src/lowering/generics.rs similarity index 99% rename from compiler/rustc_hir_analysis/src/astconv/generics.rs rename to compiler/rustc_hir_analysis/src/lowering/generics.rs index ddbee3a190562..7e7408e8ce1f6 100644 --- a/compiler/rustc_hir_analysis/src/astconv/generics.rs +++ b/compiler/rustc_hir_analysis/src/lowering/generics.rs @@ -1,5 +1,5 @@ use super::IsMethodCall; -use crate::astconv::{ +use crate::lowering::{ errors::prohibit_assoc_ty_binding, ExplicitLateBound, GenericArgCountMismatch, GenericArgCountResult, GenericArgPosition, GenericArgsLowerer, }; diff --git a/compiler/rustc_hir_analysis/src/astconv/lint.rs b/compiler/rustc_hir_analysis/src/lowering/lint.rs similarity index 100% rename from compiler/rustc_hir_analysis/src/astconv/lint.rs rename to compiler/rustc_hir_analysis/src/lowering/lint.rs diff --git a/compiler/rustc_hir_analysis/src/astconv/mod.rs b/compiler/rustc_hir_analysis/src/lowering/mod.rs similarity index 99% rename from compiler/rustc_hir_analysis/src/astconv/mod.rs rename to compiler/rustc_hir_analysis/src/lowering/mod.rs index 5d36d71381c44..60bee551290f4 100644 --- a/compiler/rustc_hir_analysis/src/astconv/mod.rs +++ b/compiler/rustc_hir_analysis/src/lowering/mod.rs @@ -11,11 +11,11 @@ pub mod generics; mod lint; mod object_safety; -use crate::astconv::errors::prohibit_assoc_ty_binding; -use crate::astconv::generics::{check_generic_arg_count, create_args_for_parent_generic_args}; use crate::bounds::Bounds; use crate::collect::HirPlaceholderCollector; use crate::errors::AmbiguousLifetimeBound; +use crate::lowering::errors::prohibit_assoc_ty_binding; +use crate::lowering::generics::{check_generic_arg_count, create_args_for_parent_generic_args}; use crate::middle::resolve_bound_vars as rbv; use crate::require_c_abi_if_c_variadic; use rustc_ast::TraitObjectSyntax; diff --git a/compiler/rustc_hir_analysis/src/astconv/object_safety.rs b/compiler/rustc_hir_analysis/src/lowering/object_safety.rs similarity index 99% rename from compiler/rustc_hir_analysis/src/astconv/object_safety.rs rename to compiler/rustc_hir_analysis/src/lowering/object_safety.rs index 1cccf896d8d6f..e423797e9f77d 100644 --- a/compiler/rustc_hir_analysis/src/astconv/object_safety.rs +++ b/compiler/rustc_hir_analysis/src/lowering/object_safety.rs @@ -1,6 +1,6 @@ -use crate::astconv::{GenericArgCountMismatch, GenericArgCountResult, OnlySelfBounds}; use crate::bounds::Bounds; use crate::errors::TraitObjectDeclaredWithNoTraits; +use crate::lowering::{GenericArgCountMismatch, GenericArgCountResult, OnlySelfBounds}; use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet}; use rustc_errors::{codes::*, struct_span_code_err}; use rustc_hir as hir; diff --git a/compiler/rustc_hir_typeck/src/closure.rs b/compiler/rustc_hir_typeck/src/closure.rs index 9b0e1c6329b4e..7547a51a8a16a 100644 --- a/compiler/rustc_hir_typeck/src/closure.rs +++ b/compiler/rustc_hir_typeck/src/closure.rs @@ -5,7 +5,7 @@ use super::{check_fn, CoroutineTypes, Expectation, FnCtxt}; use rustc_errors::ErrorGuaranteed; use rustc_hir as hir; use rustc_hir::lang_items::LangItem; -use rustc_hir_analysis::astconv::HirTyLowerer; +use rustc_hir_analysis::lowering::HirTyLowerer; use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc_infer::infer::{BoundRegionConversionTime, DefineOpaqueTypes}; use rustc_infer::infer::{InferOk, InferResult}; diff --git a/compiler/rustc_hir_typeck/src/coercion.rs b/compiler/rustc_hir_typeck/src/coercion.rs index 27ce5850835ff..acc3c5feb6cdc 100644 --- a/compiler/rustc_hir_typeck/src/coercion.rs +++ b/compiler/rustc_hir_typeck/src/coercion.rs @@ -43,7 +43,7 @@ use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_hir::intravisit::{self, Visitor}; use rustc_hir::Expr; -use rustc_hir_analysis::astconv::HirTyLowerer; +use rustc_hir_analysis::lowering::HirTyLowerer; use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc_infer::infer::{Coercion, DefineOpaqueTypes, InferOk, InferResult}; use rustc_infer::traits::{Obligation, PredicateObligation}; diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index b18a12b760b14..5b8eb9a569688 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -34,8 +34,8 @@ use rustc_hir::def_id::DefId; use rustc_hir::intravisit::Visitor; use rustc_hir::lang_items::LangItem; use rustc_hir::{ExprKind, HirId, QPath}; -use rustc_hir_analysis::astconv::HirTyLowerer as _; use rustc_hir_analysis::check::ty_kind_suggestion; +use rustc_hir_analysis::lowering::HirTyLowerer as _; use rustc_infer::infer; use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc_infer::infer::DefineOpaqueTypes; diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs index 2bcc659a5d83b..b54c194f23a94 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs @@ -11,10 +11,10 @@ use rustc_hir::def::{CtorOf, DefKind, Res}; use rustc_hir::def_id::DefId; use rustc_hir::lang_items::LangItem; use rustc_hir::{ExprKind, GenericArg, Node, QPath}; -use rustc_hir_analysis::astconv::generics::{ +use rustc_hir_analysis::lowering::generics::{ check_generic_arg_count_for_call, create_args_for_parent_generic_args, }; -use rustc_hir_analysis::astconv::{ +use rustc_hir_analysis::lowering::{ ExplicitLateBound, GenericArgCountMismatch, GenericArgCountResult, GenericArgsLowerer, HirTyLowerer, IsMethodCall, PathSeg, }; diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs index 7b5c5a6088303..c1609615130c9 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs @@ -20,9 +20,9 @@ use rustc_hir::def::{CtorOf, DefKind, Res}; use rustc_hir::def_id::DefId; use rustc_hir::intravisit::Visitor; use rustc_hir::{ExprKind, Node, QPath}; -use rustc_hir_analysis::astconv::HirTyLowerer; use rustc_hir_analysis::check::intrinsicck::InlineAsmCtxt; use rustc_hir_analysis::check::potentially_plural_count; +use rustc_hir_analysis::lowering::HirTyLowerer; use rustc_hir_analysis::structured_errors::StructuredDiagnostic; use rustc_index::IndexVec; use rustc_infer::infer::error_reporting::{FailureCode, ObligationCauseExt}; diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs index 2bcdc641c7e60..4fa8d30fa2c27 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs @@ -9,7 +9,7 @@ use crate::{CoroutineTypes, Diverges, EnclosingBreakables, Inherited}; use rustc_errors::{DiagCtxt, ErrorGuaranteed}; use rustc_hir as hir; use rustc_hir::def_id::{DefId, LocalDefId}; -use rustc_hir_analysis::astconv::HirTyLowerer; +use rustc_hir_analysis::lowering::HirTyLowerer; use rustc_infer::infer; use rustc_infer::infer::error_reporting::TypeErrCtxt; use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs index 42f6d2c3ba9bf..fc0df6b32ee48 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs @@ -21,7 +21,7 @@ use rustc_hir::{ CoroutineDesugaring, CoroutineKind, CoroutineSource, Expr, ExprKind, GenericBound, HirId, Node, Path, QPath, Stmt, StmtKind, TyKind, WherePredicate, }; -use rustc_hir_analysis::astconv::HirTyLowerer; +use rustc_hir_analysis::lowering::HirTyLowerer; use rustc_infer::traits::{self, StatementAsExpression}; use rustc_middle::lint::in_external_macro; use rustc_middle::middle::stability::EvalResult; diff --git a/compiler/rustc_hir_typeck/src/lib.rs b/compiler/rustc_hir_typeck/src/lib.rs index ba058c04cc12c..e3acfed5509ff 100644 --- a/compiler/rustc_hir_typeck/src/lib.rs +++ b/compiler/rustc_hir_typeck/src/lib.rs @@ -58,8 +58,8 @@ use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; use rustc_hir::intravisit::Visitor; use rustc_hir::{HirIdMap, Node}; -use rustc_hir_analysis::astconv::HirTyLowerer; use rustc_hir_analysis::check::check_abi; +use rustc_hir_analysis::lowering::HirTyLowerer; use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc_infer::traits::ObligationInspector; use rustc_middle::query::Providers; diff --git a/compiler/rustc_hir_typeck/src/method/confirm.rs b/compiler/rustc_hir_typeck/src/method/confirm.rs index 35c85b66a2790..a905db2d55449 100644 --- a/compiler/rustc_hir_typeck/src/method/confirm.rs +++ b/compiler/rustc_hir_typeck/src/method/confirm.rs @@ -4,10 +4,10 @@ use crate::{callee, FnCtxt}; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_hir::GenericArg; -use rustc_hir_analysis::astconv::generics::{ +use rustc_hir_analysis::lowering::generics::{ check_generic_arg_count_for_call, create_args_for_parent_generic_args, }; -use rustc_hir_analysis::astconv::{GenericArgsLowerer, HirTyLowerer, IsMethodCall}; +use rustc_hir_analysis::lowering::{GenericArgsLowerer, HirTyLowerer, IsMethodCall}; use rustc_infer::infer::{self, DefineOpaqueTypes, InferOk}; use rustc_middle::traits::{ObligationCauseCode, UnifyReceiverContext}; use rustc_middle::ty::adjustment::{Adjust, Adjustment, PointerCoercion};