diff options
| author | bors <bors@rust-lang.org> | 2022-02-01 03:58:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-02-01 03:58:32 +0000 |
| commit | 25862ffc8d360b34dd8ec82a2f01750aaab976b7 (patch) | |
| tree | d9ef0def054f8bc2a497a7d3b5b3d17ed8c15f0f /compiler/rustc_errors/src/lib.rs | |
| parent | a6cd4aa9a784e3d2e54bca2a1b41082fda67310d (diff) | |
| parent | f5a32711dc14ea66510bd5c8a21763183ee5fc99 (diff) | |
| download | rust-25862ffc8d360b34dd8ec82a2f01750aaab976b7.tar.gz rust-25862ffc8d360b34dd8ec82a2f01750aaab976b7.zip | |
Auto merge of #93259 - eddyb:diagbld-scalar-pair, r=jackh726
rustc_errors: only box the `diagnostic` field in `DiagnosticBuilder`. I happened to need to do the first change (replacing `allow_suggestions` with equivalent functionality on `Diagnostic` itself) as part of a larger change, and noticed that there's only two fields left in `DiagnosticBuilderInner`. So with this PR, instead of a single pointer, `DiagnosticBuilder` is two pointers, which should work just as well for passing *it* by value (and may even work better wrt some operations, though probably not by much). But anything that was already taking advantage of `DiagnosticBuilder` being a single pointer, and wrapping it further (e.g. `Result<T, DiagnosticBuilder>` w/ non-ZST `T`), ~~will probably see a slowdown~~, so I want to do a perf run before even trying to propose this.
Diffstat (limited to 'compiler/rustc_errors/src/lib.rs')
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 16e9b265d69..7582f317b85 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -54,9 +54,11 @@ pub use snippet::Style; pub type PResult<'a, T> = Result<T, DiagnosticBuilder<'a>>; // `PResult` is used a lot. Make sure it doesn't unintentionally get bigger. -// (See also the comment on `DiagnosticBuilderInner`.) +// (See also the comment on `DiagnosticBuilder`'s `diagnostic` field.) #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] -rustc_data_structures::static_assert_size!(PResult<'_, bool>, 16); +rustc_data_structures::static_assert_size!(PResult<'_, ()>, 16); +#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] +rustc_data_structures::static_assert_size!(PResult<'_, bool>, 24); #[derive(Debug, PartialEq, Eq, Clone, Copy, Hash, Encodable, Decodable)] pub enum SuggestionStyle { |
