Skip to content

Commit 57ee5cf

Browse files
committed
Auto merge of rust-lang#102306 - lcnr:rustc_hir_analysis, r=compiler-errors
rename rustc_typeck to rustc_hir_analysis first part of rust-lang/compiler-team#529 r? `@compiler-errors`
2 parents d9297d2 + 1fc86a6 commit 57ee5cf

File tree

140 files changed

+101
-102
lines changed

Some content is hidden

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

140 files changed

+101
-102
lines changed

Cargo.lock

+32-32
Original file line numberDiff line numberDiff line change
@@ -3394,6 +3394,7 @@ dependencies = [
33943394
"rustc_errors",
33953395
"rustc_feature",
33963396
"rustc_hir",
3397+
"rustc_hir_analysis",
33973398
"rustc_hir_pretty",
33983399
"rustc_interface",
33993400
"rustc_lint",
@@ -3407,7 +3408,6 @@ dependencies = [
34073408
"rustc_session",
34083409
"rustc_span",
34093410
"rustc_target",
3410-
"rustc_typeck",
34113411
"serde_json",
34123412
"tracing",
34133413
"winapi",
@@ -3512,6 +3512,35 @@ dependencies = [
35123512
"tracing",
35133513
]
35143514

3515+
[[package]]
3516+
name = "rustc_hir_analysis"
3517+
version = "0.0.0"
3518+
dependencies = [
3519+
"rustc_arena",
3520+
"rustc_ast",
3521+
"rustc_attr",
3522+
"rustc_data_structures",
3523+
"rustc_errors",
3524+
"rustc_feature",
3525+
"rustc_graphviz",
3526+
"rustc_hir",
3527+
"rustc_hir_pretty",
3528+
"rustc_index",
3529+
"rustc_infer",
3530+
"rustc_lint",
3531+
"rustc_macros",
3532+
"rustc_middle",
3533+
"rustc_serialize",
3534+
"rustc_session",
3535+
"rustc_span",
3536+
"rustc_target",
3537+
"rustc_trait_selection",
3538+
"rustc_ty_utils",
3539+
"rustc_type_ir",
3540+
"smallvec",
3541+
"tracing",
3542+
]
3543+
35153544
[[package]]
35163545
name = "rustc_hir_pretty"
35173546
version = "0.0.0"
@@ -3591,6 +3620,7 @@ dependencies = [
35913620
"rustc_errors",
35923621
"rustc_expand",
35933622
"rustc_hir",
3623+
"rustc_hir_analysis",
35943624
"rustc_incremental",
35953625
"rustc_lint",
35963626
"rustc_macros",
@@ -3613,7 +3643,6 @@ dependencies = [
36133643
"rustc_trait_selection",
36143644
"rustc_traits",
36153645
"rustc_ty_utils",
3616-
"rustc_typeck",
36173646
"smallvec",
36183647
"tracing",
36193648
"winapi",
@@ -3923,12 +3952,12 @@ dependencies = [
39233952
"rustc_data_structures",
39243953
"rustc_errors",
39253954
"rustc_hir",
3955+
"rustc_hir_analysis",
39263956
"rustc_macros",
39273957
"rustc_middle",
39283958
"rustc_session",
39293959
"rustc_span",
39303960
"rustc_trait_selection",
3931-
"rustc_typeck",
39323961
"tracing",
39333962
]
39343963

@@ -4212,35 +4241,6 @@ dependencies = [
42124241
"smallvec",
42134242
]
42144243

4215-
[[package]]
4216-
name = "rustc_typeck"
4217-
version = "0.0.0"
4218-
dependencies = [
4219-
"rustc_arena",
4220-
"rustc_ast",
4221-
"rustc_attr",
4222-
"rustc_data_structures",
4223-
"rustc_errors",
4224-
"rustc_feature",
4225-
"rustc_graphviz",
4226-
"rustc_hir",
4227-
"rustc_hir_pretty",
4228-
"rustc_index",
4229-
"rustc_infer",
4230-
"rustc_lint",
4231-
"rustc_macros",
4232-
"rustc_middle",
4233-
"rustc_serialize",
4234-
"rustc_session",
4235-
"rustc_span",
4236-
"rustc_target",
4237-
"rustc_trait_selection",
4238-
"rustc_ty_utils",
4239-
"rustc_type_ir",
4240-
"smallvec",
4241-
"tracing",
4242-
]
4243-
42444244
[[package]]
42454245
name = "rustc_version"
42464246
version = "0.4.0"

compiler/rustc_codegen_llvm/src/consts.rs

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

compiler/rustc_codegen_ssa/src/traits/intrinsic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_span::Span;
55
use rustc_target::abi::call::FnAbi;
66

77
pub trait IntrinsicCallMethods<'tcx>: BackendTypes {
8-
/// Remember to add all intrinsics here, in `compiler/rustc_typeck/src/check/mod.rs`,
8+
/// Remember to add all intrinsics here, in `compiler/rustc_hir_analysis/src/check/mod.rs`,
99
/// and in `library/core/src/intrinsics.rs`; if you need access to any LLVM intrinsics,
1010
/// add them to `compiler/rustc_codegen_llvm/src/context.rs`.
1111
fn codegen_intrinsic_call(

compiler/rustc_driver/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ rustc_error_codes = { path = "../rustc_error_codes" }
3030
rustc_interface = { path = "../rustc_interface" }
3131
rustc_ast = { path = "../rustc_ast" }
3232
rustc_span = { path = "../rustc_span" }
33-
rustc_typeck = { path = "../rustc_typeck" }
33+
rustc_hir_analysis = { path = "../rustc_hir_analysis" }
3434

3535
[target.'cfg(unix)'.dependencies]
3636
libc = "0.2"

compiler/rustc_driver/src/pretty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ fn print_with_analysis(
502502

503503
ThirTree => {
504504
let mut out = String::new();
505-
abort_on_err(rustc_typeck::check_crate(tcx), tcx.sess);
505+
abort_on_err(rustc_hir_analysis::check_crate(tcx), tcx.sess);
506506
debug!("pretty printing THIR tree");
507507
for did in tcx.hir().body_owners() {
508508
let _ = writeln!(

compiler/rustc_typeck/Cargo.toml renamed to compiler/rustc_hir_analysis/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "rustc_typeck"
2+
name = "rustc_hir_analysis"
33
version = "0.0.0"
44
edition = "2021"
55

compiler/rustc_typeck/src/check/dropck.rs renamed to compiler/rustc_hir_analysis/src/check/dropck.rs

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

compiler/rustc_infer/src/infer/error_reporting/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1862,7 +1862,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
18621862

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

compiler/rustc_infer/src/infer/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ impl<'tcx> TyCtxtInferExt<'tcx> for TyCtxt<'tcx> {
581581
}
582582

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

compiler/rustc_infer/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! - **Type inference.** The type inference code can be found in the `infer` module;
44
//! this code handles low-level equality and subtyping operations. The
5-
//! type check pass in the compiler is found in the `rustc_typeck` crate.
5+
//! type check pass in the compiler is found in the `rustc_hir_analysis` crate.
66
//!
77
//! For more information about how rustc works, see the [rustc dev guide].
88
//!

compiler/rustc_interface/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ rustc_mir_build = { path = "../rustc_mir_build" }
3838
rustc_mir_transform = { path = "../rustc_mir_transform" }
3939
rustc_monomorphize = { path = "../rustc_monomorphize" }
4040
rustc_passes = { path = "../rustc_passes" }
41-
rustc_typeck = { path = "../rustc_typeck" }
41+
rustc_hir_analysis = { path = "../rustc_hir_analysis" }
4242
rustc_lint = { path = "../rustc_lint" }
4343
rustc_errors = { path = "../rustc_errors" }
4444
rustc_plugin_impl = { path = "../rustc_plugin_impl" }

compiler/rustc_interface/src/passes.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ use rustc_session::{Limit, Session};
3737
use rustc_span::symbol::{sym, Symbol};
3838
use rustc_span::FileName;
3939
use rustc_trait_selection::traits;
40-
use rustc_typeck as typeck;
4140

4241
use std::any::Any;
4342
use std::cell::RefCell;
@@ -736,7 +735,7 @@ pub static DEFAULT_QUERY_PROVIDERS: LazyLock<Providers> = LazyLock::new(|| {
736735
rustc_mir_transform::provide(providers);
737736
rustc_monomorphize::provide(providers);
738737
rustc_privacy::provide(providers);
739-
typeck::provide(providers);
738+
rustc_hir_analysis::provide(providers);
740739
ty::provide(providers);
741740
traits::provide(providers);
742741
rustc_passes::provide(providers);
@@ -880,7 +879,7 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
880879
});
881880

882881
// passes are timed inside typeck
883-
typeck::check_crate(tcx)?;
882+
rustc_hir_analysis::check_crate(tcx)?;
884883

885884
sess.time("misc_checking_2", || {
886885
parallel!(

compiler/rustc_middle/src/ty/cast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub enum CastTy<'tcx> {
3838
}
3939

4040
/// Cast Kind. See [RFC 401](https://rust-lang.github.io/rfcs/0401-coercions.html)
41-
/// (or librustc_typeck/check/cast.rs).
41+
/// (or rustc_hir_analysis/check/cast.rs).
4242
#[derive(Copy, Clone, Debug, TyEncodable, TyDecodable, HashStable)]
4343
pub enum CastKind {
4444
CoercionCast,

compiler/rustc_middle/src/ty/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ pub struct TypeckResults<'tcx> {
574574

575575
/// Tracks the rvalue scoping rules which defines finer scoping for rvalue expressions
576576
/// by applying extended parameter rules.
577-
/// Details may be find in `rustc_typeck::check::rvalue_scopes`.
577+
/// Details may be find in `rustc_hir_analysis::check::rvalue_scopes`.
578578
pub rvalue_scopes: RvalueScopes,
579579

580580
/// Stores the type, expression, span and optional scope span of all types

compiler/rustc_middle/src/ty/rvalue_scopes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use rustc_data_structures::fx::FxHashMap;
33
use rustc_hir as hir;
44

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

compiler/rustc_middle/src/ty/sty.rs

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

compiler/rustc_mir_build/src/thir/cx/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ impl<'tcx> Cx<'tcx> {
998998
.temporary_scope(self.region_scope_tree, closure_expr.hir_id.local_id);
999999
let var_ty = place.base_ty;
10001000

1001-
// The result of capture analysis in `rustc_typeck/check/upvar.rs`represents a captured path
1001+
// The result of capture analysis in `rustc_hir_analysis/check/upvar.rs`represents a captured path
10021002
// as it's seen for use within the closure and not at the time of closure creation.
10031003
//
10041004
// That is we see expect to see it start from a captured upvar and not something that is local

compiler/rustc_mir_build/src/thir/pattern/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
8686
// ```
8787
//
8888
// the type assigned to `Some(n)` in `unadjusted_pat` would be `Option<i32>` (this is
89-
// determined in rustc_typeck::check::match). The adjustments would be
89+
// determined in rustc_hir_analysis::check::match). The adjustments would be
9090
//
9191
// `vec![&&Option<i32>, &Option<i32>]`.
9292
//

compiler/rustc_mir_build/src/thir/pattern/usefulness.rs

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

compiler/rustc_passes/src/check_attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1744,7 +1744,7 @@ impl CheckAttrVisitor<'_> {
17441744
}
17451745
}
17461746
Some(_) => {
1747-
// This error case is handled in rustc_typeck::collect.
1747+
// This error case is handled in rustc_hir_analysis::collect.
17481748
}
17491749
None => {
17501750
// Default case (compiler) when arg isn't defined.

compiler/rustc_privacy/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ rustc_middle = { path = "../rustc_middle" }
1414
rustc_session = { path = "../rustc_session" }
1515
rustc_span = { path = "../rustc_span" }
1616
rustc_trait_selection = { path = "../rustc_trait_selection" }
17-
rustc_typeck = { path = "../rustc_typeck" }
17+
rustc_hir_analysis = { path = "../rustc_hir_analysis" }
1818
tracing = "0.1"

compiler/rustc_privacy/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,7 @@ impl<'tcx> Visitor<'tcx> for TypePrivacyVisitor<'tcx> {
12071207
// Types in signatures.
12081208
// FIXME: This is very ineffective. Ideally each HIR type should be converted
12091209
// into a semantic type only once and the result should be cached somehow.
1210-
if self.visit(rustc_typeck::hir_ty_to_ty(self.tcx, hir_ty)).is_break() {
1210+
if self.visit(rustc_hir_analysis::hir_ty_to_ty(self.tcx, hir_ty)).is_break() {
12111211
return;
12121212
}
12131213
}
@@ -1236,7 +1236,7 @@ impl<'tcx> Visitor<'tcx> for TypePrivacyVisitor<'tcx> {
12361236
if self.maybe_typeck_results.is_none() {
12371237
// Avoid calling `hir_trait_to_predicates` in bodies, it will ICE.
12381238
// The traits' privacy in bodies is already checked as a part of trait object types.
1239-
let bounds = rustc_typeck::hir_trait_to_predicates(
1239+
let bounds = rustc_hir_analysis::hir_trait_to_predicates(
12401240
self.tcx,
12411241
trait_ref,
12421242
// NOTE: This isn't really right, but the actual type doesn't matter here. It's

compiler/rustc_resolve/src/check_unused.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// `use` items.
77
//
88
// Unused trait imports can't be checked until the method resolution. We save
9-
// candidates here, and do the actual check in librustc_typeck/check_unused.rs.
9+
// candidates here, and do the actual check in rustc_hir_analysis/check_unused.rs.
1010
//
1111
// Checking for unused imports is split into three steps:
1212
//

compiler/rustc_resolve/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! Paths in macros, imports, expressions, types, patterns are resolved here.
55
//! Label and lifetime names are resolved here as well.
66
//!
7-
//! Type-relative name resolution (methods, fields, associated items) happens in `rustc_typeck`.
7+
//! Type-relative name resolution (methods, fields, associated items) happens in `rustc_hir_analysis`.
88
99
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
1010
#![feature(box_patterns)]

compiler/rustc_ty_utils/src/instance.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ fn resolve_associated_item<'tcx>(
187187
// we know the error would've been caught (e.g. in an upstream crate).
188188
//
189189
// A better approach might be to just introduce a query (returning
190-
// `Result<(), ErrorGuaranteed>`) for the check that `rustc_typeck`
190+
// `Result<(), ErrorGuaranteed>`) for the check that `rustc_hir_analysis`
191191
// performs (i.e. that the definition's type in the `impl` matches
192192
// the declaration in the `trait`), so that we can cheaply check
193193
// here if it failed, instead of approximating it.

src/librustdoc/clean/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use rustc_hir as hir;
1717
use rustc_hir::def::{CtorKind, DefKind, Res};
1818
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
1919
use rustc_hir::PredicateOrigin;
20+
use rustc_hir_analysis::hir_ty_to_ty;
2021
use rustc_infer::infer::region_constraints::{Constraint, RegionConstraintData};
2122
use rustc_middle::middle::resolve_lifetime as rl;
2223
use rustc_middle::ty::fold::TypeFolder;
@@ -26,7 +27,6 @@ use rustc_middle::{bug, span_bug};
2627
use rustc_span::hygiene::{AstPass, MacroKind};
2728
use rustc_span::symbol::{kw, sym, Ident, Symbol};
2829
use rustc_span::{self, ExpnKind};
29-
use rustc_typeck::hir_ty_to_ty;
3030

3131
use std::assert_matches::assert_matches;
3232
use std::collections::hash_map::Entry;
@@ -632,7 +632,7 @@ fn clean_ty_generics<'tcx>(
632632
let mut impl_trait = BTreeMap::<ImplTraitParam, Vec<GenericBound>>::default();
633633

634634
// Bounds in the type_params and lifetimes fields are repeated in the
635-
// predicates field (see rustc_typeck::collect::ty_generics), so remove
635+
// predicates field (see rustc_hir_analysis::collect::ty_generics), so remove
636636
// them.
637637
let stripped_params = gens
638638
.params

0 commit comments

Comments
 (0)