Add lint modes for uses of @ and ~ pointers, in general.
This commit is contained in:
parent
b769e29680
commit
ecb646477b
4 changed files with 119 additions and 1 deletions
11
src/test/compile-fail/lint-heap-memory.rs
Normal file
11
src/test/compile-fail/lint-heap-memory.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#[forbid(heap_memory)];
|
||||
|
||||
type foo = { //~ ERROR type uses managed
|
||||
x: @int
|
||||
};
|
||||
|
||||
fn main() {
|
||||
let _x : { x : ~int } = {x : ~10};
|
||||
//~^ ERROR type uses owned
|
||||
//~^^ ERROR type uses owned
|
||||
}
|
||||
11
src/test/compile-fail/lint-managed-heap-memory.rs
Normal file
11
src/test/compile-fail/lint-managed-heap-memory.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#[forbid(managed_heap_memory)];
|
||||
|
||||
type foo = { //~ ERROR type uses managed
|
||||
x: @int
|
||||
};
|
||||
|
||||
fn main() {
|
||||
let _x : foo = {x : @10};
|
||||
//~^ ERROR type uses managed
|
||||
//~^^ ERROR type uses managed
|
||||
}
|
||||
11
src/test/compile-fail/lint-owned-heap-memory.rs
Normal file
11
src/test/compile-fail/lint-owned-heap-memory.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#[forbid(owned_heap_memory)];
|
||||
|
||||
type foo = { //~ ERROR type uses owned
|
||||
x: ~int
|
||||
};
|
||||
|
||||
fn main() {
|
||||
let _x : foo = {x : ~10};
|
||||
//~^ ERROR type uses owned
|
||||
//~^^ ERROR type uses owned
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue