Since this function is being called from the constraint solver now, we
need to generalize the way it obtains the Type of an Expression, as the
expression itself may not know its own type, only the solver does.
resolves rdar://134371893 / https://github.com/swiftlang/swift/issues/75999
Implicit initializers internally have "Default" parameter ownership
specifiers, which can only happen for a noncopyable type if the decl is
synthesized, since ownership is required to be specified if it were
written in the source.
There's no reason to warn for such decls, since the user can't see it
anyway. So specifically target an explicitly written "borrowing" as
being confusing, since that's the only valid case that could happen
anyway.
resolves rdar://131546153
There are a number of implicit conversions in Swift, such as to Optional
and to an existential, which are now possible for noncopyable types.
But all type casts are consuming operations for noncopyable types. So
it's confusing when a function that takes a borrowed argument of
optional type appears to be consuming:
```
func f(_ x: borrowing NC?) { ... }
let x = NC()
f(x)
f(x) // error!
```
So, rather than for people to write `x as T?` around all implicit
conversions, require them to write `consume x` around expressions
that will consume some lvalue. Since that makes it much more clear what
the consequences will be.
Expressions like `f(g())`, where you're passing an rvalue to the callee,
are not confusing. And those are exactly the expressions you're not
allowed to write `consume` for, anyway.
fixes rdar://127450418