rust/compiler/rustc_hir_analysis/src
Nicholas Nethercote 781111ef35 Use Cow in {D,Subd}iagnosticMessage.
Each of `{D,Subd}iagnosticMessage::{Str,Eager}` has a comment:
```
// FIXME(davidtwco): can a `Cow<'static, str>` be used here?
```
This commit answers that question in the affirmative. It's not the most
compelling change ever, but it might be worth merging.

This requires changing the `impl<'a> From<&'a str>` impls to `impl
From<&'static str>`, which involves a bunch of knock-on changes that
require/result in call sites being a little more precise about exactly
what kind of string they use to create errors, and not just `&str`. This
will result in fewer unnecessary allocations, though this will not have
any notable perf effects given that these are error paths.

Note that I was lazy within Clippy, using `to_string` in a few places to
preserve the existing string imprecision. I could have used `impl
Into<{D,Subd}iagnosticMessage>` in various places as is done in the
compiler, but that would have required changes to *many* call sites
(mostly changing `&format("...")` to `format!("...")`) which didn't seem
worthwhile.
2023-05-29 09:23:43 +10:00
..
astconv Replace EarlyBinder(x) with EarlyBinder::new(x) 2023-05-28 10:44:50 -06:00
check Use Cow in {D,Subd}iagnosticMessage. 2023-05-29 09:23:43 +10:00
coherence Rollup merge of #111648 - Nilstrieb:language-items, r=WaffleLapkin 2023-05-17 11:13:56 +05:30
collect Replace EarlyBinder(x) with EarlyBinder::new(x) 2023-05-28 10:44:50 -06:00
impl_wf_check Report nicer lifetime errors for specialization 2023-05-05 22:19:56 +01:00
outlives Make EarlyBinder's inner value private; and fix all of the resulting errors 2023-05-28 10:44:53 -06:00
structured_errors Use Option::is_some_and and Result::is_ok_and in the compiler 2023-05-24 14:20:41 +00:00
variance Move expansion of query macros in rustc_middle to rustc_middle::query 2023-05-15 08:49:13 +02:00
autoderef.rs Structurally normalize in the new solver 2023-05-22 21:18:20 +00:00
bounds.rs Auto merge of #110806 - WaffleLapkin:unmkI, r=lcnr 2023-05-04 05:54:09 +00:00
check_unused.rs Remove last instances of HashSet in query result types. 2023-03-01 10:20:45 +01:00
collect.rs Replace EarlyBinder(x) with EarlyBinder::new(x) 2023-05-28 10:44:50 -06:00
constrained_generic_params.rs IAT: Introduce AliasKind::Inherent 2023-05-04 16:59:10 +02:00
errors.rs Rollup merge of #111252 - matthewjasper:min-spec-improvements, r=compiler-errors 2023-05-09 12:33:46 +05:30
hir_wf_check.rs Move expansion of query macros in rustc_middle to rustc_middle::query 2023-05-15 08:49:13 +02:00
impl_wf_check.rs Move expansion of query macros in rustc_middle to rustc_middle::query 2023-05-15 08:49:13 +02:00
lib.rs Move expansion of query macros in rustc_middle to rustc_middle::query 2023-05-15 08:49:13 +02:00
structured_errors.rs rustc_typeck to rustc_hir_analysis 2022-09-27 10:37:23 +02:00