Skip to content
Merged
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 lib/AST/LifetimeDependence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ class LifetimeDependenceChecker {
diagnose(returnLoc,
diag::lifetime_dependence_cannot_infer_scope_ownership,
param->getParameterName().str(), diagnosticQualifier());
continue;
return;
}
targetDeps = std::move(targetDeps).add(paramIndex, *kind);
}
Expand Down
6 changes: 6 additions & 0 deletions test/Sema/lifetime_depend_infer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ struct EscapableNonTrivialSelf {
// (for initializers and stand-alone functions)
// =============================================================================

// An implicit initializer illegally consumes its nontrivial parameter.
public struct NonescapableImplicitInitializer: ~Escapable {
// expected-error @-1{{cannot borrow the lifetime of 'c', which has consuming ownership on an implicit initializer}}
var c: C
}

struct NonescapableInitializers: ~Escapable {
var c: C

Expand Down