Skip to content

Commit 3b43dcb

Browse files
committed
Replace Rc with Lrc
1 parent 683ad94 commit 3b43dcb

File tree

7 files changed

+17
-16
lines changed

7 files changed

+17
-16
lines changed

src/librustc/middle/const_val.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use graphviz::IntoCow;
1919
use syntax_pos::Span;
2020

2121
use std::borrow::Cow;
22-
use std::rc::Rc;
22+
use rustc_data_structures::sync::Lrc;
2323

2424
pub type EvalResult<'tcx> = Result<&'tcx ty::Const<'tcx>, ConstEvalErr<'tcx>>;
2525

@@ -52,7 +52,7 @@ impl<'tcx> ConstVal<'tcx> {
5252
#[derive(Clone, Debug)]
5353
pub struct ConstEvalErr<'tcx> {
5454
pub span: Span,
55-
pub kind: Rc<ErrKind<'tcx>>,
55+
pub kind: Lrc<ErrKind<'tcx>>,
5656
}
5757

5858
#[derive(Clone, Debug)]

src/librustc/traits/query/dropck_outlives.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::iter::FromIterator;
1515
use traits::query::CanonicalTyGoal;
1616
use ty::{self, Ty, TyCtxt};
1717
use ty::subst::Kind;
18-
use std::rc::Rc;
18+
use rustc_data_structures::sync::Lrc;
1919

2020
impl<'cx, 'gcx, 'tcx> At<'cx, 'gcx, 'tcx> {
2121
/// Given a type `ty` of some value being dropped, computes a set
@@ -182,13 +182,13 @@ impl_stable_hash_for!(struct DropckOutlivesResult<'tcx> {
182182

183183
impl<'gcx: 'tcx, 'tcx> Canonicalize<'gcx, 'tcx> for QueryResult<'tcx, DropckOutlivesResult<'tcx>> {
184184
// we ought to intern this, but I'm too lazy just now
185-
type Canonicalized = Rc<Canonical<'gcx, QueryResult<'gcx, DropckOutlivesResult<'gcx>>>>;
185+
type Canonicalized = Lrc<Canonical<'gcx, QueryResult<'gcx, DropckOutlivesResult<'gcx>>>>;
186186

187187
fn intern(
188188
_gcx: TyCtxt<'_, 'gcx, 'gcx>,
189189
value: Canonical<'gcx, Self::Lifted>,
190190
) -> Self::Canonicalized {
191-
Rc::new(value)
191+
Lrc::new(value)
192192
}
193193
}
194194

src/librustc/traits/query/normalize.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use infer::at::At;
1717
use infer::canonical::{Canonical, Canonicalize, QueryResult};
1818
use middle::const_val::ConstVal;
1919
use mir::interpret::GlobalId;
20-
use std::rc::Rc;
20+
use rustc_data_structures::sync::Lrc;
2121
use traits::{Obligation, ObligationCause, PredicateObligation, Reveal};
2222
use traits::query::CanonicalProjectionGoal;
2323
use traits::project::Normalized;
@@ -259,13 +259,13 @@ impl<'gcx: 'tcx, 'tcx> Canonicalize<'gcx, 'tcx> for ty::ParamEnvAnd<'tcx, ty::Pr
259259

260260
impl<'gcx: 'tcx, 'tcx> Canonicalize<'gcx, 'tcx> for QueryResult<'tcx, NormalizationResult<'tcx>> {
261261
// we ought to intern this, but I'm too lazy just now
262-
type Canonicalized = Rc<Canonical<'gcx, QueryResult<'gcx, NormalizationResult<'gcx>>>>;
262+
type Canonicalized = Lrc<Canonical<'gcx, QueryResult<'gcx, NormalizationResult<'gcx>>>>;
263263

264264
fn intern(
265265
_gcx: TyCtxt<'_, 'gcx, 'gcx>,
266266
value: Canonical<'gcx, Self::Lifted>,
267267
) -> Self::Canonicalized {
268-
Rc::new(value)
268+
Lrc::new(value)
269269
}
270270
}
271271

src/librustc/ty/structural_impls.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use ty::{self, Lift, Ty, TyCtxt};
1818
use ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
1919
use rustc_data_structures::accumulate_vec::AccumulateVec;
2020
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
21+
use rustc_data_structures::sync::Lrc;
2122
use mir::interpret;
2223

2324
use std::rc::Rc;
@@ -465,7 +466,7 @@ impl<'a, 'tcx> Lift<'tcx> for ConstEvalErr<'a> {
465466
tcx.lift(&*self.kind).map(|kind| {
466467
ConstEvalErr {
467468
span: self.span,
468-
kind: Rc::new(kind),
469+
kind: Lrc::new(kind),
469470
}
470471
})
471472
}

src/librustc_mir/interpret/const_eval.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use super::{Place, EvalContext, StackPopCleanup, ValTy, PlaceExtra, Memory};
1414

1515
use std::fmt;
1616
use std::error::Error;
17-
use std::rc::Rc;
17+
use rustc_data_structures::sync::Lrc;
1818

1919
pub fn mk_borrowck_eval_cx<'a, 'mir, 'tcx>(
2020
tcx: TyCtxt<'a, 'tcx, 'tcx>,
@@ -477,7 +477,7 @@ pub fn const_eval_provider<'a, 'tcx>(
477477
// Do match-check before building MIR
478478
if tcx.check_match(def_id).is_err() {
479479
return Err(ConstEvalErr {
480-
kind: Rc::new(CheckMatchError),
480+
kind: Lrc::new(CheckMatchError),
481481
span,
482482
});
483483
}
@@ -489,7 +489,7 @@ pub fn const_eval_provider<'a, 'tcx>(
489489
// Do not continue into miri if typeck errors occurred; it will fail horribly
490490
if tables.tainted_by_errors {
491491
return Err(ConstEvalErr {
492-
kind: Rc::new(TypeckError),
492+
kind: Lrc::new(TypeckError),
493493
span,
494494
});
495495
}

src/librustc_traits/dropck_outlives.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ use rustc::traits::query::dropck_outlives::{DtorckConstraint, DropckOutlivesResu
1616
use rustc::ty::{self, ParamEnvAnd, Ty, TyCtxt};
1717
use rustc::ty::subst::Subst;
1818
use rustc::util::nodemap::FxHashSet;
19-
use std::rc::Rc;
19+
use rustc_data_structures::sync::Lrc;
2020
use syntax::codemap::{Span, DUMMY_SP};
2121
use util;
2222

2323
crate fn dropck_outlives<'tcx>(
2424
tcx: TyCtxt<'_, 'tcx, 'tcx>,
2525
goal: CanonicalTyGoal<'tcx>,
26-
) -> Result<Rc<Canonical<'tcx, QueryResult<'tcx, DropckOutlivesResult<'tcx>>>>, NoSolution> {
26+
) -> Result<Lrc<Canonical<'tcx, QueryResult<'tcx, DropckOutlivesResult<'tcx>>>>, NoSolution> {
2727
debug!("dropck_outlives(goal={:#?})", goal);
2828

2929
tcx.infer_ctxt().enter(|ref infcx| {

src/librustc_traits/normalize_projection_ty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ use rustc::traits::{self, FulfillmentContext, Normalized, ObligationCause,
1414
use rustc::traits::query::{CanonicalProjectionGoal, NoSolution, normalize::NormalizationResult};
1515
use rustc::ty::{ParamEnvAnd, TyCtxt};
1616
use rustc::util::common::CellUsizeExt;
17-
use std::rc::Rc;
17+
use rustc_data_structures::sync::Lrc;
1818
use syntax::ast::DUMMY_NODE_ID;
1919
use syntax_pos::DUMMY_SP;
2020
use util;
2121

2222
crate fn normalize_projection_ty<'tcx>(
2323
tcx: TyCtxt<'_, 'tcx, 'tcx>,
2424
goal: CanonicalProjectionGoal<'tcx>,
25-
) -> Result<Rc<Canonical<'tcx, QueryResult<'tcx, NormalizationResult<'tcx>>>>, NoSolution> {
25+
) -> Result<Lrc<Canonical<'tcx, QueryResult<'tcx, NormalizationResult<'tcx>>>>, NoSolution> {
2626
debug!("normalize_provider(goal={:#?})", goal);
2727

2828
tcx.sess.perf_stats.normalize_projection_ty.increment();

0 commit comments

Comments
 (0)