Skip to content

Commit 7900197

Browse files
committed
---
yaml --- r: 83359 b: refs/heads/try c: d126be0 h: refs/heads/master i: 83357: e63f254 83355: c591b1a 83351: de865f1 83343: 001c386 83327: a07e49f v: v3
1 parent f457e64 commit 7900197

File tree

5 files changed

+52
-24
lines changed

5 files changed

+52
-24
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0e4d1fc8cae42e15e00f71d9f439b01bb25a86ae
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6c08cc2db4f98e9f07ae7d50338396c4123c2f0a
5-
refs/heads/try: 6ecbd75843a2187027d09649c9046189d1d4a446
5+
refs/heads/try: d126be068b0daab3b5abd9b1f365a4c98f2121b7
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustdoc/core.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
use rustc;
1212
use rustc::{driver, middle};
1313

14-
use syntax;
15-
use syntax::parse;
1614
use syntax::ast;
15+
use syntax::diagnostic;
16+
use syntax::parse;
17+
use syntax;
1718

1819
use std::os;
1920
use std::local_data;
@@ -48,9 +49,11 @@ fn get_ast_and_resolve(cpath: &Path, libs: ~[Path]) -> DocContext {
4849
let span_diagnostic_handler =
4950
syntax::diagnostic::mk_span_handler(diagnostic_handler, parsesess.cm);
5051

51-
let sess = driver::driver::build_session_(sessopts, parsesess.cm,
52-
syntax::diagnostic::emit,
53-
span_diagnostic_handler);
52+
let sess = driver::driver::build_session_(sessopts,
53+
parsesess.cm,
54+
@diagnostic::DefaultEmitter as
55+
@diagnostic::Emitter,
56+
span_diagnostic_handler);
5457

5558
let mut cfg = build_configuration(sess);
5659
cfg.push(@dummy_spanned(ast::MetaWord(@"stage2")));

branches/try/src/librusti/rusti.rs

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@ use extra::rl;
7676

7777
use rustc::driver::{driver, session};
7878
use rustc::back::link::jit;
79-
use syntax::{ast, diagnostic};
79+
use syntax::{ast, codemap, diagnostic};
8080
use syntax::ast_util::*;
81+
use syntax::diagnostic::Emitter;
8182
use syntax::parse::token;
8283
use syntax::print::pprust;
8384

@@ -107,6 +108,28 @@ enum CmdAction {
107108
action_run_line(~str),
108109
}
109110

111+
struct EncodableWarningEmitter;
112+
113+
impl diagnostic::Emitter for EncodableWarningEmitter {
114+
fn emit(&self,
115+
cm: Option<(@codemap::CodeMap, codemap::Span)>,
116+
msg: &str,
117+
lvl: diagnostic::level) {
118+
diagnostic::DefaultEmitter.emit(cm, msg, lvl);
119+
if msg.contains("failed to find an implementation of trait") &&
120+
msg.contains("extra::serialize::Encodable") {
121+
diagnostic::DefaultEmitter.emit(cm,
122+
"Currrently rusti serializes \
123+
bound locals between different \
124+
lines of input. This means that \
125+
all values of local variables \
126+
need to be encodable, and this \
127+
type isn't encodable",
128+
diagnostic::note);
129+
}
130+
}
131+
}
132+
110133
/// Run an input string in a Repl, returning the new Repl.
111134
fn run(mut program: ~Program, binary: ~str, lib_search_paths: ~[~str],
112135
input: ~str) -> (~Program, Option<~jit::Engine>)
@@ -124,18 +147,9 @@ fn run(mut program: ~Program, binary: ~str, lib_search_paths: ~[~str],
124147
// extra helpful information if the error crops up. Otherwise people are
125148
// bound to be very confused when they find out code is running that they
126149
// never typed in...
127-
let sess = driver::build_session(options, |cm, msg, lvl| {
128-
diagnostic::emit(cm, msg, lvl);
129-
if msg.contains("failed to find an implementation of trait") &&
130-
msg.contains("extra::serialize::Encodable") {
131-
diagnostic::emit(cm,
132-
"Currrently rusti serializes bound locals between \
133-
different lines of input. This means that all \
134-
values of local variables need to be encodable, \
135-
and this type isn't encodable",
136-
diagnostic::note);
137-
}
138-
});
150+
let sess = driver::build_session(options,
151+
@EncodableWarningEmitter as
152+
@diagnostic::Emitter);
139153
let intr = token::get_ident_interner();
140154

141155
//
@@ -243,7 +257,9 @@ fn run(mut program: ~Program, binary: ~str, lib_search_paths: ~[~str],
243257
let input = driver::str_input(code.to_managed());
244258
let cfg = driver::build_configuration(sess);
245259
let outputs = driver::build_output_filenames(&input, &None, &None, [], sess);
246-
let sess = driver::build_session(options, diagnostic::emit);
260+
let sess = driver::build_session(options,
261+
@diagnostic::DefaultEmitter as
262+
@diagnostic::Emitter);
247263

248264
let crate = driver::phase_1_parse_input(sess, cfg.clone(), &input);
249265
let expanded_crate = driver::phase_2_configure_and_expand(sess, cfg, crate);
@@ -305,7 +321,9 @@ fn compile_crate(src_filename: ~str, binary: ~str) -> Option<bool> {
305321
.. (*session::basic_options()).clone()
306322
};
307323
let input = driver::file_input(src_path.clone());
308-
let sess = driver::build_session(options, diagnostic::emit);
324+
let sess = driver::build_session(options,
325+
@diagnostic::DefaultEmitter as
326+
@diagnostic::Emitter);
309327
*sess.building_library = true;
310328
let cfg = driver::build_configuration(sess);
311329
let outputs = driver::build_output_filenames(

branches/try/src/librustpkg/rustpkg.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ impl<'self> PkgScript<'self> {
110110
.. (*session::basic_options()).clone()
111111
};
112112
let input = driver::file_input(script.clone());
113-
let sess = driver::build_session(options, diagnostic::emit);
113+
let sess = driver::build_session(options,
114+
@diagnostic::DefaultEmitter as
115+
@diagnostic::Emitter);
114116
let cfg = driver::build_configuration(sess);
115117
let crate = driver::phase_1_parse_input(sess, cfg.clone(), &input);
116118
let crate = driver::phase_2_configure_and_expand(sess, cfg.clone(), crate);

branches/try/src/librustpkg/util.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,10 @@ pub fn compile_input(context: &BuildContext,
232232
maybe_sysroot: Some(sysroot_to_use),
233233
addl_lib_search_paths: @mut (~[]),
234234
output_type: output_type,
235-
.. (*driver::build_session_options(binary, &matches, diagnostic::emit)).clone()
235+
.. (*driver::build_session_options(binary,
236+
&matches,
237+
@diagnostic::DefaultEmitter as
238+
@diagnostic::Emitter)).clone()
236239
};
237240

238241
let addl_lib_search_paths = @mut options.addl_lib_search_paths;
@@ -247,7 +250,9 @@ pub fn compile_input(context: &BuildContext,
247250
}
248251
}
249252

250-
let sess = driver::build_session(options, diagnostic::emit);
253+
let sess = driver::build_session(options,
254+
@diagnostic::DefaultEmitter as
255+
@diagnostic::Emitter);
251256

252257
// Infer dependencies that rustpkg needs to build, by scanning for
253258
// `extern mod` directives.

0 commit comments

Comments
 (0)