]> git.proxmox.com Git - rustc.git/blame - src/test/ui/variance/variance-btree-invariant-types.rs
New upstream version 1.62.1+dfsg1
[rustc.git] / src / test / ui / variance / variance-btree-invariant-types.rs
CommitLineData
136023e0 1use std::collections::btree_map::{IterMut, OccupiedEntry, RangeMut, VacantEntry};
9cc50fc6 2
04454e1e
FG
3// revisions: base nll
4// ignore-compare-mode-nll
5//[nll] compile-flags: -Z borrowck=mir
6
9cc50fc6 7fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> {
04454e1e
FG
8 v
9 //[base]~^ ERROR mismatched types
10 //[nll]~^^ lifetime may not live long enough
9cc50fc6
SL
11}
12fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, (), &'new ()> {
04454e1e
FG
13 v
14 //[base]~^ ERROR mismatched types
15 //[nll]~^^ lifetime may not live long enough
9cc50fc6
SL
16}
17fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, &'static (), ()> {
04454e1e
FG
18 v
19 //[base]~^ ERROR mismatched types
20 //[nll]~^^ lifetime may not live long enough
9cc50fc6
SL
21}
22fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, (), &'static ()> {
04454e1e
FG
23 v
24 //[base]~^ ERROR mismatched types
25 //[nll]~^^ lifetime may not live long enough
9cc50fc6
SL
26}
27
136023e0 28fn range_cov_key<'a, 'new>(v: RangeMut<'a, &'static (), ()>) -> RangeMut<'a, &'new (), ()> {
04454e1e
FG
29 v
30 //[base]~^ ERROR mismatched types
31 //[nll]~^^ lifetime may not live long enough
136023e0
XL
32}
33fn range_cov_val<'a, 'new>(v: RangeMut<'a, (), &'static ()>) -> RangeMut<'a, (), &'new ()> {
04454e1e
FG
34 v
35 //[base]~^ ERROR mismatched types
36 //[nll]~^^ lifetime may not live long enough
136023e0
XL
37}
38fn range_contra_key<'a, 'new>(v: RangeMut<'a, &'new (), ()>) -> RangeMut<'a, &'static (), ()> {
04454e1e
FG
39 v
40 //[base]~^ ERROR mismatched types
41 //[nll]~^^ lifetime may not live long enough
136023e0
XL
42}
43fn range_contra_val<'a, 'new>(v: RangeMut<'a, (), &'new ()>) -> RangeMut<'a, (), &'static ()> {
04454e1e
FG
44 v
45 //[base]~^ ERROR mismatched types
46 //[nll]~^^ lifetime may not live long enough
136023e0
XL
47}
48
9cc50fc6
SL
49fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>)
50 -> OccupiedEntry<'a, &'new (), ()> {
04454e1e
FG
51 v
52 //[base]~^ ERROR mismatched types
53 //[nll]~^^ lifetime may not live long enough
9cc50fc6
SL
54}
55fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>)
56 -> OccupiedEntry<'a, (), &'new ()> {
04454e1e
FG
57 v
58 //[base]~^ ERROR mismatched types
59 //[nll]~^^ lifetime may not live long enough
9cc50fc6
SL
60}
61fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>)
62 -> OccupiedEntry<'a, &'static (), ()> {
04454e1e
FG
63 v
64 //[base]~^ ERROR mismatched types
65 //[nll]~^^ lifetime may not live long enough
9cc50fc6
SL
66}
67fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>)
68 -> OccupiedEntry<'a, (), &'static ()> {
04454e1e
FG
69 v
70 //[base]~^ ERROR mismatched types
71 //[nll]~^^ lifetime may not live long enough
9cc50fc6
SL
72}
73
74fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>)
75 -> VacantEntry<'a, &'new (), ()> {
04454e1e
FG
76 v
77 //[base]~^ ERROR mismatched types
78 //[nll]~^^ lifetime may not live long enough
9cc50fc6
SL
79}
80fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>)
81 -> VacantEntry<'a, (), &'new ()> {
04454e1e
FG
82 v
83 //[base]~^ ERROR mismatched types
84 //[nll]~^^ lifetime may not live long enough
9cc50fc6
SL
85}
86fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>)
87 -> VacantEntry<'a, &'static (), ()> {
04454e1e
FG
88 v
89 //[base]~^ ERROR mismatched types
90 //[nll]~^^ lifetime may not live long enough
9cc50fc6
SL
91}
92fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>)
93 -> VacantEntry<'a, (), &'static ()> {
04454e1e
FG
94 v
95 //[base]~^ ERROR mismatched types
96 //[nll]~^^ lifetime may not live long enough
9cc50fc6
SL
97}
98
a1dfa0c6 99
9cc50fc6 100fn main() { }