From 3aa63400a27cbfefa3984aad5b52580e53b8f02d Mon Sep 17 00:00:00 2001 From: Seo Sanghyeon Date: Tue, 16 Aug 2016 20:14:41 +0900 Subject: Use UI test to test spans, instead of forced line break --- src/test/compile-fail/move-closure-span.rs | 17 ----------------- src/test/compile-fail/ty_binding_span.rs | 20 -------------------- src/test/ui/span/move-closure.rs | 16 ++++++++++++++++ src/test/ui/span/move-closure.stderr | 11 +++++++++++ src/test/ui/span/type-binding.rs | 18 ++++++++++++++++++ src/test/ui/span/type-binding.stderr | 8 ++++++++ 6 files changed, 53 insertions(+), 37 deletions(-) delete mode 100644 src/test/compile-fail/move-closure-span.rs delete mode 100644 src/test/compile-fail/ty_binding_span.rs create mode 100644 src/test/ui/span/move-closure.rs create mode 100644 src/test/ui/span/move-closure.stderr create mode 100644 src/test/ui/span/type-binding.rs create mode 100644 src/test/ui/span/type-binding.stderr diff --git a/src/test/compile-fail/move-closure-span.rs b/src/test/compile-fail/move-closure-span.rs deleted file mode 100644 index 3c590e892cc..00000000000 --- a/src/test/compile-fail/move-closure-span.rs +++ /dev/null @@ -1,17 +0,0 @@ -// 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. - -// Make sure that the span of a closure marked `move` begins at the `move` keyword. - -fn main() { - let x: () = - move //~ ERROR mismatched types - || (); -} diff --git a/src/test/compile-fail/ty_binding_span.rs b/src/test/compile-fail/ty_binding_span.rs deleted file mode 100644 index dd56ce5b3dd..00000000000 --- a/src/test/compile-fail/ty_binding_span.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 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. - -// Test the type binding span doesn't include >> - -use std::ops::Deref; - -fn homura>(_: T) { } - - -fn main() { -} diff --git a/src/test/ui/span/move-closure.rs b/src/test/ui/span/move-closure.rs new file mode 100644 index 00000000000..e11ef0dddaa --- /dev/null +++ b/src/test/ui/span/move-closure.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. + +// Regression test for issue #24986 +// Make sure that the span of a closure marked `move` begins at the `move` keyword. + +fn main() { + let x: () = move || (); +} diff --git a/src/test/ui/span/move-closure.stderr b/src/test/ui/span/move-closure.stderr new file mode 100644 index 00000000000..251feded167 --- /dev/null +++ b/src/test/ui/span/move-closure.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/move-closure.rs:15:17 + | +15 | let x: () = move || (); + | ^^^^^^^^^^ expected (), found closure + | + = note: expected type `()` + = note: found type `[closure@$DIR/move-closure.rs:15:17: 15:27]` + +error: aborting due to previous error + diff --git a/src/test/ui/span/type-binding.rs b/src/test/ui/span/type-binding.rs new file mode 100644 index 00000000000..05285c732f4 --- /dev/null +++ b/src/test/ui/span/type-binding.rs @@ -0,0 +1,18 @@ +// Copyright 2012 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. + +// Regression test for issue #28158 +// Test the type binding span doesn't include >> + +use std::ops::Deref; + +fn homura>(_: T) {} + +fn main() {} diff --git a/src/test/ui/span/type-binding.stderr b/src/test/ui/span/type-binding.stderr new file mode 100644 index 00000000000..3cd1791a34f --- /dev/null +++ b/src/test/ui/span/type-binding.stderr @@ -0,0 +1,8 @@ +error[E0220]: associated type `Trget` not found for `std::ops::Deref` + --> $DIR/type-binding.rs:16:20 + | +16 | fn homura>(_: T) {} + | ^^^^^^^^^^^ + +error: aborting due to previous error + -- cgit 1.4.1-3-g733a5