You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>// OK: ref-safe-context of `ref value` is caller-context,
1044
+
>// safe-context contributed is caller-context.
1045
+
>returnnewRS(refvalue);
1046
+
> }
1047
+
>
1048
+
> staticRSCreateWithoutCapture(scopedrefintvalue)
1049
+
> {
1050
+
>// Error: `value` is scoped ref so it does not contribute
1051
+
>// ref-safe-context. The constructor needs ref-safe-context
1052
+
>// of caller-context but `value` only has function-member.
1053
+
>returnnewRS(refvalue);
1054
+
> }
1055
+
> }
1056
+
> ```
1057
+
>
1058
+
>*endexample*
1059
+
1029
1060
#### §method-arguments-must-match Method arguments must match
1030
1061
1031
1062
Foranymethodinvocation `e.M(a1, a2, ... aN)`:
@@ -1048,6 +1079,29 @@ For any method invocation `e.M(a1, a2, ... aN)`:
1048
1079
1049
1080
The presence of `scoped` allows developers to reduce the friction this rule creates by marking parameters which are not returned as `scoped`. This removes their arguments from (1) in both cases above and provides greater flexibility to callers.
1050
1081
1082
+
> *Example*: The following illustrates how the method-arguments-must-match rule prevents a value with a narrower safe-context from being stored into a `ref` argument with a wider safe-context:
0 commit comments