From 3fdfdb0072b33af44d368c4f488c5988def011a1 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Fri, 4 Aug 2023 10:06:58 +0200 Subject: [PATCH] Various fixes --- src/generics.rst | 6 +++--- src/patterns.rst | 4 ++-- src/types-and-traits.rst | 24 ++++++++++++++++-------- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/generics.rst b/src/generics.rst index f99ac14e..bc908e81 100644 --- a/src/generics.rst +++ b/src/generics.rst @@ -107,7 +107,7 @@ default :t:`value` of its related :t:`type parameter`. :dp:`fls_3qZRBp9j26w3` The :t:`type` of the :t:`type parameter initializer` of a :t:`type parameter` -shall satisfy the :t:`[type bound]s` of the :t:`type parameter`. +shall satisfy the :t:`[trait bound]s` of the :t:`type parameter`. :dp:`fls_x4s7p2v981r6` A :t:`generic enum` shall use all of its :t:`[type parameter]s` and @@ -282,7 +282,7 @@ true for the supplied :t:`[generic argument]s`. :dp:`fls_1xgw1dq60quz` A :t:`trivial predicate` is a :t:`where clause predicate` that does not use -the :t:`[generic parameter]s` or :t:`[higher-ranked lifetime]s` of the related +the :t:`[generic parameter]s` or :t:`[higher-ranked trait bound]s` of the related :t:`construct`. :dp:`fls_47s8i7pzb9gg` @@ -320,7 +320,7 @@ Generic Arguments ConstantArgument ::= BlockExpression | $$-$$? LiteralExpression - | SimplePathSegment + | Identifier LifetimeArgument ::= LifetimeIndication diff --git a/src/patterns.rst b/src/patterns.rst index b9e50839..7cc7f211 100644 --- a/src/patterns.rst +++ b/src/patterns.rst @@ -1169,8 +1169,8 @@ A :t:`binding` of a :t:`binding pattern` binds a matched :t:`value` to a :dp:`fls_RViC5UEZPQUV` A :t:`binding` with :t:`binding mode` :dt:`by value` binds the matched -:t:`value` by :t:`[pass]ing` the :t:`value` to the :t:`place` indicated by the -:t:`name`. +:t:`value` by :t:`passing ` the :t:`value` to the :t:`place` +indicated by the :t:`name`. :dp:`fls_6lXtoxebD5It` A :t:`binding` with :t:`binding mode` :dt:`by reference` binds an diff --git a/src/types-and-traits.rst b/src/types-and-traits.rst index aaa02035..4d051d26 100644 --- a/src/types-and-traits.rst +++ b/src/types-and-traits.rst @@ -1672,23 +1672,23 @@ proceeds as follows: #. :dp:`fls_pGRLTACDvzv2` Otherwise, if one :t:`type` ``T`` is an :t:`integer type variable`, behavior depends on the other :t:`type` ``U``: - + #. :dp:`fls_fTy3FVt0fK9g` If ``U`` is an :t:`integer type` or an :t:`integer type variable`, the :t:`integer type variable` ``T`` is assigned :t:`type` ``U``. - + #. :dp:`fls_7IsrfUoPXSZU` Otherwise, :t:`type unification` fails. #. :dp:`fls_Hb95CPyUpCmc` Otherwise, if one :t:`type` ``T`` is an :t:`floating-point type variable`, behavior depends on the other :t:`type` ``U``: - + #. :dp:`fls_jEZVWlfVPevb` If ``U`` is an :t:`floating-point type` or an :t:`floating-point type variable`, the :t:`floating-point type variable` ``T`` is assigned :t:`type` ``U``. - + #. :dp:`fls_nKcqFo7yIDBe` Otherwise, :t:`type unification` fails. @@ -2120,6 +2120,12 @@ The following :t:`[expression]s` are considered :t:`[type inference root]s`: * :dp:`fls_KphY5qHev0Dc` The :t:`expression` of a :t:`discriminant initializer`. +* :dp:`fls_67Bf5kR5OtYW` + The :t:`expression` of a :t:`constant parameter initializer`. + +* :dp:`fls_67Bf5kR5OtYW` + The :t:`expression` of a :t:`constant argument`. + * :dp:`fls_Sowatt1V988J` A :t:`function body`. @@ -2152,7 +2158,7 @@ depending on the :t:`type inference root` as follows: If the :t:`enum type` that contains the :t:`discriminant` is subject to :t:`attribute` :c:`repr` that specifies a :t:`primitive representation`, the :t:`expected type` is the specified :t:`primitive type`. - + * :dp:`fls_QaGKt99CmvF6` Otherwise, the :t:`expected type` is :c:`isize`. @@ -2218,7 +2224,7 @@ inferece rules below), an :t:`obligation` requiring that ``Type`` implements #. :dp:`fls_1rnssw39aRWn` For each :t:`statement`, apply the :t:`statement` inference rules outlined below. - + #. :dp:`fls_aYJaZXcOVVyk` For each :t:`expression`, apply the :t:`expression` inference rules outlined below. @@ -2252,7 +2258,9 @@ The :t:`type inference` rules for :t:`[statement]s` are as follows: * :dp:`fls_97Fxlv2KN6QF` :t:`[Expression statement]s` apply the :t:`expression` inference rules outlined below - to the related :t:`expression`, without any :t:`expected type` set. + to the related :t:`expression`, with the :t:`expected type` set to the + :t:`unit type` if the :t:`expression statement` lacks the character 0x3B + (semicolon), unset otherwise. * :dp:`fls_hzXqj6YT1mFr` :t:`[Let statement]s` are inferred as follows: @@ -2322,7 +2330,7 @@ The :t:`type inference` rules for :t:`[expression]s` are as follows: * :dp:`fls_4ZT35povCL04` A :t:`match expression` is inferred as follows: - + #. :dp:`fls_62OcWZaVN9hh` :t:`Unify` the :t:`[type]s` of the :t:`[pattern]s` of every :t:`match arm`, then infer the :t:`subject expression` with the :t:`expected type` set to