From a17f061b13d469dfbe8d97f65aff2601ff8192be Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sun, 15 Mar 2015 11:46:51 -0700 Subject: [PATCH 01/12] Regression test for #9951 Closes #9951. --- src/test/run-pass/issue-9951.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/test/run-pass/issue-9951.rs diff --git a/src/test/run-pass/issue-9951.rs b/src/test/run-pass/issue-9951.rs new file mode 100644 index 000000000000..210f647e5be2 --- /dev/null +++ b/src/test/run-pass/issue-9951.rs @@ -0,0 +1,28 @@ +// 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. + +#![allow(unused_variables)] + +trait Bar { + fn noop(&self); +} +impl Bar for u8 { + fn noop(&self) {} +} + +fn main() { + let (a, b) = (&5u8 as &Bar, &9u8 as &Bar); + let (c, d): (&Bar, &Bar) = (a, b); + + let (a, b) = (Box::new(5u8) as Box, Box::new(9u8) as Box); + let (c, d): (&Bar, &Bar) = (&*a, &*b); + + let (c, d): (&Bar, &Bar) = (&5, &9); +} From 802e7073b7f0cc531311ffd6386837e6c166e537 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sun, 15 Mar 2015 11:57:33 -0700 Subject: [PATCH 02/12] Regression test for #11820 Closes #11820. --- src/test/run-pass/issue-11820.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/test/run-pass/issue-11820.rs diff --git a/src/test/run-pass/issue-11820.rs b/src/test/run-pass/issue-11820.rs new file mode 100644 index 000000000000..f7aaf4953774 --- /dev/null +++ b/src/test/run-pass/issue-11820.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. + +struct NoClone; + +fn main() { + let rnc = &NoClone; + let rsnc = &Some(NoClone); + + let _: &NoClone = rnc.clone(); + let _: &Option = rsnc.clone(); +} From a4fa901dab3d07e344004eceb789d779efe949fd Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sun, 15 Mar 2015 12:05:10 -0700 Subject: [PATCH 03/12] Regression test for #13407 Closes #13407. --- src/test/compile-fail/issue-13407.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/test/compile-fail/issue-13407.rs diff --git a/src/test/compile-fail/issue-13407.rs b/src/test/compile-fail/issue-13407.rs new file mode 100644 index 000000000000..f845eba40604 --- /dev/null +++ b/src/test/compile-fail/issue-13407.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. + +mod A { + struct C; +} + +fn main() { + A::C = 1; + //~^ ERROR: illegal left-hand side expression + //~| ERROR: mismatched types +} From b9f5711a8a5dc4bf813ecf8d1c92e7e0512081dc Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sun, 15 Mar 2015 13:14:15 -0700 Subject: [PATCH 04/12] Regression test for #18919 Closes #18919. --- src/test/compile-fail/issue-18919.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/test/compile-fail/issue-18919.rs diff --git a/src/test/compile-fail/issue-18919.rs b/src/test/compile-fail/issue-18919.rs new file mode 100644 index 000000000000..8c2c52e6fad4 --- /dev/null +++ b/src/test/compile-fail/issue-18919.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. + +type FuncType<'f> = Fn(&isize) -> isize + 'f; + +fn ho_func(f: Option) { + //~^ ERROR: the trait `core::marker::Sized` is not implemented for the type +} + +fn main() {} From 3a93bdb92c195cab90103743f11c14c837e84598 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sun, 15 Mar 2015 12:44:37 -0700 Subject: [PATCH 05/12] Regression test for #19982 Closes #17165, #19982. --- src/test/compile-fail/issue-19982.rs | 17 +++++++++++++++++ src/test/run-pass/issue-19982.rs | 22 ++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/test/compile-fail/issue-19982.rs create mode 100644 src/test/run-pass/issue-19982.rs diff --git a/src/test/compile-fail/issue-19982.rs b/src/test/compile-fail/issue-19982.rs new file mode 100644 index 000000000000..9dbca997341f --- /dev/null +++ b/src/test/compile-fail/issue-19982.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. + +#![feature(unboxed_closures)] + +struct Foo; + +impl Fn<(&(),)> for Foo { } //~ ERROR missing lifetime specifier + +fn main() {} diff --git a/src/test/run-pass/issue-19982.rs b/src/test/run-pass/issue-19982.rs new file mode 100644 index 000000000000..3082fc27a7de --- /dev/null +++ b/src/test/run-pass/issue-19982.rs @@ -0,0 +1,22 @@ +// 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,unboxed_closures)] + +#[allow(dead_code)] +struct Foo; + +impl<'a> Fn<(&'a (),)> for Foo { + type Output = (); + + extern "rust-call" fn call(&self, (_,): (&(),)) {} +} + +fn main() {} From a19bbca092783cd456036069ba475857fc3bc4bb Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sun, 15 Mar 2015 13:25:46 -0700 Subject: [PATCH 06/12] Regression test for #20225 Closes #20225. --- src/test/compile-fail/issue-20225.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/test/compile-fail/issue-20225.rs diff --git a/src/test/compile-fail/issue-20225.rs b/src/test/compile-fail/issue-20225.rs new file mode 100644 index 000000000000..e4bedbbb7e1e --- /dev/null +++ b/src/test/compile-fail/issue-20225.rs @@ -0,0 +1,22 @@ +// 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(unboxed_closures)] + +struct Foo; + +impl<'a, T> Fn<(&'a T,)> for Foo { + type Output = (); + + extern "rust-call" fn call(&self, (_,): (T,)) {} + //~^ ERROR: has an incompatible type for trait: expected &-ptr +} + +fn main() {} From 1759cfa01c1eac211ab8134e7edbebb14e41df29 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sun, 15 Mar 2015 13:30:04 -0700 Subject: [PATCH 07/12] Consistent spacing --- src/test/compile-fail/associated-types-eq-expr-path.rs | 2 +- src/test/compile-fail/integral-indexing.rs | 8 ++++---- src/test/compile-fail/trait-bounds-not-on-bare-trait.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test/compile-fail/associated-types-eq-expr-path.rs b/src/test/compile-fail/associated-types-eq-expr-path.rs index c48f9972ebc1..0d68b960f313 100644 --- a/src/test/compile-fail/associated-types-eq-expr-path.rs +++ b/src/test/compile-fail/associated-types-eq-expr-path.rs @@ -22,5 +22,5 @@ impl Foo for isize { pub fn main() { let x: isize = Foo::::bar(); - //~^ERROR unexpected binding of associated item in expression path + //~^ ERROR unexpected binding of associated item in expression path } diff --git a/src/test/compile-fail/integral-indexing.rs b/src/test/compile-fail/integral-indexing.rs index e8998dd7a9d4..e2fb0fa4f2fa 100644 --- a/src/test/compile-fail/integral-indexing.rs +++ b/src/test/compile-fail/integral-indexing.rs @@ -24,11 +24,11 @@ pub fn main() { s.as_bytes()[3_usize]; s.as_bytes()[3]; s.as_bytes()[3u8]; //~ERROR the trait `core::ops::Index` is not implemented - //~^ERROR the trait `core::ops::Index` is not implemented + //~^ ERROR the trait `core::ops::Index` is not implemented s.as_bytes()[3i8]; //~ERROR the trait `core::ops::Index` is not implemented - //~^ERROR the trait `core::ops::Index` is not implemented + //~^ ERROR the trait `core::ops::Index` is not implemented s.as_bytes()[3u32]; //~ERROR the trait `core::ops::Index` is not implemented - //~^ERROR the trait `core::ops::Index` is not implemented + //~^ ERROR the trait `core::ops::Index` is not implemented s.as_bytes()[3i32]; //~ERROR the trait `core::ops::Index` is not implemented - //~^ERROR the trait `core::ops::Index` is not implemented + //~^ ERROR the trait `core::ops::Index` is not implemented } diff --git a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs index 448b186f6a5c..e126a3040e99 100644 --- a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs +++ b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs @@ -15,7 +15,7 @@ trait Foo { // This should emit the less confusing error, not the more confusing one. fn foo(_x: Foo + Send) { - //~^ERROR the trait `core::marker::Sized` is not implemented + //~^ ERROR the trait `core::marker::Sized` is not implemented } fn main() { } From 1d31f31d10f4aecf4095a472d45e0ff8d7f0c7b6 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sun, 15 Mar 2015 13:30:37 -0700 Subject: [PATCH 08/12] Regression test for #20261 Closes #20261. --- src/test/compile-fail/issue-20261.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/test/compile-fail/issue-20261.rs diff --git a/src/test/compile-fail/issue-20261.rs b/src/test/compile-fail/issue-20261.rs new file mode 100644 index 000000000000..33e00f9a823c --- /dev/null +++ b/src/test/compile-fail/issue-20261.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 main() { + for (ref i,) in [].iter() { //~ ERROR: type mismatch resolving + i.clone(); + //~^ ERROR: the type of this value must be known in this context + //~| ERROR: reached the recursion limit while auto-dereferencing + } +} From c986199425415a498c8250e2c74f1f33a8fc7fe6 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sun, 15 Mar 2015 13:30:37 -0700 Subject: [PATCH 09/12] Regression test for #20396 Closes #20396. --- src/test/run-pass/issue-20396.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/test/run-pass/issue-20396.rs diff --git a/src/test/run-pass/issue-20396.rs b/src/test/run-pass/issue-20396.rs new file mode 100644 index 000000000000..63a88988162a --- /dev/null +++ b/src/test/run-pass/issue-20396.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. + +#![allow(dead_code)] + +trait Foo { + fn noop(&self, _: T); +} + +enum Bar { Bla(T) } + +struct Baz<'a> { + inner: for<'b> Foo> + 'a, +} + +fn main() {} From ef343645c6bc0cebc6c29d0086ff842764319fe5 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sun, 15 Mar 2015 13:30:37 -0700 Subject: [PATCH 10/12] Regression test for #20714 Closes #20714. --- src/test/compile-fail/issue-20714.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/test/compile-fail/issue-20714.rs diff --git a/src/test/compile-fail/issue-20714.rs b/src/test/compile-fail/issue-20714.rs new file mode 100644 index 000000000000..cb322f00723d --- /dev/null +++ b/src/test/compile-fail/issue-20714.rs @@ -0,0 +1,15 @@ +// 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 G; + +fn main() { + let g = G(); //~ ERROR: expected function, found `G` +} From 2522207a99367d6237970be1553649753b2b979e Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sun, 15 Mar 2015 13:30:37 -0700 Subject: [PATCH 11/12] Regression test for #16922 Closes #16922. --- src/test/compile-fail/issue-16922.rs | 20 ++++++++++++++++++++ src/test/run-pass/issue-16922.rs | 18 ++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/test/compile-fail/issue-16922.rs create mode 100644 src/test/run-pass/issue-16922.rs diff --git a/src/test/compile-fail/issue-16922.rs b/src/test/compile-fail/issue-16922.rs new file mode 100644 index 000000000000..b525d5f64fc9 --- /dev/null +++ b/src/test/compile-fail/issue-16922.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. + +use std::any::Any; + +fn foo(value: &T) -> Box { + Box::new(value) as Box + //~^ ERROR: cannot infer an appropriate lifetime +} + +fn main() { + let _ = foo(&5); +} diff --git a/src/test/run-pass/issue-16922.rs b/src/test/run-pass/issue-16922.rs new file mode 100644 index 000000000000..25909bcbfe9a --- /dev/null +++ b/src/test/run-pass/issue-16922.rs @@ -0,0 +1,18 @@ +// 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::any::Any; + +fn foo(_: &u8) { +} + +fn main() { + let _ = &foo as &Any; +} From c1f6951826c4f99d570aaf9bba321e1bfde0c0de Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sun, 15 Mar 2015 13:30:37 -0700 Subject: [PATCH 12/12] Regression test for #13077 Closes #13077. --- src/test/auxiliary/pub_static_array.rs | 11 ++++++++++ .../compile-fail/static-array-across-crate.rs | 20 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/test/auxiliary/pub_static_array.rs create mode 100644 src/test/compile-fail/static-array-across-crate.rs diff --git a/src/test/auxiliary/pub_static_array.rs b/src/test/auxiliary/pub_static_array.rs new file mode 100644 index 000000000000..4419a5ae83cf --- /dev/null +++ b/src/test/auxiliary/pub_static_array.rs @@ -0,0 +1,11 @@ +// Copyright 2014 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. + +pub static ARRAY: &'static [u8] = &[1]; diff --git a/src/test/compile-fail/static-array-across-crate.rs b/src/test/compile-fail/static-array-across-crate.rs new file mode 100644 index 000000000000..422cf630429c --- /dev/null +++ b/src/test/compile-fail/static-array-across-crate.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. + +// aux-build:pub_static_array.rs + +extern crate "pub_static_array" as array; + +use array::ARRAY; + +static X: &'static u8 = &ARRAY[0]; +//~^ ERROR: cannot refer to the interior of another static, use a constant + +pub fn main() {}