File tree Expand file tree Collapse file tree 2 files changed +14
-19
lines changed Expand file tree Collapse file tree 2 files changed +14
-19
lines changed Original file line number Diff line number Diff line change @@ -95,19 +95,15 @@ struct Foo {
9595 x: !,
9696}
9797
98- fn diverging_place_read() -> () {
98+ fn diverging_place_read() -> ! {
9999 let foo = Foo { x: make() };
100- let _: ! = {
101- // A read of a place expression produces a diverging block
102- let _x = foo.x;
103- };
100+ // A read of a place expression produces a diverging block
101+ let _x = foo.x;
104102}
105103fn diverging_place_not_read() -> () {
106104 let foo = Foo { x: make() };
107- let _: () = {
108- // Asssignment to `_` means the place is not read
109- let _ = foo.x;
110- };
105+ // Asssignment to `_` means the place is not read
106+ let _ = foo.x;
111107}
112108```
113109
Original file line number Diff line number Diff line change @@ -103,16 +103,15 @@ r[expr.match.empty]
103103If there are no match arms, then the ` match ` expression is diverging and the type is [ ` ! ` ] ( ../types/never.md ) .
104104
105105> [ !EXAMPLE]
106- ``` rust
107- # fn make <T >() -> T { loop {} }
108- enum Empty {}
109-
110- fn diverging_match_no_arms () -> ! {
111- let e : Empty = make ();
112- let
113- match e {}
114- }
115- ```
106+ > ``` rust
107+ > # fn make <T >() -> T { loop {} }
108+ > enum Empty {}
109+ >
110+ > fn diverging_match_no_arms () -> ! {
111+ > let e : Empty = make ();
112+ > match e {}
113+ > }
114+ > ```
116115
117116
118117r [expr . match . conditional]
You can’t perform that action at this time.
0 commit comments