]> git.lizzy.rs Git - rust.git/commitdiff
Add a test
authorNick Cameron <ncameron@mozilla.com>
Tue, 5 Jan 2016 01:35:22 +0000 (14:35 +1300)
committerNick Cameron <ncameron@mozilla.com>
Thu, 14 Jan 2016 21:24:12 +0000 (10:24 +1300)
And fix bustage in make check

src/librustdoc/core.rs
src/librustdoc/lib.rs
src/librustdoc/test.rs
src/libsyntax/errors/json.rs
src/test/run-make/execution-engine/test.rs
src/test/run-make/json-errors/Makefile [new file with mode: 0644]
src/test/run-make/json-errors/foo.rs [new file with mode: 0644]
src/test/run-pass-fulldeps/compiler-calls.rs

index d57d1bcd92da505454cb45ad23818b0550cbb6ff..a7fd170b91c37778196b1a080c66acd5c605aeee 100644 (file)
@@ -118,11 +118,11 @@ pub fn run_core(search_paths: SearchPaths, cfgs: Vec<String>, externs: Externs,
     };
 
     let codemap = Rc::new(codemap::CodeMap::new());
-    let diagnostic_handler = errors::Handler::new(ColorConfig::Auto,
-                                                  None,
-                                                  true,
-                                                  false,
-                                                  codemap.clone());
+    let diagnostic_handler = errors::Handler::with_tty_emitter(ColorConfig::Auto,
+                                                               None,
+                                                               true,
+                                                               false,
+                                                               codemap.clone());
 
     let cstore = Rc::new(CStore::new(token::get_ident_interner()));
     let sess = session::build_session_(sessopts, cpath, diagnostic_handler,
index ffda261c24f3d819ed05f32fa8ba981be261a580..dce537fe9d292a0a5923dba022b0c0ac3c14bcab 100644 (file)
@@ -50,6 +50,7 @@
 
 use std::cell::RefCell;
 use std::collections::HashMap;
+use std::default::Default;
 use std::env;
 use std::fs::File;
 use std::io::{self, Read, Write};
@@ -62,7 +63,7 @@
 use serialize::Decodable;
 use serialize::json::{self, Json};
 use rustc::session::search_paths::SearchPaths;
-use syntax::errors::emitter::ColorConfig;
+use rustc::session::config::ErrorOutputType;
 
 // reexported from `clean` so it can be easily updated with the mod itself
 pub use clean::SCHEMA_VERSION;
@@ -225,7 +226,7 @@ pub fn main_args(args: &[String]) -> isize {
 
     let mut libs = SearchPaths::new();
     for s in &matches.opt_strs("L") {
-        libs.add_path(s, ColorConfig::Auto);
+        libs.add_path(s, ErrorOutputType::default());
     }
     let externs = match parse_externs(&matches) {
         Ok(ex) => ex,
@@ -360,7 +361,7 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche
     // First, parse the crate and extract all relevant information.
     let mut paths = SearchPaths::new();
     for s in &matches.opt_strs("L") {
-        paths.add_path(s, ColorConfig::Auto);
+        paths.add_path(s, ErrorOutputType::default());
     }
     let cfgs = matches.opt_strs("cfg");
     let triple = matches.opt_str("target");
index 7aa97d3652f5ab3d03db2fddae1dec8bdc09d9c7..d7d30f065bf0e9c857fe5aa83cfb4db23431a854 100644 (file)
@@ -73,11 +73,11 @@ pub fn run(input: &str,
     };
 
     let codemap = Rc::new(CodeMap::new());
-    let diagnostic_handler = errors::Handler::new(ColorConfig::Auto,
-                                                  None,
-                                                  true,
-                                                  false,
-                                                  codemap.clone());
+    let diagnostic_handler = errors::Handler::with_tty_emitter(ColorConfig::Auto,
+                                                               None,
+                                                               true,
+                                                               false,
+                                                               codemap.clone());
 
     let cstore = Rc::new(CStore::new(token::get_ident_interner()));
     let sess = session::build_session_(sessopts,
index 0b8da7a09b12176ff78211becdd6d62d2fa29385..713190ef419d69a974f4989f62999608836b8091 100644 (file)
@@ -131,7 +131,7 @@ fn from_render_span(span: &RenderSpan,
                         je: &JsonEmitter)
                         -> Diagnostic<'a> {
         Diagnostic {
-            msg: msg,
+            message: msg,
             code: None,
             level: level.to_str(),
             span: Some(DiagnosticSpan::from_render_span(span, je)),
index 928f2f996a028820aac3931bf75ea61832f612d2..dc409f393a86a971fa82fb3005fc0ef78eb286dc 100644 (file)
@@ -195,7 +195,7 @@ fn build_exec_options(sysroot: PathBuf) -> Options {
     opts.maybe_sysroot = Some(sysroot);
 
     // Prefer faster build time
-    opts.optimize = config::No;
+    opts.optimize = config::OptLevel::No;
 
     // Don't require a `main` function
     opts.crate_types = vec![config::CrateTypeDylib];
diff --git a/src/test/run-make/json-errors/Makefile b/src/test/run-make/json-errors/Makefile
new file mode 100644 (file)
index 0000000..2c1eae8
--- /dev/null
@@ -0,0 +1,7 @@
+-include ../tools.mk
+
+all:
+       cp foo.rs $(TMPDIR)
+       cd $(TMPDIR)
+       $(RUSTC) -Z unstable-options --output=json foo.rs 2>foo.log || true
+       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
diff --git a/src/test/run-make/json-errors/foo.rs b/src/test/run-make/json-errors/foo.rs
new file mode 100644 (file)
index 0000000..9a6f4ad
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-linelength
+
+fn main() {
+    let x = 42 + y;
+}
index e3eeeb863568800949e95c08d3bbe57d9910d2ef..56481dc646a9c5e35a694a4daac24cc24e532094 100644 (file)
@@ -35,7 +35,7 @@ impl<'a> CompilerCalls<'a> for TestCalls {
     fn early_callback(&mut self,
                       _: &getopts::Matches,
                       _: &diagnostics::registry::Registry,
-                      _: errors::emitter::ColorConfig)
+                      _: config::ErrorOutputType)
                       -> Compilation {
         self.count *= 2;
         Compilation::Continue