Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/swift/AST/DiagnosticsParse.def
Original file line number Diff line number Diff line change
Expand Up @@ -2147,7 +2147,7 @@ ERROR(expected_lparen_after_lifetime_dependence, PointsToFirstBadToken,

ERROR(expected_identifier_or_index_or_self_after_lifetime_dependence,
PointsToFirstBadToken,
"expected 'copy', 'borrow', or '&' followed by an identifier, index or 'self' in lifetime dependence specifier",
"expected identifier, index or self in lifetime dependence specifier",
())

ERROR(expected_rparen_after_lifetime_dependence, PointsToFirstBadToken,
Expand Down
6 changes: 0 additions & 6 deletions lib/Parse/ParseDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5014,7 +5014,6 @@ ParserResult<LifetimeEntry> Parser::parseLifetimeEntry(SourceLoc loc) {
SmallVector<LifetimeDescriptor> sources;
SourceLoc rParenLoc;
bool foundParamId = false;
bool invalidSourceDescriptor = false;
status = parseList(
tok::r_paren, lParenLoc, rParenLoc, /*AllowSepAfterLast=*/false,
diag::expected_rparen_after_lifetime_dependence, [&]() -> ParserStatus {
Expand All @@ -5031,18 +5030,13 @@ ParserResult<LifetimeEntry> Parser::parseLifetimeEntry(SourceLoc loc) {
auto sourceDescriptor =
parseLifetimeDescriptor(*this, lifetimeDependenceKind);
if (!sourceDescriptor) {
invalidSourceDescriptor = true;
listStatus.setIsParseError();
return listStatus;
}
sources.push_back(*sourceDescriptor);
return listStatus;
});

if (invalidSourceDescriptor) {
status.setIsParseError();
return status;
}
if (!foundParamId) {
diagnose(
Tok,
Expand Down
2 changes: 1 addition & 1 deletion test/Parse/lifetime_attr.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func testMissingLParenError(_ ne: NE) -> NE { // expected-error{{cannot infer th
ne
}

@_lifetime() // expected-error{{expected 'copy', 'borrow', or '&' followed by an identifier, index or 'self' in lifetime dependence specifier}}
@_lifetime() // expected-error{{expected identifier, index or self in lifetime dependence specifier}}
func testMissingDependence(_ ne: NE) -> NE { // expected-error{{cannot infer the lifetime dependence scope on a function with a ~Escapable parameter, specify '@_lifetime(borrow ne)' or '@_lifetime(copy ne)'}}
ne
}
Expand Down
5 changes: 0 additions & 5 deletions test/Sema/lifetime_depend_infer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -591,11 +591,6 @@ func f_inout_no_infer(a: inout MutNE, b: NE) {}
// expected-error @-1{{a function with a ~Escapable 'inout' parameter requires '@_lifetime(a: ...)'}}
// expected-note @-2{{use '@_lifetime(a: copy a) to forward the inout dependency}}

// Invalid keyword for the dependence kind.
//
@_lifetime(a: inout a) // expected-error{{expected 'copy', 'borrow', or '&' followed by an identifier, index or 'self' in lifetime dependence specifier}}
func f_inout_bad_keyword(a: inout MutableRawSpan) {}

// Don't allow a useless borrow dependency on an inout param--it is misleading.
//
@_lifetime(a: &a) // expected-error{{invalid use of inout dependence on the same inout parameter}}
Expand Down