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,
1042
+
>// safe-context contributed is caller-context.
1043
+
>returnnewRS(refvalue);
1044
+
> }
1045
+
>
1046
+
> staticRSCreateWithoutCapture(scopedrefintvalue)
1047
+
> {
1048
+
>// Error: `value` is scoped ref so it does not contribute
1049
+
>// ref-safe-context. The constructor needs ref-safe-context
1050
+
>// of caller-context but `value` only has function-member.
1051
+
>returnnewRS(refvalue);
1052
+
> }
1053
+
> }
1054
+
> ```
1055
+
>
1056
+
>*endexample*
1057
+
1027
1058
#### §method-arguments-must-match Method arguments must match
1028
1059
1029
1060
Foranymethodinvocation `e.M(a1, a2, ... aN)`:
@@ -1046,6 +1077,29 @@ For any method invocation `e.M(a1, a2, ... aN)`:
1046
1077
1047
1078
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.
1048
1079
1080
+
> *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