Skip to content

Commit

Permalink
Add niche-in-generator test
Browse files Browse the repository at this point in the history
  • Loading branch information
tmandry committed Aug 3, 2019
1 parent 6fae7f8 commit 9d4ca87
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/test/run-pass/generator/niche-in-generator.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Test that niche finding works with captured generator upvars.

#![feature(generators)]

use std::mem::size_of_val;

fn take<T>(_: T) {}

fn main() {
let x = false;
let gen1 = || {
yield;
take(x);
};

assert_eq!(size_of_val(&gen1), size_of_val(&Some(gen1)));
}

0 comments on commit 9d4ca87

Please sign in to comment.