auto merge of #12861 : huonw/rust/lint-owned-vecs, r=thestinger
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.
This commit is contained in:
commit
b35e8fbfcb
34 changed files with 79 additions and 3 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
17
src/test/compile-fail/lint-deprecated-owned-vector.rs
Normal file
17
src/test/compile-fail/lint-deprecated-owned-vector.rs
Normal file
|
|
@ -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 <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(deprecated_owned_vector)];
|
||||
|
||||
fn main() {
|
||||
~[1]; //~ ERROR use of deprecated `~[]`
|
||||
//~^ ERROR use of deprecated `~[]`
|
||||
std::vec::with_capacity::<int>(10); //~ ERROR use of deprecated `~[]`
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#[feature(globs)];
|
||||
#[deny(unused_imports)];
|
||||
#[allow(dead_code)];
|
||||
#[allow(deprecated_owned_vector)];
|
||||
|
||||
use cal = bar::c::cc;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#[allow(dead_assignment)];
|
||||
#[allow(unused_variable)];
|
||||
#[allow(dead_code)];
|
||||
#[allow(deprecated_owned_vector)];
|
||||
#[deny(unused_mut)];
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#[allow(dead_code)];
|
||||
#[deny(unused_unsafe)];
|
||||
#[allow(deprecated_owned_vector)];
|
||||
|
||||
mod foo {
|
||||
extern {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#[feature(macro_rules)];
|
||||
#[deny(warnings)];
|
||||
#[allow(unused_must_use)];
|
||||
#[allow(deprecated_owned_vector)];
|
||||
|
||||
use std::fmt;
|
||||
use std::io::MemWriter;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue