change the test suite //! kind
syntax to //~ kind
in order to avoid a
conflict with the new single-line-sugared-inner-doc-comment (`//! ...`).
This commit is contained in:
parent
0b653ab953
commit
6d86969260
253 changed files with 596 additions and 596 deletions
|
@ -21,14 +21,14 @@ fn load_errors(testfile: str) -> [expected_error]/~ {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_expected(line_num: uint, line: str) -> [expected_error]/~ unsafe {
|
fn parse_expected(line_num: uint, line: str) -> [expected_error]/~ unsafe {
|
||||||
let error_tag = "//!";
|
let error_tag = "//~";
|
||||||
let mut idx;
|
let mut idx;
|
||||||
alt str::find_str(line, error_tag) {
|
alt str::find_str(line, error_tag) {
|
||||||
option::none { ret []/~; }
|
option::none { ret []/~; }
|
||||||
option::some(nn) { idx = (nn as uint) + str::len(error_tag); }
|
option::some(nn) { idx = (nn as uint) + str::len(error_tag); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// "//!^^^ kind msg" denotes a message expected
|
// "//~^^^ kind msg" denotes a message expected
|
||||||
// three lines above current line:
|
// three lines above current line:
|
||||||
let mut adjust_line = 0u;
|
let mut adjust_line = 0u;
|
||||||
let len = str::len(line);
|
let len = str::len(line);
|
||||||
|
|
|
@ -6,6 +6,6 @@ fn my_fail() -> ! { fail; }
|
||||||
fn main() {
|
fn main() {
|
||||||
alt true { false { my_fail(); } true { } }
|
alt true { false { my_fail(); } true { } }
|
||||||
|
|
||||||
log(debug, x); //! ERROR unresolved name: x
|
log(debug, x); //~ ERROR unresolved name: x
|
||||||
let x: int;
|
let x: int;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ fn main() {
|
||||||
rgb(_, _, _) { }
|
rgb(_, _, _) { }
|
||||||
cmyk(_, _, _, _) { }
|
cmyk(_, _, _, _) { }
|
||||||
no_color(_) { }
|
no_color(_) { }
|
||||||
//!^ ERROR this pattern has 1 field, but the corresponding variant has no fields
|
//~^ ERROR this pattern has 1 field, but the corresponding variant has no fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ fn main() {
|
||||||
fn foo(c: color) {
|
fn foo(c: color) {
|
||||||
alt c {
|
alt c {
|
||||||
rgb(_, _) { }
|
rgb(_, _) { }
|
||||||
//!^ ERROR this pattern has 2 fields, but the corresponding variant has 3 fields
|
//~^ ERROR this pattern has 2 fields, but the corresponding variant has 3 fields
|
||||||
cmyk(_, _, _, _) { }
|
cmyk(_, _, _, _) { }
|
||||||
no_color { }
|
no_color { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
impl methods1 for uint { fn me() -> uint { self } } //! NOTE candidate #1 is `methods1::me`
|
impl methods1 for uint { fn me() -> uint { self } } //~ NOTE candidate #1 is `methods1::me`
|
||||||
impl methods2 for uint { fn me() -> uint { self } } //! NOTE candidate #2 is `methods2::me`
|
impl methods2 for uint { fn me() -> uint { self } } //~ NOTE candidate #2 is `methods2::me`
|
||||||
fn main() { 1u.me(); } //! ERROR multiple applicable methods in scope
|
fn main() { 1u.me(); } //~ ERROR multiple applicable methods in scope
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
// aux-build:ambig_impl_2_lib.rs
|
// aux-build:ambig_impl_2_lib.rs
|
||||||
use ambig_impl_2_lib;
|
use ambig_impl_2_lib;
|
||||||
import ambig_impl_2_lib::methods1;
|
import ambig_impl_2_lib::methods1;
|
||||||
impl methods2 for uint { fn me() -> uint { self } } //! NOTE candidate #2 is `methods2::me`
|
impl methods2 for uint { fn me() -> uint { self } } //~ NOTE candidate #2 is `methods2::me`
|
||||||
fn main() { 1u.me(); } //! ERROR multiple applicable methods in scope
|
fn main() { 1u.me(); } //~ ERROR multiple applicable methods in scope
|
||||||
//!^ NOTE candidate #1 is `ambig_impl_2_lib::methods1::me`
|
//~^ NOTE candidate #1 is `ambig_impl_2_lib::methods1::me`
|
||||||
|
|
|
@ -2,9 +2,9 @@ iface A { fn foo(); }
|
||||||
iface B { fn foo(); }
|
iface B { fn foo(); }
|
||||||
|
|
||||||
fn foo<T: A B>(t: T) {
|
fn foo<T: A B>(t: T) {
|
||||||
t.foo(); //! ERROR multiple applicable methods in scope
|
t.foo(); //~ ERROR multiple applicable methods in scope
|
||||||
//!^ NOTE candidate #1 derives from the bound `A`
|
//~^ NOTE candidate #1 derives from the bound `A`
|
||||||
//!^^ NOTE candidate #2 derives from the bound `B`
|
//~^^ NOTE candidate #2 derives from the bound `B`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
|
@ -1,12 +1,12 @@
|
||||||
impl methods for [uint]/~ {
|
impl methods for [uint]/~ {
|
||||||
fn foo() -> int {1} //! NOTE candidate #1 is `methods::foo`
|
fn foo() -> int {1} //~ NOTE candidate #1 is `methods::foo`
|
||||||
}
|
}
|
||||||
|
|
||||||
impl methods for [int]/~ {
|
impl methods for [int]/~ {
|
||||||
fn foo() -> int {2} //! NOTE candidate #2 is `methods::foo`
|
fn foo() -> int {2} //~ NOTE candidate #2 is `methods::foo`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = []/~;
|
let x = []/~;
|
||||||
x.foo(); //! ERROR multiple applicable methods in scope
|
x.foo(); //~ ERROR multiple applicable methods in scope
|
||||||
}
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
fn test() {
|
fn test() {
|
||||||
let v: int;
|
let v: int;
|
||||||
v = 1; //! NOTE prior assignment occurs here
|
v = 1; //~ NOTE prior assignment occurs here
|
||||||
#debug["v=%d", v];
|
#debug["v=%d", v];
|
||||||
v = 2; //! ERROR re-assignment of immutable variable
|
v = 2; //~ ERROR re-assignment of immutable variable
|
||||||
#debug["v=%d", v];
|
#debug["v=%d", v];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut x: [mut int]/~ = [mut 3]/~;
|
let mut x: [mut int]/~ = [mut 3]/~;
|
||||||
let y: [int]/~ = [3]/~;
|
let y: [int]/~ = [3]/~;
|
||||||
x = y; //! ERROR values differ in mutability
|
x = y; //~ ERROR values differ in mutability
|
||||||
}
|
}
|
|
@ -11,5 +11,5 @@ class cat {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let nyan : cat = cat(52u, 99);
|
let nyan : cat = cat(52u, 99);
|
||||||
nyan.speak = fn@() { #debug["meow"]; }; //! ERROR assigning to method
|
nyan.speak = fn@() { #debug["meow"]; }; //~ ERROR assigning to method
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Check that bogus field access is non-fatal
|
// Check that bogus field access is non-fatal
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = 0;
|
let x = 0;
|
||||||
log(debug, x.foo); //! ERROR attempted access of field
|
log(debug, x.foo); //~ ERROR attempted access of field
|
||||||
log(debug, x.bar); //! ERROR attempted access of field
|
log(debug, x.bar); //~ ERROR attempted access of field
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
#[attr]
|
#[attr]
|
||||||
#debug("hi"); //! ERROR expected item
|
#debug("hi"); //~ ERROR expected item
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
#[attr]
|
#[attr]
|
||||||
let _i = 0; //! ERROR expected item
|
let _i = 0; //~ ERROR expected item
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
fn bad_bang(i: uint) -> ! {
|
fn bad_bang(i: uint) -> ! {
|
||||||
ret 7u;
|
ret 7u;
|
||||||
//!^ ERROR expected `_|_` but found `uint`
|
//~^ ERROR expected `_|_` but found `uint`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { bad_bang(5u); }
|
fn main() { bad_bang(5u); }
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
fn bad_bang(i: uint) -> ! {
|
fn bad_bang(i: uint) -> ! {
|
||||||
if i < 0u { } else { fail; }
|
if i < 0u { } else { fail; }
|
||||||
//!^ ERROR expected `_|_` but found `()`
|
//~^ ERROR expected `_|_` but found `()`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { bad_bang(5u); }
|
fn main() { bad_bang(5u); }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
fn baz(_x: fn() -> int) {}
|
fn baz(_x: fn() -> int) {}
|
||||||
for baz {|_e| } //! ERROR should return `bool`
|
for baz {|_e| } //~ ERROR should return `bool`
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
fn foo<T>() {
|
fn foo<T>() {
|
||||||
1u.bar::<T>(); //! ERROR: missing `copy`
|
1u.bar::<T>(); //~ ERROR: missing `copy`
|
||||||
}
|
}
|
||||||
|
|
||||||
impl methods for uint {
|
impl methods for uint {
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
fn false() { } //! ERROR found `false` in restricted position
|
fn false() { } //~ ERROR found `false` in restricted position
|
||||||
fn main() { }
|
fn main() { }
|
|
@ -1,2 +1,2 @@
|
||||||
fn true() { } //! ERROR found `true` in restricted position
|
fn true() { } //~ ERROR found `true` in restricted position
|
||||||
fn main() { }
|
fn main() { }
|
|
@ -2,6 +2,6 @@ fn main() {
|
||||||
let x = 3;
|
let x = 3;
|
||||||
fn blah(_a: native fn()) {}
|
fn blah(_a: native fn()) {}
|
||||||
blah({||
|
blah({||
|
||||||
log(debug, x); //! ERROR attempted dynamic environment capture
|
log(debug, x); //~ ERROR attempted dynamic environment capture
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
fn f() -> ! {
|
fn f() -> ! {
|
||||||
3i //! ERROR expected `_|_` but found `int`
|
3i //~ ERROR expected `_|_` but found `int`
|
||||||
}
|
}
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -4,5 +4,5 @@ fn main() {
|
||||||
let x = true;
|
let x = true;
|
||||||
let y = 1;
|
let y = 1;
|
||||||
let z = x + y;
|
let z = x + y;
|
||||||
//!^ ERROR binary operation + cannot be applied to type `bool`
|
//~^ ERROR binary operation + cannot be applied to type `bool`
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ fn compute1() -> float {
|
||||||
let v = [0f, 1f, 2f, 3f]/~;
|
let v = [0f, 1f, 2f, 3f]/~;
|
||||||
|
|
||||||
vec::foldl(0f, v) { |x, y| x + y } - 10f
|
vec::foldl(0f, v) { |x, y| x + y } - 10f
|
||||||
//!^ ERROR mismatched types: expected `()`
|
//~^ ERROR mismatched types: expected `()`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -9,5 +9,5 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
f(g);
|
f(g);
|
||||||
//!^ ERROR mismatched types: expected `extern fn(extern fn(extern fn()))`
|
//~^ ERROR mismatched types: expected `extern fn(extern fn(extern fn()))`
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ fn coerce(b: fn()) -> native fn() {
|
||||||
g: fn()) -> native fn() { ret f(g); }
|
g: fn()) -> native fn() { ret f(g); }
|
||||||
fn fn_id(f: native fn()) -> native fn() { ret f }
|
fn fn_id(f: native fn()) -> native fn() { ret f }
|
||||||
ret lol(fn_id, b);
|
ret lol(fn_id, b);
|
||||||
//!^ ERROR mismatched types: expected `extern fn(fn()) -> extern fn()`
|
//~^ ERROR mismatched types: expected `extern fn(fn()) -> extern fn()`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -4,9 +4,9 @@ fn a() {
|
||||||
let mut p = [mut 1]/~;
|
let mut p = [mut 1]/~;
|
||||||
|
|
||||||
// Create an immutable pointer into p's contents:
|
// Create an immutable pointer into p's contents:
|
||||||
let _q: &int = &p[0]; //! NOTE loan of mutable vec content granted here
|
let _q: &int = &p[0]; //~ NOTE loan of mutable vec content granted here
|
||||||
|
|
||||||
p[0] = 5; //! ERROR assigning to mutable vec content prohibited due to outstanding loan
|
p[0] = 5; //~ ERROR assigning to mutable vec content prohibited due to outstanding loan
|
||||||
}
|
}
|
||||||
|
|
||||||
fn borrow(_x: [int]/&, _f: fn()) {}
|
fn borrow(_x: [int]/&, _f: fn()) {}
|
||||||
|
@ -17,8 +17,8 @@ fn b() {
|
||||||
|
|
||||||
let mut p = [mut 1]/~;
|
let mut p = [mut 1]/~;
|
||||||
|
|
||||||
borrow(p) {|| //! NOTE loan of mutable vec content granted here
|
borrow(p) {|| //~ NOTE loan of mutable vec content granted here
|
||||||
p[0] = 5; //! ERROR assigning to mutable vec content prohibited due to outstanding loan
|
p[0] = 5; //~ ERROR assigning to mutable vec content prohibited due to outstanding loan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,12 @@ type point = { x: int, y: int };
|
||||||
|
|
||||||
fn a() {
|
fn a() {
|
||||||
let mut p = {x: 3, y: 4};
|
let mut p = {x: 3, y: 4};
|
||||||
let _q = &p; //! NOTE loan of mutable local variable granted here
|
let _q = &p; //~ NOTE loan of mutable local variable granted here
|
||||||
|
|
||||||
// This assignment is illegal because the field x is not
|
// This assignment is illegal because the field x is not
|
||||||
// inherently mutable; since `p` was made immutable, `p.x` is now
|
// inherently mutable; since `p` was made immutable, `p.x` is now
|
||||||
// immutable. Otherwise the type of &_q.x (&int) would be wrong.
|
// immutable. Otherwise the type of &_q.x (&int) would be wrong.
|
||||||
p.x = 5; //! ERROR assigning to mutable field prohibited due to outstanding loan
|
p.x = 5; //~ ERROR assigning to mutable field prohibited due to outstanding loan
|
||||||
}
|
}
|
||||||
|
|
||||||
fn b() {
|
fn b() {
|
||||||
|
@ -24,8 +24,8 @@ fn c() {
|
||||||
// and then try to overwrite `p` as a whole.
|
// and then try to overwrite `p` as a whole.
|
||||||
|
|
||||||
let mut p = {x: 3, mut y: 4};
|
let mut p = {x: 3, mut y: 4};
|
||||||
let _q = &p.y; //! NOTE loan of mutable local variable granted here
|
let _q = &p.y; //~ NOTE loan of mutable local variable granted here
|
||||||
p = {x: 5, mut y: 7};//! ERROR assigning to mutable local variable prohibited due to outstanding loan
|
p = {x: 5, mut y: 7};//~ ERROR assigning to mutable local variable prohibited due to outstanding loan
|
||||||
copy p;
|
copy p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@ fn d() {
|
||||||
// address of a subcomponent and then modify that subcomponent:
|
// address of a subcomponent and then modify that subcomponent:
|
||||||
|
|
||||||
let mut p = {x: 3, mut y: 4};
|
let mut p = {x: 3, mut y: 4};
|
||||||
let _q = &p.y; //! NOTE loan of mutable field granted here
|
let _q = &p.y; //~ NOTE loan of mutable field granted here
|
||||||
p.y = 5; //! ERROR assigning to mutable field prohibited due to outstanding loan
|
p.y = 5; //~ ERROR assigning to mutable field prohibited due to outstanding loan
|
||||||
copy p;
|
copy p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,6 @@ const foo: int = 5;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// assigning to various global constants
|
// assigning to various global constants
|
||||||
none = some(3); //! ERROR assigning to static item
|
none = some(3); //~ ERROR assigning to static item
|
||||||
foo = 6; //! ERROR assigning to static item
|
foo = 6; //~ ERROR assigning to static item
|
||||||
}
|
}
|
|
@ -2,5 +2,5 @@ enum foo = int;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = foo(3);
|
let x = foo(3);
|
||||||
*x = 4; //! ERROR assigning to enum content
|
*x = 4; //~ ERROR assigning to enum content
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@ fn main() {
|
||||||
|
|
||||||
// in these cases we pass through a box, so the mut
|
// in these cases we pass through a box, so the mut
|
||||||
// of the box is dominant
|
// of the box is dominant
|
||||||
p.x.a = 2; //! ERROR assigning to immutable field
|
p.x.a = 2; //~ ERROR assigning to immutable field
|
||||||
p.y.a = 2; //! ERROR assigning to const field
|
p.y.a = 2; //~ ERROR assigning to const field
|
||||||
p.z.a = 2;
|
p.z.a = 2;
|
||||||
}
|
}
|
|
@ -6,8 +6,8 @@ fn main() {
|
||||||
|
|
||||||
alt x {
|
alt x {
|
||||||
{f: v} => {
|
{f: v} => {
|
||||||
impure(v); //! ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
impure(v); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = some(~1);
|
let x = some(~1);
|
||||||
alt x { //! NOTE loan of immutable local variable granted here
|
alt x { //~ NOTE loan of immutable local variable granted here
|
||||||
some(y) {
|
some(y) {
|
||||||
let _a <- x; //! ERROR moving out of immutable local variable prohibited due to outstanding loan
|
let _a <- x; //~ ERROR moving out of immutable local variable prohibited due to outstanding loan
|
||||||
}
|
}
|
||||||
_ {}
|
_ {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ fn main() {
|
||||||
let x = some(~1);
|
let x = some(~1);
|
||||||
alt x {
|
alt x {
|
||||||
some(y) {
|
some(y) {
|
||||||
let _b <- y; //! ERROR moving out of pattern binding
|
let _b <- y; //~ ERROR moving out of pattern binding
|
||||||
}
|
}
|
||||||
_ {}
|
_ {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,8 @@ fn borrow_from_arg_imm_ref(&&v: ~int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn borrow_from_arg_mut_ref(&v: ~int) {
|
fn borrow_from_arg_mut_ref(&v: ~int) {
|
||||||
borrow(v); //! ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
borrow(v); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn borrow_from_arg_move(-v: ~int) {
|
fn borrow_from_arg_move(-v: ~int) {
|
||||||
|
|
|
@ -19,23 +19,23 @@ fn post_aliased_const() {
|
||||||
fn post_aliased_mut() {
|
fn post_aliased_mut() {
|
||||||
// SPURIOUS--flow
|
// SPURIOUS--flow
|
||||||
let mut v = ~3;
|
let mut v = ~3;
|
||||||
borrow(v); //! ERROR loan of mutable local variable as immutable conflicts with prior loan
|
borrow(v); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
|
||||||
let _w = &mut v; //! NOTE prior loan as mutable granted here
|
let _w = &mut v; //~ NOTE prior loan as mutable granted here
|
||||||
}
|
}
|
||||||
|
|
||||||
fn post_aliased_scope(cond: bool) {
|
fn post_aliased_scope(cond: bool) {
|
||||||
// NDM--scope of &
|
// NDM--scope of &
|
||||||
let mut v = ~3;
|
let mut v = ~3;
|
||||||
borrow(v); //! ERROR loan of mutable local variable as immutable conflicts with prior loan
|
borrow(v); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
|
||||||
if cond { inc(&mut v); } //! NOTE prior loan as mutable granted here
|
if cond { inc(&mut v); } //~ NOTE prior loan as mutable granted here
|
||||||
}
|
}
|
||||||
|
|
||||||
fn loop_aliased_mut() {
|
fn loop_aliased_mut() {
|
||||||
let mut v = ~3, w = ~4;
|
let mut v = ~3, w = ~4;
|
||||||
let mut _x = &mut w;
|
let mut _x = &mut w;
|
||||||
loop {
|
loop {
|
||||||
borrow(v); //! ERROR loan of mutable local variable as immutable conflicts with prior loan
|
borrow(v); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
|
||||||
_x = &mut v; //! NOTE prior loan as mutable granted here
|
_x = &mut v; //~ NOTE prior loan as mutable granted here
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ fn while_aliased_mut(cond: bool) {
|
||||||
let mut v = ~3, w = ~4;
|
let mut v = ~3, w = ~4;
|
||||||
let mut _x = &mut w;
|
let mut _x = &mut w;
|
||||||
while cond {
|
while cond {
|
||||||
borrow(v); //! ERROR loan of mutable local variable as immutable conflicts with prior loan
|
borrow(v); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
|
||||||
_x = &mut v; //! NOTE prior loan as mutable granted here
|
_x = &mut v; //~ NOTE prior loan as mutable granted here
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,9 +52,9 @@ fn while_aliased_mut_cond(cond: bool, cond2: bool) {
|
||||||
let mut v = ~3, w = ~4;
|
let mut v = ~3, w = ~4;
|
||||||
let mut _x = &mut w;
|
let mut _x = &mut w;
|
||||||
while cond {
|
while cond {
|
||||||
borrow(v); //! ERROR loan of mutable local variable as immutable conflicts with prior loan
|
borrow(v); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
|
||||||
if cond2 {
|
if cond2 {
|
||||||
_x = &mut v; //! NOTE prior loan as mutable granted here
|
_x = &mut v; //~ NOTE prior loan as mutable granted here
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,8 +63,8 @@ fn loop_in_block() {
|
||||||
let mut v = ~3, w = ~4;
|
let mut v = ~3, w = ~4;
|
||||||
let mut _x = &mut w;
|
let mut _x = &mut w;
|
||||||
for uint::range(0u, 10u) {|_i|
|
for uint::range(0u, 10u) {|_i|
|
||||||
borrow(v); //! ERROR loan of mutable variable declared in an outer block as immutable conflicts with prior loan
|
borrow(v); //~ ERROR loan of mutable variable declared in an outer block as immutable conflicts with prior loan
|
||||||
_x = &mut v; //! NOTE prior loan as mutable granted here
|
_x = &mut v; //~ NOTE prior loan as mutable granted here
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,8 +77,8 @@ fn at_most_once_block() {
|
||||||
let mut v = ~3, w = ~4;
|
let mut v = ~3, w = ~4;
|
||||||
let mut _x = &mut w;
|
let mut _x = &mut w;
|
||||||
at_most_once {||
|
at_most_once {||
|
||||||
borrow(v); //! ERROR loan of mutable variable declared in an outer block as immutable conflicts with prior loan
|
borrow(v); //~ ERROR loan of mutable variable declared in an outer block as immutable conflicts with prior loan
|
||||||
_x = &mut v; //! NOTE prior loan as mutable granted here
|
_x = &mut v; //~ NOTE prior loan as mutable granted here
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,16 +4,16 @@ fn borrow(v: &int, f: fn(x: &int)) {
|
||||||
|
|
||||||
fn box_imm() {
|
fn box_imm() {
|
||||||
let mut v = ~3;
|
let mut v = ~3;
|
||||||
let _w = &mut v; //! NOTE loan of mutable local variable granted here
|
let _w = &mut v; //~ NOTE loan of mutable local variable granted here
|
||||||
task::spawn { |move v|
|
task::spawn { |move v|
|
||||||
//!^ ERROR moving out of mutable local variable prohibited due to outstanding loan
|
//~^ ERROR moving out of mutable local variable prohibited due to outstanding loan
|
||||||
#debug["v=%d", *v];
|
#debug["v=%d", *v];
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut v = ~3;
|
let mut v = ~3;
|
||||||
let _w = &mut v; //! NOTE loan of mutable local variable granted here
|
let _w = &mut v; //~ NOTE loan of mutable local variable granted here
|
||||||
task::spawn(fn~(move v) {
|
task::spawn(fn~(move v) {
|
||||||
//!^ ERROR moving out of mutable local variable prohibited due to outstanding loan
|
//~^ ERROR moving out of mutable local variable prohibited due to outstanding loan
|
||||||
#debug["v=%d", *v];
|
#debug["v=%d", *v];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@ fn take(-_v: ~int) {
|
||||||
|
|
||||||
fn box_imm() {
|
fn box_imm() {
|
||||||
let v = ~3;
|
let v = ~3;
|
||||||
let _w = &v; //! NOTE loan of immutable local variable granted here
|
let _w = &v; //~ NOTE loan of immutable local variable granted here
|
||||||
take(v); //! ERROR moving out of immutable local variable prohibited due to outstanding loan
|
take(v); //~ ERROR moving out of immutable local variable prohibited due to outstanding loan
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -4,8 +4,8 @@ fn borrow(v: &int, f: fn(x: &int)) {
|
||||||
|
|
||||||
fn box_imm() {
|
fn box_imm() {
|
||||||
let mut v = ~3;
|
let mut v = ~3;
|
||||||
borrow(v) { |w| //! NOTE loan of mutable local variable granted here
|
borrow(v) { |w| //~ NOTE loan of mutable local variable granted here
|
||||||
v = ~4; //! ERROR assigning to mutable variable declared in an outer block prohibited due to outstanding loan
|
v = ~4; //~ ERROR assigning to mutable variable declared in an outer block prohibited due to outstanding loan
|
||||||
assert *v == 3;
|
assert *v == 3;
|
||||||
assert *w == 4;
|
assert *w == 4;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,11 @@ fn b() {
|
||||||
|
|
||||||
// Here I create an outstanding loan and check that we get conflicts:
|
// Here I create an outstanding loan and check that we get conflicts:
|
||||||
|
|
||||||
&mut p; //! NOTE prior loan as mutable granted here
|
&mut p; //~ NOTE prior loan as mutable granted here
|
||||||
//!^ NOTE prior loan as mutable granted here
|
//~^ NOTE prior loan as mutable granted here
|
||||||
|
|
||||||
p + 3; //! ERROR loan of mutable local variable as immutable conflicts with prior loan
|
p + 3; //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
|
||||||
p * 3; //! ERROR loan of mutable local variable as immutable conflicts with prior loan
|
p * 3; //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
|
||||||
}
|
}
|
||||||
|
|
||||||
fn c() {
|
fn c() {
|
||||||
|
@ -35,8 +35,8 @@ fn c() {
|
||||||
|
|
||||||
|
|
||||||
// ...but not impure fns
|
// ...but not impure fns
|
||||||
*q * 3; //! ERROR illegal borrow unless pure: creating immutable alias to aliasable, mutable memory
|
*q * 3; //~ ERROR illegal borrow unless pure: creating immutable alias to aliasable, mutable memory
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -19,8 +19,8 @@ fn a() {
|
||||||
p.impurem();
|
p.impurem();
|
||||||
|
|
||||||
// But in this case we do not honor the loan:
|
// But in this case we do not honor the loan:
|
||||||
p.blockm {|| //! NOTE loan of mutable local variable granted here
|
p.blockm {|| //~ NOTE loan of mutable local variable granted here
|
||||||
p.x = 10; //! ERROR assigning to mutable field prohibited due to outstanding loan
|
p.x = 10; //~ ERROR assigning to mutable field prohibited due to outstanding loan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,11 +29,11 @@ fn b() {
|
||||||
|
|
||||||
// Here I create an outstanding loan and check that we get conflicts:
|
// Here I create an outstanding loan and check that we get conflicts:
|
||||||
|
|
||||||
&mut p; //! NOTE prior loan as mutable granted here
|
&mut p; //~ NOTE prior loan as mutable granted here
|
||||||
//!^ NOTE prior loan as mutable granted here
|
//~^ NOTE prior loan as mutable granted here
|
||||||
|
|
||||||
p.purem(); //! ERROR loan of mutable local variable as immutable conflicts with prior loan
|
p.purem(); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
|
||||||
p.impurem(); //! ERROR loan of mutable local variable as immutable conflicts with prior loan
|
p.impurem(); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
|
||||||
}
|
}
|
||||||
|
|
||||||
fn c() {
|
fn c() {
|
||||||
|
@ -45,8 +45,8 @@ fn c() {
|
||||||
(*q).purem();
|
(*q).purem();
|
||||||
|
|
||||||
// ...but not impure fns
|
// ...but not impure fns
|
||||||
(*q).impurem(); //! ERROR illegal borrow unless pure: creating immutable alias to aliasable, mutable memory
|
(*q).impurem(); //~ ERROR illegal borrow unless pure: creating immutable alias to aliasable, mutable memory
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -14,8 +14,8 @@ fn has_mut_vec_and_does_not_try_to_change_it() {
|
||||||
|
|
||||||
fn has_mut_vec_but_tries_to_change_it() {
|
fn has_mut_vec_but_tries_to_change_it() {
|
||||||
let v = [mut 1, 2, 3]/~;
|
let v = [mut 1, 2, 3]/~;
|
||||||
takes_imm_elt(&v[0]) {|| //! NOTE loan of mutable vec content granted here
|
takes_imm_elt(&v[0]) {|| //~ NOTE loan of mutable vec content granted here
|
||||||
v[1] = 4; //! ERROR assigning to mutable vec content prohibited due to outstanding loan
|
v[1] = 4; //~ ERROR assigning to mutable vec content prohibited due to outstanding loan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
fn foo(x: *~int) -> ~int {
|
fn foo(x: *~int) -> ~int {
|
||||||
let y <- *x; //! ERROR dereference of unsafe pointer requires unsafe function or block
|
let y <- *x; //~ ERROR dereference of unsafe pointer requires unsafe function or block
|
||||||
ret y;
|
ret y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
let x: int = 3;
|
let x: int = 3;
|
||||||
let y: &mut int = &mut x; //! ERROR taking mut reference to immutable local variable
|
let y: &mut int = &mut x; //~ ERROR taking mut reference to immutable local variable
|
||||||
*y = 5;
|
*y = 5;
|
||||||
log (debug, *y);
|
log (debug, *y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,8 @@ fn want_slice(v: [int]/&) -> int {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_mut_vec(+v: @[mut int]/~) -> int {
|
fn has_mut_vec(+v: @[mut int]/~) -> int {
|
||||||
want_slice(*v) //! ERROR illegal borrow unless pure: creating immutable alias to aliasable, mutable memory
|
want_slice(*v) //~ ERROR illegal borrow unless pure: creating immutable alias to aliasable, mutable memory
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -5,9 +5,9 @@ enum cycle {
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = ~node({mut a: ~empty});
|
let x = ~node({mut a: ~empty});
|
||||||
// Create a cycle!
|
// Create a cycle!
|
||||||
alt check *x { //! NOTE loan of immutable local variable granted here
|
alt check *x { //~ NOTE loan of immutable local variable granted here
|
||||||
node(y) {
|
node(y) {
|
||||||
y.a <- x; //! ERROR moving out of immutable local variable prohibited due to outstanding loan
|
y.a <- x; //~ ERROR moving out of immutable local variable prohibited due to outstanding loan
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -27,8 +27,8 @@ fn process(_i: int) {}
|
||||||
|
|
||||||
fn match_const_box_and_do_bad_things(v: &const @const option<int>) {
|
fn match_const_box_and_do_bad_things(v: &const @const option<int>) {
|
||||||
alt *v {
|
alt *v {
|
||||||
@some(i) { //! ERROR illegal borrow unless pure: enum variant in aliasable, mutable location
|
@some(i) { //~ ERROR illegal borrow unless pure: enum variant in aliasable, mutable location
|
||||||
process(i) //! NOTE impure due to access to impure function
|
process(i) //~ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
@none {}
|
@none {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,8 @@ fn match_const_reg_unused(v: &const option<int>) {
|
||||||
|
|
||||||
fn match_const_reg_impure(v: &const option<int>) {
|
fn match_const_reg_impure(v: &const option<int>) {
|
||||||
alt *v {
|
alt *v {
|
||||||
some(i) {impure(i)} //! ERROR illegal borrow unless pure: enum variant in aliasable, mutable location
|
some(i) {impure(i)} //~ ERROR illegal borrow unless pure: enum variant in aliasable, mutable location
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
none {}
|
none {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut x: option<int> = none;
|
let mut x: option<int> = none;
|
||||||
alt x { //! NOTE loan of mutable local variable granted here
|
alt x { //~ NOTE loan of mutable local variable granted here
|
||||||
none {}
|
none {}
|
||||||
some(i) {
|
some(i) {
|
||||||
// Not ok: i is an outstanding ptr into x.
|
// Not ok: i is an outstanding ptr into x.
|
||||||
x = some(i+1); //! ERROR assigning to mutable local variable prohibited due to outstanding loan
|
x = some(i+1); //~ ERROR assigning to mutable local variable prohibited due to outstanding loan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
copy x; // just to prevent liveness warnings
|
copy x; // just to prevent liveness warnings
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut x = none;
|
let mut x = none;
|
||||||
alt x { //! NOTE loan of mutable local variable granted here
|
alt x { //~ NOTE loan of mutable local variable granted here
|
||||||
none {
|
none {
|
||||||
// It is ok to reassign x here, because there is in
|
// It is ok to reassign x here, because there is in
|
||||||
// fact no outstanding loan of x!
|
// fact no outstanding loan of x!
|
||||||
x = some(0);
|
x = some(0);
|
||||||
}
|
}
|
||||||
some(i) {
|
some(i) {
|
||||||
x = some(1); //! ERROR assigning to mutable local variable prohibited due to outstanding loan
|
x = some(1); //~ ERROR assigning to mutable local variable prohibited due to outstanding loan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
copy x; // just to prevent liveness warnings
|
copy x; // just to prevent liveness warnings
|
||||||
|
|
|
@ -4,8 +4,8 @@ fn test1(x: @mut ~int) {
|
||||||
// Here, evaluating the second argument actually invalidates the
|
// Here, evaluating the second argument actually invalidates the
|
||||||
// first borrow, even though it occurs outside of the scope of the
|
// first borrow, even though it occurs outside of the scope of the
|
||||||
// borrow!
|
// borrow!
|
||||||
pure_borrow(*x, *x = ~5); //! ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
pure_borrow(*x, *x = ~5); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
||||||
//!^ NOTE impure due to assigning to dereference of mutable @ pointer
|
//~^ NOTE impure due to assigning to dereference of mutable @ pointer
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test2() {
|
fn test2() {
|
||||||
|
@ -13,8 +13,8 @@ fn test2() {
|
||||||
|
|
||||||
// Same, but for loanable data:
|
// Same, but for loanable data:
|
||||||
|
|
||||||
pure_borrow(x, x = ~5); //! ERROR assigning to mutable local variable prohibited due to outstanding loan
|
pure_borrow(x, x = ~5); //~ ERROR assigning to mutable local variable prohibited due to outstanding loan
|
||||||
//!^ NOTE loan of mutable local variable granted here
|
//~^ NOTE loan of mutable local variable granted here
|
||||||
|
|
||||||
copy x;
|
copy x;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ fn impure(_i: int) {}
|
||||||
fn foo(v: &const option<int>) {
|
fn foo(v: &const option<int>) {
|
||||||
alt *v {
|
alt *v {
|
||||||
some(i) {
|
some(i) {
|
||||||
//!^ ERROR illegal borrow unless pure: enum variant in aliasable, mutable location
|
//~^ ERROR illegal borrow unless pure: enum variant in aliasable, mutable location
|
||||||
unchecked {
|
unchecked {
|
||||||
impure(i); //! NOTE impure due to access to impure function
|
impure(i); //~ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
none {
|
none {
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
fn borrow(_v: &int) {}
|
fn borrow(_v: &int) {}
|
||||||
|
|
||||||
fn box_mut(v: @mut ~int) {
|
fn box_mut(v: @mut ~int) {
|
||||||
borrow(*v); //! ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
borrow(*v); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_rec_mut(v: @{mut f: ~int}) {
|
fn box_rec_mut(v: @{mut f: ~int}) {
|
||||||
borrow(v.f); //! ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
borrow(v.f); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_mut_rec(v: @mut {f: ~int}) {
|
fn box_mut_rec(v: @mut {f: ~int}) {
|
||||||
borrow(v.f); //! ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
borrow(v.f); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_mut_recs(v: @mut {f: {g: {h: ~int}}}) {
|
fn box_mut_recs(v: @mut {f: {g: {h: ~int}}}) {
|
||||||
borrow(v.f.g.h); //! ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
borrow(v.f.g.h); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_imm(v: @~int) {
|
fn box_imm(v: @~int) {
|
||||||
|
@ -33,28 +33,28 @@ fn box_imm_recs(v: @{f: {g: {h: ~int}}}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_const(v: @const ~int) {
|
fn box_const(v: @const ~int) {
|
||||||
borrow(*v); //! ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
borrow(*v); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_rec_const(v: @{const f: ~int}) {
|
fn box_rec_const(v: @{const f: ~int}) {
|
||||||
borrow(v.f); //! ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
borrow(v.f); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_recs_const(v: @{f: {g: {const h: ~int}}}) {
|
fn box_recs_const(v: @{f: {g: {const h: ~int}}}) {
|
||||||
borrow(v.f.g.h); //! ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
borrow(v.f.g.h); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_const_rec(v: @const {f: ~int}) {
|
fn box_const_rec(v: @const {f: ~int}) {
|
||||||
borrow(v.f); //! ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
borrow(v.f); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_const_recs(v: @const {f: {g: {h: ~int}}}) {
|
fn box_const_recs(v: @const {f: {g: {h: ~int}}}) {
|
||||||
borrow(v.f.g.h); //! ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
borrow(v.f.g.h); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -29,8 +29,8 @@ fn aliased_const() {
|
||||||
|
|
||||||
fn aliased_mut() {
|
fn aliased_mut() {
|
||||||
let mut v = ~3;
|
let mut v = ~3;
|
||||||
let _w = &mut v; //! NOTE prior loan as mutable granted here
|
let _w = &mut v; //~ NOTE prior loan as mutable granted here
|
||||||
borrow(v); //! ERROR loan of mutable local variable as immutable conflicts with prior loan
|
borrow(v); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
|
||||||
}
|
}
|
||||||
|
|
||||||
fn aliased_other() {
|
fn aliased_other() {
|
||||||
|
@ -42,8 +42,8 @@ fn aliased_other() {
|
||||||
fn aliased_other_reassign() {
|
fn aliased_other_reassign() {
|
||||||
let mut v = ~3, w = ~4;
|
let mut v = ~3, w = ~4;
|
||||||
let mut _x = &mut w;
|
let mut _x = &mut w;
|
||||||
_x = &mut v; //! NOTE prior loan as mutable granted here
|
_x = &mut v; //~ NOTE prior loan as mutable granted here
|
||||||
borrow(v); //! ERROR loan of mutable local variable as immutable conflicts with prior loan
|
borrow(v); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
fn borrow(_v: &int) {}
|
fn borrow(_v: &int) {}
|
||||||
|
|
||||||
fn box_mut(v: &mut ~int) {
|
fn box_mut(v: &mut ~int) {
|
||||||
borrow(*v); //! ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
borrow(*v); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_rec_mut(v: &{mut f: ~int}) {
|
fn box_rec_mut(v: &{mut f: ~int}) {
|
||||||
borrow(v.f); //! ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
borrow(v.f); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_mut_rec(v: &mut {f: ~int}) {
|
fn box_mut_rec(v: &mut {f: ~int}) {
|
||||||
borrow(v.f); //! ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
borrow(v.f); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_mut_recs(v: &mut {f: {g: {h: ~int}}}) {
|
fn box_mut_recs(v: &mut {f: {g: {h: ~int}}}) {
|
||||||
borrow(v.f.g.h); //! ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
borrow(v.f.g.h); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_imm(v: &~int) {
|
fn box_imm(v: &~int) {
|
||||||
|
@ -33,28 +33,28 @@ fn box_imm_recs(v: &{f: {g: {h: ~int}}}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_const(v: &const ~int) {
|
fn box_const(v: &const ~int) {
|
||||||
borrow(*v); //! ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
borrow(*v); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_rec_const(v: &{const f: ~int}) {
|
fn box_rec_const(v: &{const f: ~int}) {
|
||||||
borrow(v.f); //! ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
borrow(v.f); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_recs_const(v: &{f: {g: {const h: ~int}}}) {
|
fn box_recs_const(v: &{f: {g: {const h: ~int}}}) {
|
||||||
borrow(v.f.g.h); //! ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
borrow(v.f.g.h); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_const_rec(v: &const {f: ~int}) {
|
fn box_const_rec(v: &const {f: ~int}) {
|
||||||
borrow(v.f); //! ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
borrow(v.f); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_const_recs(v: &const {f: {g: {h: ~int}}}) {
|
fn box_const_recs(v: &const {f: {g: {h: ~int}}}) {
|
||||||
borrow(v.f.g.h); //! ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
borrow(v.f.g.h); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
|
||||||
//!^ NOTE impure due to access to impure function
|
//~^ NOTE impure due to access to impure function
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = 5;
|
let x = 5;
|
||||||
let _y = fn~(move x) -> int {
|
let _y = fn~(move x) -> int {
|
||||||
let _z = fn~(move x) -> int { x }; //! ERROR moving out of variable declared in an outer block
|
let _z = fn~(move x) -> int { x }; //~ ERROR moving out of variable declared in an outer block
|
||||||
22
|
22
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ fn main() {
|
||||||
foo {|| bar(x); }
|
foo {|| bar(x); }
|
||||||
|
|
||||||
let x = @3;
|
let x = @3;
|
||||||
foo {|copy x| bar(x); } //! ERROR cannot capture values explicitly with a block closure
|
foo {|copy x| bar(x); } //~ ERROR cannot capture values explicitly with a block closure
|
||||||
|
|
||||||
let x = @3;
|
let x = @3;
|
||||||
foo {|move x| bar(x); } //! ERROR cannot capture values explicitly with a block closure
|
foo {|move x| bar(x); } //~ ERROR cannot capture values explicitly with a block closure
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class cat : int { //! ERROR can only implement interface types
|
class cat : int { //~ ERROR can only implement interface types
|
||||||
let meows: uint;
|
let meows: uint;
|
||||||
new(in_x : uint) { self.meows = in_x; }
|
new(in_x : uint) { self.meows = in_x; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,8 @@ class cat {
|
||||||
fn sleep() { loop{} }
|
fn sleep() { loop{} }
|
||||||
fn meow() {
|
fn meow() {
|
||||||
#error("Meow");
|
#error("Meow");
|
||||||
meows += 1u; //! ERROR unresolved name
|
meows += 1u; //~ ERROR unresolved name
|
||||||
sleep(); //! ERROR unresolved name
|
sleep(); //~ ERROR unresolved name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = do y; //! ERROR: `do` must be followed by a block call
|
let x = do y; //~ ERROR: `do` must be followed by a block call
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
fn f(f: fn@(int) -> bool) -> bool { f(10i) }
|
fn f(f: fn@(int) -> bool) -> bool { f(10i) }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
assert do f() { |i| i == 10i } == 10i; //! ERROR: expected `bool` but found `int`
|
assert do f() { |i| i == 10i } == 10i; //~ ERROR: expected `bool` but found `int`
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
let v = [,]/~; //! ERROR unexpected token: ','
|
let v = [,]/~; //~ ERROR unexpected token: ','
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
enum hello = int;
|
enum hello = int;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let hello = 0; //!ERROR declaration of `hello` shadows an enum that's in
|
let hello = 0; //~ERROR declaration of `hello` shadows an enum that's in
|
||||||
}
|
}
|
|
@ -4,26 +4,26 @@ fn wants_three(x: str/3) { }
|
||||||
|
|
||||||
fn has_box(x: str/@) {
|
fn has_box(x: str/@) {
|
||||||
wants_box(x);
|
wants_box(x);
|
||||||
wants_uniq(x); //! ERROR str storage differs: expected ~ but found @
|
wants_uniq(x); //~ ERROR str storage differs: expected ~ but found @
|
||||||
wants_three(x); //! ERROR str storage differs: expected 3 but found @
|
wants_three(x); //~ ERROR str storage differs: expected 3 but found @
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_uniq(x: str/~) {
|
fn has_uniq(x: str/~) {
|
||||||
wants_box(x); //! ERROR str storage differs: expected @ but found ~
|
wants_box(x); //~ ERROR str storage differs: expected @ but found ~
|
||||||
wants_uniq(x);
|
wants_uniq(x);
|
||||||
wants_three(x); //! ERROR str storage differs: expected 3 but found ~
|
wants_three(x); //~ ERROR str storage differs: expected 3 but found ~
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_three(x: str/3) {
|
fn has_three(x: str/3) {
|
||||||
wants_box(x); //! ERROR str storage differs: expected @ but found 3
|
wants_box(x); //~ ERROR str storage differs: expected @ but found 3
|
||||||
wants_uniq(x); //! ERROR str storage differs: expected ~ but found 3
|
wants_uniq(x); //~ ERROR str storage differs: expected ~ but found 3
|
||||||
wants_three(x);
|
wants_three(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_four(x: str/4) {
|
fn has_four(x: str/4) {
|
||||||
wants_box(x); //! ERROR str storage differs: expected @ but found 4
|
wants_box(x); //~ ERROR str storage differs: expected @ but found 4
|
||||||
wants_uniq(x); //! ERROR str storage differs: expected ~ but found 4
|
wants_uniq(x); //~ ERROR str storage differs: expected ~ but found 4
|
||||||
wants_three(x); //! ERROR str storage differs: expected 3 but found 4
|
wants_three(x); //~ ERROR str storage differs: expected 3 but found 4
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -4,26 +4,26 @@ fn wants_three(x: [uint]/3) { }
|
||||||
|
|
||||||
fn has_box(x: [uint]/@) {
|
fn has_box(x: [uint]/@) {
|
||||||
wants_box(x);
|
wants_box(x);
|
||||||
wants_uniq(x); //! ERROR [] storage differs: expected ~ but found @
|
wants_uniq(x); //~ ERROR [] storage differs: expected ~ but found @
|
||||||
wants_three(x); //! ERROR [] storage differs: expected 3 but found @
|
wants_three(x); //~ ERROR [] storage differs: expected 3 but found @
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_uniq(x: [uint]/~) {
|
fn has_uniq(x: [uint]/~) {
|
||||||
wants_box(x); //! ERROR [] storage differs: expected @ but found ~
|
wants_box(x); //~ ERROR [] storage differs: expected @ but found ~
|
||||||
wants_uniq(x);
|
wants_uniq(x);
|
||||||
wants_three(x); //! ERROR [] storage differs: expected 3 but found ~
|
wants_three(x); //~ ERROR [] storage differs: expected 3 but found ~
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_three(x: [uint]/3) {
|
fn has_three(x: [uint]/3) {
|
||||||
wants_box(x); //! ERROR [] storage differs: expected @ but found 3
|
wants_box(x); //~ ERROR [] storage differs: expected @ but found 3
|
||||||
wants_uniq(x); //! ERROR [] storage differs: expected ~ but found 3
|
wants_uniq(x); //~ ERROR [] storage differs: expected ~ but found 3
|
||||||
wants_three(x);
|
wants_three(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_four(x: [uint]/4) {
|
fn has_four(x: [uint]/4) {
|
||||||
wants_box(x); //! ERROR [] storage differs: expected @ but found 4
|
wants_box(x); //~ ERROR [] storage differs: expected @ but found 4
|
||||||
wants_uniq(x); //! ERROR [] storage differs: expected ~ but found 4
|
wants_uniq(x); //~ ERROR [] storage differs: expected ~ but found 4
|
||||||
wants_three(x); //! ERROR [] storage differs: expected 3 but found 4
|
wants_three(x); //~ ERROR [] storage differs: expected 3 but found 4
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -2,5 +2,5 @@ fn main() {
|
||||||
fn f() { }
|
fn f() { }
|
||||||
fn g(i: int) { }
|
fn g(i: int) { }
|
||||||
let x = f == g;
|
let x = f == g;
|
||||||
//!^ ERROR expected `extern fn()` but found `extern fn(int)`
|
//~^ ERROR expected `extern fn()` but found `extern fn(int)`
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,11 +7,11 @@ fn apply<T>(t: T, f: fn(T)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
apply(@3, takes_mut); //! ERROR (values differ in mutability)
|
apply(@3, takes_mut); //~ ERROR (values differ in mutability)
|
||||||
apply(@3, takes_const);
|
apply(@3, takes_const);
|
||||||
apply(@3, takes_imm);
|
apply(@3, takes_imm);
|
||||||
|
|
||||||
apply(@mut 3, takes_mut);
|
apply(@mut 3, takes_mut);
|
||||||
apply(@mut 3, takes_const);
|
apply(@mut 3, takes_const);
|
||||||
apply(@mut 3, takes_imm); //! ERROR (values differ in mutability)
|
apply(@mut 3, takes_imm); //~ ERROR (values differ in mutability)
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,5 +18,5 @@ fn main() {
|
||||||
let g: @const int = r();
|
let g: @const int = r();
|
||||||
|
|
||||||
// Bad.
|
// Bad.
|
||||||
let h: @int = r(); //! ERROR (values differ in mutability)
|
let h: @int = r(); //~ ERROR (values differ in mutability)
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,5 +20,5 @@ fn main() {
|
||||||
// mutability check will fail, because the
|
// mutability check will fail, because the
|
||||||
// type of r has been inferred to be
|
// type of r has been inferred to be
|
||||||
// fn(@const int) -> @const int
|
// fn(@const int) -> @const int
|
||||||
*r(@mut 3) = 4; //! ERROR assigning to dereference of const @ pointer
|
*r(@mut 3) = 4; //~ ERROR assigning to dereference of const @ pointer
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
let x: option<uint>;
|
let x: option<uint>;
|
||||||
x = 5;
|
x = 5;
|
||||||
//!^ ERROR mismatched types: expected `core::option::option<uint>`
|
//~^ ERROR mismatched types: expected `core::option::option<uint>`
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ mod y {
|
||||||
|
|
||||||
fn bar(x: x::foo) -> y::foo {
|
fn bar(x: x::foo) -> y::foo {
|
||||||
ret x;
|
ret x;
|
||||||
//!^ ERROR mismatched types: expected `y::foo` but found `x::foo`
|
//~^ ERROR mismatched types: expected `y::foo` but found `x::foo`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -5,7 +5,7 @@ type T2 = int;
|
||||||
|
|
||||||
fn bar(x: T1) -> T2 {
|
fn bar(x: T1) -> T2 {
|
||||||
ret x;
|
ret x;
|
||||||
//!^ ERROR mismatched types: expected `T2` but found `T1`
|
//~^ ERROR mismatched types: expected `T2` but found `T1`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import core::task::task;
|
||||||
|
|
||||||
fn bar(x: uint) -> task {
|
fn bar(x: uint) -> task {
|
||||||
ret x;
|
ret x;
|
||||||
//!^ ERROR mismatched types: expected `core::task::task`
|
//~^ ERROR mismatched types: expected `core::task::task`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -2,7 +2,7 @@ iface foo<T> { }
|
||||||
|
|
||||||
fn bar(x: foo<uint>) -> foo<int> {
|
fn bar(x: foo<uint>) -> foo<int> {
|
||||||
ret (x as foo::<int>);
|
ret (x as foo::<int>);
|
||||||
//!^ ERROR mismatched types: expected `foo<int>` but found `foo<uint>`
|
//~^ ERROR mismatched types: expected `foo<int>` but found `foo<uint>`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -3,7 +3,7 @@ iface foo {
|
||||||
}
|
}
|
||||||
impl of foo for int {
|
impl of foo for int {
|
||||||
fn bar() -> int {
|
fn bar() -> int {
|
||||||
//!^ ERROR method `bar` has 0 parameters but the iface has 1
|
//~^ ERROR method `bar` has 0 parameters but the iface has 1
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,8 @@ impl of bar for uint { fn dup() -> uint { self } fn blah<X>() {} }
|
||||||
impl of bar for uint { fn dup() -> uint { self } fn blah<X>() {} }
|
impl of bar for uint { fn dup() -> uint { self } fn blah<X>() {} }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
10.dup::<int>(); //! ERROR does not take type parameters
|
10.dup::<int>(); //~ ERROR does not take type parameters
|
||||||
10.blah::<int, int>(); //! ERROR incorrect number of type parameters
|
10.blah::<int, int>(); //~ ERROR incorrect number of type parameters
|
||||||
10u.dup(); //! ERROR multiple applicable methods
|
10u.dup(); //~ ERROR multiple applicable methods
|
||||||
(10 as bar).dup(); //! ERROR contains a self type
|
(10 as bar).dup(); //~ ERROR contains a self type
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
iface foo { fn foo(); }
|
iface foo { fn foo(); }
|
||||||
|
|
||||||
impl of foo for uint {} //! ERROR missing method `foo`
|
impl of foo for uint {} //~ ERROR missing method `foo`
|
||||||
|
|
||||||
impl of foo for uint { fn foo() -> int {} } //! ERROR incompatible type
|
impl of foo for uint { fn foo() -> int {} } //~ ERROR incompatible type
|
||||||
|
|
||||||
impl of int for uint { fn foo() {} } //! ERROR can only implement interface
|
impl of int for uint { fn foo() {} } //~ ERROR can only implement interface
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
fn g() { }
|
fn g() { }
|
||||||
|
|
||||||
pure fn f(_q: int) -> bool {
|
pure fn f(_q: int) -> bool {
|
||||||
g(); //! ERROR access to impure function prohibited in pure context
|
g(); //~ ERROR access to impure function prohibited in pure context
|
||||||
ret true;
|
ret true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
let z = ();
|
let z = ();
|
||||||
log(debug, z[0]); //! ERROR cannot index a value of type `()`
|
log(debug, z[0]); //~ ERROR cannot index a value of type `()`
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,62 +29,62 @@ fn main() {
|
||||||
fn id_u64(n: u64) -> u64 { n }
|
fn id_u64(n: u64) -> u64 { n }
|
||||||
|
|
||||||
id_i8(a8); // ok
|
id_i8(a8); // ok
|
||||||
id_i8(a16); //! ERROR mismatched types: expected `i8` but found `i16`
|
id_i8(a16); //~ ERROR mismatched types: expected `i8` but found `i16`
|
||||||
id_i8(a32); //! ERROR mismatched types: expected `i8` but found `i32`
|
id_i8(a32); //~ ERROR mismatched types: expected `i8` but found `i32`
|
||||||
id_i8(a64); //! ERROR mismatched types: expected `i8` but found `i64`
|
id_i8(a64); //~ ERROR mismatched types: expected `i8` but found `i64`
|
||||||
|
|
||||||
id_i16(a8); //! ERROR mismatched types: expected `i16` but found `i8`
|
id_i16(a8); //~ ERROR mismatched types: expected `i16` but found `i8`
|
||||||
id_i16(a16); // ok
|
id_i16(a16); // ok
|
||||||
id_i16(a32); //! ERROR mismatched types: expected `i16` but found `i32`
|
id_i16(a32); //~ ERROR mismatched types: expected `i16` but found `i32`
|
||||||
id_i16(a64); //! ERROR mismatched types: expected `i16` but found `i64`
|
id_i16(a64); //~ ERROR mismatched types: expected `i16` but found `i64`
|
||||||
|
|
||||||
id_i32(a8); //! ERROR mismatched types: expected `i32` but found `i8`
|
id_i32(a8); //~ ERROR mismatched types: expected `i32` but found `i8`
|
||||||
id_i32(a16); //! ERROR mismatched types: expected `i32` but found `i16`
|
id_i32(a16); //~ ERROR mismatched types: expected `i32` but found `i16`
|
||||||
id_i32(a32); // ok
|
id_i32(a32); // ok
|
||||||
id_i32(a64); //! ERROR mismatched types: expected `i32` but found `i64`
|
id_i32(a64); //~ ERROR mismatched types: expected `i32` but found `i64`
|
||||||
|
|
||||||
id_i64(a8); //! ERROR mismatched types: expected `i64` but found `i8`
|
id_i64(a8); //~ ERROR mismatched types: expected `i64` but found `i8`
|
||||||
id_i64(a16); //! ERROR mismatched types: expected `i64` but found `i16`
|
id_i64(a16); //~ ERROR mismatched types: expected `i64` but found `i16`
|
||||||
id_i64(a32); //! ERROR mismatched types: expected `i64` but found `i32`
|
id_i64(a32); //~ ERROR mismatched types: expected `i64` but found `i32`
|
||||||
id_i64(a64); // ok
|
id_i64(a64); // ok
|
||||||
|
|
||||||
id_i8(c8); // ok
|
id_i8(c8); // ok
|
||||||
id_i8(c16); //! ERROR mismatched types: expected `i8` but found `i16`
|
id_i8(c16); //~ ERROR mismatched types: expected `i8` but found `i16`
|
||||||
id_i8(c32); //! ERROR mismatched types: expected `i8` but found `i32`
|
id_i8(c32); //~ ERROR mismatched types: expected `i8` but found `i32`
|
||||||
id_i8(c64); //! ERROR mismatched types: expected `i8` but found `i64`
|
id_i8(c64); //~ ERROR mismatched types: expected `i8` but found `i64`
|
||||||
|
|
||||||
id_i16(c8); //! ERROR mismatched types: expected `i16` but found `i8`
|
id_i16(c8); //~ ERROR mismatched types: expected `i16` but found `i8`
|
||||||
id_i16(c16); // ok
|
id_i16(c16); // ok
|
||||||
id_i16(c32); //! ERROR mismatched types: expected `i16` but found `i32`
|
id_i16(c32); //~ ERROR mismatched types: expected `i16` but found `i32`
|
||||||
id_i16(c64); //! ERROR mismatched types: expected `i16` but found `i64`
|
id_i16(c64); //~ ERROR mismatched types: expected `i16` but found `i64`
|
||||||
|
|
||||||
id_i32(c8); //! ERROR mismatched types: expected `i32` but found `i8`
|
id_i32(c8); //~ ERROR mismatched types: expected `i32` but found `i8`
|
||||||
id_i32(c16); //! ERROR mismatched types: expected `i32` but found `i16`
|
id_i32(c16); //~ ERROR mismatched types: expected `i32` but found `i16`
|
||||||
id_i32(c32); // ok
|
id_i32(c32); // ok
|
||||||
id_i32(c64); //! ERROR mismatched types: expected `i32` but found `i64`
|
id_i32(c64); //~ ERROR mismatched types: expected `i32` but found `i64`
|
||||||
|
|
||||||
id_i64(a8); //! ERROR mismatched types: expected `i64` but found `i8`
|
id_i64(a8); //~ ERROR mismatched types: expected `i64` but found `i8`
|
||||||
id_i64(a16); //! ERROR mismatched types: expected `i64` but found `i16`
|
id_i64(a16); //~ ERROR mismatched types: expected `i64` but found `i16`
|
||||||
id_i64(a32); //! ERROR mismatched types: expected `i64` but found `i32`
|
id_i64(a32); //~ ERROR mismatched types: expected `i64` but found `i32`
|
||||||
id_i64(a64); // ok
|
id_i64(a64); // ok
|
||||||
|
|
||||||
id_u8(b8); // ok
|
id_u8(b8); // ok
|
||||||
id_u8(b16); //! ERROR mismatched types: expected `u8` but found `u16`
|
id_u8(b16); //~ ERROR mismatched types: expected `u8` but found `u16`
|
||||||
id_u8(b32); //! ERROR mismatched types: expected `u8` but found `u32`
|
id_u8(b32); //~ ERROR mismatched types: expected `u8` but found `u32`
|
||||||
id_u8(b64); //! ERROR mismatched types: expected `u8` but found `u64`
|
id_u8(b64); //~ ERROR mismatched types: expected `u8` but found `u64`
|
||||||
|
|
||||||
id_u16(b8); //! ERROR mismatched types: expected `u16` but found `u8`
|
id_u16(b8); //~ ERROR mismatched types: expected `u16` but found `u8`
|
||||||
id_u16(b16); // ok
|
id_u16(b16); // ok
|
||||||
id_u16(b32); //! ERROR mismatched types: expected `u16` but found `u32`
|
id_u16(b32); //~ ERROR mismatched types: expected `u16` but found `u32`
|
||||||
id_u16(b64); //! ERROR mismatched types: expected `u16` but found `u64`
|
id_u16(b64); //~ ERROR mismatched types: expected `u16` but found `u64`
|
||||||
|
|
||||||
id_u32(b8); //! ERROR mismatched types: expected `u32` but found `u8`
|
id_u32(b8); //~ ERROR mismatched types: expected `u32` but found `u8`
|
||||||
id_u32(b16); //! ERROR mismatched types: expected `u32` but found `u16`
|
id_u32(b16); //~ ERROR mismatched types: expected `u32` but found `u16`
|
||||||
id_u32(b32); // ok
|
id_u32(b32); // ok
|
||||||
id_u32(b64); //! ERROR mismatched types: expected `u32` but found `u64`
|
id_u32(b64); //~ ERROR mismatched types: expected `u32` but found `u64`
|
||||||
|
|
||||||
id_u64(b8); //! ERROR mismatched types: expected `u64` but found `u8`
|
id_u64(b8); //~ ERROR mismatched types: expected `u64` but found `u8`
|
||||||
id_u64(b16); //! ERROR mismatched types: expected `u64` but found `u16`
|
id_u64(b16); //~ ERROR mismatched types: expected `u64` but found `u16`
|
||||||
id_u64(b32); //! ERROR mismatched types: expected `u64` but found `u32`
|
id_u64(b32); //~ ERROR mismatched types: expected `u64` but found `u32`
|
||||||
id_u64(b64); // ok
|
id_u64(b64); // ok
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Regression test for issue #1362 - without that fix the span will be bogus
|
// Regression test for issue #1362 - without that fix the span will be bogus
|
||||||
// no-reformat
|
// no-reformat
|
||||||
fn main() {
|
fn main() {
|
||||||
let x: uint = 20i; //! ERROR mismatched types
|
let x: uint = 20i; //~ ERROR mismatched types
|
||||||
}
|
}
|
||||||
// NOTE: Do not add any extra lines as the line number the error is
|
// NOTE: Do not add any extra lines as the line number the error is
|
||||||
// on is significant; an error later in the source file might not
|
// on is significant; an error later in the source file might not
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
#macro[[#apply[f, [x, ...]], f(x, ...)]];
|
#macro[[#apply[f, [x, ...]], f(x, ...)]];
|
||||||
fn add(a: int, b: int) -> int { ret a + b; }
|
fn add(a: int, b: int) -> int { ret a + b; }
|
||||||
assert (#apply[add, [y, 15]] == 16); //! ERROR unresolved name: y
|
assert (#apply[add, [y, 15]] == 16); //~ ERROR unresolved name: y
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Regresion test for issue #1448 and #1386
|
// Regresion test for issue #1448 and #1386
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
#debug["%u", 10i]; //! ERROR mismatched types
|
#debug["%u", 10i]; //~ ERROR mismatched types
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Testing that we don't fail abnormally after hitting the errors
|
// Testing that we don't fail abnormally after hitting the errors
|
||||||
|
|
||||||
import unresolved::*; //! ERROR unresolved modulename
|
import unresolved::*; //~ ERROR unresolved modulename
|
||||||
//!^ ERROR unresolved does not name a module
|
//~^ ERROR unresolved does not name a module
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
// Issue #1763 - infer types correctly
|
// Issue #1763 - infer types correctly
|
||||||
|
|
||||||
type actor<T> = { //! ERROR type parameter `T` is unused
|
type actor<T> = { //~ ERROR type parameter `T` is unused
|
||||||
unused: bool
|
unused: bool
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,6 @@ type t<T> = { f: fn() -> T };
|
||||||
fn f<T>(_x: t<T>) {}
|
fn f<T>(_x: t<T>) {}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x: t<()> = { f: { || () } }; //! ERROR expressions with stack closure
|
let x: t<()> = { f: { || () } }; //~ ERROR expressions with stack closure
|
||||||
f(x);
|
f(x);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// compile-flags: -W err-while-true
|
// compile-flags: -W err-while-true
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
while true { //! ERROR denote infinite loops with loop
|
while true { //~ ERROR denote infinite loops with loop
|
||||||
i += 1;
|
i += 1;
|
||||||
if i == 5 { break; }
|
if i == 5 { break; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
// test that autoderef of a type like this does not
|
// test that autoderef of a type like this does not
|
||||||
// cause compiler to loop. Note that no instances
|
// cause compiler to loop. Note that no instances
|
||||||
// of such a type could ever be constructed.
|
// of such a type could ever be constructed.
|
||||||
class t { //! ERROR this type cannot be instantiated
|
class t { //~ ERROR this type cannot be instantiated
|
||||||
let x: x;
|
let x: x;
|
||||||
let to_str: ();
|
let to_str: ();
|
||||||
new(x: x) { self.x = x; self.to_str = (); }
|
new(x: x) { self.x = x; self.to_str = (); }
|
||||||
}
|
}
|
||||||
enum x = @t; //! ERROR this type cannot be instantiated
|
enum x = @t; //~ ERROR this type cannot be instantiated
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// test that autoderef of a type like this does not
|
// test that autoderef of a type like this does not
|
||||||
// cause compiler to loop. Note that no instances
|
// cause compiler to loop. Note that no instances
|
||||||
// of such a type could ever be constructed.
|
// of such a type could ever be constructed.
|
||||||
enum t = @t; //! ERROR this type cannot be instantiated
|
enum t = @t; //~ ERROR this type cannot be instantiated
|
||||||
|
|
||||||
// I use an impl here because it will cause
|
// I use an impl here because it will cause
|
||||||
// the compiler to attempt autoderef and then
|
// the compiler to attempt autoderef and then
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
fn foo(a: option<uint>, b: option<uint>) {
|
fn foo(a: option<uint>, b: option<uint>) {
|
||||||
alt (a,b) { //! ERROR: non-exhaustive patterns: none not covered
|
alt (a,b) { //~ ERROR: non-exhaustive patterns: none not covered
|
||||||
(some(a), some(b)) if a == b { }
|
(some(a), some(b)) if a == b { }
|
||||||
(some(_), none) |
|
(some(_), none) |
|
||||||
(none, some(_)) { }
|
(none, some(_)) { }
|
||||||
|
|
|
@ -2,8 +2,8 @@ impl monad<A> for [A]/~ {
|
||||||
fn bind<B>(f: fn(A) -> [B]/~) {
|
fn bind<B>(f: fn(A) -> [B]/~) {
|
||||||
let mut r = fail;
|
let mut r = fail;
|
||||||
for self.each {|elt| r += f(elt); }
|
for self.each {|elt| r += f(elt); }
|
||||||
//!^ WARNING unreachable expression
|
//~^ WARNING unreachable expression
|
||||||
//!^^ ERROR the type of this value must be known
|
//~^^ ERROR the type of this value must be known
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
fn fail_len(v: [const int]/~) -> uint {
|
fn fail_len(v: [const int]/~) -> uint {
|
||||||
let mut i = fail;
|
let mut i = fail;
|
||||||
for v.each {|x| i += 1u; }
|
for v.each {|x| i += 1u; }
|
||||||
//!^ WARNING unreachable statement
|
//~^ WARNING unreachable statement
|
||||||
//!^^ ERROR the type of this value must be known
|
//~^^ ERROR the type of this value must be known
|
||||||
ret i;
|
ret i;
|
||||||
}
|
}
|
||||||
fn main() {}
|
fn main() {}
|
|
@ -1,6 +1,6 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
vec::iter(fail) {|i|
|
vec::iter(fail) {|i|
|
||||||
log (debug, i * 2);
|
log (debug, i * 2);
|
||||||
//!^ ERROR the type of this value must be known
|
//~^ ERROR the type of this value must be known
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -5,7 +5,7 @@ iface channel<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// `chan` is not an iface, it's an enum
|
// `chan` is not an iface, it's an enum
|
||||||
impl of chan for int { //! ERROR can only implement interface types
|
impl of chan for int { //~ ERROR can only implement interface types
|
||||||
fn send(v: int) { fail }
|
fn send(v: int) { fail }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
near the corresponding open brace. But currently it's reported at the end.
|
near the corresponding open brace. But currently it's reported at the end.
|
||||||
xfailed for now (see Issue #2354)
|
xfailed for now (see Issue #2354)
|
||||||
*/
|
*/
|
||||||
fn foo() { //! ERROR this open brace is not closed
|
fn foo() { //~ ERROR this open brace is not closed
|
||||||
alt some(x) {
|
alt some(x) {
|
||||||
some(y) { fail; }
|
some(y) { fail; }
|
||||||
none { fail; }
|
none { fail; }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
enum test { thing = 3u } //! ERROR mismatched types
|
enum test { thing = 3u } //~ ERROR mismatched types
|
||||||
//!^ ERROR expected signed integer constant
|
//~^ ERROR expected signed integer constant
|
||||||
fn main() {
|
fn main() {
|
||||||
log(error, thing as int);
|
log(error, thing as int);
|
||||||
assert(thing as int == 3);
|
assert(thing as int == 3);
|
||||||
|
|
|
@ -7,7 +7,7 @@ class socket {
|
||||||
|
|
||||||
fn set_identity() {
|
fn set_identity() {
|
||||||
closure { ||
|
closure { ||
|
||||||
setsockopt_bytes(self.sock) //! ERROR copying a noncopyable value
|
setsockopt_bytes(self.sock) //~ ERROR copying a noncopyable value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class c { //! ERROR a class must have at least one field
|
class c { //~ ERROR a class must have at least one field
|
||||||
new() { }
|
new() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ type parser = {
|
||||||
|
|
||||||
impl parser for parser {
|
impl parser for parser {
|
||||||
fn parse() -> [mut int] {
|
fn parse() -> [mut int] {
|
||||||
dvec::unwrap(self.tokens) //! ERROR illegal move from self
|
dvec::unwrap(self.tokens) //~ ERROR illegal move from self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ class send_packet<T: copy> {
|
||||||
|
|
||||||
mod pingpong {
|
mod pingpong {
|
||||||
type ping = send_packet<pong>;
|
type ping = send_packet<pong>;
|
||||||
enum pong = send_packet<ping>; //! ERROR illegal recursive enum type; wrap the inner value in a box to make it representable
|
enum pong = send_packet<ping>; //~ ERROR illegal recursive enum type; wrap the inner value in a box to make it representable
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue