diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-06-03 02:39:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-03 02:39:07 +0200 |
| commit | 0050b8817b56484a82a0f78bf4d5e9b7011b75af (patch) | |
| tree | bf7a48c6ce9414537cf91e1773dbd815aaff9036 /src | |
| parent | 69a1ac3891a36f921bb73095850e6a4a66d9d9de (diff) | |
| parent | a3344d1a3aef9d8c1171899fcd34486a7038a984 (diff) | |
| download | rust-0050b8817b56484a82a0f78bf4d5e9b7011b75af.tar.gz rust-0050b8817b56484a82a0f78bf4d5e9b7011b75af.zip | |
Rollup merge of #72902 - cuviper:fuse-covariant, r=nikomatsakis
Add a test to ensure Fuse stays covariant When #70502 attempted to specialize the data types in `Fuse`, one of the problems we found was that it broke variance. This was also realized when `Fuse` was first added, https://github.com/rust-lang/rust/pull/35656#discussion-diff-74995079, but now this PR adds a test so we don't forget again.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/variance-iterators-in-libcore.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/test/ui/variance-iterators-in-libcore.rs b/src/test/ui/variance-iterators-in-libcore.rs index 2ab3a8ab5c1..a542e44d517 100644 --- a/src/test/ui/variance-iterators-in-libcore.rs +++ b/src/test/ui/variance-iterators-in-libcore.rs @@ -1,9 +1,10 @@ // run-pass -#![allow(warnings)] +#![allow(dead_code)] -use std::iter::Zip; +use std::iter::{Fuse, Zip}; +fn fuse_covariant<'a, I>(iter: Fuse<&'static I>) -> Fuse<&'a I> { iter } fn zip_covariant<'a, A, B>(iter: Zip<&'static A, &'static B>) -> Zip<&'a A, &'a B> { iter } fn main() { } |
