diff options
| author | bors <bors@rust-lang.org> | 2016-01-15 23:26:38 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-01-15 23:26:38 +0000 |
| commit | cee9463d24ee3e5682888aa4ddfbcfc01a1f5e83 (patch) | |
| tree | 8aee2b144b34ac5ef24ac994759aa77d5d8a9ec9 /src/test | |
| parent | 683af0d9e09d799e74cef5f3d0dd1ed7c74c093b (diff) | |
| parent | ca81d3dddc19d05aa731faeb888a68d8846441b3 (diff) | |
| download | rust-cee9463d24ee3e5682888aa4ddfbcfc01a1f5e83.tar.gz rust-cee9463d24ee3e5682888aa4ddfbcfc01a1f5e83.zip | |
Auto merge of #30878 - brson:raw-pointer-derive, r=brson
This adds back the raw_pointer_derive lint as a 'removed' lint, so that its removal does not cause errors (#30346) but warnings. In the process I discovered regressions in the code for renamed and removed lints, which didn't appear to have any tests. The addition of a second lint pass (ast vs. hir) meant that attributes were being inspected twice, renamed and removed warnings printed twice. I restructured the code so these tests are only done once and added tests. Unfortunately it makes the patch more complicated for the needed beta backport. r? @nikomatsakis
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/lint-malformed.rs | 14 | ||||
| -rw-r--r-- | src/test/compile-fail/lint-removed-cmdline.rs | 20 | ||||
| -rw-r--r-- | src/test/compile-fail/lint-removed.rs | 16 | ||||
| -rw-r--r-- | src/test/compile-fail/lint-renamed-cmdline.rs | 18 | ||||
| -rw-r--r-- | src/test/compile-fail/lint-renamed.rs | 13 | ||||
| -rw-r--r-- | src/test/compile-fail/lint-unknown-lint-cmdline.rs | 16 | ||||
| -rw-r--r-- | src/test/compile-fail/lint-unknown-lint.rs | 13 |
7 files changed, 110 insertions, 0 deletions
diff --git a/src/test/compile-fail/lint-malformed.rs b/src/test/compile-fail/lint-malformed.rs new file mode 100644 index 00000000000..592e2b11905 --- /dev/null +++ b/src/test/compile-fail/lint-malformed.rs @@ -0,0 +1,14 @@ +// Copyright 2016 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 = "foo"] //~ ERR malformed lint attribute +#![allow(bar = "baz")] //~ ERR malformed lint attribute + +fn main() { } diff --git a/src/test/compile-fail/lint-removed-cmdline.rs b/src/test/compile-fail/lint-removed-cmdline.rs new file mode 100644 index 00000000000..d6bfd1eec39 --- /dev/null +++ b/src/test/compile-fail/lint-removed-cmdline.rs @@ -0,0 +1,20 @@ +// Copyright 2016 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. + +// The raw_pointer_derived lint warns about its removal +// cc #30346 + +// compile-flags:-D raw_pointer_derive + +// error-pattern:lint raw_pointer_derive has been removed +// error-pattern:requested on the command line with `-D raw_pointer_derive` + +#[deny(warnings)] +fn main() { let unused = (); } diff --git a/src/test/compile-fail/lint-removed.rs b/src/test/compile-fail/lint-removed.rs new file mode 100644 index 00000000000..e196e128b17 --- /dev/null +++ b/src/test/compile-fail/lint-removed.rs @@ -0,0 +1,16 @@ +// Copyright 2016 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. + +// The raw_pointer_derived lint only warns about its own removal +// cc #30346 + +#[deny(raw_pointer_derive)] //~ WARN raw_pointer_derive has been removed +#[deny(warnings)] +fn main() { let unused = (); } //~ ERR unused diff --git a/src/test/compile-fail/lint-renamed-cmdline.rs b/src/test/compile-fail/lint-renamed-cmdline.rs new file mode 100644 index 00000000000..3b352b384ff --- /dev/null +++ b/src/test/compile-fail/lint-renamed-cmdline.rs @@ -0,0 +1,18 @@ +// Copyright 2016 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. + +// compile-flags:-D unknown_features + +// error-pattern:lint unknown_features has been renamed to unused_features +// error-pattern:requested on the command line with `-D unknown_features` +// error-pattern:unused + +#[deny(unused)] +fn main() { let unused = (); } diff --git a/src/test/compile-fail/lint-renamed.rs b/src/test/compile-fail/lint-renamed.rs new file mode 100644 index 00000000000..2e85a323a1c --- /dev/null +++ b/src/test/compile-fail/lint-renamed.rs @@ -0,0 +1,13 @@ +// Copyright 2016 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(unknown_features)] //~ WARN lint unknown_features has been renamed to unused_features +#[deny(unused)] +fn main() { let unused = (); } //~ ERR unused diff --git a/src/test/compile-fail/lint-unknown-lint-cmdline.rs b/src/test/compile-fail/lint-unknown-lint-cmdline.rs new file mode 100644 index 00000000000..0c41959f8a7 --- /dev/null +++ b/src/test/compile-fail/lint-unknown-lint-cmdline.rs @@ -0,0 +1,16 @@ +// Copyright 2016 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. + +// compile-flags:-D bogus + +// error-pattern:unknown lint +// error-pattern:requested on the command line with `-D bogus` + +fn main() { } diff --git a/src/test/compile-fail/lint-unknown-lint.rs b/src/test/compile-fail/lint-unknown-lint.rs new file mode 100644 index 00000000000..8f20a2c8ab7 --- /dev/null +++ b/src/test/compile-fail/lint-unknown-lint.rs @@ -0,0 +1,13 @@ +// Copyright 2016 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. + +#![allow(not_a_real_lint)] //~ WARN unknown lint +#![deny(unused)] +fn main() { let unused = (); } //~ ERR unused variable |
