diff options
| author | Flavio Percoco <flaper87@gmail.com> | 2015-02-27 01:13:31 +0100 |
|---|---|---|
| committer | Flavio Percoco <flaper87@gmail.com> | 2015-02-27 14:39:48 +0100 |
| commit | b7f9d07f4c4f0fdb5e33736814a2f4f7fd1db7bf (patch) | |
| tree | 33719be1d43e701f603c349123cfb4474d546494 /src/test | |
| parent | bd27985457d4afc7c0a6218e8e1c30fdf359e48c (diff) | |
| download | rust-b7f9d07f4c4f0fdb5e33736814a2f4f7fd1db7bf.tar.gz rust-b7f9d07f4c4f0fdb5e33736814a2f4f7fd1db7bf.zip | |
Normalize types before collecting obligations
Fixes #22828 Fixes #22629
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-pass/issue-22629.rs | 20 | ||||
| -rw-r--r-- | src/test/run-pass/issue-22828.rs | 29 |
2 files changed, 49 insertions, 0 deletions
diff --git a/src/test/run-pass/issue-22629.rs b/src/test/run-pass/issue-22629.rs new file mode 100644 index 00000000000..7bbd85d817f --- /dev/null +++ b/src/test/run-pass/issue-22629.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 <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. + +// Test transitive analysis for associated types. Collected types +// should be normalized and new obligations generated. + +use std::borrow::{ToOwned, Cow}; + +fn assert_send<T: Send>(_: T) {} + +fn main() { + assert_send(Cow::Borrowed("foo")); +} diff --git a/src/test/run-pass/issue-22828.rs b/src/test/run-pass/issue-22828.rs new file mode 100644 index 00000000000..8ad960b3f1b --- /dev/null +++ b/src/test/run-pass/issue-22828.rs @@ -0,0 +1,29 @@ +// 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 <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. + +// Test transitive analysis for associated types. Collected types +// should be normalized and new obligations generated. + +trait Foo { + type A; + fn foo(&self) {} +} + +impl Foo for usize { + type A = usize; +} + +struct Bar<T: Foo> { inner: T::A } + +fn is_send<T: Send>() {} + +fn main() { + is_send::<Bar<usize>>(); +} |
