diff --git a/doc/langref.html.in b/doc/langref.html.in index 6e2d2bd9a..57da8a5f0 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -4264,13 +4264,21 @@ fn foo() i32 { return 1234; } {#code_end#} -
However, if the expression has type {#syntax#}void{#endsyntax#}:
+However, if the expression has type {#syntax#}void{#endsyntax#}, there will be no error. Function return values can also be explicitly ignored by assigning them to {#syntax#}_{#endsyntax#}.
{#code_begin|test#} -test "ignoring expression value" { - foo(); +test "void is ignored" { + returnsVoid(); } -fn foo() void {} +test "explicitly ignoring expression value" { + _ = foo(); +} + +fn returnsVoid() void {} + +fn foo() i32 { + return 1234; +} {#code_end#} {#header_close#}