]> git.proxmox.com Git - rustc.git/blob - src/test/run-pass/issues/issue-41677.rs
New upstream version 1.31.0~beta.4+dfsg1
[rustc.git] / src / test / run-pass / issues / issue-41677.rs
1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // run-pass
12 // Regression test for #41677. The local variable was winding up with
13 // a type `Receiver<?T, H>` where `?T` was unconstrained, because we
14 // failed to enforce the WF obligations and `?T` is a bivariant type
15 // parameter position.
16
17 #![allow(unused_variables, dead_code)]
18
19 use std::marker::PhantomData;
20
21 trait Handle {
22 type Inner;
23 }
24
25 struct ResizingHandle<H>(PhantomData<H>);
26 impl<H> Handle for ResizingHandle<H> {
27 type Inner = H;
28 }
29
30 struct Receiver<T, H: Handle<Inner=T>>(PhantomData<H>);
31
32 fn channel<T>(size: usize) -> Receiver<T, ResizingHandle<T>> {
33 let rx = Receiver(PhantomData);
34 rx
35 }
36
37 fn main() {
38 }