Skip to content

Commit 3aa6f3e

Browse files
committed
Use () for inferred_outlives_crate.
1 parent 09f205a commit 3aa6f3e

File tree

2 files changed

+4
-7
lines changed
  • compiler

2 files changed

+4
-7
lines changed

compiler/rustc_middle/src/query/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,7 @@ rustc_queries! {
555555
}
556556

557557
/// Maps from thee `DefId` of a type to its (inferred) outlives.
558-
query inferred_outlives_crate(_: CrateNum)
559-
-> ty::CratePredicatesMap<'tcx> {
558+
query inferred_outlives_crate(_: ()) -> ty::CratePredicatesMap<'tcx> {
560559
storage(ArenaCacheSelector<'tcx>)
561560
desc { "computing the inferred outlives predicates for items in this crate" }
562561
}

compiler/rustc_typeck/src/outlives/mod.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use hir::Node;
22
use rustc_hir as hir;
3-
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
3+
use rustc_hir::def_id::DefId;
44
use rustc_middle::ty::query::Providers;
55
use rustc_middle::ty::subst::GenericArgKind;
66
use rustc_middle::ty::{self, CratePredicatesMap, ToPredicate, TyCtxt};
@@ -23,7 +23,7 @@ fn inferred_outlives_of(tcx: TyCtxt<'_>, item_def_id: DefId) -> &[(ty::Predicate
2323
match tcx.hir().get(id) {
2424
Node::Item(item) => match item.kind {
2525
hir::ItemKind::Struct(..) | hir::ItemKind::Enum(..) | hir::ItemKind::Union(..) => {
26-
let crate_map = tcx.inferred_outlives_crate(LOCAL_CRATE);
26+
let crate_map = tcx.inferred_outlives_crate(());
2727

2828
let predicates = crate_map.predicates.get(&item_def_id).copied().unwrap_or(&[]);
2929

@@ -58,9 +58,7 @@ fn inferred_outlives_of(tcx: TyCtxt<'_>, item_def_id: DefId) -> &[(ty::Predicate
5858
}
5959
}
6060

61-
fn inferred_outlives_crate(tcx: TyCtxt<'_>, crate_num: CrateNum) -> CratePredicatesMap<'_> {
62-
assert_eq!(crate_num, LOCAL_CRATE);
63-
61+
fn inferred_outlives_crate(tcx: TyCtxt<'_>, (): ()) -> CratePredicatesMap<'_> {
6462
// Compute a map from each struct/enum/union S to the **explicit**
6563
// outlives predicates (`T: 'a`, `'a: 'b`) that the user wrote.
6664
// Typically there won't be many of these, except in older code where

0 commit comments

Comments
 (0)