Skip to content

Rename 'rc' files and add a warnings lint attribute #7371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -239,29 +239,29 @@ $(foreach target,$(CFG_TARGET_TRIPLES),\
# Standard library variables
######################################################################

STDLIB_CRATE := $(S)src/libstd/core.rc
STDLIB_CRATE := $(S)src/libstd/std.rs
STDLIB_INPUTS := $(wildcard $(addprefix $(S)src/libstd/, \
core.rc *.rs */*.rs */*/*rs */*/*/*rs))
*.rs */*.rs */*/*rs */*/*/*rs))

######################################################################
# Extra library variables
######################################################################

EXTRALIB_CRATE := $(S)src/libextra/std.rc
EXTRALIB_CRATE := $(S)src/libextra/extra.rs
EXTRALIB_INPUTS := $(wildcard $(addprefix $(S)src/libextra/, \
std.rc *.rs */*.rs))
*.rs */*.rs))

######################################################################
# rustc crate variables
######################################################################

COMPILER_CRATE := $(S)src/librustc/rustc.rc
COMPILER_CRATE := $(S)src/librustc/rustc.rs
COMPILER_INPUTS := $(wildcard $(addprefix $(S)src/librustc/, \
rustc.rc *.rs */*.rs */*/*.rs */*/*/*.rs))
*.rs */*.rs */*/*.rs */*/*/*.rs))

LIBSYNTAX_CRATE := $(S)src/libsyntax/syntax.rc
LIBSYNTAX_CRATE := $(S)src/libsyntax/syntax.rs
LIBSYNTAX_INPUTS := $(wildcard $(addprefix $(S)src/libsyntax/, \
syntax.rc *.rs */*.rs */*/*.rs))
*.rs */*.rs */*/*.rs))

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

Expand Down
14 changes: 7 additions & 7 deletions mk/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@
# and host architectures

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

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

# Rustdoc, the documentation tool
RUSTDOC_LIB := $(S)src/librustdoc/rustdoc.rc
RUSTDOC_LIB := $(S)src/librustdoc/rustdoc.rs
RUSTDOC_INPUTS := $(wildcard $(S)src/librustdoc/*.rs)

# Rusti, the JIT REPL
RUSTI_LIB := $(S)src/librusti/rusti.rc
RUSTI_LIB := $(S)src/librusti/rusti.rs
RUSTI_INPUTS := $(wildcard $(S)src/librusti/*.rs)

# Rust, the convenience tool
RUST_LIB := $(S)src/librust/rust.rc
RUST_LIB := $(S)src/librust/rust.rs
RUST_INPUTS := $(wildcard $(S)src/librust/*.rs)

# FIXME: These are only built for the host arch. Eventually we'll
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 12 additions & 2 deletions src/librustc/middle/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ pub enum lint {

missing_doc,
unreachable_code,

warnings,
}

pub fn level_to_str(lv: level) -> &'static str {
Expand Down Expand Up @@ -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
}),
];

/*
Expand Down Expand Up @@ -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 {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 30 additions & 0 deletions src/test/compile-fail/lint-change-warnings.rs
Original file line number Diff line number Diff line change
@@ -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
}