Use () for inferred_outlives_crate.
This commit is contained in:
parent
09f205ac57
commit
3aa6f3e8f5
2 changed files with 4 additions and 7 deletions
|
@ -555,8 +555,7 @@ rustc_queries! {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Maps from thee `DefId` of a type to its (inferred) outlives.
|
/// Maps from thee `DefId` of a type to its (inferred) outlives.
|
||||||
query inferred_outlives_crate(_: CrateNum)
|
query inferred_outlives_crate(_: ()) -> ty::CratePredicatesMap<'tcx> {
|
||||||
-> ty::CratePredicatesMap<'tcx> {
|
|
||||||
storage(ArenaCacheSelector<'tcx>)
|
storage(ArenaCacheSelector<'tcx>)
|
||||||
desc { "computing the inferred outlives predicates for items in this crate" }
|
desc { "computing the inferred outlives predicates for items in this crate" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use hir::Node;
|
use hir::Node;
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
use rustc_hir::def_id::DefId;
|
||||||
use rustc_middle::ty::query::Providers;
|
use rustc_middle::ty::query::Providers;
|
||||||
use rustc_middle::ty::subst::GenericArgKind;
|
use rustc_middle::ty::subst::GenericArgKind;
|
||||||
use rustc_middle::ty::{self, CratePredicatesMap, ToPredicate, TyCtxt};
|
use rustc_middle::ty::{self, CratePredicatesMap, ToPredicate, TyCtxt};
|
||||||
|
@ -23,7 +23,7 @@ fn inferred_outlives_of(tcx: TyCtxt<'_>, item_def_id: DefId) -> &[(ty::Predicate
|
||||||
match tcx.hir().get(id) {
|
match tcx.hir().get(id) {
|
||||||
Node::Item(item) => match item.kind {
|
Node::Item(item) => match item.kind {
|
||||||
hir::ItemKind::Struct(..) | hir::ItemKind::Enum(..) | hir::ItemKind::Union(..) => {
|
hir::ItemKind::Struct(..) | hir::ItemKind::Enum(..) | hir::ItemKind::Union(..) => {
|
||||||
let crate_map = tcx.inferred_outlives_crate(LOCAL_CRATE);
|
let crate_map = tcx.inferred_outlives_crate(());
|
||||||
|
|
||||||
let predicates = crate_map.predicates.get(&item_def_id).copied().unwrap_or(&[]);
|
let predicates = crate_map.predicates.get(&item_def_id).copied().unwrap_or(&[]);
|
||||||
|
|
||||||
|
@ -58,9 +58,7 @@ fn inferred_outlives_of(tcx: TyCtxt<'_>, item_def_id: DefId) -> &[(ty::Predicate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn inferred_outlives_crate(tcx: TyCtxt<'_>, crate_num: CrateNum) -> CratePredicatesMap<'_> {
|
fn inferred_outlives_crate(tcx: TyCtxt<'_>, (): ()) -> CratePredicatesMap<'_> {
|
||||||
assert_eq!(crate_num, LOCAL_CRATE);
|
|
||||||
|
|
||||||
// Compute a map from each struct/enum/union S to the **explicit**
|
// Compute a map from each struct/enum/union S to the **explicit**
|
||||||
// outlives predicates (`T: 'a`, `'a: 'b`) that the user wrote.
|
// outlives predicates (`T: 'a`, `'a: 'b`) that the user wrote.
|
||||||
// Typically there won't be many of these, except in older code where
|
// Typically there won't be many of these, except in older code where
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue