From d393ff7c474eaf99ff00166745f971a833f8fff8 Mon Sep 17 00:00:00 2001 From: Johannes Oertel Date: Tue, 5 May 2015 15:02:11 +0200 Subject: [PATCH 1/5] Add regression test for #20105 Closes #20105. --- src/test/compile-fail/issue-20105.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/test/compile-fail/issue-20105.rs diff --git a/src/test/compile-fail/issue-20105.rs b/src/test/compile-fail/issue-20105.rs new file mode 100644 index 000000000000..f133a59d7229 --- /dev/null +++ b/src/test/compile-fail/issue-20105.rs @@ -0,0 +1,17 @@ +// 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 f(_: F) where F: Fn() -> R { +} + +fn main() { + f(|| -> ! { () }); +//~^ ERROR: computation may converge in a function marked as diverging [E0270] +} From 341fb57b57cd0623a2b3b63aa106436b16015045 Mon Sep 17 00:00:00 2001 From: Johannes Oertel Date: Tue, 5 May 2015 15:06:43 +0200 Subject: [PATCH 2/5] Add regression test for #20174 Closes #20174. --- src/test/run-pass/issue-20174.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/test/run-pass/issue-20174.rs diff --git a/src/test/run-pass/issue-20174.rs b/src/test/run-pass/issue-20174.rs new file mode 100644 index 000000000000..072738812727 --- /dev/null +++ b/src/test/run-pass/issue-20174.rs @@ -0,0 +1,16 @@ +// 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. + +struct GradFn usize>(F); + +fn main() { + let GradFn(x_squared) : GradFn<_> = GradFn(|| -> usize { 2 }); + let _ = x_squared(); +} From 526258c0f86e623245175162e1dba20483d93e91 Mon Sep 17 00:00:00 2001 From: Johannes Oertel Date: Tue, 5 May 2015 15:14:33 +0200 Subject: [PATCH 3/5] Add regression test for #20186 Closes #20186. --- src/test/run-pass/issue-20186.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/test/run-pass/issue-20186.rs diff --git a/src/test/run-pass/issue-20186.rs b/src/test/run-pass/issue-20186.rs new file mode 100644 index 000000000000..b3895e36a19a --- /dev/null +++ b/src/test/run-pass/issue-20186.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. + +struct Foo; + +impl Foo { + fn putc(&self, b: u8) { } + + fn puts(&self, s: &str) { + for byte in s.bytes() { + self.putc(byte) + } + } +} + +fn main() {} From 29a7d3589401fdedfa54a5ab0f7331212a020281 Mon Sep 17 00:00:00 2001 From: Johannes Oertel Date: Tue, 5 May 2015 15:27:49 +0200 Subject: [PATCH 4/5] Add regression test for #20862 Closes #20862. --- src/test/compile-fail/issue-20862.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/test/compile-fail/issue-20862.rs diff --git a/src/test/compile-fail/issue-20862.rs b/src/test/compile-fail/issue-20862.rs new file mode 100644 index 000000000000..729311416386 --- /dev/null +++ b/src/test/compile-fail/issue-20862.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 foo(x: i32) { + |y| x + y +//~^ ERROR: mismatched types: +//~| expected `()`, +//~| found closure +//~| (expected (), +//~| found closure) [E0308] +} + +fn main() { + let x = foo(5)(2); +//~^ ERROR: expected function, found `()` +} From c4693ea1db3c88f65b40cffd72696e62ef7d4781 Mon Sep 17 00:00:00 2001 From: Johannes Oertel Date: Tue, 5 May 2015 15:31:10 +0200 Subject: [PATCH 5/5] Add regression tests for #21174 Closes #21174. --- src/test/compile-fail/issue-21174.rs | 21 +++++++++++++++++++++ src/test/run-pass/issue-21174.rs | 20 ++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/test/compile-fail/issue-21174.rs create mode 100644 src/test/run-pass/issue-21174.rs diff --git a/src/test/compile-fail/issue-21174.rs b/src/test/compile-fail/issue-21174.rs new file mode 100644 index 000000000000..ec258449cb16 --- /dev/null +++ b/src/test/compile-fail/issue-21174.rs @@ -0,0 +1,21 @@ +// 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<'a> { + type A; + type B; +} + +fn foo<'a, T: Trait<'a>>(value: T::A) { + let new: T::B = unsafe { std::mem::transmute(value) }; +//~^ ERROR: cannot transmute to or from a type that contains type parameters in its interior [E0139] +} + +fn main() { } diff --git a/src/test/run-pass/issue-21174.rs b/src/test/run-pass/issue-21174.rs new file mode 100644 index 000000000000..6c0280de36d0 --- /dev/null +++ b/src/test/run-pass/issue-21174.rs @@ -0,0 +1,20 @@ +// 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<'a> { + type A; + type B; +} + +fn foo<'a, T: Trait<'a>>(value: T::A) { + let new: T::B = unsafe { std::mem::transmute_copy(&value) }; +} + +fn main() { }