]> git.lizzy.rs Git - rust.git/blob - src/test/ui/diverging-fallback-option.rs
Auto merge of #81507 - weiznich:add_diesel_to_cargo_test, r=Mark-Simulacrum
[rust.git] / src / test / ui / diverging-fallback-option.rs
1 // run-pass
2
3 #![allow(warnings)]
4
5 // Here the type of `c` is `Option<?T>`, where `?T` is unconstrained.
6 // Because there is data-flow from the `{ return; }` block, which
7 // diverges and hence has type `!`, into `c`, we will default `?T` to
8 // `!`, and hence this code compiles rather than failing and requiring
9 // a type annotation.
10
11 fn main() {
12     let c = Some({ return; });
13     c.unwrap();
14 }