Skip to content

Commit 032dcc5

Browse files
committed
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
2 parents d161e63 + 92424f0 commit 032dcc5

File tree

13 files changed

+57
-17
lines changed

13 files changed

+57
-17
lines changed

Makefile.in

+8-8
Original file line numberDiff line numberDiff line change
@@ -239,29 +239,29 @@ $(foreach target,$(CFG_TARGET_TRIPLES),\
239239
# Standard library variables
240240
######################################################################
241241

242-
STDLIB_CRATE := $(S)src/libstd/core.rc
242+
STDLIB_CRATE := $(S)src/libstd/std.rs
243243
STDLIB_INPUTS := $(wildcard $(addprefix $(S)src/libstd/, \
244-
core.rc *.rs */*.rs */*/*rs */*/*/*rs))
244+
*.rs */*.rs */*/*rs */*/*/*rs))
245245

246246
######################################################################
247247
# Extra library variables
248248
######################################################################
249249

250-
EXTRALIB_CRATE := $(S)src/libextra/std.rc
250+
EXTRALIB_CRATE := $(S)src/libextra/extra.rs
251251
EXTRALIB_INPUTS := $(wildcard $(addprefix $(S)src/libextra/, \
252-
std.rc *.rs */*.rs))
252+
*.rs */*.rs))
253253

254254
######################################################################
255255
# rustc crate variables
256256
######################################################################
257257

258-
COMPILER_CRATE := $(S)src/librustc/rustc.rc
258+
COMPILER_CRATE := $(S)src/librustc/rustc.rs
259259
COMPILER_INPUTS := $(wildcard $(addprefix $(S)src/librustc/, \
260-
rustc.rc *.rs */*.rs */*/*.rs */*/*/*.rs))
260+
*.rs */*.rs */*/*.rs */*/*/*.rs))
261261

262-
LIBSYNTAX_CRATE := $(S)src/libsyntax/syntax.rc
262+
LIBSYNTAX_CRATE := $(S)src/libsyntax/syntax.rs
263263
LIBSYNTAX_INPUTS := $(wildcard $(addprefix $(S)src/libsyntax/, \
264-
syntax.rc *.rs */*.rs */*/*.rs))
264+
*.rs */*.rs */*/*.rs))
265265

266266
DRIVER_CRATE := $(S)src/driver/driver.rs
267267

mk/tools.mk

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@
1212
# and host architectures
1313

1414
# The test runner that runs the cfail/rfail/rpass and bxench tests
15-
COMPILETEST_CRATE := $(S)src/compiletest/compiletest.rc
16-
COMPILETEST_INPUTS := $(wildcard $(S)src/compiletest/*rs)
15+
COMPILETEST_CRATE := $(S)src/compiletest/compiletest.rs
16+
COMPILETEST_INPUTS := $(wildcard $(S)src/compiletest/*.rs)
1717

1818
# Rustpkg, the package manager and build system
19-
RUSTPKG_LIB := $(S)src/librustpkg/rustpkg.rc
20-
RUSTPKG_INPUTS := $(wildcard $(S)src/librustpkg/*rs)
19+
RUSTPKG_LIB := $(S)src/librustpkg/rustpkg.rs
20+
RUSTPKG_INPUTS := $(wildcard $(S)src/librustpkg/*.rs)
2121

2222
# Rustdoc, the documentation tool
23-
RUSTDOC_LIB := $(S)src/librustdoc/rustdoc.rc
23+
RUSTDOC_LIB := $(S)src/librustdoc/rustdoc.rs
2424
RUSTDOC_INPUTS := $(wildcard $(S)src/librustdoc/*.rs)
2525

2626
# Rusti, the JIT REPL
27-
RUSTI_LIB := $(S)src/librusti/rusti.rc
27+
RUSTI_LIB := $(S)src/librusti/rusti.rs
2828
RUSTI_INPUTS := $(wildcard $(S)src/librusti/*.rs)
2929

3030
# Rust, the convenience tool
31-
RUST_LIB := $(S)src/librust/rust.rc
31+
RUST_LIB := $(S)src/librust/rust.rs
3232
RUST_INPUTS := $(wildcard $(S)src/librust/*.rs)
3333

3434
# FIXME: These are only built for the host arch. Eventually we'll
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/librustc/middle/lint.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ pub enum lint {
9696

9797
missing_doc,
9898
unreachable_code,
99+
100+
warnings,
99101
}
100102

101103
pub fn level_to_str(lv: level) -> &'static str {
@@ -280,6 +282,13 @@ static lint_table: &'static [(&'static str, LintSpec)] = &[
280282
desc: "detects unreachable code",
281283
default: warn
282284
}),
285+
286+
("warnings",
287+
LintSpec {
288+
lint: warnings,
289+
desc: "mass-change the level for lints which produce warnings",
290+
default: warn
291+
}),
283292
];
284293

285294
/*
@@ -362,10 +371,11 @@ impl Context {
362371

363372
fn span_lint(&self, lint: lint, span: span, msg: &str) {
364373
let (level, src) = match self.curr.find(&(lint as uint)) {
374+
None => { return }
375+
Some(&(warn, src)) => (self.get_level(warnings), src),
365376
Some(&pair) => pair,
366-
None => { return; }
367377
};
368-
if level == allow { return; }
378+
if level == allow { return }
369379

370380
let mut note = None;
371381
let msg = match src {
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright 2013 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+
#[deny(warnings)];
12+
13+
fn main() {
14+
while true {} //~ ERROR: infinite
15+
}
16+
17+
#[allow(warnings)]
18+
fn foo() {
19+
while true {}
20+
}
21+
22+
#[warn(warnings)]
23+
fn bar() {
24+
while true {} //~ WARNING: infinite
25+
}
26+
27+
#[forbid(warnings)]
28+
fn baz() {
29+
while true {} //~ ERROR: warnings
30+
}

0 commit comments

Comments
 (0)