diff --git a/src/test/compile-fail/E0599.rs b/src/test/compile-fail/E0599.rs new file mode 100644 index 00000000000..30fca2bac03 --- /dev/null +++ b/src/test/compile-fail/E0599.rs @@ -0,0 +1,15 @@ +// Copyright 2017 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; + +fn main() { + || if let Foo::NotEvenReal() = Foo {}; //~ ERROR E0599 +} diff --git a/src/test/compile-fail/associated-const-in-trait.rs b/src/test/compile-fail/associated-const-in-trait.rs new file mode 100644 index 00000000000..f837d9ab8e5 --- /dev/null +++ b/src/test/compile-fail/associated-const-in-trait.rs @@ -0,0 +1,24 @@ +// Copyright 2017 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. + +// #29924 + +#![feature(const_fn, associated_consts)] + +trait Trait { + const N: usize; +} + +impl Trait { + //~^ ERROR the trait `Trait` cannot be made into an object [E0038] + const fn n() -> usize { Self::N } +} + +fn main() {} diff --git a/src/test/compile-fail/conservative_impl_trait.rs b/src/test/compile-fail/conservative_impl_trait.rs new file mode 100644 index 00000000000..7fb0ec52f29 --- /dev/null +++ b/src/test/compile-fail/conservative_impl_trait.rs @@ -0,0 +1,18 @@ +// Copyright 2017 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. + +// #39872, #39553 + +#![feature(conservative_impl_trait)] +fn will_ice(something: &u32) -> impl Iterator { + //~^ ERROR the trait bound `(): std::iter::Iterator` is not satisfied [E0277] +} + +fn main() {} diff --git a/src/test/compile-fail/issue-38857.rs b/src/test/compile-fail/issue-38857.rs new file mode 100644 index 00000000000..b38b1b9fdc6 --- /dev/null +++ b/src/test/compile-fail/issue-38857.rs @@ -0,0 +1,15 @@ +// Copyright 2017 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() { + let a = std::sys::imp::process::process_common::StdioPipes { ..panic!() }; + //~^ ERROR failed to resolve. Could not find `imp` in `sys` [E0433] + //~^^ ERROR module `sys` is private [E0603] +} diff --git a/src/test/compile-fail/issue-41880.rs b/src/test/compile-fail/issue-41880.rs new file mode 100644 index 00000000000..23a2b78a769 --- /dev/null +++ b/src/test/compile-fail/issue-41880.rs @@ -0,0 +1,39 @@ +// Copyright 2017 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 iterate(initial: T, f: F) -> Iterate { + Iterate { + state: initial, + f: f, + } +} + +pub struct Iterate { + state: T, + f: F +} + +impl Iterator for Iterate where F: Fn(&T) -> T { + type Item = T; + + #[inline] + fn next(&mut self) -> Option { + self.state = (self.f)(&self.state); + Some(self.state.clone()) + } + #[inline] + fn size_hint(&self) -> (usize, Option) { (std::usize::MAX, None) } +} + +fn main() { + let a = iterate(0, |x| x+1); + println!("{:?}", a.iter().take(10).collect::>()); + //~^ ERROR no method named `iter` found for type `Iterate<{integer} +} diff --git a/src/test/run-pass/conservative_impl_trait.rs b/src/test/run-pass/conservative_impl_trait.rs new file mode 100644 index 00000000000..30090018e29 --- /dev/null +++ b/src/test/run-pass/conservative_impl_trait.rs @@ -0,0 +1,19 @@ +// Copyright 2017 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. + +// #39665 + +#![feature(conservative_impl_trait)] + +fn batches(n: &u32) -> impl Iterator { + std::iter::once(n) +} + +fn main() {} diff --git a/src/test/run-pass/issue-43483.rs b/src/test/run-pass/issue-43483.rs new file mode 100644 index 00000000000..48482af76db --- /dev/null +++ b/src/test/run-pass/issue-43483.rs @@ -0,0 +1,23 @@ +// Copyright 2017 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 VecN { + const DIM: usize; +} + +trait Mat { + type Row: VecN; +} + +fn m() { + let x = M::Row::DIM; +} + +fn main() {}