Skip to content

Commit

Permalink
Use DroplessArena for variance inference
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Oct 20, 2020
1 parent d07ce65 commit 9b453d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_typeck/src/variance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/variance.html
use hir::Node;
use rustc_arena::TypedArena;
use rustc_arena::DroplessArena;
use rustc_hir as hir;
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
use rustc_middle::ty::query::Providers;
Expand Down Expand Up @@ -32,8 +32,8 @@ pub fn provide(providers: &mut Providers) {

fn crate_variances(tcx: TyCtxt<'_>, crate_num: CrateNum) -> CrateVariancesMap<'_> {
assert_eq!(crate_num, LOCAL_CRATE);
let mut arena = TypedArena::default();
let terms_cx = terms::determine_parameters_to_be_inferred(tcx, &mut arena);
let arena = DroplessArena::default();
let terms_cx = terms::determine_parameters_to_be_inferred(tcx, &arena);
let constraints_cx = constraints::add_constraints_from_crate(terms_cx);
solve::solve_constraints(constraints_cx)
}
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_typeck/src/variance/terms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// `InferredIndex` is a newtype'd int representing the index of such
// a variable.

use rustc_arena::TypedArena;
use rustc_arena::DroplessArena;
use rustc_hir as hir;
use rustc_hir::itemlikevisit::ItemLikeVisitor;
use rustc_hir::HirIdMap;
Expand Down Expand Up @@ -47,7 +47,7 @@ impl<'a> fmt::Debug for VarianceTerm<'a> {

pub struct TermsContext<'a, 'tcx> {
pub tcx: TyCtxt<'tcx>,
pub arena: &'a TypedArena<VarianceTerm<'a>>,
pub arena: &'a DroplessArena,

// For marker types, UnsafeCell, and other lang items where
// variance is hardcoded, records the item-id and the hardcoded
Expand All @@ -64,7 +64,7 @@ pub struct TermsContext<'a, 'tcx> {

pub fn determine_parameters_to_be_inferred<'a, 'tcx>(
tcx: TyCtxt<'tcx>,
arena: &'a mut TypedArena<VarianceTerm<'a>>,
arena: &'a DroplessArena,
) -> TermsContext<'a, 'tcx> {
let mut terms_cx = TermsContext {
tcx,
Expand Down

0 comments on commit 9b453d6

Please sign in to comment.