File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -119,9 +119,9 @@ struct DiagnosticBase {
119119 : Kind(kind), Level(level), Format(format) {
120120 static_assert ((... && !(std::is_same_v<Args, llvm::StringRef> ||
121121 std::is_same_v<Args, llvm::StringLiteral>)),
122- " For diagnostics, use a format provider (see "
123- " toolchain/diagnostics/format_providers.h) or std::string to "
124- " avoid lifetime issues. " );
122+ " String type disallowed in diagnostics. See "
123+ " https://github.com/carbon-language/carbon-lang/blob/trunk/ "
124+ " toolchain/docs/diagnostics.md#diagnostic-parameter-types " );
125125 }
126126
127127 // The diagnostic's kind.
Original file line number Diff line number Diff line change @@ -167,9 +167,11 @@ methods for formatting arguments:
167167 - This includes `char` and integer types (`int`, `int32_t`, and so on).
168168 - String types can be added as needed, but stringifying values using the
169169 methods noted below is preferred.
170- - Use `llvm::StringLiteral` where appropriate; use `std::string` when
171- allocations are required.
170+ - Use `std::string` when allocations are required.
172171 - `llvm::StringRef` is disallowed due to lifetime issues.
172+ - `llvm::StringLiteral` is disallowed because format providers such as
173+ `BoolAsSelect` should work in cases where a `StringLiteral` could be
174+ used.
173175- `llvm::format_provider<...>` specializations.
174176 - `BoolAsSelect` and `IntAsSelect` from
175177 [format_providers.h](/toolchain/diagnostics/format_providers.h) are
You can’t perform that action at this time.
0 commit comments