Skip to content

Commit c34bee1

Browse files
committed
---
yaml --- r: 131739 b: refs/heads/dist-snap c: b57d272 h: refs/heads/master i: 131737: 8227cf2 131735: 6d96ec6 v: v3
1 parent 87414e8 commit c34bee1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+659
-168
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 457a3c991d79b971be07fce75f9d0c12848fb37c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 8aa8ca7991412b6d326b131e17177b8610239841
9+
refs/heads/dist-snap: b57d272e9908e164a72bd1a688141031705e1208
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/mk/dist.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ distcheck-tar-bins: dist-tar-bins
259259
$(Q)cd tmp/distcheck && tar -xzf ../../dist/$(PKG_NAME)-$(CFG_BUILD).tar.gz
260260
$(Q)mkdir -p tmp/distcheck/tarbininstall
261261
$(Q)sh tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix=tmp/distcheck/tarbininstall
262-
$(Q)tmp/distcheck/tarbininstall/bin/rustc --version
263262
$(Q)sh tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix=tmp/distcheck/tarbininstall --uninstall
264263
$(Q)rm -Rf tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD)
265264
$(Q)rm -Rf tmp/distcheck/tarbininstall

branches/dist-snap/src/compiletest/procsrv.rs

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::os;
1211
use std::str;
1312
use std::io::process::{ProcessExit, Command, Process, ProcessOutput};
1413
use std::dynamic_lib::DynamicLibrary;
1514

16-
fn target_env(lib_path: &str, aux_path: Option<&str>) -> Vec<(String, String)> {
15+
fn add_target_env(cmd: &mut Command, lib_path: &str, aux_path: Option<&str>) {
1716
// Need to be sure to put both the lib_path and the aux path in the dylib
1817
// search path for the child.
1918
let mut path = DynamicLibrary::search_path();
@@ -23,19 +22,11 @@ fn target_env(lib_path: &str, aux_path: Option<&str>) -> Vec<(String, String)> {
2322
}
2423
path.insert(0, Path::new(lib_path));
2524

26-
// Remove the previous dylib search path var
27-
let var = DynamicLibrary::envvar();
28-
let mut env: Vec<(String,String)> = os::env();
29-
match env.iter().position(|&(ref k, _)| k.as_slice() == var) {
30-
Some(i) => { env.remove(i); }
31-
None => {}
32-
}
33-
3425
// Add the new dylib search path var
26+
let var = DynamicLibrary::envvar();
3527
let newpath = DynamicLibrary::create_path(path.as_slice());
3628
let newpath = str::from_utf8(newpath.as_slice()).unwrap().to_string();
37-
env.push((var.to_string(), newpath));
38-
return env;
29+
cmd.env(var.to_string(), newpath);
3930
}
4031

4132
pub struct Result {pub status: ProcessExit, pub out: String, pub err: String}
@@ -47,8 +38,14 @@ pub fn run(lib_path: &str,
4738
env: Vec<(String, String)> ,
4839
input: Option<String>) -> Option<Result> {
4940

50-
let env = env.clone().append(target_env(lib_path, aux_path).as_slice());
51-
match Command::new(prog).args(args).env(env.as_slice()).spawn() {
41+
let mut cmd = Command::new(prog);
42+
cmd.args(args);
43+
add_target_env(&mut cmd, lib_path, aux_path);
44+
for (key, val) in env.move_iter() {
45+
cmd.env(key, val);
46+
}
47+
48+
match cmd.spawn() {
5249
Ok(mut process) => {
5350
for input in input.iter() {
5451
process.stdin.get_mut_ref().write(input.as_bytes()).unwrap();
@@ -73,8 +70,14 @@ pub fn run_background(lib_path: &str,
7370
env: Vec<(String, String)> ,
7471
input: Option<String>) -> Option<Process> {
7572

76-
let env = env.clone().append(target_env(lib_path, aux_path).as_slice());
77-
match Command::new(prog).args(args).env(env.as_slice()).spawn() {
73+
let mut cmd = Command::new(prog);
74+
cmd.args(args);
75+
add_target_env(&mut cmd, lib_path, aux_path);
76+
for (key, val) in env.move_iter() {
77+
cmd.env(key, val);
78+
}
79+
80+
match cmd.spawn() {
7881
Ok(mut process) => {
7982
for input in input.iter() {
8083
process.stdin.get_mut_ref().write(input.as_bytes()).unwrap();

branches/dist-snap/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
574574
cmd.arg("./src/etc/lldb_batchmode.py")
575575
.arg(test_executable)
576576
.arg(debugger_script)
577-
.env([("PYTHONPATH", config.lldb_python_dir.clone().unwrap().as_slice())]);
577+
.env_set_all([("PYTHONPATH", config.lldb_python_dir.clone().unwrap().as_slice())]);
578578

579579
let (status, out, err) = match cmd.spawn() {
580580
Ok(process) => {

branches/dist-snap/src/libcore/num/f32.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
//! Operations and constants for 32-bits floats (`f32` type)
1212
1313
#![doc(primitive = "f32")]
14+
// FIXME: MIN_VALUE and MAX_VALUE literals are parsed as -inf and inf #14353
15+
#![allow(type_overflow)]
1416

1517
use intrinsics;
1618
use mem;

branches/dist-snap/src/libcore/num/f64.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
//! Operations and constants for 64-bits floats (`f64` type)
1212
1313
#![doc(primitive = "f64")]
14+
// FIXME: MIN_VALUE and MAX_VALUE literals are parsed as -inf and inf #14353
15+
#![allow(type_overflow)]
1416

1517
use intrinsics;
1618
use mem;

branches/dist-snap/src/libnative/io/process.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ fn with_argv<T>(prog: &CString, args: &[CString],
729729
}
730730

731731
#[cfg(unix)]
732-
fn with_envp<T>(env: Option<&[(CString, CString)]>,
732+
fn with_envp<T>(env: Option<&[(&CString, &CString)]>,
733733
cb: proc(*const c_void) -> T) -> T {
734734
// On posixy systems we can pass a char** for envp, which is a
735735
// null-terminated array of "k=v\0" strings. Since we must create
@@ -762,7 +762,7 @@ fn with_envp<T>(env: Option<&[(CString, CString)]>,
762762
}
763763

764764
#[cfg(windows)]
765-
fn with_envp<T>(env: Option<&[(CString, CString)]>, cb: |*mut c_void| -> T) -> T {
765+
fn with_envp<T>(env: Option<&[(&CString, &CString)]>, cb: |*mut c_void| -> T) -> T {
766766
// On win32 we pass an "environment block" which is not a char**, but
767767
// rather a concatenation of null-terminated k=v\0 sequences, with a final
768768
// \0 to terminate.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2014 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+
register_diagnostic!(E0001, r##"
12+
This error suggests that the expression arm corresponding to the noted pattern
13+
will never be reached as for all possible values of the expression being matched,
14+
one of the preceeding patterns will match.
15+
16+
This means that perhaps some of the preceeding patterns are too general, this
17+
one is too specific or the ordering is incorrect.
18+
"##)

branches/dist-snap/src/librustc/driver/config.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ pub fn optgroups() -> Vec<getopts::OptGroup> {
532532
optopt("", "opt-level", "Optimize with possible levels 0-3", "LEVEL"),
533533
optopt( "", "out-dir", "Write output to compiler-chosen filename in <dir>", "DIR"),
534534
optflag("", "parse-only", "Parse only; do not compile, assemble, or link"),
535+
optopt("", "explain", "Provide a detailed explanation of an error message", "OPT"),
535536
optflagopt("", "pretty",
536537
"Pretty-print the input instead of compiling;
537538
valid types are: `normal` (un-annotated source),
@@ -807,6 +808,7 @@ mod test {
807808
use getopts::getopts;
808809
use syntax::attr;
809810
use syntax::attr::AttrMetaMethods;
811+
use syntax::diagnostics;
810812

811813
// When the user supplies --test we should implicitly supply --cfg test
812814
#[test]
@@ -816,8 +818,9 @@ mod test {
816818
Ok(m) => m,
817819
Err(f) => fail!("test_switch_implies_cfg_test: {}", f)
818820
};
821+
let registry = diagnostics::registry::Registry::new([]);
819822
let sessopts = build_session_options(matches);
820-
let sess = build_session(sessopts, None);
823+
let sess = build_session(sessopts, None, registry);
821824
let cfg = build_configuration(&sess);
822825
assert!((attr::contains_name(cfg.as_slice(), "test")));
823826
}
@@ -834,8 +837,9 @@ mod test {
834837
fail!("test_switch_implies_cfg_test_unless_cfg_test: {}", f)
835838
}
836839
};
840+
let registry = diagnostics::registry::Registry::new([]);
837841
let sessopts = build_session_options(matches);
838-
let sess = build_session(sessopts, None);
842+
let sess = build_session(sessopts, None, registry);
839843
let cfg = build_configuration(&sess);
840844
let mut test_items = cfg.iter().filter(|m| m.name().equiv(&("test")));
841845
assert!(test_items.next().is_some());

branches/dist-snap/src/librustc/driver/driver.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use driver::{PpmFlowGraph, PpmExpanded, PpmExpandedIdentified, PpmTyped};
1616
use driver::{PpmIdentified};
1717
use front;
1818
use lib::llvm::{ContextRef, ModuleRef};
19+
use lint;
1920
use metadata::common::LinkMeta;
2021
use metadata::creader;
2122
use middle::cfg;
@@ -26,7 +27,7 @@ use middle;
2627
use plugin::load::Plugins;
2728
use plugin::registry::Registry;
2829
use plugin;
29-
use lint;
30+
3031
use util::common::time;
3132
use util::ppaux;
3233
use util::nodemap::{NodeSet};
@@ -41,6 +42,7 @@ use std::io::MemReader;
4142
use syntax::ast;
4243
use syntax::attr;
4344
use syntax::attr::{AttrMetaMethods};
45+
use syntax::diagnostics;
4446
use syntax::parse;
4547
use syntax::parse::token;
4648
use syntax::print::{pp, pprust};
@@ -213,6 +215,15 @@ pub fn phase_2_configure_and_expand(sess: &Session,
213215
let mut registry = Registry::new(&krate);
214216

215217
time(time_passes, "plugin registration", (), |_| {
218+
if sess.features.rustc_diagnostic_macros.get() {
219+
registry.register_macro("__diagnostic_used",
220+
diagnostics::plugin::expand_diagnostic_used);
221+
registry.register_macro("__register_diagnostic",
222+
diagnostics::plugin::expand_register_diagnostic);
223+
registry.register_macro("__build_diagnostic_array",
224+
diagnostics::plugin::expand_build_diagnostic_array);
225+
}
226+
216227
for &registrar in registrars.iter() {
217228
registrar(&mut registry);
218229
}

branches/dist-snap/src/librustc/driver/mod.rs

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use std::task::TaskBuilder;
2626
use syntax::ast;
2727
use syntax::parse;
2828
use syntax::diagnostic::Emitter;
29+
use syntax::diagnostics;
2930

3031
use getopts;
3132

@@ -49,8 +50,24 @@ fn run_compiler(args: &[String]) {
4950
Some(matches) => matches,
5051
None => return
5152
};
52-
let sopts = config::build_session_options(&matches);
5353

54+
let descriptions = diagnostics::registry::Registry::new(super::DIAGNOSTICS);
55+
match matches.opt_str("explain") {
56+
Some(ref code) => {
57+
match descriptions.find_description(code.as_slice()) {
58+
Some(ref description) => {
59+
println!("{}", description);
60+
}
61+
None => {
62+
early_error(format!("no extended information for {}", code).as_slice());
63+
}
64+
}
65+
return;
66+
},
67+
None => ()
68+
}
69+
70+
let sopts = config::build_session_options(&matches);
5471
let (input, input_file_path) = match matches.free.len() {
5572
0u => {
5673
if sopts.describe_lints {
@@ -75,7 +92,7 @@ fn run_compiler(args: &[String]) {
7592
_ => early_error("multiple input filenames provided")
7693
};
7794

78-
let sess = build_session(sopts, input_file_path);
95+
let sess = build_session(sopts, input_file_path, descriptions);
7996
let cfg = config::build_configuration(&sess);
8097
let odir = matches.opt_str("out-dir").map(|o| Path::new(o));
8198
let ofile = matches.opt_str("o").map(|o| Path::new(o));
@@ -383,14 +400,14 @@ fn parse_crate_attrs(sess: &Session, input: &Input) ->
383400
}
384401

385402
pub fn early_error(msg: &str) -> ! {
386-
let mut emitter = diagnostic::EmitterWriter::stderr(diagnostic::Auto);
387-
emitter.emit(None, msg, diagnostic::Fatal);
403+
let mut emitter = diagnostic::EmitterWriter::stderr(diagnostic::Auto, None);
404+
emitter.emit(None, msg, None, diagnostic::Fatal);
388405
fail!(diagnostic::FatalError);
389406
}
390407

391408
pub fn early_warn(msg: &str) {
392-
let mut emitter = diagnostic::EmitterWriter::stderr(diagnostic::Auto);
393-
emitter.emit(None, msg, diagnostic::Warning);
409+
let mut emitter = diagnostic::EmitterWriter::stderr(diagnostic::Auto, None);
410+
emitter.emit(None, msg, None, diagnostic::Warning);
394411
}
395412

396413
pub fn list_metadata(sess: &Session, path: &Path,
@@ -429,14 +446,15 @@ fn monitor(f: proc():Send) {
429446
Err(value) => {
430447
// Task failed without emitting a fatal diagnostic
431448
if !value.is::<diagnostic::FatalError>() {
432-
let mut emitter = diagnostic::EmitterWriter::stderr(diagnostic::Auto);
449+
let mut emitter = diagnostic::EmitterWriter::stderr(diagnostic::Auto, None);
433450

434451
// a .span_bug or .bug call has already printed what
435452
// it wants to print.
436453
if !value.is::<diagnostic::ExplicitBug>() {
437454
emitter.emit(
438455
None,
439456
"unexpected failure",
457+
None,
440458
diagnostic::Bug);
441459
}
442460

@@ -447,7 +465,7 @@ fn monitor(f: proc():Send) {
447465
"run with `RUST_BACKTRACE=1` for a backtrace".to_string(),
448466
];
449467
for note in xs.iter() {
450-
emitter.emit(None, note.as_slice(), diagnostic::Note)
468+
emitter.emit(None, note.as_slice(), None, diagnostic::Note)
451469
}
452470

453471
match r.read_to_string() {
@@ -457,6 +475,7 @@ fn monitor(f: proc():Send) {
457475
format!("failed to read internal \
458476
stderr: {}",
459477
e).as_slice(),
478+
None,
460479
diagnostic::Error)
461480
}
462481
}

branches/dist-snap/src/librustc/driver/session.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use util::nodemap::NodeMap;
2020
use syntax::ast::NodeId;
2121
use syntax::codemap::Span;
2222
use syntax::diagnostic;
23+
use syntax::diagnostics;
2324
use syntax::parse;
2425
use syntax::parse::token;
2526
use syntax::parse::ParseSess;
@@ -65,6 +66,9 @@ impl Session {
6566
pub fn span_err(&self, sp: Span, msg: &str) {
6667
self.diagnostic().span_err(sp, msg)
6768
}
69+
pub fn span_err_with_code(&self, sp: Span, msg: &str, code: &str) {
70+
self.diagnostic().span_err_with_code(sp, msg, code)
71+
}
6872
pub fn err(&self, msg: &str) {
6973
self.diagnostic().handler().err(msg)
7074
}
@@ -197,11 +201,12 @@ impl Session {
197201
}
198202

199203
pub fn build_session(sopts: config::Options,
200-
local_crate_source_file: Option<Path>)
204+
local_crate_source_file: Option<Path>,
205+
registry: diagnostics::registry::Registry)
201206
-> Session {
202207
let codemap = codemap::CodeMap::new();
203208
let diagnostic_handler =
204-
diagnostic::default_handler(sopts.color);
209+
diagnostic::default_handler(sopts.color, Some(registry));
205210
let span_diagnostic_handler =
206211
diagnostic::mk_span_handler(diagnostic_handler, codemap);
207212

branches/dist-snap/src/librustc/front/feature_gate.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
6666

6767
("quad_precision_float", Removed),
6868

69+
("rustc_diagnostic_macros", Active),
70+
6971
// A temporary feature gate used to enable parser extensions needed
7072
// to bootstrap fix for #5723.
7173
("issue_5723_bootstrap", Active),
@@ -93,6 +95,7 @@ pub struct Features {
9395
pub default_type_params: Cell<bool>,
9496
pub issue_5723_bootstrap: Cell<bool>,
9597
pub overloaded_calls: Cell<bool>,
98+
pub rustc_diagnostic_macros: Cell<bool>
9699
}
97100

98101
impl Features {
@@ -101,6 +104,7 @@ impl Features {
101104
default_type_params: Cell::new(false),
102105
issue_5723_bootstrap: Cell::new(false),
103106
overloaded_calls: Cell::new(false),
107+
rustc_diagnostic_macros: Cell::new(false)
104108
}
105109
}
106110
}
@@ -425,4 +429,5 @@ pub fn check_crate(sess: &Session, krate: &ast::Crate) {
425429
sess.features.default_type_params.set(cx.has_feature("default_type_params"));
426430
sess.features.issue_5723_bootstrap.set(cx.has_feature("issue_5723_bootstrap"));
427431
sess.features.overloaded_calls.set(cx.has_feature("overloaded_calls"));
432+
sess.features.rustc_diagnostic_macros.set(cx.has_feature("rustc_diagnostic_macros"));
428433
}

0 commit comments

Comments
 (0)