Skip to content

Commit 4b53a2c

Browse files
committed
librustc: De-@mut ImportResolution::type_id
1 parent 9253df1 commit 4b53a2c

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/librustc/middle/resolve.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,13 @@ struct ImportResolution {
364364
type_target: RefCell<Option<Target>>,
365365
/// The source node of the `use` directive leading to the type target
366366
/// being non-none
367-
type_id: NodeId,
367+
type_id: Cell<NodeId>,
368368
}
369369

370370
impl ImportResolution {
371371
fn new(id: NodeId, is_public: bool) -> ImportResolution {
372372
ImportResolution {
373-
type_id: id,
373+
type_id: Cell::new(id),
374374
value_id: Cell::new(id),
375375
outstanding_references: Cell::new(0),
376376
value_target: RefCell::new(None),
@@ -389,7 +389,7 @@ impl ImportResolution {
389389

390390
fn id(&self, namespace: Namespace) -> NodeId {
391391
match namespace {
392-
TypeNS => self.type_id,
392+
TypeNS => self.type_id.get(),
393393
ValueNS => self.value_id.get(),
394394
}
395395
}
@@ -1973,7 +1973,7 @@ impl Resolver {
19731973
resolution.outstanding_references.get() + 1);
19741974

19751975
// the source of this name is different now
1976-
resolution.type_id = id;
1976+
resolution.type_id.set(id);
19771977
resolution.value_id.set(id);
19781978
}
19791979
None => {
@@ -2435,7 +2435,7 @@ impl Resolver {
24352435
name_bindings.type_def.get().unwrap().type_def);
24362436
import_resolution.type_target.set(
24372437
Some(Target::new(target_module, name_bindings)));
2438-
import_resolution.type_id = directive.id;
2438+
import_resolution.type_id.set(directive.id);
24392439
used_public = name_bindings.defined_in_public_namespace(TypeNS);
24402440
}
24412441
UnboundResult => { /* Continue. */ }
@@ -2604,7 +2604,7 @@ impl Resolver {
26042604
debug!("(resolving glob import) ... for type target");
26052605
dest_import_resolution.type_target.set(
26062606
Some(Target::new(containing_module, name_bindings)));
2607-
dest_import_resolution.type_id = id;
2607+
dest_import_resolution.type_id.set(id);
26082608
}
26092609
dest_import_resolution.is_public.set(is_public);
26102610
};
@@ -5392,7 +5392,8 @@ impl Resolver {
53925392
&mut found_traits,
53935393
trait_def_id, name);
53945394
self.used_imports.insert(
5395-
import_resolution.type_id);
5395+
import_resolution.type_id
5396+
.get());
53965397
}
53975398
}
53985399
_ => {

0 commit comments

Comments
 (0)