Skip to content

Commit ca59fca

Browse files
committed
---
yaml --- r: 114151 b: refs/heads/master c: d6cf0df h: refs/heads/master i: 114149: ad6acf5 114147: 403f6f9 114143: 0400f43 v: v3
1 parent 0838817 commit ca59fca

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
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: 579e0a5f5555ed926cf9378ef61b034b0c316e76
2+
refs/heads/master: d6cf0dfbab35f40abaef345024701ff8112ed2d8
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ec0258a381b88b5574e3f8ce72ae553ac3a574b7
55
refs/heads/try: 7c6c492fb2af9a85f21ff952942df3523b22fd17

trunk/src/librustc/driver/mod.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,17 @@ fn run_compiler(args: &[~str]) {
104104
driver::compile_input(sess, cfg, &input, &odir, &ofile);
105105
}
106106

107-
pub fn version(command: &str) {
107+
pub fn version(argv0: &str) {
108108
let vers = match option_env!("CFG_VERSION") {
109109
Some(vers) => vers,
110110
None => "unknown version"
111111
};
112-
println!("{} {}", command, vers);
112+
println!("{} {}", argv0, vers);
113113
println!("host: {}", driver::host_triple());
114114
}
115115

116-
fn usage() {
117-
let message = format!("Usage: rustc [OPTIONS] INPUT");
116+
fn usage(argv0: &str) {
117+
let message = format!("Usage: {} [OPTIONS] INPUT", argv0);
118118
println!("{}\n\
119119
Additional help:
120120
-C help Print codegen options
@@ -192,10 +192,9 @@ fn describe_codegen_flags() {
192192
/// should continue, returns a getopts::Matches object parsed from args, otherwise
193193
/// returns None.
194194
pub fn handle_options(mut args: Vec<~str>) -> Option<getopts::Matches> {
195-
// Throw away the first argument, the name of the binary
196-
let _binary = args.shift().unwrap();
195+
let binary = args.shift().unwrap();
197196

198-
if args.is_empty() { usage(); return None; }
197+
if args.is_empty() { usage(binary); return None; }
199198

200199
let matches =
201200
match getopts::getopts(args.as_slice(), config::optgroups().as_slice()) {
@@ -206,7 +205,7 @@ pub fn handle_options(mut args: Vec<~str>) -> Option<getopts::Matches> {
206205
};
207206

208207
if matches.opt_present("h") || matches.opt_present("help") {
209-
usage();
208+
usage(binary);
210209
return None;
211210
}
212211

@@ -235,7 +234,7 @@ pub fn handle_options(mut args: Vec<~str>) -> Option<getopts::Matches> {
235234
}
236235

237236
if matches.opt_present("v") || matches.opt_present("version") {
238-
version("rustc");
237+
version(binary);
239238
return None;
240239
}
241240

trunk/src/librustdoc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ pub fn main_args(args: &[StrBuf]) -> int {
153153
usage(args[0].as_slice());
154154
return 0;
155155
} else if matches.opt_present("version") {
156-
rustc::driver::version("rustdoc");
156+
rustc::driver::version(args[0].as_slice());
157157
return 0;
158158
}
159159

trunk/src/libsyntax/visit.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,17 @@ pub fn generics_of_fn(fk: &FnKind) -> Generics {
6161
}
6262
}
6363

64+
/// Each method of the Visitor trait is a hook to be potentially
65+
/// overriden. Each method's default implementation recursively visits
66+
/// the substructure of the input via the corresponding `walk` method;
67+
/// e.g. the `visit_mod` method by default calls `visit::walk_mod`.
68+
///
69+
/// If you want to ensure that your code handles every variant
70+
/// explicitly, you need to override each method. (And you also need
71+
/// to monitor future changes to `Visitor` in case a new method with a
72+
/// new default implementation gets introduced.)
6473
pub trait Visitor<E: Clone> {
74+
6575
fn visit_ident(&mut self, _sp: Span, _ident: Ident, _e: E) {
6676
/*! Visit the idents */
6777
}
@@ -179,9 +189,9 @@ pub fn walk_local<E: Clone, V: Visitor<E>>(visitor: &mut V, local: &Local, env:
179189
}
180190
}
181191

182-
fn walk_explicit_self<E: Clone, V: Visitor<E>>(visitor: &mut V,
183-
explicit_self: &ExplicitSelf,
184-
env: E) {
192+
pub fn walk_explicit_self<E: Clone, V: Visitor<E>>(visitor: &mut V,
193+
explicit_self: &ExplicitSelf,
194+
env: E) {
185195
match explicit_self.node {
186196
SelfStatic | SelfValue | SelfUniq => {}
187197
SelfRegion(ref lifetime, _) => {

0 commit comments

Comments
 (0)