Skip to content

Commit 4863b17

Browse files
committed
Move InferVarInfo out of rustc_middle.
It's only used in `rustc_hir_typeck`.
1 parent 6bc8ae5 commit 4863b17

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

compiler/rustc_hir_typeck/src/fallback.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use rustc_span::{DUMMY_SP, Span};
1818
use rustc_trait_selection::traits::{ObligationCause, ObligationCtxt};
1919
use tracing::debug;
2020

21+
use crate::typeck_root_ctxt::InferVarInfo;
2122
use crate::{FnCtxt, errors};
2223

2324
#[derive(Copy, Clone)]
@@ -345,7 +346,7 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
345346
.map(|(_, info)| *info)
346347
.collect();
347348

348-
let found_infer_var_info = ty::InferVarInfo {
349+
let found_infer_var_info = InferVarInfo {
349350
self_in_trait: infer_var_infos.items().any(|info| info.self_in_trait),
350351
output: infer_var_infos.items().any(|info| info.output),
351352
};

compiler/rustc_hir_typeck/src/typeck_root_ctxt.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@ use tracing::{debug, instrument};
1717

1818
use super::callee::DeferredCallResolution;
1919

20+
#[derive(Debug, Default, Copy, Clone)]
21+
pub(crate) struct InferVarInfo {
22+
/// This is true if we identified that this Ty (`?T`) is found in a `?T: Foo`
23+
/// obligation, where:
24+
///
25+
/// * `Foo` is not `Sized`
26+
/// * `(): Foo` may be satisfied
27+
pub self_in_trait: bool,
28+
/// This is true if we identified that this Ty (`?T`) is found in a `<_ as
29+
/// _>::AssocType = ?T`
30+
pub output: bool,
31+
}
32+
2033
/// Data shared between a "typeck root" and its nested bodies,
2134
/// e.g. closures defined within the function. For example:
2235
/// ```ignore (illustrative)
@@ -71,7 +84,7 @@ pub(crate) struct TypeckRootCtxt<'tcx> {
7184
/// fallback. See the `fallback` module for details.
7285
pub(super) diverging_type_vars: RefCell<UnordSet<Ty<'tcx>>>,
7386

74-
pub(super) infer_var_info: RefCell<UnordMap<ty::TyVid, ty::InferVarInfo>>,
87+
pub(super) infer_var_info: RefCell<UnordMap<ty::TyVid, InferVarInfo>>,
7588
}
7689

7790
impl<'tcx> Deref for TypeckRootCtxt<'tcx> {

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,19 +2232,6 @@ impl<'tcx> fmt::Debug for SymbolName<'tcx> {
22322232
}
22332233
}
22342234

2235-
#[derive(Debug, Default, Copy, Clone)]
2236-
pub struct InferVarInfo {
2237-
/// This is true if we identified that this Ty (`?T`) is found in a `?T: Foo`
2238-
/// obligation, where:
2239-
///
2240-
/// * `Foo` is not `Sized`
2241-
/// * `(): Foo` may be satisfied
2242-
pub self_in_trait: bool,
2243-
/// This is true if we identified that this Ty (`?T`) is found in a `<_ as
2244-
/// _>::AssocType = ?T`
2245-
pub output: bool,
2246-
}
2247-
22482235
/// The constituent parts of a type level constant of kind ADT or array.
22492236
#[derive(Copy, Clone, Debug, HashStable)]
22502237
pub struct DestructuredConst<'tcx> {

0 commit comments

Comments
 (0)