rust/compiler
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
..
rustc
rustc_abi
rustc_apfloat
rustc_arena
rustc_ast Add warn-by-default lint for local binding shadowing exported glob re-export item 2023-05-27 18:49:07 +08:00
rustc_ast_lowering Auto merge of #111858 - clubby789:fluent-alphabetical, r=jyn514,compiler-errors 2023-05-26 03:31:04 +00:00
rustc_ast_passes Ensure Fluent messages are in alphabetical order 2023-05-25 23:49:35 +00:00
rustc_ast_pretty
rustc_attr Ensure Fluent messages are in alphabetical order 2023-05-25 23:49:35 +00:00
rustc_baked_icu_data
rustc_borrowck Rollup merge of #111983 - compiler-errors:type-op-locally, r=lcnr 2023-05-27 13:38:32 +02:00
rustc_builtin_macros Use Cow in {D,Subd}iagnosticMessage. 2023-05-29 09:23:43 +10:00
rustc_codegen_cranelift Replace EarlyBinder(x) with EarlyBinder::new(x) 2023-05-28 10:44:50 -06:00
rustc_codegen_gcc Ensure Fluent messages are in alphabetical order 2023-05-25 23:49:35 +00:00
rustc_codegen_llvm Replace EarlyBinder(x) with EarlyBinder::new(x) 2023-05-28 10:44:50 -06:00
rustc_codegen_ssa Use Cow in {D,Subd}iagnosticMessage. 2023-05-29 09:23:43 +10:00
rustc_const_eval Replace EarlyBinder(x) with EarlyBinder::new(x) 2023-05-28 10:44:50 -06:00
rustc_data_structures Add some comments 2023-05-28 15:54:52 +02:00
rustc_driver
rustc_driver_impl Use Cow in {D,Subd}iagnosticMessage. 2023-05-29 09:23:43 +10:00
rustc_error_codes
rustc_error_messages Use Cow in {D,Subd}iagnosticMessage. 2023-05-29 09:23:43 +10:00
rustc_errors Use Cow in {D,Subd}iagnosticMessage. 2023-05-29 09:23:43 +10:00
rustc_expand Use Cow in {D,Subd}iagnosticMessage. 2023-05-29 09:23:43 +10:00
rustc_feature
rustc_fluent_macro
rustc_fs_util
rustc_graphviz
rustc_hir
rustc_hir_analysis Use Cow in {D,Subd}iagnosticMessage. 2023-05-29 09:23:43 +10:00
rustc_hir_pretty
rustc_hir_typeck Use Cow in {D,Subd}iagnosticMessage. 2023-05-29 09:23:43 +10:00
rustc_incremental Ensure Fluent messages are in alphabetical order 2023-05-25 23:49:35 +00:00
rustc_index
rustc_infer Use Cow in {D,Subd}iagnosticMessage. 2023-05-29 09:23:43 +10:00
rustc_interface Ensure Fluent messages are in alphabetical order 2023-05-25 23:49:35 +00:00
rustc_lexer
rustc_lint Use Cow in {D,Subd}iagnosticMessage. 2023-05-29 09:23:43 +10:00
rustc_lint_defs Add warn-by-default lint for local binding shadowing exported glob re-export item 2023-05-27 18:49:07 +08:00
rustc_llvm Add SafeStack support to rustc 2023-05-26 15:18:54 -04:00
rustc_log
rustc_macros
rustc_metadata Replace EarlyBinder(x) with EarlyBinder::new(x) 2023-05-28 10:44:50 -06:00
rustc_middle Use Cow in {D,Subd}iagnosticMessage. 2023-05-29 09:23:43 +10:00
rustc_mir_build Rollup merge of #111952 - cjgillot:drop-replace, r=WaffleLapkin 2023-05-27 13:38:31 +02:00
rustc_mir_dataflow Rollup merge of #111952 - cjgillot:drop-replace, r=WaffleLapkin 2023-05-27 13:38:31 +02:00
rustc_mir_transform Make EarlyBinder's inner value private; and fix all of the resulting errors 2023-05-28 10:44:53 -06:00
rustc_monomorphize Replace EarlyBinder(x) with EarlyBinder::new(x) 2023-05-28 10:44:50 -06:00
rustc_parse Use Cow in {D,Subd}iagnosticMessage. 2023-05-29 09:23:43 +10:00
rustc_parse_format
rustc_passes Ensure Fluent messages are in alphabetical order 2023-05-25 23:49:35 +00:00
rustc_plugin_impl
rustc_privacy Ensure Fluent messages are in alphabetical order 2023-05-25 23:49:35 +00:00
rustc_query_impl
rustc_query_system Ensure Fluent messages are in alphabetical order 2023-05-25 23:49:35 +00:00
rustc_resolve Use Cow in {D,Subd}iagnosticMessage. 2023-05-29 09:23:43 +10:00
rustc_serialize
rustc_session Use Cow in {D,Subd}iagnosticMessage. 2023-05-29 09:23:43 +10:00
rustc_smir Remove DesugaringKind::Replace. 2023-05-25 17:40:46 +00:00
rustc_span Rollup merge of #111952 - cjgillot:drop-replace, r=WaffleLapkin 2023-05-27 13:38:31 +02:00
rustc_symbol_mangling Use Cow in {D,Subd}iagnosticMessage. 2023-05-29 09:23:43 +10:00
rustc_target Add SafeStack support to rustc 2023-05-26 15:18:54 -04:00
rustc_trait_selection Use Cow in {D,Subd}iagnosticMessage. 2023-05-29 09:23:43 +10:00
rustc_traits Make EarlyBinder's inner value private; and fix all of the resulting errors 2023-05-28 10:44:53 -06:00
rustc_transmute
rustc_ty_utils Make EarlyBinder's inner value private; and fix all of the resulting errors 2023-05-28 10:44:53 -06:00
rustc_type_ir