Skip to content

librustc: Change @mut Block to @Block. #11058

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 228 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
228 commits
Select commit Hold shift + click to select a range
c943232
librustc: Change `@mut Block` to `@Block`.
pcwalton Dec 18, 2013
09589aa
librustc: De-`@mut` `FnCtxt`.
pcwalton Dec 18, 2013
fffbe7a
librustc: De-`@mut` the type interner
pcwalton Dec 18, 2013
386300d
librustc: De-`@mut` the `node_type_substs` table
pcwalton Dec 18, 2013
f15f938
librustc: De-`@mut` the type context's `methods` table
pcwalton Dec 18, 2013
214d6bc
librustc: De-`@mut` the `trait_method_def_ids` table.
pcwalton Dec 18, 2013
02f13ad
librustc: De-`@mut` the `trait_methods_cache`
pcwalton Dec 18, 2013
efdbd60
librustc: De-`@mut` the `impl_trait_cache`
pcwalton Dec 18, 2013
3f444dc
librustc: De-`@mut` `trait_refs`
pcwalton Dec 19, 2013
2ead970
librustc: De-`@mut` `trait_defs`
pcwalton Dec 19, 2013
2612d76
librustc: De-`@mut` `intrinsic_defs`
pcwalton Dec 19, 2013
2e46ac6
librustc: De-`@mut` the short names cache
pcwalton Dec 19, 2013
ba2e6c1
librustc: De-`@mut` the `needs_unwind_cleanup_cache`
pcwalton Dec 19, 2013
6a0450c
librustc: De-`@mut` the `tc_cache`
pcwalton Dec 19, 2013
b5218ba
librustc: De-`@mut` `monomorphized` in the crate context
pcwalton Dec 19, 2013
d3f58c5
librustc: De-`@mut` the `monomorphizing` field in `CrateContext`
pcwalton Dec 19, 2013
610096d
librustc: De-`@mut` `CrateContext::item_vals`
pcwalton Dec 19, 2013
df7f137
librustc: De-`@mut` `item_symbols`
pcwalton Dec 19, 2013
0f3e4fe
librustc: Remove unused field `enum_sizes` from the crate context
pcwalton Dec 19, 2013
5dcc516
librustc: Remove unused `discrim_symbols` field from the crate context
pcwalton Dec 19, 2013
13f85cb
librustc: De-`@mut` `CrateContext::vtables`.
pcwalton Dec 19, 2013
0e2041c
librustc: De-`@mut` `CrateContext::const_cstr_cache`.
pcwalton Dec 19, 2013
28943e9
librustc: De-`@mut` `RefCell::const_globals`.
pcwalton Dec 19, 2013
d16cca1
librustc: De-`@mut` `const_values`.
pcwalton Dec 19, 2013
37e3f2f
librustc: De-`@mut` `CrateContext::extern_const_values`
pcwalton Dec 19, 2013
1185fcc
librustc: De-`@mut` the `impl_method_cache`
pcwalton Dec 19, 2013
8c194a0
librustc: De-`@mut` `CrateContext::module_data`
pcwalton Dec 19, 2013
0680520
librustc: De-`@mut` `lltypes`.
pcwalton Dec 19, 2013
db83a95
librustc: De-`@mut` `CrateContext::llsizingtypes`
pcwalton Dec 19, 2013
a1747a6
librustc: De-`@mut` `CrateContext::adt_reprs`
pcwalton Dec 19, 2013
25337a7
librustc: De-`@mut` `CrateContext::type_hashcodes`
pcwalton Dec 19, 2013
b895ba5
librustc: Remove unused `CrateContext::type_short_names`
pcwalton Dec 19, 2013
02bdda2
librustc: De-`@mut` `CrateContext::all_llvm_symbols`
pcwalton Dec 19, 2013
b5aa6eb
librustc: De-`@mut` `CrateContext::non_inlineable_statics`
pcwalton Dec 19, 2013
519db34
librustc: De-`@mut` `CrateContext::tydescs`
pcwalton Dec 19, 2013
1e654f5
librustc: De-`@mut` `CrateContext::externs`
pcwalton Dec 19, 2013
462a791
librustc: De-`@mut` the `external` and `external_srcs` fields of
pcwalton Dec 19, 2013
fc92f92
librustc: De-`@mut` `CrateContext::finished_tydescs`.
pcwalton Dec 19, 2013
6ac286b
librustc: De-`@mut` `CrateDebugContext::created_files`
pcwalton Dec 19, 2013
38be67a
librustc: De-`@mut` `CrateDebugContext::created_types`.
pcwalton Dec 19, 2013
3ed45bb
librustc: De-`@mut` `CrateDebugContext::namespace_map`.
pcwalton Dec 19, 2013
f38561d
librustc: De-`@mut` `CrateDebugContext::composite_types_completed`
pcwalton Dec 19, 2013
e66bcf4
librustc: De-`@mut` `CrateDebugContext::current_debug_location`
pcwalton Dec 19, 2013
d40974a
librustc: De-`mut` `CrateDebugContext`
pcwalton Dec 19, 2013
07dc0f3
libstd: Make a temporary separate `stage0` implementation for `Cell` to
pcwalton Dec 19, 2013
303a394
librustc: De-`@mut` `CrateContext::symbol_hasher`.
pcwalton Dec 19, 2013
ddf3c6d
librustc: Remove unused `TypeNames::find_name` function
pcwalton Dec 19, 2013
d2bcd14
librustc: Remove unused `TypeNames::type_names` table
pcwalton Dec 20, 2013
61768de
librustc: De-`&mut` `TypeNames`
pcwalton Dec 20, 2013
2418cc0
librustc: De-`@mut` the crate context's `do_not_commit_warning_issued`
pcwalton Dec 20, 2013
b941677
librustc: De-`@mut` the crate context
pcwalton Dec 20, 2013
ab0d7b2
librustc: De-`@mut` the `ast_ty_to_ty_cache`.
pcwalton Dec 20, 2013
d803a0f
librustc: De-`@mut` the `enum_var_cache`
pcwalton Dec 20, 2013
3e9bcea
librustc: Remove `ty_param_defs` from the type context
pcwalton Dec 20, 2013
7cf6abc
librustc: De-`@mut` the adjustments table in the type context
pcwalton Dec 20, 2013
84e4503
librustc: De-`@mut` `provided_method_sources` in the type context
pcwalton Dec 20, 2013
7f5e57a
librustc: De-`@mut` `supertraits` in the type context
pcwalton Dec 20, 2013
5b98c66
librustc: De-`@mut` the item variance map in the type context
pcwalton Dec 20, 2013
4dc923f
librustc: De-`@mut` the `normalized_cache` in the type context
pcwalton Dec 20, 2013
7522838
librustc: De-`@mut` `destructor_for_type` in the type context
pcwalton Dec 20, 2013
a1ee381
librustc: De-`@mut` `resolve::Module::kind`
pcwalton Dec 20, 2013
d503fff
librustc: De-`@mut` `resolve::Module::populated`
pcwalton Dec 20, 2013
6db9a8c
librustc: De-`@mut` `resolve::Module::def_id`
pcwalton Dec 20, 2013
01d8380
librustc: De-`@mut` `resolve::Module::glob_count`
pcwalton Dec 20, 2013
ec02f94
librustc: De-`@mut` `resolve::Module::resolved_import_count`
pcwalton Dec 20, 2013
daf31d2
librustc: De-`@mut` `resolve::Module`
pcwalton Dec 20, 2013
a66fcca
librustc: De-`@mut` `destructors` in the type context
pcwalton Dec 20, 2013
c554d23
librustc: De-`@mut` `trait_impls` in the type context
pcwalton Dec 20, 2013
42f7f7f
librustc: De-`@mut` `inherent_impls` in the type context
pcwalton Dec 20, 2013
55a7b2f
librustc: De-`@mut` the `impls` table in the type context
pcwalton Dec 20, 2013
a5db84c
librustc: De-`@mut` the `extern_const_statics` table in the type context
pcwalton Dec 20, 2013
b976226
librustc: De-`@mut` `extern_const_variants` in the type context
pcwalton Dec 20, 2013
2c3f926
librustc: De-`@mut` the type cache in the type context
pcwalton Dec 20, 2013
ea5368c
librustc: De-`@mut` `ty::ctxt_::rcache`
pcwalton Dec 20, 2013
727fa3a
librustc: De-`@mut` `impl_vtables` in the type context
pcwalton Dec 20, 2013
c4661fd
librustc: De-`@mut` `node_types` in the type context
pcwalton Dec 20, 2013
72f9cbe
librustc: De-`@mut` the borrow check's root map
pcwalton Dec 20, 2013
dd745b3
librustc: De-`@mut` the capture map
pcwalton Dec 20, 2013
4fe1cb1
librustc: De-`@mut` the vtable map
pcwalton Dec 20, 2013
de3d581
librustc: De-`@mut` the typechecking crate context
pcwalton Dec 20, 2013
7ffba5c
librustc: De-`@mut` `llupvars` in the translation crate context
pcwalton Dec 20, 2013
984b567
librustc: De-`@mut` the variable counters in the inference context
pcwalton Dec 20, 2013
3840d50
librustc: De-`@mut` the variable bindings in the inference context
pcwalton Dec 20, 2013
9f4cfe2
librustc: De-`@mut` `RegionVarBindings::constraints`
pcwalton Dec 20, 2013
0a0ce8d
librustc: De-`@mut` `RegionVarBindings::skolemization_count`
pcwalton Dec 20, 2013
bdfd0b5
librustc: De-`@mut` `RegionVarBindings::bound_count`
pcwalton Dec 20, 2013
b84f294
librustc: De-`@mut` `glbs` and `lubs` in `RegionVarBindings`
pcwalton Dec 20, 2013
38d5072
librustc: De-`@mut` the undo log in `RegionVarBindings`
pcwalton Dec 20, 2013
1095e63
librustc: De-`@mut` `RegionVarBindings::values`
pcwalton Dec 21, 2013
a39ab74
librustc: De-`@mut` `RegionVarBindings::var_origins`
pcwalton Dec 21, 2013
ff2d16e
librustc: De-`@mut` `RegionVarBindings`
pcwalton Dec 21, 2013
a5f4a40
librustc: De-`@mut` the inference context
pcwalton Dec 21, 2013
82f5a38
librustc: De-`@mut` `llargs` and `lllocals` in the function context
pcwalton Dec 21, 2013
2fb3328
libextra: Stop using `@mut MemWriter` in the EBML module
pcwalton Dec 21, 2013
7b71ca3
librustc: De-`@mut` `break_ln` and `cont_ln` in liveness
pcwalton Dec 21, 2013
01e3168
librustc: De-`@mut` `used_unsafe` in the type context
pcwalton Dec 21, 2013
2de1e36
librustc: De-`@mut` the named region map in the type context
pcwalton Dec 21, 2013
ef32b12
librustc: Remove the unused `stmt_map` from the borrow checker
pcwalton Dec 21, 2013
df373e6
librustc: De-`@mut` `CStore::metas`
pcwalton Dec 21, 2013
978b6bf
librustc: De-`@mut` `CStore::extern_mod_crate_map`
pcwalton Dec 21, 2013
3528f74
librustc: De-`@mut` `CStore::used_crate_sources`
pcwalton Dec 21, 2013
af11840
librustc: De-`@mut` `CStore::used_libraries`
pcwalton Dec 21, 2013
79d97ca
librustc: De-`@mut` `CStore::used_link_args`
pcwalton Dec 21, 2013
43aee50
librustc: De-`@mut` `cstore::CStore`
pcwalton Dec 21, 2013
4173785
librustc: De-`@mut` `lints` in the session
pcwalton Dec 21, 2013
fbb70d9
librustc: De-`@mut` the `reachable` map
pcwalton Dec 21, 2013
2ae76e1
librustc: De-`@mut` the `type_abbrevs` table
pcwalton Dec 21, 2013
2fa456d
librustc: De-`@mut` the borrow check's `loan_map`
pcwalton Dec 21, 2013
eb9eade
librustc: De-`@mut` the `CollectFreevarsVisitor`
pcwalton Dec 21, 2013
c909c34
librustc: De-`@mut` the `freevar_map`
pcwalton Dec 21, 2013
d7392bd
librustc: De-`@mut` `FunctionContext::llenv`
pcwalton Dec 21, 2013
5b0401f
librustc: De-`@mut` `FunctionContext::llretptr`
pcwalton Dec 21, 2013
a07cee2
librustc: De-`@mut` `FunctionContext::alloca_insert_pt`
pcwalton Dec 21, 2013
bd6a223
librustc: De-`@mut` `FunctionContext::llreturn`
pcwalton Dec 21, 2013
cd5168b
librustc: De-`@mut` `FunctionContext::llself`
pcwalton Dec 21, 2013
05e57db
librustc: De-`@mut` `FunctionContext::personality`
pcwalton Dec 21, 2013
7437a56
librustc: De-`@mut` `FunctionContext::entry_bcx`
pcwalton Dec 21, 2013
b80a111
librustc: De-`@mut` `FunctionDebugContextData::scope_map`
pcwalton Dec 21, 2013
a74138e
librustc: De-`@mut` `FunctionDebugContextData::argument_counter`
pcwalton Dec 21, 2013
13e1bf1
librustc: De-`@mut` `FunctionDebugContextData::source_locations_enabled`
pcwalton Dec 21, 2013
558099b
librustc: De-`@mut` the `FunctionDebugContext`
pcwalton Dec 21, 2013
8ae01fc
librustc: De-`@mut` the translation `FunctionContext`
pcwalton Dec 21, 2013
c5f07cf
librustc: De-`@mut` `Inherited::locals`
pcwalton Dec 21, 2013
f73dee1
librustc: De-`@mut` the export map
pcwalton Dec 21, 2013
4e9b8a7
librustc: De-`@mut` `IrMaps::num_live_nodes`
pcwalton Dec 21, 2013
01ee2fb
librustc: De-`@mut` `IrMaps::num_vars`
pcwalton Dec 21, 2013
e5c399a
librustc: De-`@mut` `IrMaps::live_node_map`
pcwalton Dec 21, 2013
30b8f8b
librustc: De-`@mut` `IrMaps::variable_map`
pcwalton Dec 21, 2013
bd08889
librustc: De-`@mut` `IrMaps::capture_info_map`
pcwalton Dec 21, 2013
bef2353
librustc: De-`@mut` `IrMaps::var_kinds`
pcwalton Dec 21, 2013
810177c
librustc: De-`@mut` `IrMaps::lnks`
pcwalton Dec 21, 2013
be67ace
librustc: De-`@mut` `IrMaps`
pcwalton Dec 21, 2013
ea63a18
librustc: De-`@mut` `Rib::bindings`
pcwalton Dec 21, 2013
b5b403a
librustc: De-`@mut` `Module::external_module_children`
pcwalton Dec 21, 2013
bc1ea78
librustc: De-`@mut` the write guard map
pcwalton Dec 21, 2013
c45c9a5
librustc: De-`@mut` `NameBindings::type_def`
pcwalton Dec 21, 2013
35c8fec
librustc: De-`@mut` `NameBindings::value_def`
pcwalton Dec 21, 2013
9988970
librustc: De-`@mut` `NameBindings`
pcwalton Dec 21, 2013
abe2ad0
librustc: De-`@mut` `Module::anonymous_children`
pcwalton Dec 21, 2013
02d31b7
librustc: De-`@mut` the additional library search paths
pcwalton Dec 21, 2013
8ee8d2b
librustc: De-`@mut` arrays of `entry` used in the encoder
pcwalton Dec 21, 2013
992696f
librustc: De-`@mut` `Module::import_resolutions`
pcwalton Dec 21, 2013
473d048
librustc: De-`@mut` several instances of `io::Writer`.
pcwalton Dec 21, 2013
f857398
librustc: De-`@mut` the bindings list in pattern resolution
pcwalton Dec 21, 2013
19ca9e1
librustc: De-`@mut` `Module::children`
pcwalton Dec 21, 2013
3b1a7b5
librustc: Remove the unused `reported` table from the loan checking pass
pcwalton Dec 21, 2013
89a85e4
librustc: De-`@mut` `ScopeInfo::cleanups`
pcwalton Dec 21, 2013
7acaa73
librustc: De-`@mut` `ScopeInfo::cleanup_paths`
pcwalton Dec 21, 2013
8728b09
librustc: De-`@mut` `ScopeInfo::landing_pad`
pcwalton Dec 21, 2013
abbee6d
librustc: De-`@mut` `ScopeInfo`
pcwalton Dec 22, 2013
e9b9c82
librustc: De-`@mut` the various glues in the type descriptor info
pcwalton Dec 22, 2013
0727901
librustc: De-`@mut` the type descriptor info
pcwalton Dec 22, 2013
b9568cd
librustc: De-`@mut` `creader::Env`
pcwalton Dec 22, 2013
f7393d8
librustc: De-`@mut` the method map
pcwalton Dec 22, 2013
d9c87c7
librustc: De-`@mut` the moves map
pcwalton Dec 22, 2013
a5d9762
librustc: De-`@mut` `impl_dups` in method checking
pcwalton Dec 22, 2013
9ff65b5
librustc: De-`@mut` `TestCtxt::path`
pcwalton Dec 22, 2013
d0dfc35
librustc: De-`@mut` `TestCtxt::testfns`
pcwalton Dec 22, 2013
7cb234b
librustc: De-`@mut` the test context
pcwalton Dec 22, 2013
522743c
librustc: De-`@mut` the moved variables set
pcwalton Dec 22, 2013
5c63b1f
librustc: De-`@mut` the entry function and entry type in the session
pcwalton Dec 22, 2013
ccb18f4
librustc: De-`@mut` the `used_mut_nodes` table in the type context
pcwalton Dec 22, 2013
de6eb2b
librustc: De-`@mut` `ImportResolution::outstanding_references`
pcwalton Dec 22, 2013
aa5b422
librustc: De-`@mut` `ImportResolution::is_public`
pcwalton Dec 22, 2013
5fe8411
librustc: De-`@mut` `ImportResolution::value_target`
pcwalton Dec 22, 2013
c10d717
librustc: De-`@mut` `ImportResolution::value_id`
pcwalton Dec 22, 2013
9253df1
librustc: De-`@mut` `ImportResolution::type_target`
pcwalton Dec 22, 2013
4b53a2c
librustc: De-`@mut` `ImportResolution::type_id`
pcwalton Dec 22, 2013
b9f0d9b
librustc: De-`@mut` `ImportResolution`
pcwalton Dec 22, 2013
2551344
librustc: De-`@mut` all remaining uses of `MemWriter`
pcwalton Dec 22, 2013
d5e3272
librustc: De-`@mut` the scope map in the region maps
pcwalton Dec 22, 2013
0c3950d
librustc: De-`@mut` the free region map in the region maps
pcwalton Dec 22, 2013
f759fe1
librustc: De-`@mut` `cleanup_scopes` in the region maps
pcwalton Dec 22, 2013
75c95e0
librustc: De-`@mut` the region maps
pcwalton Dec 22, 2013
df0c13d
librustc: De-`@mut` the encoding stats
pcwalton Dec 22, 2013
5a9c37b
librustc: De-`@mut` the borrow check stat fields
pcwalton Dec 22, 2013
620be92
librustc: De-`@mut` the `cnum_map`
pcwalton Dec 22, 2013
2ba1b0b
librustc: De-`@mut` `populated_external_types` in the type context
pcwalton Dec 22, 2013
211c6d5
librustc: Extract `loan_path` from move data into an accessor
pcwalton Dec 22, 2013
f19a9b9
librustc: Extract `parent` from move data as an accessor
pcwalton Dec 22, 2013
f700cf3
librustc: Extract `first_move` from the move data into an accessor
pcwalton Dec 22, 2013
fcb4781
librustc: Extract `first_child` and `next_sibling` from the borrow check
pcwalton Dec 22, 2013
026364c
librustc: Change `mut_path` into mutators for specific fields in the
pcwalton Dec 22, 2013
12c5c19
librustc: De-`@mut` `MoveData::paths`
pcwalton Dec 22, 2013
1ded423
librustc: Replace the `move` method with an accessor in the borrow check
pcwalton Dec 22, 2013
1b8391c
librustc: De-`@mut` `MoveData::moves`
pcwalton Dec 22, 2013
7d3e253
librustc: De-`@mut` `MoveData::path_map`
pcwalton Dec 22, 2013
4603057
librustc: De-`@mut` `MoveData::path_assignments`
pcwalton Dec 22, 2013
111e167
librustc: De-`@mut` `MoveData::var_assignments`
pcwalton Dec 22, 2013
1b06a95
librustc: De-`@mut` `MoveData::assignee_ids`
pcwalton Dec 22, 2013
d1e23ae
librustc: De-`@mut` `MoveData`
pcwalton Dec 22, 2013
6659ae7
librustc: De-`@mut` `Rib::self_binding`
pcwalton Dec 22, 2013
091bfa9
librustc: De-`@mut` `n_static_tydescs` in the stats
pcwalton Dec 22, 2013
26d1394
librustc: De-`@mut` `n_glues_created` in the stats
pcwalton Dec 22, 2013
75efa07
librustc: De-`@mut` `n_null_glues` in the stats
pcwalton Dec 22, 2013
16828bb
librustc: De-`@mut` `n_real_glues`
pcwalton Dec 22, 2013
38572f4
librustc: De-`@mut` `n_fns` in the stats
pcwalton Dec 22, 2013
8c7804f
librustc: De-`@mut` `n_monos` in the stats
pcwalton Dec 22, 2013
c010d08
librustc: De-`@mut` `n_inlines` in the stats
pcwalton Dec 22, 2013
21e4e41
librustc: De-`@mut` `n_closures` in the stats
pcwalton Dec 22, 2013
97ceac7
librustc: De-`@mut` `n_llvm_insns` in the stats
pcwalton Dec 22, 2013
8c3a552
librustc: Remove the unused `llvm_insn_ctxt` from the stats
pcwalton Dec 22, 2013
e84f79f
librustc: De-`@mut` `llvm_insns` in the stats
pcwalton Dec 22, 2013
9f67069
librustc: De-`@mut` `fn_stats` in the stats
pcwalton Dec 22, 2013
d3fc7b9
librustc: De-`@mut` the translation stats
pcwalton Dec 22, 2013
a483ee8
librustc: De-`@mut` the trait map
pcwalton Dec 22, 2013
89dfd00
librustc: De-`@mut` `next_id` in the type context
pcwalton Dec 22, 2013
1a6c1e5
librustc: De-`@mut` `Liveness::successors`
pcwalton Dec 22, 2013
0afae85
librustc: De-`@mut` `inherent_candidates` and `extension_candidates` in
pcwalton Dec 22, 2013
fc0b466
librustc: De-`@mut` `all_loans` in the borrow checker
pcwalton Dec 22, 2013
4b4ff2c
librustc: De-`@mut` `DynamicFailureHandler::finished`
pcwalton Dec 22, 2013
8c70364
librustc: De-`@mut` the reachability worklist
pcwalton Dec 22, 2013
7f816b7
librustc: De-`@mut` the `idstack` in constant checking
pcwalton Dec 22, 2013
298d0b8
librustc: De-`@mut` `label_ribs` in the resolver
pcwalton Dec 22, 2013
eaf6949
librustc: De-`@mut` the loop scope in liveness
pcwalton Dec 22, 2013
c56bac7
librustc: De-`@mut` `node_id` in the session
pcwalton Dec 22, 2013
d7b1527
librustc: De-`@mut` `building_library` in the session
pcwalton Dec 22, 2013
ff23e12
librustc: De-`@mut` `BindingRscope::anon_bindings`
pcwalton Dec 22, 2013
e4815b6
librustc: De-`@mut` the `users` list in liveness
pcwalton Dec 22, 2013
f62faa8
librustc: De-`@mut` `outputs` in the session
pcwalton Dec 22, 2013
1f76a9b
librustc: De-`@mut` `populated_external_traits` in the type context
pcwalton Dec 22, 2013
ed819c9
librustc: De-`@mut` the crate cache in the crate reader
pcwalton Dec 22, 2013
fecef74
librustc: De-`@mut` the inherent implementations list
pcwalton Dec 23, 2013
4784611
librustc: Fully de-`@mut` `trait_impls` in the type context
pcwalton Dec 23, 2013
c48335e
librustc: De-`@mut` `Module::imports` in the resolver
pcwalton Dec 23, 2013
56b9a20
librustc: De-`@mut` the value and type ribs in the resolver
pcwalton Dec 23, 2013
cc05847
librustc: De-`@mut` the def map.
pcwalton Dec 23, 2013
ad16014
librustc: Fix tidy problem.
pcwalton Dec 24, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 44 additions & 40 deletions src/libextra/ebml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,22 +593,13 @@ pub mod writer {
use std::io::extensions::u64_to_be_bytes;

// ebml writing
pub struct Encoder {
pub struct Encoder<'a> {
// FIXME(#5665): this should take a trait object
writer: @mut MemWriter,
writer: &'a mut MemWriter,
priv size_positions: ~[uint],
}

impl Clone for Encoder {
fn clone(&self) -> Encoder {
Encoder {
writer: self.writer,
size_positions: self.size_positions.clone(),
}
}
}

fn write_sized_vuint(w: @mut MemWriter, n: uint, size: uint) {
fn write_sized_vuint(w: &mut MemWriter, n: uint, size: uint) {
match size {
1u => w.write(&[0x80u8 | (n as u8)]),
2u => w.write(&[0x40u8 | ((n >> 8_u) as u8), n as u8]),
Expand All @@ -620,15 +611,15 @@ pub mod writer {
};
}

fn write_vuint(w: @mut MemWriter, n: uint) {
fn write_vuint(w: &mut MemWriter, n: uint) {
if n < 0x7f_u { write_sized_vuint(w, n, 1u); return; }
if n < 0x4000_u { write_sized_vuint(w, n, 2u); return; }
if n < 0x200000_u { write_sized_vuint(w, n, 3u); return; }
if n < 0x10000000_u { write_sized_vuint(w, n, 4u); return; }
fail!("vint to write too big: {}", n);
}

pub fn Encoder(w: @mut MemWriter) -> Encoder {
pub fn Encoder<'a>(w: &'a mut MemWriter) -> Encoder<'a> {
let size_positions: ~[uint] = ~[];
Encoder {
writer: w,
Expand All @@ -637,7 +628,15 @@ pub mod writer {
}

// FIXME (#2741): Provide a function to write the standard ebml header.
impl Encoder {
impl<'a> Encoder<'a> {
/// XXX(pcwalton): Workaround for badness in trans. DO NOT USE ME.
pub unsafe fn unsafe_clone(&self) -> Encoder<'a> {
Encoder {
writer: cast::transmute_copy(&self.writer),
size_positions: self.size_positions.clone(),
}
}

pub fn start_tag(&mut self, tag_id: uint) {
debug!("Start tag {}", tag_id);

Expand Down Expand Up @@ -739,7 +738,7 @@ pub mod writer {
// Totally lame approach.
static DEBUG: bool = true;

impl Encoder {
impl<'a> Encoder<'a> {
// used internally to emit things like the vector length and so on
fn _emit_tagged_uint(&mut self, t: EbmlEncoderTag, v: uint) {
assert!(v <= 0xFFFF_FFFF_u);
Expand All @@ -755,17 +754,15 @@ pub mod writer {
// try and check failures more quickly.
if DEBUG { self.wr_tagged_str(EsLabel as uint, label) }
}
}

impl Encoder {
pub fn emit_opaque(&mut self, f: |&mut Encoder|) {
self.start_tag(EsOpaque as uint);
f(self);
self.end_tag();
}
}

impl ::serialize::Encoder for Encoder {
impl<'a> ::serialize::Encoder for Encoder<'a> {
fn emit_nil(&mut self) {}

fn emit_uint(&mut self, v: uint) {
Expand Down Expand Up @@ -820,7 +817,7 @@ pub mod writer {
self.wr_tagged_str(EsStr as uint, v)
}

fn emit_enum(&mut self, name: &str, f: |&mut Encoder|) {
fn emit_enum(&mut self, name: &str, f: |&mut Encoder<'a>|) {
self._emit_label(name);
self.start_tag(EsEnum as uint);
f(self);
Expand All @@ -831,98 +828,103 @@ pub mod writer {
_: &str,
v_id: uint,
_: uint,
f: |&mut Encoder|) {
f: |&mut Encoder<'a>|) {
self._emit_tagged_uint(EsEnumVid, v_id);
self.start_tag(EsEnumBody as uint);
f(self);
self.end_tag();
}

fn emit_enum_variant_arg(&mut self, _: uint, f: |&mut Encoder|) {
fn emit_enum_variant_arg(&mut self, _: uint, f: |&mut Encoder<'a>|) {
f(self)
}

fn emit_enum_struct_variant(&mut self,
v_name: &str,
v_id: uint,
cnt: uint,
f: |&mut Encoder|) {
f: |&mut Encoder<'a>|) {
self.emit_enum_variant(v_name, v_id, cnt, f)
}

fn emit_enum_struct_variant_field(&mut self,
_: &str,
idx: uint,
f: |&mut Encoder|) {
f: |&mut Encoder<'a>|) {
self.emit_enum_variant_arg(idx, f)
}

fn emit_struct(&mut self, _: &str, _len: uint, f: |&mut Encoder|) {
fn emit_struct(&mut self,
_: &str,
_len: uint,
f: |&mut Encoder<'a>|) {
f(self)
}

fn emit_struct_field(&mut self,
name: &str,
_: uint,
f: |&mut Encoder|) {
f: |&mut Encoder<'a>|) {
self._emit_label(name);
f(self)
}

fn emit_tuple(&mut self, len: uint, f: |&mut Encoder|) {
fn emit_tuple(&mut self, len: uint, f: |&mut Encoder<'a>|) {
self.emit_seq(len, f)
}
fn emit_tuple_arg(&mut self, idx: uint, f: |&mut Encoder|) {
fn emit_tuple_arg(&mut self, idx: uint, f: |&mut Encoder<'a>|) {
self.emit_seq_elt(idx, f)
}

fn emit_tuple_struct(&mut self,
_: &str,
len: uint,
f: |&mut Encoder|) {
f: |&mut Encoder<'a>|) {
self.emit_seq(len, f)
}
fn emit_tuple_struct_arg(&mut self, idx: uint, f: |&mut Encoder|) {
fn emit_tuple_struct_arg(&mut self,
idx: uint,
f: |&mut Encoder<'a>|) {
self.emit_seq_elt(idx, f)
}

fn emit_option(&mut self, f: |&mut Encoder|) {
fn emit_option(&mut self, f: |&mut Encoder<'a>|) {
self.emit_enum("Option", f);
}
fn emit_option_none(&mut self) {
self.emit_enum_variant("None", 0, 0, |_| ())
}
fn emit_option_some(&mut self, f: |&mut Encoder|) {
fn emit_option_some(&mut self, f: |&mut Encoder<'a>|) {
self.emit_enum_variant("Some", 1, 1, f)
}

fn emit_seq(&mut self, len: uint, f: |&mut Encoder|) {
fn emit_seq(&mut self, len: uint, f: |&mut Encoder<'a>|) {
self.start_tag(EsVec as uint);
self._emit_tagged_uint(EsVecLen, len);
f(self);
self.end_tag();
}

fn emit_seq_elt(&mut self, _idx: uint, f: |&mut Encoder|) {
fn emit_seq_elt(&mut self, _idx: uint, f: |&mut Encoder<'a>|) {
self.start_tag(EsVecElt as uint);
f(self);
self.end_tag();
}

fn emit_map(&mut self, len: uint, f: |&mut Encoder|) {
fn emit_map(&mut self, len: uint, f: |&mut Encoder<'a>|) {
self.start_tag(EsMap as uint);
self._emit_tagged_uint(EsMapLen, len);
f(self);
self.end_tag();
}

fn emit_map_elt_key(&mut self, _idx: uint, f: |&mut Encoder|) {
fn emit_map_elt_key(&mut self, _idx: uint, f: |&mut Encoder<'a>|) {
self.start_tag(EsMapKey as uint);
f(self);
self.end_tag();
}

fn emit_map_elt_val(&mut self, _idx: uint, f: |&mut Encoder|) {
fn emit_map_elt_val(&mut self, _idx: uint, f: |&mut Encoder<'a>|) {
self.start_tag(EsMapVal as uint);
f(self);
self.end_tag();
Expand All @@ -948,9 +950,11 @@ mod tests {
fn test_option_int() {
fn test_v(v: Option<int>) {
debug!("v == {:?}", v);
let wr = @mut MemWriter::new();
let mut ebml_w = writer::Encoder(wr);
v.encode(&mut ebml_w);
let mut wr = MemWriter::new();
{
let mut ebml_w = writer::Encoder(&mut wr);
v.encode(&mut ebml_w);
}
let ebml_doc = reader::Doc(*wr.inner_ref());
let mut deser = reader::Decoder(ebml_doc);
let v1 = serialize::Decodable::decode(&mut deser);
Expand Down
6 changes: 5 additions & 1 deletion src/librustc/back/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,11 @@ impl Archive {

let mut rustpath = filesearch::rust_path();
rustpath.push(self.sess.filesearch.get_target_lib_path());
let path = self.sess.opts.addl_lib_search_paths.iter();
let addl_lib_search_paths = self.sess
.opts
.addl_lib_search_paths
.borrow();
let path = addl_lib_search_paths.get().iter();
for path in path.chain(rustpath.iter()) {
debug!("looking for {} inside {}", name, path.display());
let test = path.join(oslibname.as_slice());
Expand Down
52 changes: 33 additions & 19 deletions src/librustc/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,9 @@ pub mod write {
// Emit the bytecode if we're either saving our temporaries or
// emitting an rlib. Whenever an rlib is create, the bytecode is
// inserted into the archive in order to allow LTO against it.
let outputs = sess.outputs.borrow();
if sess.opts.save_temps ||
sess.outputs.iter().any(|&o| o == session::OutputRlib) {
outputs.get().iter().any(|&o| o == session::OutputRlib) {
output.with_extension("bc").with_c_str(|buf| {
llvm::LLVMWriteBitcodeToFile(llmod, buf);
})
Expand Down Expand Up @@ -520,15 +521,20 @@ pub fn symbol_hash(tcx: ty::ctxt,
hash.to_managed()
}

pub fn get_symbol_hash(ccx: &mut CrateContext, t: ty::t) -> @str {
match ccx.type_hashcodes.find(&t) {
Some(&h) => h,
None => {
let hash = symbol_hash(ccx.tcx, &mut ccx.symbol_hasher, t, &ccx.link_meta);
ccx.type_hashcodes.insert(t, hash);
hash
}
pub fn get_symbol_hash(ccx: &CrateContext, t: ty::t) -> @str {
{
let type_hashcodes = ccx.type_hashcodes.borrow();
match type_hashcodes.get().find(&t) {
Some(&h) => return h,
None => {}
}
}

let mut type_hashcodes = ccx.type_hashcodes.borrow_mut();
let mut symbol_hasher = ccx.symbol_hasher.borrow_mut();
let hash = symbol_hash(ccx.tcx, symbol_hasher.get(), t, &ccx.link_meta);
type_hashcodes.get().insert(t, hash);
hash
}


Expand Down Expand Up @@ -657,7 +663,7 @@ pub fn exported_name(sess: Session,
mangle(sess, path, Some(hash), Some(vers.as_slice()))
}

pub fn mangle_exported_name(ccx: &mut CrateContext,
pub fn mangle_exported_name(ccx: &CrateContext,
path: path,
t: ty::t) -> ~str {
let hash = get_symbol_hash(ccx, t);
Expand All @@ -666,7 +672,7 @@ pub fn mangle_exported_name(ccx: &mut CrateContext,
ccx.link_meta.pkgid.version_or_default());
}

pub fn mangle_internal_name_by_type_only(ccx: &mut CrateContext,
pub fn mangle_internal_name_by_type_only(ccx: &CrateContext,
t: ty::t,
name: &str) -> ~str {
let s = ppaux::ty_to_short_str(ccx.tcx, t);
Expand All @@ -678,7 +684,7 @@ pub fn mangle_internal_name_by_type_only(ccx: &mut CrateContext,
None);
}

pub fn mangle_internal_name_by_type_and_seq(ccx: &mut CrateContext,
pub fn mangle_internal_name_by_type_and_seq(ccx: &CrateContext,
t: ty::t,
name: &str) -> ~str {
let s = ppaux::ty_to_str(ccx.tcx, t);
Expand All @@ -690,15 +696,15 @@ pub fn mangle_internal_name_by_type_and_seq(ccx: &mut CrateContext,
None);
}

pub fn mangle_internal_name_by_path_and_seq(ccx: &mut CrateContext,
pub fn mangle_internal_name_by_path_and_seq(ccx: &CrateContext,
mut path: path,
flav: &str) -> ~str {
let (_, name) = gensym_name(flav);
path.push(name);
mangle(ccx.sess, path, None, None)
}

pub fn mangle_internal_name_by_path(ccx: &mut CrateContext, path: path) -> ~str {
pub fn mangle_internal_name_by_path(ccx: &CrateContext, path: path) -> ~str {
mangle(ccx.sess, path, None, None)
}

Expand Down Expand Up @@ -740,7 +746,8 @@ pub fn link_binary(sess: Session,
out_filename: &Path,
lm: &LinkMeta) -> ~[Path] {
let mut out_filenames = ~[];
for &output in sess.outputs.iter() {
let outputs = sess.outputs.borrow();
for &output in outputs.get().iter() {
let out_file = link_binary_output(sess, trans, output, obj_filename,
out_filename, lm);
out_filenames.push(out_file);
Expand Down Expand Up @@ -848,7 +855,9 @@ fn link_rlib(sess: Session,
out_filename: &Path) -> Archive {
let mut a = Archive::create(sess, out_filename, obj_filename);

for &(ref l, kind) in sess.cstore.get_used_libraries().iter() {
let used_libraries = sess.cstore.get_used_libraries();
let used_libraries = used_libraries.borrow();
for &(ref l, kind) in used_libraries.get().iter() {
match kind {
cstore::NativeStatic => {
a.add_native_library(l.as_slice());
Expand Down Expand Up @@ -1082,7 +1091,9 @@ fn link_args(sess: Session,
// Finally add all the linker arguments provided on the command line along
// with any #[link_args] attributes found inside the crate
args.push_all(sess.opts.linker_args);
for arg in sess.cstore.get_used_link_args().iter() {
let used_link_args = sess.cstore.get_used_link_args();
let used_link_args = used_link_args.borrow();
for arg in used_link_args.get().iter() {
args.push(arg.clone());
}
return args;
Expand All @@ -1100,7 +1111,8 @@ fn link_args(sess: Session,
// in the current crate. Upstream crates with native library dependencies
// may have their native library pulled in above.
fn add_local_native_libraries(args: &mut ~[~str], sess: Session) {
for path in sess.opts.addl_lib_search_paths.iter() {
let addl_lib_search_paths = sess.opts.addl_lib_search_paths.borrow();
for path in addl_lib_search_paths.get().iter() {
// FIXME (#9639): This needs to handle non-utf8 paths
args.push("-L" + path.as_str().unwrap().to_owned());
}
Expand All @@ -1111,7 +1123,9 @@ fn add_local_native_libraries(args: &mut ~[~str], sess: Session) {
args.push("-L" + path.as_str().unwrap().to_owned());
}

for &(ref l, kind) in sess.cstore.get_used_libraries().iter() {
let used_libraries = sess.cstore.get_used_libraries();
let used_libraries = used_libraries.borrow();
for &(ref l, kind) in used_libraries.get().iter() {
match kind {
cstore::NativeUnknown | cstore::NativeStatic => {
args.push("-l" + *l);
Expand Down
3 changes: 2 additions & 1 deletion src/librustc/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ use std::libc;
pub fn run(sess: session::Session, llmod: ModuleRef,
tm: TargetMachineRef, reachable: &[~str]) {
// Make sure we actually can run LTO
for output in sess.outputs.iter() {
let outputs = sess.outputs.borrow();
for output in outputs.get().iter() {
match *output {
session::OutputExecutable | session::OutputStaticlib => {}
_ => {
Expand Down
Loading