diff --git a/src/test/compile-fail/issue-21177.rs b/src/test/compile-fail/issue-21177.rs new file mode 100644 index 0000000000000..5ad9a12362d60 --- /dev/null +++ b/src/test/compile-fail/issue-21177.rs @@ -0,0 +1,19 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait Trait { + type A; + type B; +} + +fn foo>() { } +//~^ ERROR: unsupported cyclic reference between types/traits detected + +fn main() { } diff --git a/src/test/compile-fail/issue-21701.rs b/src/test/compile-fail/issue-21701.rs new file mode 100644 index 0000000000000..f24de2ffe6b5f --- /dev/null +++ b/src/test/compile-fail/issue-21701.rs @@ -0,0 +1,25 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn foo(t: U) { + let y = t(); +//~^ ERROR: expected function, found `U` +} + +struct Bar; + +pub fn some_func() { + let f = Bar(); +//~^ ERROR: expected function, found `Bar` +} + +fn main() { + foo(|| { 1 }); +} diff --git a/src/test/compile-fail/issue-22037.rs b/src/test/compile-fail/issue-22037.rs new file mode 100644 index 0000000000000..3c8e7a2be0cdb --- /dev/null +++ b/src/test/compile-fail/issue-22037.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait A { + type Output; + fn a(&self) -> ::X; +//~^ ERROR: use of undeclared associated type `A::X` +} + +impl A for u32 { + type Output = u32; + fn a(&self) -> u32 { + 0 + } +} + +fn main() { + let a: u32 = 0; + let b: u32 = a.a(); +} diff --git a/src/test/run-make/issue-20626/Makefile b/src/test/run-make/issue-20626/Makefile new file mode 100644 index 0000000000000..0487b24040021 --- /dev/null +++ b/src/test/run-make/issue-20626/Makefile @@ -0,0 +1,8 @@ +-include ../tools.mk + +# Test output to be four +# The original error only occurred when printing, not when comparing using assert! + +all: + $(RUSTC) foo.rs -O + [ `$(call RUN,foo)` = "4" ] diff --git a/src/test/run-make/issue-20626/foo.rs b/src/test/run-make/issue-20626/foo.rs new file mode 100644 index 0000000000000..9f727607e4ed8 --- /dev/null +++ b/src/test/run-make/issue-20626/foo.rs @@ -0,0 +1,23 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn identity(a: &u32) -> &u32 { a } + +fn print_foo(f: &fn(&u32) -> &u32, x: &u32) { + print!("{}", (*f)(x)); +} + +fn main() { + let x = &4; + let f: fn(&u32) -> &u32 = identity; + + // Didn't print 4 on optimized builds + print_foo(&f, x); +} diff --git a/src/test/run-pass/issue-21562.rs b/src/test/run-pass/issue-21562.rs new file mode 100644 index 0000000000000..aa784ba432cd9 --- /dev/null +++ b/src/test/run-pass/issue-21562.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(core)] + +extern crate core; +use core::marker::Sync; + +static SARRAY: [i32; 1] = [11]; + +struct MyStruct { + pub arr: *const [i32], +} +unsafe impl Sync for MyStruct {} + +static mystruct: MyStruct = MyStruct { + arr: &SARRAY +}; + +fn main() {} diff --git a/src/test/run-pass/issue-22258.rs b/src/test/run-pass/issue-22258.rs new file mode 100644 index 0000000000000..f749131345ea5 --- /dev/null +++ b/src/test/run-pass/issue-22258.rs @@ -0,0 +1,19 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::ops::Add; + +fn f(a: T, b: T) -> ::Output { + a + b +} + +fn main() { + println!("a + b is {}", f::(100f32, 200f32)); +} diff --git a/src/test/run-pass/issue-22463.rs b/src/test/run-pass/issue-22463.rs new file mode 100644 index 0000000000000..3aeb92f0becc9 --- /dev/null +++ b/src/test/run-pass/issue-22463.rs @@ -0,0 +1,29 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +macro_rules! items { + () => { + type A = (); + fn a() {} + } +} + +trait Foo { + type A; + fn a(); +} + +impl Foo for () { + items!(); +} + +fn main() { + +}