From 62792f09f20221add2484608fc3071259067b79a Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Thu, 13 Mar 2014 18:53:14 +1100 Subject: lint: add lint for use of a `~[T]`. This is useless at the moment (since pretty much every crate uses `~[]`), but should help avoid regressions once completely removed from a crate. --- src/test/compile-fail/issue-2150.rs | 1 + src/test/compile-fail/issue-8727.rs | 1 + src/test/compile-fail/lint-deprecated-owned-vector.rs | 17 +++++++++++++++++ src/test/compile-fail/lint-heap-memory.rs | 1 + src/test/compile-fail/lint-unused-imports.rs | 1 + src/test/compile-fail/lint-unused-mut-variables.rs | 1 + src/test/compile-fail/lint-unused-unsafe.rs | 1 + 7 files changed, 23 insertions(+) create mode 100644 src/test/compile-fail/lint-deprecated-owned-vector.rs (limited to 'src/test/compile-fail') diff --git a/src/test/compile-fail/issue-2150.rs b/src/test/compile-fail/issue-2150.rs index 2c54b622021..b5269519bb7 100644 --- a/src/test/compile-fail/issue-2150.rs +++ b/src/test/compile-fail/issue-2150.rs @@ -11,6 +11,7 @@ #[deny(unreachable_code)]; #[allow(unused_variable)]; #[allow(dead_code)]; +#[allow(deprecated_owned_vector)]; fn fail_len(v: ~[int]) -> uint { let mut i = 3; diff --git a/src/test/compile-fail/issue-8727.rs b/src/test/compile-fail/issue-8727.rs index fca59ed74ee..be676becd5a 100644 --- a/src/test/compile-fail/issue-8727.rs +++ b/src/test/compile-fail/issue-8727.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[allow(deprecated_owned_vector)]; // Verify the compiler fails with an error on infinite function // recursions. diff --git a/src/test/compile-fail/lint-deprecated-owned-vector.rs b/src/test/compile-fail/lint-deprecated-owned-vector.rs new file mode 100644 index 00000000000..c21ca87e244 --- /dev/null +++ b/src/test/compile-fail/lint-deprecated-owned-vector.rs @@ -0,0 +1,17 @@ +// Copyright 2014 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[deny(deprecated_owned_vector)]; + +fn main() { + ~[1]; //~ ERROR use of deprecated `~[]` + //~^ ERROR use of deprecated `~[]` + std::vec::with_capacity::(10); //~ ERROR use of deprecated `~[]` +} diff --git a/src/test/compile-fail/lint-heap-memory.rs b/src/test/compile-fail/lint-heap-memory.rs index fa359dcd538..4c178cdf65c 100644 --- a/src/test/compile-fail/lint-heap-memory.rs +++ b/src/test/compile-fail/lint-heap-memory.rs @@ -11,6 +11,7 @@ #[feature(managed_boxes)]; #[forbid(heap_memory)]; #[allow(dead_code)]; +#[allow(deprecated_owned_vector)]; struct Foo { x: @int //~ ERROR type uses managed diff --git a/src/test/compile-fail/lint-unused-imports.rs b/src/test/compile-fail/lint-unused-imports.rs index 8d294af3e3e..c20546d8590 100644 --- a/src/test/compile-fail/lint-unused-imports.rs +++ b/src/test/compile-fail/lint-unused-imports.rs @@ -11,6 +11,7 @@ #[feature(globs)]; #[deny(unused_imports)]; #[allow(dead_code)]; +#[allow(deprecated_owned_vector)]; use cal = bar::c::cc; diff --git a/src/test/compile-fail/lint-unused-mut-variables.rs b/src/test/compile-fail/lint-unused-mut-variables.rs index 271aedd3f6a..6b6311739f0 100644 --- a/src/test/compile-fail/lint-unused-mut-variables.rs +++ b/src/test/compile-fail/lint-unused-mut-variables.rs @@ -13,6 +13,7 @@ #[allow(dead_assignment)]; #[allow(unused_variable)]; #[allow(dead_code)]; +#[allow(deprecated_owned_vector)]; #[deny(unused_mut)]; fn main() { diff --git a/src/test/compile-fail/lint-unused-unsafe.rs b/src/test/compile-fail/lint-unused-unsafe.rs index 96a4c2adca3..de01a711a3e 100644 --- a/src/test/compile-fail/lint-unused-unsafe.rs +++ b/src/test/compile-fail/lint-unused-unsafe.rs @@ -12,6 +12,7 @@ #[allow(dead_code)]; #[deny(unused_unsafe)]; +#[allow(deprecated_owned_vector)]; mod foo { extern { -- cgit 1.4.1-3-g733a5