rust/compiler/rustc_codegen_ssa/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
..
back Use Cow in {D,Subd}iagnosticMessage. 2023-05-29 09:23:43 +10:00
coverageinfo Isolate coverage FFI type layouts from their underlying LLVM C++ types 2023-05-09 18:08:32 +10:00
debuginfo Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
mir Replace EarlyBinder(x) with EarlyBinder::new(x) 2023-05-28 10:44:50 -06:00
traits Rollup merge of #110145 - WaffleLapkin:share_slice_of_bytes, r=Nilstrieb 2023-05-17 11:13:55 +05:30
base.rs Move DebuggerVisualizerFile types from rustc_span to rustc_middle 2023-05-16 21:03:28 +02:00
codegen_attrs.rs Move expansion of query macros in rustc_middle to rustc_middle::query 2023-05-15 08:49:13 +02:00
common.rs DELETE - fn span_invalid_monomorphization_error and localize intrinsics macros 2022-12-27 20:59:22 -05:00
errors.rs Use Cow in {D,Subd}iagnosticMessage. 2023-05-29 09:23:43 +10:00
glue.rs Use size_of_val instead of manual calculation 2023-03-17 19:55:49 -07:00
lib.rs Auto merge of #111641 - michaelwoerister:debugger-visualizer-fixes, r=cjgillot 2023-05-19 11:30:44 +00:00
meth.rs Add cross-language LLVM CFI support to the Rust compiler 2023-05-03 22:41:29 +00:00
mono_item.rs Store a LocalDefId in hir::AnonConst. 2022-11-13 14:06:11 +00:00
target_features.rs Rollup merge of #110884 - korran:unaligned-scalar-mem, r=wesleywiser 2023-05-18 10:52:33 +05:30