@@ -8089,7 +8089,7 @@ ERROR(pack_iteration_where_clause_not_supported, none,
8089
8089
8090
8090
8091
8091
// ------------------------------------------------------------------------------
8092
- // MARK: Lifetime Dependence Diagnostics
8092
+ // MARK: Lifetime Dependence Syntax
8093
8093
// ------------------------------------------------------------------------------
8094
8094
8095
8095
ERROR(lifetime_dependence_invalid_param_name, none,
@@ -8108,34 +8108,15 @@ ERROR(lifetime_dependence_cannot_use_kind, none,
8108
8108
ERROR(lifetime_dependence_cannot_use_parsed_scoped_consuming, none,
8109
8109
" invalid use of scoped lifetime dependence with consuming ownership" ,
8110
8110
())
8111
- ERROR(lifetime_dependence_cannot_use_inferred_scoped_consuming, none,
8112
- " invalid use of lifetime dependence on an Escapable parameter with "
8113
- " consuming ownership" ,
8114
- ())
8115
- ERROR(lifetime_dependence_invalid_self_ownership, none,
8116
- " invalid scoped lifetime dependence on an Escapable self with consuming "
8117
- " ownership" ,
8118
- ())
8119
8111
ERROR(lifetime_dependence_only_on_function_method_init_result, none,
8120
8112
" lifetime dependence specifiers may only be used on result of "
8121
8113
" functions, methods, initializers" , ())
8122
- ERROR(lifetime_dependence_invalid_type, none,
8123
- " lifetime dependence can only be specified on ~Escapable types" , ())
8124
- ERROR(lifetime_dependence_cannot_infer_ambiguous_candidate, none,
8125
- " cannot infer lifetime dependence %0, multiple parameters qualifiy as a candidate" , (StringRef))
8126
- ERROR(lifetime_dependence_cannot_infer_no_candidates, none,
8127
- " cannot infer lifetime dependence%0, no parameters found that are either "
8128
- " ~Escapable or Escapable with a borrowing ownership" , (StringRef))
8129
- ERROR(lifetime_dependence_ctor_non_self_or_nil_return, none,
8130
- " expected nil or self as return values in an initializer with "
8131
- " lifetime dependent specifiers" ,
8132
- ())
8133
- ERROR(lifetime_dependence_cannot_be_applied_to_tuple_elt, none,
8134
- " lifetime dependence specifiers cannot be applied to tuple elements" , ())
8135
- ERROR(lifetime_dependence_method_escapable_bitwisecopyable_self, none,
8136
- " cannot infer lifetime dependence on a self which is BitwiseCopyable & "
8137
- " Escapable" ,
8114
+ ERROR(lifetime_dependence_ctor_non_self_or_nil_return, none,
8115
+ " expected 'nil' or 'self' as return values in an initializer with "
8116
+ " lifetime dependent specifiers" ,
8138
8117
())
8118
+ ERROR(lifetime_dependence_cannot_be_applied_to_tuple_elt, none,
8119
+ " lifetime dependence specifiers cannot be applied to tuple elements" , ())
8139
8120
ERROR(lifetime_dependence_immortal_conflict_name, none,
8140
8121
" conflict between the parameter name and 'immortal' contextual keyword" , ())
8141
8122
ERROR(lifetime_dependence_function_type, none,
@@ -8144,18 +8125,75 @@ ERROR(lifetime_dependence_function_type, none,
8144
8125
ERROR(lifetime_dependence_immortal_alone, none,
8145
8126
" cannot specify any other dependence source along with immortal" , ())
8146
8127
ERROR(lifetime_dependence_invalid_inherit_escapable_type, none,
8147
- " invalid lifetime dependence on a source of Escapable type, use borrow "
8148
- " dependence instead" ,
8149
- ())
8128
+ " cannot copy the lifetime of an Escapable type, use "
8129
+ " '@lifetime(borrow %0)' instead" ,
8130
+ (StringRef ))
8150
8131
ERROR(lifetime_dependence_cannot_use_parsed_borrow_consuming, none,
8151
8132
" invalid use of borrow dependence with consuming ownership" ,
8152
8133
())
8134
+ ERROR(lifetime_dependence_cannot_use_parsed_borrow_inout, none,
8135
+ " invalid use of borrow dependence on the same inout parameter" ,
8136
+ ())
8153
8137
ERROR(lifetime_dependence_duplicate_target, none,
8154
8138
" invalid duplicate target lifetime dependencies on function" , ())
8139
+ ERROR(lifetime_parameter_requires_inout, none,
8140
+ " lifetime-dependent parameter must be 'inout'" , (Identifier))
8141
+
8142
+ // ------------------------------------------------------------------------------
8143
+ // MARK: Lifetime Dependence Requirements
8144
+ // ------------------------------------------------------------------------------
8145
+
8146
+ ERROR(lifetime_dependence_feature_required_return, none,
8147
+ " %0 with a ~Escapable result requires "
8148
+ " '-enable-experimental-feature LifetimeDependence'" , (StringRef))
8149
+ ERROR(lifetime_dependence_feature_required_mutating, none,
8150
+ " %0 with ~Escapable 'self' requires "
8151
+ " '-enable-experimental-feature LifetimeDependence'" , (StringRef))
8152
+ ERROR(lifetime_dependence_feature_required_inout, none,
8153
+ " %0 with a ~Escapable 'inout' parameter requires "
8154
+ " '-enable-experimental-feature LifetimeDependence'" ,
8155
+ // arg list is interchangable with lifetime_dependence_cannot_infer_inout
8156
+ (StringRef, Identifier))
8157
+
8158
+ ERROR(lifetime_dependence_cannot_infer_return, none,
8159
+ " %0 with a ~Escapable result requires '@lifetime(...)'" , (StringRef))
8160
+ ERROR(lifetime_dependence_cannot_infer_mutating, none,
8161
+ " %0 with a ~Escapable 'self' requires '@lifetime(self: ...)'" , (StringRef))
8162
+ ERROR(lifetime_dependence_cannot_infer_inout, none,
8163
+ " %0 with a ~Escapable 'inout' parameter requires '@lifetime(%1: ...)'" ,
8164
+ (StringRef, Identifier))
8165
+
8166
+ // ------------------------------------------------------------------------------
8167
+ // MARK: Lifetime Dependence Inference - refinements to the requirements above
8168
+ // ------------------------------------------------------------------------------
8155
8169
8156
- ERROR(lifetime_dependence_feature_required, none,
8157
- " returning ~Escapable type requires '-enable-experimental-feature "
8158
- " LifetimeDependence'" , ())
8170
+ ERROR(lifetime_dependence_cannot_infer_return_no_param, none,
8171
+ " %0 with a ~Escapable result needs a parameter to depend on" ,
8172
+ (StringRef))
8173
+ NOTE(lifetime_dependence_cannot_infer_return_immortal, none,
8174
+ " '@lifetime(immortal)' can be used to indicate that values produced by "
8175
+ " this initializer have no lifetime dependencies" , ())
8176
+ ERROR(lifetime_dependence_cannot_infer_bitwisecopyable, none,
8177
+ " cannot infer lifetime dependence on %0 because '%1' is BitwiseCopyable, "
8178
+ " specify '@lifetime(borrow self)'" ,
8179
+ (StringRef, StringRef))
8180
+ ERROR(lifetime_dependence_cannot_infer_kind, none,
8181
+ " cannot infer the lifetime dependence scope on %0 with a ~Escapable "
8182
+ " parameter, specify '@lifetime(borrow %1)' or '@lifetime(copy %1)'" ,
8183
+ (StringRef, StringRef))
8184
+ ERROR(lifetime_dependence_cannot_infer_scope_ownership, none,
8185
+ " cannot borrow the lifetime of '%0', which has consuming ownership on %1" ,
8186
+ (StringRef, StringRef))
8187
+
8188
+ // ------------------------------------------------------------------------------
8189
+ // MARK: Lifetime Dependence Experimental Inference
8190
+ // ------------------------------------------------------------------------------
8191
+
8192
+ ERROR(lifetime_dependence_cannot_infer_no_candidates, none,
8193
+ " cannot infer lifetime dependence%0, no parameters found that are either "
8194
+ " ~Escapable or Escapable with a borrowing ownership" , (StringRef))
8195
+ ERROR(lifetime_dependence_cannot_infer_ambiguous_candidate, none,
8196
+ " cannot infer lifetime dependence%0, multiple parameters qualify as a candidate" , (StringRef))
8159
8197
8160
8198
// ===----------------------------------------------------------------------===//
8161
8199
// MARK: Sending
0 commit comments