describe more cases of noncopyable in a tuple; also improve existing message a bit.

This commit is contained in:
Kavon Farvardin
2023-06-26 14:22:04 -07:00
parent c40985dfb3
commit 485bdc7918
6 changed files with 29 additions and 13 deletions

View File

@@ -6156,6 +6156,13 @@ bool NotCopyableFailure::diagnoseAsError() {
case NoncopyableMatchFailure::CopyableConstraint: {
auto *loc = getLocator();
if (loc->isLastElement<LocatorPathElt::AnyTupleElement>()) {
assert(!noncopyableTy->is<TupleType>() && "will use poor wording");
emitDiagnostic(diag::tuple_move_only_not_supported, noncopyableTy);
return true;
}
// a bit paranoid of nulls and such...
if (auto *genericParam = loc->getGenericParameter()) {
if (auto *paramDecl = genericParam->getDecl()) {