Skip to content

Commit 11dcb48

Browse files
committed
Add a test
And fix bustage in make check
1 parent b976d9e commit 11dcb48

File tree

8 files changed

+39
-16
lines changed

8 files changed

+39
-16
lines changed

src/librustdoc/core.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ pub fn run_core(search_paths: SearchPaths, cfgs: Vec<String>, externs: Externs,
118118
};
119119

120120
let codemap = Rc::new(codemap::CodeMap::new());
121-
let diagnostic_handler = errors::Handler::new(ColorConfig::Auto,
122-
None,
123-
true,
124-
false,
125-
codemap.clone());
121+
let diagnostic_handler = errors::Handler::with_tty_emitter(ColorConfig::Auto,
122+
None,
123+
true,
124+
false,
125+
codemap.clone());
126126

127127
let cstore = Rc::new(CStore::new(token::get_ident_interner()));
128128
let sess = session::build_session_(sessopts, cpath, diagnostic_handler,

src/librustdoc/lib.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ extern crate serialize as rustc_serialize; // used by deriving
5050

5151
use std::cell::RefCell;
5252
use std::collections::HashMap;
53+
use std::default::Default;
5354
use std::env;
5455
use std::fs::File;
5556
use std::io::{self, Read, Write};
@@ -62,7 +63,7 @@ use externalfiles::ExternalHtml;
6263
use serialize::Decodable;
6364
use serialize::json::{self, Json};
6465
use rustc::session::search_paths::SearchPaths;
65-
use syntax::errors::emitter::ColorConfig;
66+
use rustc::session::config::ErrorOutputType;
6667

6768
// reexported from `clean` so it can be easily updated with the mod itself
6869
pub use clean::SCHEMA_VERSION;
@@ -225,7 +226,7 @@ pub fn main_args(args: &[String]) -> isize {
225226

226227
let mut libs = SearchPaths::new();
227228
for s in &matches.opt_strs("L") {
228-
libs.add_path(s, ColorConfig::Auto);
229+
libs.add_path(s, ErrorOutputType::default());
229230
}
230231
let externs = match parse_externs(&matches) {
231232
Ok(ex) => ex,
@@ -360,7 +361,7 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche
360361
// First, parse the crate and extract all relevant information.
361362
let mut paths = SearchPaths::new();
362363
for s in &matches.opt_strs("L") {
363-
paths.add_path(s, ColorConfig::Auto);
364+
paths.add_path(s, ErrorOutputType::default());
364365
}
365366
let cfgs = matches.opt_strs("cfg");
366367
let triple = matches.opt_str("target");

src/librustdoc/test.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ pub fn run(input: &str,
7373
};
7474

7575
let codemap = Rc::new(CodeMap::new());
76-
let diagnostic_handler = errors::Handler::new(ColorConfig::Auto,
77-
None,
78-
true,
79-
false,
80-
codemap.clone());
76+
let diagnostic_handler = errors::Handler::with_tty_emitter(ColorConfig::Auto,
77+
None,
78+
true,
79+
false,
80+
codemap.clone());
8181

8282
let cstore = Rc::new(CStore::new(token::get_ident_interner()));
8383
let sess = session::build_session_(sessopts,

src/libsyntax/errors/json.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ impl<'a> Diagnostic<'a> {
131131
je: &JsonEmitter)
132132
-> Diagnostic<'a> {
133133
Diagnostic {
134-
msg: msg,
134+
message: msg,
135135
code: None,
136136
level: level.to_str(),
137137
span: Some(DiagnosticSpan::from_render_span(span, je)),

src/test/run-make/execution-engine/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ fn build_exec_options(sysroot: PathBuf) -> Options {
195195
opts.maybe_sysroot = Some(sysroot);
196196

197197
// Prefer faster build time
198-
opts.optimize = config::No;
198+
opts.optimize = config::OptLevel::No;
199199

200200
// Don't require a `main` function
201201
opts.crate_types = vec![config::CrateTypeDylib];
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-include ../tools.mk
2+
3+
all:
4+
cp foo.rs $(TMPDIR)
5+
cd $(TMPDIR)
6+
$(RUSTC) -Z unstable-options --output=json foo.rs 2>foo.log || true
7+
grep -q '{"message":"unresolved name `y`","code":{"code":"E0425","explanation":"\\nAn unresolved name was used. Example of erroneous codes.*"},"level":"error","span":{"file_name":"foo.rs","byte_start":523,"byte_end":524,"line_start":14,"line_end":14,"column_start":18,"column_end":19},"children":\[\]}' foo.log

src/test/run-make/json-errors/foo.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// ignore-tidy-linelength
12+
13+
fn main() {
14+
let x = 42 + y;
15+
}

src/test/run-pass-fulldeps/compiler-calls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl<'a> CompilerCalls<'a> for TestCalls {
3535
fn early_callback(&mut self,
3636
_: &getopts::Matches,
3737
_: &diagnostics::registry::Registry,
38-
_: errors::emitter::ColorConfig)
38+
_: config::ErrorOutputType)
3939
-> Compilation {
4040
self.count *= 2;
4141
Compilation::Continue

0 commit comments

Comments
 (0)