about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-06-25 10:47:01 -0700
committerbors <bors@rust-lang.org>2013-06-25 10:47:01 -0700
commit032dcc57e8876e960837c3a050be2c7570e7eafd (patch)
tree0e63580109393a724f823d21c9668eb25466d796 /src
parentd161e630d8378e9705987e0b746d8dbf0da48842 (diff)
parent92424f0670723e417a96a96310a6ad871994c6b7 (diff)
downloadrust-032dcc57e8876e960837c3a050be2c7570e7eafd.tar.gz
rust-032dcc57e8876e960837c3a050be2c7570e7eafd.zip
auto merge of #7371 : alexcrichton/rust/trying, r=cmr
This is an attempt at a smaller request than #7113, it's just the first two commits
Diffstat (limited to 'src')
-rw-r--r--src/compiletest/compiletest.rs (renamed from src/compiletest/compiletest.rc)0
-rw-r--r--src/libextra/extra.rs (renamed from src/libextra/std.rc)0
-rw-r--r--src/librust/rust.rs (renamed from src/librust/rust.rc)0
-rw-r--r--src/librustc/middle/lint.rs14
-rw-r--r--src/librustc/rustc.rs (renamed from src/librustc/rustc.rc)0
-rw-r--r--src/librustdoc/rustdoc.rs (renamed from src/librustdoc/rustdoc.rc)0
-rw-r--r--src/librusti/rusti.rs (renamed from src/librusti/rusti.rc)0
-rw-r--r--src/librustpkg/rustpkg.rs (renamed from src/librustpkg/rustpkg.rc)0
-rw-r--r--src/libstd/std.rs (renamed from src/libstd/core.rc)0
-rw-r--r--src/libsyntax/syntax.rs (renamed from src/libsyntax/syntax.rc)0
-rw-r--r--src/test/compile-fail/lint-change-warnings.rs30
11 files changed, 42 insertions, 2 deletions
diff --git a/src/compiletest/compiletest.rc b/src/compiletest/compiletest.rs
index e8876c4851b..e8876c4851b 100644
--- a/src/compiletest/compiletest.rc
+++ b/src/compiletest/compiletest.rs
diff --git a/src/libextra/std.rc b/src/libextra/extra.rs
index 11aebdf467f..11aebdf467f 100644
--- a/src/libextra/std.rc
+++ b/src/libextra/extra.rs
diff --git a/src/librust/rust.rc b/src/librust/rust.rs
index 68427745ff5..68427745ff5 100644
--- a/src/librust/rust.rc
+++ b/src/librust/rust.rs
diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs
index 17ff5930078..5c36ab7750c 100644
--- a/src/librustc/middle/lint.rs
+++ b/src/librustc/middle/lint.rs
@@ -96,6 +96,8 @@ pub enum lint {
 
     missing_doc,
     unreachable_code,
+
+    warnings,
 }
 
 pub fn level_to_str(lv: level) -> &'static str {
@@ -280,6 +282,13 @@ static lint_table: &'static [(&'static str, LintSpec)] = &[
         desc: "detects unreachable code",
         default: warn
     }),
+
+    ("warnings",
+     LintSpec {
+        lint: warnings,
+        desc: "mass-change the level for lints which produce warnings",
+        default: warn
+    }),
 ];
 
 /*
@@ -362,10 +371,11 @@ impl Context {
 
     fn span_lint(&self, lint: lint, span: span, msg: &str) {
         let (level, src) = match self.curr.find(&(lint as uint)) {
+            None => { return }
+            Some(&(warn, src)) => (self.get_level(warnings), src),
             Some(&pair) => pair,
-            None => { return; }
         };
-        if level == allow { return; }
+        if level == allow { return }
 
         let mut note = None;
         let msg = match src {
diff --git a/src/librustc/rustc.rc b/src/librustc/rustc.rs
index 20705b3d797..20705b3d797 100644
--- a/src/librustc/rustc.rc
+++ b/src/librustc/rustc.rs
diff --git a/src/librustdoc/rustdoc.rc b/src/librustdoc/rustdoc.rs
index d02620229f5..d02620229f5 100644
--- a/src/librustdoc/rustdoc.rc
+++ b/src/librustdoc/rustdoc.rs
diff --git a/src/librusti/rusti.rc b/src/librusti/rusti.rs
index 57a2a48a0f6..57a2a48a0f6 100644
--- a/src/librusti/rusti.rc
+++ b/src/librusti/rusti.rs
diff --git a/src/librustpkg/rustpkg.rc b/src/librustpkg/rustpkg.rs
index 9242e450e24..9242e450e24 100644
--- a/src/librustpkg/rustpkg.rc
+++ b/src/librustpkg/rustpkg.rs
diff --git a/src/libstd/core.rc b/src/libstd/std.rs
index 13c54799fac..13c54799fac 100644
--- a/src/libstd/core.rc
+++ b/src/libstd/std.rs
diff --git a/src/libsyntax/syntax.rc b/src/libsyntax/syntax.rs
index 278600bc039..278600bc039 100644
--- a/src/libsyntax/syntax.rc
+++ b/src/libsyntax/syntax.rs
diff --git a/src/test/compile-fail/lint-change-warnings.rs b/src/test/compile-fail/lint-change-warnings.rs
new file mode 100644
index 00000000000..977abc4dc0d
--- /dev/null
+++ b/src/test/compile-fail/lint-change-warnings.rs
@@ -0,0 +1,30 @@
+// Copyright 2013 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.
+
+#[deny(warnings)];
+
+fn main() {
+    while true {} //~ ERROR: infinite
+}
+
+#[allow(warnings)]
+fn foo() {
+    while true {}
+}
+
+#[warn(warnings)]
+fn bar() {
+    while true {} //~ WARNING: infinite
+}
+
+#[forbid(warnings)]
+fn baz() {
+    while true {} //~ ERROR: warnings
+}