From 4de60dde6ed734acbc428887866ae3d528abbd37 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 26 Jun 2018 15:48:42 -0400 Subject: [PATCH] langref: explicit cast section --- doc/langref.html.in | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/doc/langref.html.in b/doc/langref.html.in index b76fc69385..8e24a4be2c 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -3602,6 +3602,10 @@ test "implicit cast - invoke a type as a function" { var b = u16(a); } {#code_end#} +

+ Implicit casts are only allowed when it is completely unambiguous how to get from one type to another, + and the transformation is guaranteed to be safe. +

{#header_open|Implicit Cast: Stricter Qualification#}

Values which have the same representation at runtime can be cast to increase the strictness @@ -3722,7 +3726,32 @@ test "float widening" { {#header_close#} {#header_open|Explicit Casts#} -

TODO

+

+ Explicit casts are performed via {#link|Builtin Functions#}. + Some explicit casts are safe; some are not. + Some explicit casts perform language-level assertions; some do not. + Some explicit casts are no-ops at runtime; some are not. +

+ {#header_close#} {#header_open|Peer Type Resolution#}