rustc_typeck to rustc_hir_analysis

This commit is contained in:
lcnr 2022-09-26 13:00:29 +02:00
parent de0b511daa
commit 1fc86a63f4
140 changed files with 101 additions and 102 deletions

View File

@ -3394,6 +3394,7 @@ dependencies = [
"rustc_errors", "rustc_errors",
"rustc_feature", "rustc_feature",
"rustc_hir", "rustc_hir",
"rustc_hir_analysis",
"rustc_hir_pretty", "rustc_hir_pretty",
"rustc_interface", "rustc_interface",
"rustc_lint", "rustc_lint",
@ -3407,7 +3408,6 @@ dependencies = [
"rustc_session", "rustc_session",
"rustc_span", "rustc_span",
"rustc_target", "rustc_target",
"rustc_typeck",
"serde_json", "serde_json",
"tracing", "tracing",
"winapi", "winapi",
@ -3512,6 +3512,35 @@ dependencies = [
"tracing", "tracing",
] ]
[[package]]
name = "rustc_hir_analysis"
version = "0.0.0"
dependencies = [
"rustc_arena",
"rustc_ast",
"rustc_attr",
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_graphviz",
"rustc_hir",
"rustc_hir_pretty",
"rustc_index",
"rustc_infer",
"rustc_lint",
"rustc_macros",
"rustc_middle",
"rustc_serialize",
"rustc_session",
"rustc_span",
"rustc_target",
"rustc_trait_selection",
"rustc_ty_utils",
"rustc_type_ir",
"smallvec",
"tracing",
]
[[package]] [[package]]
name = "rustc_hir_pretty" name = "rustc_hir_pretty"
version = "0.0.0" version = "0.0.0"
@ -3591,6 +3620,7 @@ dependencies = [
"rustc_errors", "rustc_errors",
"rustc_expand", "rustc_expand",
"rustc_hir", "rustc_hir",
"rustc_hir_analysis",
"rustc_incremental", "rustc_incremental",
"rustc_lint", "rustc_lint",
"rustc_macros", "rustc_macros",
@ -3613,7 +3643,6 @@ dependencies = [
"rustc_trait_selection", "rustc_trait_selection",
"rustc_traits", "rustc_traits",
"rustc_ty_utils", "rustc_ty_utils",
"rustc_typeck",
"smallvec", "smallvec",
"tracing", "tracing",
"winapi", "winapi",
@ -3923,12 +3952,12 @@ dependencies = [
"rustc_data_structures", "rustc_data_structures",
"rustc_errors", "rustc_errors",
"rustc_hir", "rustc_hir",
"rustc_hir_analysis",
"rustc_macros", "rustc_macros",
"rustc_middle", "rustc_middle",
"rustc_session", "rustc_session",
"rustc_span", "rustc_span",
"rustc_trait_selection", "rustc_trait_selection",
"rustc_typeck",
"tracing", "tracing",
] ]
@ -4212,35 +4241,6 @@ dependencies = [
"smallvec", "smallvec",
] ]
[[package]]
name = "rustc_typeck"
version = "0.0.0"
dependencies = [
"rustc_arena",
"rustc_ast",
"rustc_attr",
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_graphviz",
"rustc_hir",
"rustc_hir_pretty",
"rustc_index",
"rustc_infer",
"rustc_lint",
"rustc_macros",
"rustc_middle",
"rustc_serialize",
"rustc_session",
"rustc_span",
"rustc_target",
"rustc_trait_selection",
"rustc_ty_utils",
"rustc_type_ir",
"smallvec",
"tracing",
]
[[package]] [[package]]
name = "rustc_version" name = "rustc_version"
version = "0.4.0" version = "0.4.0"

View File

@ -552,7 +552,7 @@ impl<'ll> StaticMethods for CodegenCx<'ll, '_> {
// `#[used(compiler)]` is explicitly requested. This is to avoid similar breakage // `#[used(compiler)]` is explicitly requested. This is to avoid similar breakage
// on other targets, in particular MachO targets have *their* static constructor // on other targets, in particular MachO targets have *their* static constructor
// lists broken if `llvm.compiler.used` is emitted rather than llvm.used. However, // lists broken if `llvm.compiler.used` is emitted rather than llvm.used. However,
// that check happens when assigning the `CodegenFnAttrFlags` in `rustc_typeck`, // that check happens when assigning the `CodegenFnAttrFlags` in `rustc_hir_analysis`,
// so we don't need to take care of it here. // so we don't need to take care of it here.
self.add_compiler_used_global(g); self.add_compiler_used_global(g);
} }

View File

@ -5,7 +5,7 @@ use rustc_span::Span;
use rustc_target::abi::call::FnAbi; use rustc_target::abi::call::FnAbi;
pub trait IntrinsicCallMethods<'tcx>: BackendTypes { pub trait IntrinsicCallMethods<'tcx>: BackendTypes {
/// Remember to add all intrinsics here, in `compiler/rustc_typeck/src/check/mod.rs`, /// Remember to add all intrinsics here, in `compiler/rustc_hir_analysis/src/check/mod.rs`,
/// and in `library/core/src/intrinsics.rs`; if you need access to any LLVM intrinsics, /// and in `library/core/src/intrinsics.rs`; if you need access to any LLVM intrinsics,
/// add them to `compiler/rustc_codegen_llvm/src/context.rs`. /// add them to `compiler/rustc_codegen_llvm/src/context.rs`.
fn codegen_intrinsic_call( fn codegen_intrinsic_call(

View File

@ -30,7 +30,7 @@ rustc_error_codes = { path = "../rustc_error_codes" }
rustc_interface = { path = "../rustc_interface" } rustc_interface = { path = "../rustc_interface" }
rustc_ast = { path = "../rustc_ast" } rustc_ast = { path = "../rustc_ast" }
rustc_span = { path = "../rustc_span" } rustc_span = { path = "../rustc_span" }
rustc_typeck = { path = "../rustc_typeck" } rustc_hir_analysis = { path = "../rustc_hir_analysis" }
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]
libc = "0.2" libc = "0.2"

View File

@ -502,7 +502,7 @@ fn print_with_analysis(
ThirTree => { ThirTree => {
let mut out = String::new(); let mut out = String::new();
abort_on_err(rustc_typeck::check_crate(tcx), tcx.sess); abort_on_err(rustc_hir_analysis::check_crate(tcx), tcx.sess);
debug!("pretty printing THIR tree"); debug!("pretty printing THIR tree");
for did in tcx.hir().body_owners() { for did in tcx.hir().body_owners() {
let _ = writeln!( let _ = writeln!(

View File

@ -1,5 +1,5 @@
[package] [package]
name = "rustc_typeck" name = "rustc_hir_analysis"
version = "0.0.0" version = "0.0.0"
edition = "2021" edition = "2021"

View File

@ -1,4 +1,4 @@
// FIXME(@lcnr): Move this module out of `rustc_typeck`. // FIXME(@lcnr): Move this module out of `rustc_hir_analysis`.
// //
// We don't do any drop checking during hir typeck. // We don't do any drop checking during hir typeck.
use crate::hir::def_id::{DefId, LocalDefId}; use crate::hir::def_id::{DefId, LocalDefId};

View File

@ -1862,7 +1862,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
// In some (most?) cases cause.body_id points to actual body, but in some cases // In some (most?) cases cause.body_id points to actual body, but in some cases
// it's an actual definition. According to the comments (e.g. in // it's an actual definition. According to the comments (e.g. in
// librustc_typeck/check/compare_method.rs:compare_predicate_entailment) the latter // rustc_hir_analysis/check/compare_method.rs:compare_predicate_entailment) the latter
// is relied upon by some other code. This might (or might not) need cleanup. // is relied upon by some other code. This might (or might not) need cleanup.
let body_owner_def_id = let body_owner_def_id =
self.tcx.hir().opt_local_def_id(cause.body_id).unwrap_or_else(|| { self.tcx.hir().opt_local_def_id(cause.body_id).unwrap_or_else(|| {

View File

@ -581,7 +581,7 @@ impl<'tcx> TyCtxtInferExt<'tcx> for TyCtxt<'tcx> {
} }
impl<'tcx> InferCtxtBuilder<'tcx> { impl<'tcx> InferCtxtBuilder<'tcx> {
/// Used only by `rustc_typeck` during body type-checking/inference, /// Used only by `rustc_hir_analysis` during body type-checking/inference,
/// will initialize `in_progress_typeck_results` with fresh `TypeckResults`. /// will initialize `in_progress_typeck_results` with fresh `TypeckResults`.
/// Will also change the scope for opaque type defining use checks to the given owner. /// Will also change the scope for opaque type defining use checks to the given owner.
pub fn with_fresh_in_progress_typeck_results(mut self, table_owner: OwnerId) -> Self { pub fn with_fresh_in_progress_typeck_results(mut self, table_owner: OwnerId) -> Self {

View File

@ -2,7 +2,7 @@
//! //!
//! - **Type inference.** The type inference code can be found in the `infer` module; //! - **Type inference.** The type inference code can be found in the `infer` module;
//! this code handles low-level equality and subtyping operations. The //! this code handles low-level equality and subtyping operations. The
//! type check pass in the compiler is found in the `rustc_typeck` crate. //! type check pass in the compiler is found in the `rustc_hir_analysis` crate.
//! //!
//! For more information about how rustc works, see the [rustc dev guide]. //! For more information about how rustc works, see the [rustc dev guide].
//! //!

View File

@ -38,7 +38,7 @@ rustc_mir_build = { path = "../rustc_mir_build" }
rustc_mir_transform = { path = "../rustc_mir_transform" } rustc_mir_transform = { path = "../rustc_mir_transform" }
rustc_monomorphize = { path = "../rustc_monomorphize" } rustc_monomorphize = { path = "../rustc_monomorphize" }
rustc_passes = { path = "../rustc_passes" } rustc_passes = { path = "../rustc_passes" }
rustc_typeck = { path = "../rustc_typeck" } rustc_hir_analysis = { path = "../rustc_hir_analysis" }
rustc_lint = { path = "../rustc_lint" } rustc_lint = { path = "../rustc_lint" }
rustc_errors = { path = "../rustc_errors" } rustc_errors = { path = "../rustc_errors" }
rustc_plugin_impl = { path = "../rustc_plugin_impl" } rustc_plugin_impl = { path = "../rustc_plugin_impl" }

View File

@ -37,7 +37,6 @@ use rustc_session::{Limit, Session};
use rustc_span::symbol::{sym, Symbol}; use rustc_span::symbol::{sym, Symbol};
use rustc_span::FileName; use rustc_span::FileName;
use rustc_trait_selection::traits; use rustc_trait_selection::traits;
use rustc_typeck as typeck;
use std::any::Any; use std::any::Any;
use std::cell::RefCell; use std::cell::RefCell;
@ -736,7 +735,7 @@ pub static DEFAULT_QUERY_PROVIDERS: LazyLock<Providers> = LazyLock::new(|| {
rustc_mir_transform::provide(providers); rustc_mir_transform::provide(providers);
rustc_monomorphize::provide(providers); rustc_monomorphize::provide(providers);
rustc_privacy::provide(providers); rustc_privacy::provide(providers);
typeck::provide(providers); rustc_hir_analysis::provide(providers);
ty::provide(providers); ty::provide(providers);
traits::provide(providers); traits::provide(providers);
rustc_passes::provide(providers); rustc_passes::provide(providers);
@ -880,7 +879,7 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
}); });
// passes are timed inside typeck // passes are timed inside typeck
typeck::check_crate(tcx)?; rustc_hir_analysis::check_crate(tcx)?;
sess.time("misc_checking_2", || { sess.time("misc_checking_2", || {
parallel!( parallel!(

View File

@ -38,7 +38,7 @@ pub enum CastTy<'tcx> {
} }
/// Cast Kind. See [RFC 401](https://rust-lang.github.io/rfcs/0401-coercions.html) /// Cast Kind. See [RFC 401](https://rust-lang.github.io/rfcs/0401-coercions.html)
/// (or librustc_typeck/check/cast.rs). /// (or rustc_hir_analysis/check/cast.rs).
#[derive(Copy, Clone, Debug, TyEncodable, TyDecodable, HashStable)] #[derive(Copy, Clone, Debug, TyEncodable, TyDecodable, HashStable)]
pub enum CastKind { pub enum CastKind {
CoercionCast, CoercionCast,

View File

@ -574,7 +574,7 @@ pub struct TypeckResults<'tcx> {
/// Tracks the rvalue scoping rules which defines finer scoping for rvalue expressions /// Tracks the rvalue scoping rules which defines finer scoping for rvalue expressions
/// by applying extended parameter rules. /// by applying extended parameter rules.
/// Details may be find in `rustc_typeck::check::rvalue_scopes`. /// Details may be find in `rustc_hir_analysis::check::rvalue_scopes`.
pub rvalue_scopes: RvalueScopes, pub rvalue_scopes: RvalueScopes,
/// Stores the type, expression, span and optional scope span of all types /// Stores the type, expression, span and optional scope span of all types

View File

@ -3,7 +3,7 @@ use rustc_data_structures::fx::FxHashMap;
use rustc_hir as hir; use rustc_hir as hir;
/// `RvalueScopes` is a mapping from sub-expressions to _extended_ lifetime as determined by /// `RvalueScopes` is a mapping from sub-expressions to _extended_ lifetime as determined by
/// rules laid out in `rustc_typeck::check::rvalue_scopes`. /// rules laid out in `rustc_hir_analysis::check::rvalue_scopes`.
#[derive(TyEncodable, TyDecodable, Clone, Debug, Default, Eq, PartialEq, HashStable)] #[derive(TyEncodable, TyDecodable, Clone, Debug, Default, Eq, PartialEq, HashStable)]
pub struct RvalueScopes { pub struct RvalueScopes {
map: FxHashMap<hir::ItemLocalId, Option<Scope>>, map: FxHashMap<hir::ItemLocalId, Option<Scope>>,

View File

@ -315,7 +315,7 @@ impl<'tcx> ClosureSubsts<'tcx> {
/// closure. /// closure.
// FIXME(eddyb) this should be unnecessary, as the shallowly resolved // FIXME(eddyb) this should be unnecessary, as the shallowly resolved
// type is known at the time of the creation of `ClosureSubsts`, // type is known at the time of the creation of `ClosureSubsts`,
// see `rustc_typeck::check::closure`. // see `rustc_hir_analysis::check::closure`.
pub fn sig_as_fn_ptr_ty(self) -> Ty<'tcx> { pub fn sig_as_fn_ptr_ty(self) -> Ty<'tcx> {
self.split().closure_sig_as_fn_ptr_ty.expect_ty() self.split().closure_sig_as_fn_ptr_ty.expect_ty()
} }
@ -2121,7 +2121,7 @@ impl<'tcx> Ty<'tcx> {
/// ///
/// Note that during type checking, we use an inference variable /// Note that during type checking, we use an inference variable
/// to represent the closure kind, because it has not yet been /// to represent the closure kind, because it has not yet been
/// inferred. Once upvar inference (in `rustc_typeck/src/check/upvar.rs`) /// inferred. Once upvar inference (in `rustc_hir_analysis/src/check/upvar.rs`)
/// is complete, that type variable will be unified. /// is complete, that type variable will be unified.
pub fn to_opt_closure_kind(self) -> Option<ty::ClosureKind> { pub fn to_opt_closure_kind(self) -> Option<ty::ClosureKind> {
match self.kind() { match self.kind() {

View File

@ -998,7 +998,7 @@ impl<'tcx> Cx<'tcx> {
.temporary_scope(self.region_scope_tree, closure_expr.hir_id.local_id); .temporary_scope(self.region_scope_tree, closure_expr.hir_id.local_id);
let var_ty = place.base_ty; let var_ty = place.base_ty;
// The result of capture analysis in `rustc_typeck/check/upvar.rs`represents a captured path // The result of capture analysis in `rustc_hir_analysis/check/upvar.rs`represents a captured path
// as it's seen for use within the closure and not at the time of closure creation. // as it's seen for use within the closure and not at the time of closure creation.
// //
// That is we see expect to see it start from a captured upvar and not something that is local // That is we see expect to see it start from a captured upvar and not something that is local

View File

@ -86,7 +86,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
// ``` // ```
// //
// the type assigned to `Some(n)` in `unadjusted_pat` would be `Option<i32>` (this is // the type assigned to `Some(n)` in `unadjusted_pat` would be `Option<i32>` (this is
// determined in rustc_typeck::check::match). The adjustments would be // determined in rustc_hir_analysis::check::match). The adjustments would be
// //
// `vec![&&Option<i32>, &Option<i32>]`. // `vec![&&Option<i32>, &Option<i32>]`.
// //

View File

@ -746,7 +746,7 @@ impl<'p, 'tcx> Witness<'p, 'tcx> {
/// Report that a match of a `non_exhaustive` enum marked with `non_exhaustive_omitted_patterns` /// Report that a match of a `non_exhaustive` enum marked with `non_exhaustive_omitted_patterns`
/// is not exhaustive enough. /// is not exhaustive enough.
/// ///
/// NB: The partner lint for structs lives in `compiler/rustc_typeck/src/check/pat.rs`. /// NB: The partner lint for structs lives in `compiler/rustc_hir_analysis/src/check/pat.rs`.
fn lint_non_exhaustive_omitted_patterns<'p, 'tcx>( fn lint_non_exhaustive_omitted_patterns<'p, 'tcx>(
cx: &MatchCheckCtxt<'p, 'tcx>, cx: &MatchCheckCtxt<'p, 'tcx>,
scrut_ty: Ty<'tcx>, scrut_ty: Ty<'tcx>,

View File

@ -1744,7 +1744,7 @@ impl CheckAttrVisitor<'_> {
} }
} }
Some(_) => { Some(_) => {
// This error case is handled in rustc_typeck::collect. // This error case is handled in rustc_hir_analysis::collect.
} }
None => { None => {
// Default case (compiler) when arg isn't defined. // Default case (compiler) when arg isn't defined.

Some files were not shown because too many files have changed in this diff Show More