Skip to content

Commit

Permalink
Rollup merge of #72902 - cuviper:fuse-covariant, r=nikomatsakis
Browse files Browse the repository at this point in the history
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, #35656 (diff), but now this PR adds a test so we don't forget again.
  • Loading branch information
Dylan-DPC committed Jun 3, 2020
2 parents 69a1ac3 + a3344d1 commit 0050b88
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/test/ui/variance-iterators-in-libcore.rs
Original file line number Diff line number Diff line change
@@ -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() { }

0 comments on commit 0050b88

Please sign in to comment.