Skip to content

Commit

Permalink
Merge pull request #433 from GBGamer/master
Browse files Browse the repository at this point in the history
Fix #419 (check all whitelisted examples)
  • Loading branch information
steveklabnik committed Jan 31, 2015
2 parents 4848890 + d92c355 commit 3882c51
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 30 deletions.
30 changes: 15 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ STRICT = -D deprecated
QUIET = -A unused-variables -A dead-code -A unused-assignments
RUSTC_NT = $(RUSTC) -Z no-trans --test $(QUIET) ${STRICT}
WHITELIST = examples/attribute/cfg/custom/custom.rs \
examples/borrow/borrow.rs \
examples/borrow/freeze/freeze.rs \
examples/borrow/mut/mut.rs \
examples/bounds/bounds.rs \
examples/constants/constants.rs \
examples/crates/link/executable.rs \
examples/lifetime/borrow/borrow.rs \
examples/mod/mod.rs \
examples/print/print.rs \
examples/type/cast/cast.rs \
examples/type/type.rs \
examples/variables/declare/declare.rs \
examples/variables/mut/mut.rs \
examples/variables/scope/scope.rs \
examples/vec/vec.rs \
examples/borrow/borrow.rs \
examples/borrow/freeze/freeze.rs \
examples/borrow/mut/mut.rs \
examples/bounds/bounds.rs \
examples/constants/constants.rs \
examples/crates/link/executable.rs \
examples/lifetime/borrow/borrow.rs \
examples/mod/mod.rs \
examples/print/print.rs \
examples/type/cast/cast.rs \
examples/type/type.rs \
examples/variables/scope/scope.rs \
examples/variables/mut/mut.rs \
examples/variables/declare/declare.rs \
examples/vec/vec.rs

srcs = $(filter-out $(WHITELIST),$(shell find examples -name '*.rs'))

Expand Down
2 changes: 1 addition & 1 deletion examples/borrow/freeze/freeze.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fn main() {
let mut _integer = 5i;
let mut _integer = 5i32;

{
// Borrow `integer`
Expand Down
4 changes: 2 additions & 2 deletions examples/constants/constants.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
static LANGUAGE: &'static str = "Rust";
static THRESHOLD: int = 10;
static THRESHOLD: i32 = 10;

fn is_big(n: int) -> bool {
fn is_big(n: i32) -> bool {
// Access constant in some function
n > THRESHOLD
}
Expand Down
12 changes: 6 additions & 6 deletions examples/lifetime/borrow/borrow.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// FIXME To see the "real" compiler error, change both `&'b` and `&'e` into `&`

fn main() { // `'main` starts ────────────────────────────────────────────┐
let stack_integer: int = 5; // `'a` starts ─────────────────────────┐ │
let boxed_integer = box 4; // `'b` starts ────────────────────────┐ │ │
let stack_integer: i32 = 5; // `'a` starts ─────────────────────────┐ │
let boxed_integer = Box::new(4); // `'b` starts ──────────────────┐ │ │
// │ │ │
// This is a valid operation │ │ │
let ref_to_box: &'b int = &*boxed_integer; // `'c` starts ──────┐ │ │ │
let ref_to_box: &'b i32 = &*boxed_integer; // `'c` starts ──────┐ │ │ │
// │ │ │ │
// The compiler forbids this operation, because │ │ │ │
// `ref_to_another_box` would become a dangling pointer │ │ │ │
let ref_to_another_box: &'e int = { // `'let` `'d` start ───┬─┐ │ │ │ │
let another_boxed_integer = box 3; // `'e` starts ────┐ │ │ │ │ │ │
// │ │ │ │ │ │ │
let ref_to_another_box: &'e i32 = { // `'let` `'d` start ───┬─┐ │ │ │ │
let another_boxed_integer = Box::new(3); // ──────────┐ │ │ │ │ │ │
// ^ `e` starts │ │ │ │ │ │ │
&*another_boxed_integer // │ │ │ │ │ │ │
}; // `'e` `'let` end ────────────────────────────────────┴─┘ │ │ │ │ │
// │ │ │ │ │
Expand Down
12 changes: 6 additions & 6 deletions examples/vec/vec.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
fn main() {
// Iterators can be collected into vectors
let collected_iterator: Vec<int> = range(0i, 10).collect();
println!("Collected range(0, 10) into: {}", collected_iterator);
let collected_iterator: Vec<i32> = range(0, 10).collect();
println!("Collected range(0, 10) into: {:?}", collected_iterator);

// The `vec!` macro can be used to initialize a vector
let mut xs = vec![1i, 2, 3];
println!("Initial vector: {}", xs);
let mut xs = vec![1i32, 2, 3];
println!("Initial vector: {:?}", xs);

// Insert new element at the end of the vector
println!("Push 4 into the vector");
xs.push(4);
println!("Vector: {}", xs);
println!("Vector: {:?}", xs);

// Error! Immutable vectors can't grow
collected_iterator.push(0);
Expand All @@ -23,7 +23,7 @@ fn main() {
println!("Second element: {}", xs[1]);

// `pop` removes the last element from the vector and returns it
println!("Pop last element: {}", xs.pop());
println!("Pop last element: {:?}", xs.pop());

// Out of bounds indexing yields a task failure
println!("Fourth element: {}", xs[3]);
Expand Down

0 comments on commit 3882c51

Please sign in to comment.