Skip to content

Commit 75f82f0

Browse files
committed
---
yaml --- r: 42363 b: refs/heads/master c: fae8fc9 h: refs/heads/master i: 42361: 568f8b0 42359: 41d59a8 v: v3
1 parent 998bed4 commit 75f82f0

File tree

7 files changed

+114
-166
lines changed

7 files changed

+114
-166
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 2bc9655bc1a5486a2fa4cbcd7543fe094cfc4616
2+
refs/heads/master: fae8fc94dc893c7a08a49941da3568a2ae673a47
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
55
refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650

trunk/src/librustc/driver/driver.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -521,9 +521,6 @@ pub fn build_session_options(+binary: ~str,
521521
} else {
522522
session::unknown_crate
523523
};
524-
let static = opt_present(matches, ~"static");
525-
let gc = opt_present(matches, ~"gc");
526-
527524
let parse_only = opt_present(matches, ~"parse-only");
528525
let no_trans = opt_present(matches, ~"no-trans");
529526
@@ -570,7 +567,6 @@ pub fn build_session_options(+binary: ~str,
570567
}
571568
}
572569
573-
let jit = opt_present(matches, ~"jit");
574570
let output_type =
575571
if parse_only || no_trans {
576572
link::output_type_none
@@ -584,8 +580,6 @@ pub fn build_session_options(+binary: ~str,
584580
} else if opt_present(matches, ~"emit-llvm") {
585581
link::output_type_bitcode
586582
} else { link::output_type_exe };
587-
let extra_debuginfo = opt_present(matches, ~"xg");
588-
let debuginfo = opt_present(matches, ~"g") || extra_debuginfo;
589583
let sysroot_opt = getopts::opt_maybe_str(matches, ~"sysroot");
590584
let sysroot_opt = sysroot_opt.map(|m| Path(*m));
591585
let target_opt = getopts::opt_maybe_str(matches, ~"target");
@@ -616,6 +610,12 @@ pub fn build_session_options(+binary: ~str,
616610
}
617611
} else { No }
618612
};
613+
let gc = debugging_opts & session::gc != 0;
614+
let jit = debugging_opts & session::jit != 0;
615+
let extra_debuginfo = debugging_opts & session::extra_debug_info != 0;
616+
let debuginfo = debugging_opts & session::debug_info != 0 ||
617+
extra_debuginfo;
618+
let static = debugging_opts & session::static != 0;
619619
let target =
620620
match target_opt {
621621
None => host_triple(),
@@ -712,14 +712,11 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] {
712712
environment", ~"SPEC"),
713713
optflag(~"", ~"emit-llvm",
714714
~"Produce an LLVM bitcode file"),
715-
optflag(~"g", ~"", ~"Produce debug info (experimental)"),
716-
optflag(~"", ~"gc", ~"Garbage collect shared data (experimental)"),
717715
optflag(~"h", ~"help",~"Display this message"),
718716
optmulti(~"L", ~"", ~"Add a directory to the library search path",
719717
~"PATH"),
720718
optflag(~"", ~"lib", ~"Compile a library crate"),
721719
optflag(~"", ~"ls", ~"List the symbols defined by a library crate"),
722-
optflag(~"", ~"jit", ~"Execute using JIT (experimental)"),
723720
optflag(~"", ~"no-trans",
724721
~"Run all passes except translation; no output"),
725722
optflag(~"O", ~"", ~"Equivalent to --opt-level=2"),
@@ -739,13 +736,9 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] {
739736
or identified (fully parenthesized,
740737
AST nodes and blocks with IDs)", ~"TYPE"),
741738
optflag(~"S", ~"", ~"Compile only; do not assemble or link"),
742-
optflag(~"", ~"xg", ~"Extra debugging info (experimental)"),
743739
optflag(~"", ~"save-temps",
744740
~"Write intermediate files (.bc, .opt.bc, .o)
745741
in addition to normal output"),
746-
optflag(~"", ~"static",
747-
~"Use or produce static libraries or binaries
748-
(experimental)"),
749742
optopt(~"", ~"sysroot",
750743
~"Override the system root", ~"PATH"),
751744
optflag(~"", ~"test", ~"Build a test harness"),

trunk/src/librustc/driver/session.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ pub const count_type_sizes: uint = 1 << 14;
7575
pub const meta_stats: uint = 1 << 15;
7676
pub const no_opt: uint = 1 << 16;
7777
pub const no_monomorphic_collapse: uint = 1 << 17;
78+
pub const gc: uint = 1 << 18;
79+
pub const jit: uint = 1 << 19;
80+
pub const debug_info: uint = 1 << 20;
81+
pub const extra_debug_info: uint = 1 << 21;
82+
pub const static: uint = 1 << 22;
7883

7984
pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
8085
~[(~"verbose", ~"in general, enable more debug printouts", verbose),
@@ -102,6 +107,13 @@ pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
102107
(~"no-opt", ~"do not optimize, even if -O is passed", no_opt),
103108
(~"no-monomorphic-collapse", ~"do not collapse template instantiations",
104109
no_monomorphic_collapse),
110+
(~"gc", ~"Garbage collect shared data (experimental)", gc),
111+
(~"jit", ~"Execute using JIT (experimental)", jit),
112+
(~"extra-debug-info", ~"Extra debugging info (experimental)",
113+
extra_debug_info),
114+
(~"debug-info", ~"Produce debug info (experimental)", debug_info),
115+
(~"static", ~"Use or produce static libraries or binaries " +
116+
"(experimental)", static)
105117
]
106118
}
107119

trunk/src/librustc/middle/resolve.rs

Lines changed: 20 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -392,19 +392,17 @@ pub struct ImportResolution {
392392
/// The type that this `use` directive names, if there is one.
393393
mut type_target: Option<Target>,
394394
395-
/// There exists one state per import statement
396-
state: @mut ImportState,
395+
mut used: bool,
397396
}
398397
399-
pub fn ImportResolution(privacy: Privacy, span: span,
400-
state: @mut ImportState) -> ImportResolution {
398+
pub fn ImportResolution(privacy: Privacy, span: span) -> ImportResolution {
401399
ImportResolution {
402400
privacy: privacy,
403401
span: span,
404402
outstanding_references: 0,
405403
value_target: None,
406404
type_target: None,
407-
state: state,
405+
used: false
408406
}
409407
}
410408
@@ -417,15 +415,6 @@ pub impl ImportResolution {
417415
}
418416
}
419417
420-
pub struct ImportState {
421-
used: bool,
422-
warned: bool
423-
}
424-
425-
pub fn ImportState() -> ImportState {
426-
ImportState{ used: false, warned: false }
427-
}
428-
429418
/// The link from a module up to its nearest parent node.
430419
pub enum ParentLink {
431420
NoParentLink,
@@ -1426,7 +1415,6 @@ pub impl Resolver {
14261415
14271416
// Build up the import directives.
14281417
let module_ = self.get_module_from_parent(parent);
1429-
let state = @mut ImportState();
14301418
match view_path.node {
14311419
view_path_simple(binding, full_path, ns, _) => {
14321420
let ns = match ns {
@@ -1442,8 +1430,7 @@ pub impl Resolver {
14421430
module_,
14431431
module_path,
14441432
subclass,
1445-
view_path.span,
1446-
state);
1433+
view_path.span);
14471434
}
14481435
view_path_list(_, ref source_idents, _) => {
14491436
for (*source_idents).each |source_ident| {
@@ -1455,17 +1442,15 @@ pub impl Resolver {
14551442
module_,
14561443
module_path,
14571444
subclass,
1458-
view_path.span,
1459-
state);
1445+
view_path.span);
14601446
}
14611447
}
14621448
view_path_glob(_, _) => {
14631449
self.build_import_directive(privacy,
14641450
module_,
14651451
module_path,
14661452
@GlobImport,
1467-
view_path.span,
1468-
state);
1453+
view_path.span);
14691454
}
14701455
}
14711456
}
@@ -1588,8 +1573,7 @@ pub impl Resolver {
15881573
// avoid creating cycles in the
15891574
// module graph.
15901575
1591-
let resolution = @ImportResolution(Public, dummy_sp(),
1592-
@mut ImportState());
1576+
let resolution = @ImportResolution(Public, dummy_sp());
15931577
resolution.outstanding_references = 0;
15941578
15951579
match existing_module.parent_link {
@@ -1842,8 +1826,7 @@ pub impl Resolver {
18421826
module_: @Module,
18431827
module_path: @DVec<ident>,
18441828
subclass: @ImportDirectiveSubclass,
1845-
span: span,
1846-
state: @mut ImportState) {
1829+
span: span) {
18471830
let directive = @ImportDirective(privacy, module_path,
18481831
subclass, span);
18491832
module_.imports.push(directive);
@@ -1867,14 +1850,7 @@ pub impl Resolver {
18671850
}
18681851
None => {
18691852
debug!("(building import directive) creating new");
1870-
let resolution = @ImportResolution(privacy, span,
1871-
state);
1872-
let name = self.idents_to_str(module_path.get());
1873-
// Don't warn about unused intrinsics because they're
1874-
// automatically appended to all files
1875-
if name == ~"intrinsic::rusti" {
1876-
resolution.state.warned = true;
1877-
}
1853+
let resolution = @ImportResolution(privacy, span);
18781854
resolution.outstanding_references = 1;
18791855
module_.import_resolutions.insert(target, resolution);
18801856
}
@@ -2207,7 +2183,7 @@ pub impl Resolver {
22072183
return UnboundResult;
22082184
}
22092185
Some(target) => {
2210-
import_resolution.state.used = true;
2186+
import_resolution.used = true;
22112187
return BoundResult(target.target_module,
22122188
target.bindings);
22132189
}
@@ -2376,7 +2352,7 @@ pub impl Resolver {
23762352
module_result = UnboundResult;
23772353
}
23782354
Some(target) => {
2379-
import_resolution.state.used = true;
2355+
import_resolution.used = true;
23802356
module_result = BoundResult
23812357
(target.target_module,
23822358
target.bindings);
@@ -2443,7 +2419,6 @@ pub impl Resolver {
24432419
// everything it can to the list of import resolutions of the module
24442420
// node.
24452421
debug!("(resolving glob import) resolving %? glob import", privacy);
2446-
let state = @mut ImportState();
24472422
24482423
// We must bail out if the node has unresolved imports of any kind
24492424
// (including globs).
@@ -2470,8 +2445,7 @@ pub impl Resolver {
24702445
// Simple: just copy the old import resolution.
24712446
let new_import_resolution =
24722447
@ImportResolution(privacy,
2473-
target_import_resolution.span,
2474-
state);
2448+
target_import_resolution.span);
24752449
new_import_resolution.value_target =
24762450
copy target_import_resolution.value_target;
24772451
new_import_resolution.type_target =
@@ -2512,8 +2486,7 @@ pub impl Resolver {
25122486
match module_.import_resolutions.find(&ident) {
25132487
None => {
25142488
// Create a new import resolution from this child.
2515-
dest_import_resolution = @ImportResolution(privacy, span,
2516-
state);
2489+
dest_import_resolution = @ImportResolution(privacy, span);
25172490
module_.import_resolutions.insert
25182491
(ident, dest_import_resolution);
25192492
}
@@ -2740,7 +2713,7 @@ pub impl Resolver {
27402713
namespace);
27412714
}
27422715
Some(target) => {
2743-
import_resolution.state.used = true;
2716+
import_resolution.used = true;
27442717
return Success(copy target);
27452718
}
27462719
}
@@ -2989,7 +2962,7 @@ pub impl Resolver {
29892962
Some(target) => {
29902963
debug!("(resolving name in module) resolved to \
29912964
import");
2992-
import_resolution.state.used = true;
2965+
import_resolution.used = true;
29932966
return Success(copy target);
29942967
}
29952968
}
@@ -4587,7 +4560,7 @@ pub impl Resolver {
45874560
namespace)) {
45884561
(Some(def), Some(Public)) => {
45894562
// Found it.
4590-
import_resolution.state.used = true;
4563+
import_resolution.used = true;
45914564
return ImportNameDefinition(def);
45924565
}
45934566
(Some(_), _) | (None, _) => {
@@ -5061,13 +5034,9 @@ pub impl Resolver {
50615034
Some(def) => {
50625035
match def {
50635036
def_ty(trait_def_id) => {
5064-
let added = self.
5037+
self.
50655038
add_trait_info_if_containing_method(
50665039
found_traits, trait_def_id, name);
5067-
if added {
5068-
import_resolution.state.used =
5069-
true;
5070-
}
50715040
}
50725041
_ => {
50735042
// Continue.
@@ -5100,7 +5069,7 @@ pub impl Resolver {
51005069

51015070
fn add_trait_info_if_containing_method(found_traits: @DVec<def_id>,
51025071
trait_def_id: def_id,
5103-
name: ident) -> bool {
5072+
name: ident) {
51045073

51055074
debug!("(adding trait info if containing method) trying trait %d:%d \
51065075
for method '%s'",
@@ -5116,10 +5085,9 @@ pub impl Resolver {
51165085
trait_def_id.node,
51175086
self.session.str_of(name));
51185087
(*found_traits).push(trait_def_id);
5119-
true
51205088
}
51215089
Some(_) | None => {
5122-
false
5090+
// Continue.
51235091
}
51245092
}
51255093
}
@@ -5236,13 +5204,7 @@ pub impl Resolver {
52365204

52375205
fn check_for_unused_imports_in_module(module_: @Module) {
52385206
for module_.import_resolutions.each_value_ref |&import_resolution| {
5239-
// Ignore dummy spans for things like automatically injected
5240-
// imports for the prelude, and also don't warn about the same
5241-
// import statement being unused more than once.
5242-
if !import_resolution.state.used &&
5243-
!import_resolution.state.warned &&
5244-
import_resolution.span != dummy_sp() {
5245-
import_resolution.state.warned = true;
5207+
if !import_resolution.used {
52465208
match self.unused_import_lint_level {
52475209
warn => {
52485210
self.session.span_warn(import_resolution.span,

0 commit comments

Comments
 (0)