commit
c14609035d
39 changed files with 1603 additions and 889 deletions
|
|
@ -9,7 +9,5 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
for
|
||||
&1 //~ ERROR refutable pattern in `for` loop binding
|
||||
in [1].iter() {}
|
||||
for &1 in [1].iter() {} //~ ERROR refutable pattern in `for` loop binding
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,4 +16,17 @@ fn main() -> (){
|
|||
for n in 0..1 {
|
||||
println!("{}", f!()); //~ ERROR unresolved name `n`
|
||||
}
|
||||
|
||||
if let Some(n) = None {
|
||||
println!("{}", f!()); //~ ERROR unresolved name `n`
|
||||
}
|
||||
|
||||
if false {
|
||||
} else if let Some(n) = None {
|
||||
println!("{}", f!()); //~ ERROR unresolved name `n`
|
||||
}
|
||||
|
||||
while let Some(n) = None {
|
||||
println!("{}", f!()); //~ ERROR unresolved name `n`
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,10 +13,8 @@
|
|||
fn main() {
|
||||
let values: Vec<u8> = vec![1,2,3,4,5,6,7,8];
|
||||
|
||||
for
|
||||
[x,y,z]
|
||||
//~^ ERROR refutable pattern in `for` loop binding: `[]` not covered
|
||||
in values.chunks(3).filter(|&xs| xs.len() == 3) {
|
||||
for [x,y,z] in values.chunks(3).filter(|&xs| xs.len() == 3) {
|
||||
//~^ ERROR refutable pattern in `for` loop binding: `[]` not covered
|
||||
println!("y={}", y);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,11 +8,17 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// Test that we get an expansion stack for `for` loops.
|
||||
// Check that placement in respects unsafe code checks.
|
||||
|
||||
// error-pattern:in this expansion of for loop expansion
|
||||
#![feature(box_heap)]
|
||||
#![feature(placement_in_syntax)]
|
||||
|
||||
fn main() {
|
||||
for t in &foo {
|
||||
}
|
||||
use std::boxed::HEAP;
|
||||
|
||||
let p: *const i32 = &42;
|
||||
let _ = in HEAP { *p }; //~ ERROR requires unsafe
|
||||
|
||||
let p: *const _ = &HEAP;
|
||||
let _ = in *p { 42 }; //~ ERROR requires unsafe
|
||||
}
|
||||
27
src/test/compile-fail/placement-expr-unstable.rs
Normal file
27
src/test/compile-fail/placement-expr-unstable.rs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright 2015 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.
|
||||
|
||||
// Check that placement in respects unstable code checks.
|
||||
|
||||
#![feature(placement_in_syntax)]
|
||||
#![feature(core)]
|
||||
|
||||
extern crate core;
|
||||
|
||||
fn main() {
|
||||
use std::boxed::HEAP; //~ ERROR use of unstable library feature
|
||||
|
||||
let _ = in HEAP { //~ ERROR use of unstable library feature
|
||||
::core::raw::Slice { //~ ERROR use of unstable library feature
|
||||
data: &42, //~ ERROR use of unstable library feature
|
||||
len: 1 //~ ERROR use of unstable library feature
|
||||
}
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue