diff options
| author | kennytm <kennytm@gmail.com> | 2018-01-13 02:26:40 +0800 |
|---|---|---|
| committer | kennytm <kennytm@gmail.com> | 2018-01-13 03:17:00 +0800 |
| commit | f589482c5765a63c1a0746e0cdc38dd3efe9ff43 (patch) | |
| tree | 3976520b0016e68e5371a111177b3098116f17c4 /src | |
| parent | b480366445ad06550ea9e73c78318fac821bc7ed (diff) | |
| parent | 9649c4a27cf3c8011aeb881c272c641181c79e89 (diff) | |
| download | rust-f589482c5765a63c1a0746e0cdc38dd3efe9ff43.tar.gz rust-f589482c5765a63c1a0746e0cdc38dd3efe9ff43.zip | |
Rollup merge of #47344 - topecongiro:fixed-ices, r=alexcrichton
Add tests to fixed issues. Closes #36792. Closes #38091. Closes #39687. Closes #42148. Closes #42956.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/compile-fail/issue-39687.rs | 16 | ||||
| -rw-r--r-- | src/test/run-pass/issue-36792.rs | 17 | ||||
| -rw-r--r-- | src/test/run-pass/issue-38091.rs | 29 | ||||
| -rw-r--r-- | src/test/run-pass/issue-42148.rs | 15 | ||||
| -rw-r--r-- | src/test/run-pass/issue-42956.rs | 33 |
5 files changed, 110 insertions, 0 deletions
diff --git a/src/test/compile-fail/issue-39687.rs b/src/test/compile-fail/issue-39687.rs new file mode 100644 index 00000000000..404465e6a0f --- /dev/null +++ b/src/test/compile-fail/issue-39687.rs @@ -0,0 +1,16 @@ +// Copyright 2018 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 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(fn_traits)] + +fn main() { + <fn() as Fn()>::call; + //~^ ERROR associated type bindings are not allowed here [E0229] +} diff --git a/src/test/run-pass/issue-36792.rs b/src/test/run-pass/issue-36792.rs new file mode 100644 index 00000000000..faf983f6ecb --- /dev/null +++ b/src/test/run-pass/issue-36792.rs @@ -0,0 +1,17 @@ +// Copyright 2018 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 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(conservative_impl_trait)] +fn foo() -> impl Copy { + foo +} +fn main() { + foo(); +} diff --git a/src/test/run-pass/issue-38091.rs b/src/test/run-pass/issue-38091.rs new file mode 100644 index 00000000000..34050242f84 --- /dev/null +++ b/src/test/run-pass/issue-38091.rs @@ -0,0 +1,29 @@ +// Copyright 2018 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 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(specialization)] + +trait Iterate<'a> { + type Ty: Valid; + fn iterate(self); +} +impl<'a, T> Iterate<'a> for T where T: Check { + default type Ty = (); + default fn iterate(self) {} +} + +trait Check {} +impl<'a, T> Check for T where <T as Iterate<'a>>::Ty: Valid {} + +trait Valid {} + +fn main() { + Iterate::iterate(0); +} diff --git a/src/test/run-pass/issue-42148.rs b/src/test/run-pass/issue-42148.rs new file mode 100644 index 00000000000..0196649a3f6 --- /dev/null +++ b/src/test/run-pass/issue-42148.rs @@ -0,0 +1,15 @@ +// Copyright 2018 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 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Zst; + +fn main() { + unsafe { ::std::ptr::write_volatile(1 as *mut Zst, Zst) } +} diff --git a/src/test/run-pass/issue-42956.rs b/src/test/run-pass/issue-42956.rs new file mode 100644 index 00000000000..9bda6ee4bcb --- /dev/null +++ b/src/test/run-pass/issue-42956.rs @@ -0,0 +1,33 @@ +// Copyright 2018 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 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(associated_consts)] + +impl A for i32 { + type Foo = u32; +} +impl B for u32 { + const BAR: i32 = 0; +} + +trait A { + type Foo: B; +} + +trait B { + const BAR: i32; +} + +fn generic<T: A>() { + // This panics if the universal function call syntax is used as well + println!("{}", T::Foo::BAR); +} + +fn main() {} |
