]> git.proxmox.com Git - rustc.git/blob - tests/ui/typeck/issue-100246.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / typeck / issue-100246.rs
1 #![recursion_limit = "5"] // To reduce noise
2
3 //expect incompatible type error when ambiguous traits are in scope
4 //and not an overflow error on the span in the main function.
5
6 struct Ratio<T>(T);
7
8 pub trait Pow {
9 fn pow(self) -> Self;
10 }
11
12 impl<'a, T> Pow for &'a Ratio<T>
13 where
14 &'a T: Pow,
15 {
16 fn pow(self) -> Self {
17 self
18 }
19 }
20
21 fn downcast<'a, W: ?Sized>() -> std::io::Result<&'a W> {
22 todo!()
23 }
24
25 struct Other;
26
27 fn main() -> std::io::Result<()> {
28 let other: Other = downcast()?;//~ERROR 28:24: 28:35: `?` operator has incompatible types
29 Ok(())
30 }