]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-29037.rs
Auto merge of #78066 - bugadani:wat, r=jonas-schievink
[rust.git] / src / test / ui / issues / issue-29037.rs
1 // check-pass
2 #![allow(dead_code)]
3 // This test ensures that each pointer type `P<X>` is covariant in `X`.
4
5 use std::rc::Rc;
6 use std::sync::Arc;
7
8 fn a<'r>(x: Box<&'static str>) -> Box<&'r str> {
9     x
10 }
11
12 fn b<'r, 'w>(x: &'w &'static str) -> &'w &'r str {
13     x
14 }
15
16 fn c<'r>(x: Arc<&'static str>) -> Arc<&'r str> {
17     x
18 }
19
20 fn d<'r>(x: Rc<&'static str>) -> Rc<&'r str> {
21     x
22 }
23
24 fn main() {}