Skip to content

Commit de3d581

Browse files
committed
librustc: De-@mut the typechecking crate context
1 parent 4fe1cb1 commit de3d581

File tree

6 files changed

+28
-28
lines changed

6 files changed

+28
-28
lines changed

src/librustc/middle/typeck/check/method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ impl<'a> LookupContext<'a> {
343343
// If the method being called is associated with a trait, then
344344
// find all the impls of that trait. Each of those are
345345
// candidates.
346-
let trait_map: &mut resolve::TraitMap = &mut self.fcx.ccx.trait_map;
346+
let trait_map: &resolve::TraitMap = &self.fcx.ccx.trait_map;
347347
let opt_applicable_traits = trait_map.find(&self.expr.id);
348348
for applicable_traits in opt_applicable_traits.iter() {
349349
for trait_did in applicable_traits.iter() {

src/librustc/middle/typeck/check/mod.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ pub struct FnCtxt {
251251

252252
inh: @Inherited,
253253

254-
ccx: @mut CrateCtxt,
254+
ccx: @CrateCtxt,
255255
}
256256

257257
impl Inherited {
@@ -272,7 +272,7 @@ impl Inherited {
272272
}
273273

274274
// Used by check_const and check_enum_variants
275-
pub fn blank_fn_ctxt(ccx: @mut CrateCtxt,
275+
pub fn blank_fn_ctxt(ccx: @CrateCtxt,
276276
rty: ty::t,
277277
region_bnd: ast::NodeId)
278278
-> @FnCtxt {
@@ -302,7 +302,7 @@ impl ExprTyProvider for FnCtxt {
302302
}
303303
}
304304

305-
struct CheckItemTypesVisitor { ccx: @mut CrateCtxt }
305+
struct CheckItemTypesVisitor { ccx: @CrateCtxt }
306306

307307
impl Visitor<()> for CheckItemTypesVisitor {
308308
fn visit_item(&mut self, i:@ast::item, _:()) {
@@ -311,12 +311,12 @@ impl Visitor<()> for CheckItemTypesVisitor {
311311
}
312312
}
313313

314-
pub fn check_item_types(ccx: @mut CrateCtxt, crate: &ast::Crate) {
314+
pub fn check_item_types(ccx: @CrateCtxt, crate: &ast::Crate) {
315315
let mut visit = CheckItemTypesVisitor { ccx: ccx };
316316
visit::walk_crate(&mut visit, crate, ());
317317
}
318318

319-
pub fn check_bare_fn(ccx: @mut CrateCtxt,
319+
pub fn check_bare_fn(ccx: @CrateCtxt,
320320
decl: &ast::fn_decl,
321321
body: ast::P<ast::Block>,
322322
id: ast::NodeId,
@@ -407,7 +407,7 @@ impl Visitor<()> for GatherLocalsVisitor {
407407

408408
}
409409

410-
pub fn check_fn(ccx: @mut CrateCtxt,
410+
pub fn check_fn(ccx: @CrateCtxt,
411411
opt_self_info: Option<SelfInfo>,
412412
purity: ast::purity,
413413
fn_sig: &ty::FnSig,
@@ -556,7 +556,7 @@ pub fn check_no_duplicate_fields(tcx: ty::ctxt,
556556
}
557557
}
558558

559-
pub fn check_struct(ccx: @mut CrateCtxt, id: ast::NodeId, span: Span) {
559+
pub fn check_struct(ccx: @CrateCtxt, id: ast::NodeId, span: Span) {
560560
let tcx = ccx.tcx;
561561

562562
// Check that the class is instantiable
@@ -567,7 +567,7 @@ pub fn check_struct(ccx: @mut CrateCtxt, id: ast::NodeId, span: Span) {
567567
}
568568
}
569569

570-
pub fn check_item(ccx: @mut CrateCtxt, it: @ast::item) {
570+
pub fn check_item(ccx: @CrateCtxt, it: @ast::item) {
571571
debug!("check_item(it.id={}, it.ident={})",
572572
it.id,
573573
ty::item_path_str(ccx.tcx, local_def(it.id)));
@@ -670,7 +670,7 @@ pub fn check_item(ccx: @mut CrateCtxt, it: @ast::item) {
670670
}
671671
}
672672

673-
fn check_method_body(ccx: @mut CrateCtxt,
673+
fn check_method_body(ccx: @CrateCtxt,
674674
item_generics: &ty::Generics,
675675
self_bound: Option<@ty::TraitRef>,
676676
method: @ast::method) {
@@ -722,7 +722,7 @@ fn check_method_body(ccx: @mut CrateCtxt,
722722
param_env);
723723
}
724724

725-
fn check_impl_methods_against_trait(ccx: @mut CrateCtxt,
725+
fn check_impl_methods_against_trait(ccx: @CrateCtxt,
726726
impl_span: Span,
727727
impl_generics: &ty::Generics,
728728
ast_trait_ref: &ast::trait_ref,
@@ -1388,7 +1388,7 @@ pub fn check_lit(fcx: @FnCtxt, lit: @ast::lit) -> ty::t {
13881388
}
13891389
}
13901390

1391-
pub fn valid_range_bounds(ccx: @mut CrateCtxt,
1391+
pub fn valid_range_bounds(ccx: @CrateCtxt,
13921392
from: @ast::Expr,
13931393
to: @ast::Expr)
13941394
-> Option<bool> {
@@ -3443,7 +3443,7 @@ pub fn check_block_with_expected(fcx: @FnCtxt,
34433443
fcx.ps.set(prev);
34443444
}
34453445

3446-
pub fn check_const(ccx: @mut CrateCtxt,
3446+
pub fn check_const(ccx: @CrateCtxt,
34473447
sp: Span,
34483448
e: @ast::Expr,
34493449
id: ast::NodeId) {
@@ -3519,15 +3519,15 @@ pub fn check_simd(tcx: ty::ctxt, sp: Span, id: ast::NodeId) {
35193519
}
35203520
}
35213521

3522-
pub fn check_enum_variants(ccx: @mut CrateCtxt,
3522+
pub fn check_enum_variants(ccx: @CrateCtxt,
35233523
sp: Span,
35243524
vs: &[ast::P<ast::variant>],
35253525
id: ast::NodeId) {
35263526

3527-
fn disr_in_range(ccx: @mut CrateCtxt,
3527+
fn disr_in_range(ccx: @CrateCtxt,
35283528
ty: attr::IntType,
35293529
disr: ty::Disr) -> bool {
3530-
fn uint_in_range(ccx: @mut CrateCtxt, ty: ast::uint_ty, disr: ty::Disr) -> bool {
3530+
fn uint_in_range(ccx: @CrateCtxt, ty: ast::uint_ty, disr: ty::Disr) -> bool {
35313531
match ty {
35323532
ast::ty_u8 => disr as u8 as Disr == disr,
35333533
ast::ty_u16 => disr as u16 as Disr == disr,
@@ -3536,7 +3536,7 @@ pub fn check_enum_variants(ccx: @mut CrateCtxt,
35363536
ast::ty_u => uint_in_range(ccx, ccx.tcx.sess.targ_cfg.uint_type, disr)
35373537
}
35383538
}
3539-
fn int_in_range(ccx: @mut CrateCtxt, ty: ast::int_ty, disr: ty::Disr) -> bool {
3539+
fn int_in_range(ccx: @CrateCtxt, ty: ast::int_ty, disr: ty::Disr) -> bool {
35403540
match ty {
35413541
ast::ty_i8 => disr as i8 as Disr == disr,
35423542
ast::ty_i16 => disr as i16 as Disr == disr,
@@ -3551,7 +3551,7 @@ pub fn check_enum_variants(ccx: @mut CrateCtxt,
35513551
}
35523552
}
35533553

3554-
fn do_check(ccx: @mut CrateCtxt,
3554+
fn do_check(ccx: @CrateCtxt,
35553555
vs: &[ast::P<ast::variant>],
35563556
id: ast::NodeId,
35573557
hint: attr::ReprAttr)
@@ -3923,7 +3923,7 @@ pub fn may_break(cx: ty::ctxt, id: ast::NodeId, b: ast::P<ast::Block>) -> bool {
39233923
}}))
39243924
}
39253925

3926-
pub fn check_bounds_are_used(ccx: @mut CrateCtxt,
3926+
pub fn check_bounds_are_used(ccx: @CrateCtxt,
39273927
span: Span,
39283928
tps: &OptVec<ast::TyParam>,
39293929
ty: ty::t) {
@@ -3953,8 +3953,8 @@ pub fn check_bounds_are_used(ccx: @mut CrateCtxt,
39533953
}
39543954
}
39553955

3956-
pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
3957-
fn param(ccx: @mut CrateCtxt, n: uint) -> ty::t {
3956+
pub fn check_intrinsic_type(ccx: @CrateCtxt, it: @ast::foreign_item) {
3957+
fn param(ccx: @CrateCtxt, n: uint) -> ty::t {
39583958
ty::mk_param(ccx.tcx, n, local_def(0))
39593959
}
39603960

src/librustc/middle/typeck/check/vtable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ fn resolve_expr(fcx: @FnCtxt,
728728
visit::walk_expr(&mut fcx, ex, ());
729729
}
730730

731-
pub fn resolve_impl(ccx: @mut CrateCtxt,
731+
pub fn resolve_impl(ccx: @CrateCtxt,
732732
impl_item: @ast::item,
733733
impl_generics: &ty::Generics,
734734
impl_trait_ref: &ty::TraitRef) {

src/librustc/middle/typeck/coherence.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,15 @@ pub fn get_base_type_def_id(inference_context: @mut InferCtxt,
142142
}
143143
}
144144

145-
pub fn CoherenceChecker(crate_context: @mut CrateCtxt) -> CoherenceChecker {
145+
pub fn CoherenceChecker(crate_context: @CrateCtxt) -> CoherenceChecker {
146146
CoherenceChecker {
147147
crate_context: crate_context,
148148
inference_context: new_infer_ctxt(crate_context.tcx),
149149
}
150150
}
151151

152152
pub struct CoherenceChecker {
153-
crate_context: @mut CrateCtxt,
153+
crate_context: @CrateCtxt,
154154
inference_context: @mut InferCtxt,
155155
}
156156

@@ -825,7 +825,7 @@ fn subst_receiver_types_in_method_ty(tcx: ty::ctxt,
825825
)
826826
}
827827

828-
pub fn check_coherence(crate_context: @mut CrateCtxt, crate: &Crate) {
828+
pub fn check_coherence(crate_context: @CrateCtxt, crate: &Crate) {
829829
let coherence_checker = CoherenceChecker(crate_context);
830830
coherence_checker.check_coherence(crate);
831831
}

src/librustc/middle/typeck/collect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ use syntax::opt_vec::OptVec;
5757
use syntax::parse::token::special_idents;
5858

5959
struct CollectItemTypesVisitor {
60-
ccx: @mut CrateCtxt
60+
ccx: @CrateCtxt
6161
}
6262

6363
impl visit::Visitor<()> for CollectItemTypesVisitor {
@@ -71,7 +71,7 @@ impl visit::Visitor<()> for CollectItemTypesVisitor {
7171
}
7272
}
7373

74-
pub fn collect_item_types(ccx: @mut CrateCtxt, crate: &ast::Crate) {
74+
pub fn collect_item_types(ccx: @CrateCtxt, crate: &ast::Crate) {
7575
fn collect_intrinsic_type(ccx: &CrateCtxt,
7676
lang_item: ast::DefId) {
7777
let ty::ty_param_bounds_and_ty { ty: ty, .. } =

src/librustc/middle/typeck/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ pub fn check_crate(tcx: ty::ctxt,
456456
crate: &ast::Crate)
457457
-> (method_map, vtable_map) {
458458
let time_passes = tcx.sess.time_passes();
459-
let ccx = @mut CrateCtxt {
459+
let ccx = @CrateCtxt {
460460
trait_map: trait_map,
461461
method_map: @mut HashMap::new(),
462462
vtable_map: @RefCell::new(HashMap::new()),

0 commit comments

Comments
 (0)