mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 14:23:45 +00:00
rustc_typeck to rustc_hir_analysis
This commit is contained in:
parent
de0b511daa
commit
1fc86a63f4
64
Cargo.lock
64
Cargo.lock
@ -3394,6 +3394,7 @@ dependencies = [
|
||||
"rustc_errors",
|
||||
"rustc_feature",
|
||||
"rustc_hir",
|
||||
"rustc_hir_analysis",
|
||||
"rustc_hir_pretty",
|
||||
"rustc_interface",
|
||||
"rustc_lint",
|
||||
@ -3407,7 +3408,6 @@ dependencies = [
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"rustc_target",
|
||||
"rustc_typeck",
|
||||
"serde_json",
|
||||
"tracing",
|
||||
"winapi",
|
||||
@ -3512,6 +3512,35 @@ dependencies = [
|
||||
"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]]
|
||||
name = "rustc_hir_pretty"
|
||||
version = "0.0.0"
|
||||
@ -3591,6 +3620,7 @@ dependencies = [
|
||||
"rustc_errors",
|
||||
"rustc_expand",
|
||||
"rustc_hir",
|
||||
"rustc_hir_analysis",
|
||||
"rustc_incremental",
|
||||
"rustc_lint",
|
||||
"rustc_macros",
|
||||
@ -3613,7 +3643,6 @@ dependencies = [
|
||||
"rustc_trait_selection",
|
||||
"rustc_traits",
|
||||
"rustc_ty_utils",
|
||||
"rustc_typeck",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
"winapi",
|
||||
@ -3923,12 +3952,12 @@ dependencies = [
|
||||
"rustc_data_structures",
|
||||
"rustc_errors",
|
||||
"rustc_hir",
|
||||
"rustc_hir_analysis",
|
||||
"rustc_macros",
|
||||
"rustc_middle",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"rustc_trait_selection",
|
||||
"rustc_typeck",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@ -4212,35 +4241,6 @@ dependencies = [
|
||||
"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]]
|
||||
name = "rustc_version"
|
||||
version = "0.4.0"
|
||||
|
@ -552,7 +552,7 @@ impl<'ll> StaticMethods for CodegenCx<'ll, '_> {
|
||||
// `#[used(compiler)]` is explicitly requested. This is to avoid similar breakage
|
||||
// on other targets, in particular MachO targets have *their* static constructor
|
||||
// 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.
|
||||
self.add_compiler_used_global(g);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ use rustc_span::Span;
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
|
||||
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,
|
||||
/// add them to `compiler/rustc_codegen_llvm/src/context.rs`.
|
||||
fn codegen_intrinsic_call(
|
||||
|
@ -30,7 +30,7 @@ rustc_error_codes = { path = "../rustc_error_codes" }
|
||||
rustc_interface = { path = "../rustc_interface" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
rustc_typeck = { path = "../rustc_typeck" }
|
||||
rustc_hir_analysis = { path = "../rustc_hir_analysis" }
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
libc = "0.2"
|
||||
|
@ -502,7 +502,7 @@ fn print_with_analysis(
|
||||
|
||||
ThirTree => {
|
||||
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");
|
||||
for did in tcx.hir().body_owners() {
|
||||
let _ = writeln!(
|
||||
|
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "rustc_typeck"
|
||||
name = "rustc_hir_analysis"
|
||||
version = "0.0.0"
|
||||
edition = "2021"
|
||||
|
@ -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.
|
||||
use crate::hir::def_id::{DefId, LocalDefId};
|
@ -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
|
||||
// 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.
|
||||
let body_owner_def_id =
|
||||
self.tcx.hir().opt_local_def_id(cause.body_id).unwrap_or_else(|| {
|
||||
|
@ -581,7 +581,7 @@ impl<'tcx> TyCtxtInferExt<'tcx> for TyCtxt<'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 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 {
|
||||
|
@ -2,7 +2,7 @@
|
||||
//!
|
||||
//! - **Type inference.** The type inference code can be found in the `infer` module;
|
||||
//! 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].
|
||||
//!
|
||||
|
@ -38,7 +38,7 @@ rustc_mir_build = { path = "../rustc_mir_build" }
|
||||
rustc_mir_transform = { path = "../rustc_mir_transform" }
|
||||
rustc_monomorphize = { path = "../rustc_monomorphize" }
|
||||
rustc_passes = { path = "../rustc_passes" }
|
||||
rustc_typeck = { path = "../rustc_typeck" }
|
||||
rustc_hir_analysis = { path = "../rustc_hir_analysis" }
|
||||
rustc_lint = { path = "../rustc_lint" }
|
||||
rustc_errors = { path = "../rustc_errors" }
|
||||
rustc_plugin_impl = { path = "../rustc_plugin_impl" }
|
||||
|
@ -37,7 +37,6 @@ use rustc_session::{Limit, Session};
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::FileName;
|
||||
use rustc_trait_selection::traits;
|
||||
use rustc_typeck as typeck;
|
||||
|
||||
use std::any::Any;
|
||||
use std::cell::RefCell;
|
||||
@ -736,7 +735,7 @@ pub static DEFAULT_QUERY_PROVIDERS: LazyLock<Providers> = LazyLock::new(|| {
|
||||
rustc_mir_transform::provide(providers);
|
||||
rustc_monomorphize::provide(providers);
|
||||
rustc_privacy::provide(providers);
|
||||
typeck::provide(providers);
|
||||
rustc_hir_analysis::provide(providers);
|
||||
ty::provide(providers);
|
||||
traits::provide(providers);
|
||||
rustc_passes::provide(providers);
|
||||
@ -880,7 +879,7 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
|
||||
});
|
||||
|
||||
// passes are timed inside typeck
|
||||
typeck::check_crate(tcx)?;
|
||||
rustc_hir_analysis::check_crate(tcx)?;
|
||||
|
||||
sess.time("misc_checking_2", || {
|
||||
parallel!(
|
||||
|
@ -38,7 +38,7 @@ pub enum CastTy<'tcx> {
|
||||
}
|
||||
|
||||
/// 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)]
|
||||
pub enum CastKind {
|
||||
CoercionCast,
|
||||
|
@ -574,7 +574,7 @@ pub struct TypeckResults<'tcx> {
|
||||
|
||||
/// Tracks the rvalue scoping rules which defines finer scoping for rvalue expressions
|
||||
/// 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,
|
||||
|
||||
/// Stores the type, expression, span and optional scope span of all types
|
||||
|
@ -3,7 +3,7 @@ use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_hir as hir;
|
||||
|
||||
/// `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)]
|
||||
pub struct RvalueScopes {
|
||||
map: FxHashMap<hir::ItemLocalId, Option<Scope>>,
|
||||
|
@ -315,7 +315,7 @@ impl<'tcx> ClosureSubsts<'tcx> {
|
||||
/// closure.
|
||||
// FIXME(eddyb) this should be unnecessary, as the shallowly resolved
|
||||
// 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> {
|
||||
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
|
||||
/// 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.
|
||||
pub fn to_opt_closure_kind(self) -> Option<ty::ClosureKind> {
|
||||
match self.kind() {
|
||||
|
@ -998,7 +998,7 @@ impl<'tcx> Cx<'tcx> {
|
||||
.temporary_scope(self.region_scope_tree, closure_expr.hir_id.local_id);
|
||||
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.
|
||||
//
|
||||
// That is we see expect to see it start from a captured upvar and not something that is local
|
||||
|
@ -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
|
||||
// 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>]`.
|
||||
//
|
||||
|
@ -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`
|
||||
/// 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>(
|
||||
cx: &MatchCheckCtxt<'p, 'tcx>,
|
||||
scrut_ty: Ty<'tcx>,
|
||||
|
@ -1744,7 +1744,7 @@ impl CheckAttrVisitor<'_> {
|
||||
}
|
||||
}
|
||||
Some(_) => {
|
||||
// This error case is handled in rustc_typeck::collect.
|
||||
// This error case is handled in rustc_hir_analysis::collect.
|
||||
}
|
||||
None => {
|
||||
// Default case (compiler) when arg isn't defined.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user