Unscoped parameters are typically noticed at call-sites and only when an error is reported if the call-site has a mismatch of lifetimes. If we report a warning at the method declaration, that should catch cases where parameters were left unscoped unintentionally. The warning should also reduce the risk that a parameter needs to be marked scoped later, which is a potential API breaking change.
The warning would be reported for a ref, in, or ref struct parameter where references do not escape the method, and where:
- The method returns a
ref or ref readonly or ref struct or
- The method has a
ref or out parameter of ref struct type.
The warning could be a warning wave warning.