From 8ebb8d29e18d7cb18bd2b57b004dcecd65a96232 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Mon, 24 May 2021 15:13:23 +0200 Subject: internal: intern `TypeBound`s Doesn't save much memory (~2 mb), but interning things is generally a good pattern to follow --- crates/hir_def/src/path.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/hir_def/src/path.rs') diff --git a/crates/hir_def/src/path.rs b/crates/hir_def/src/path.rs index 9b8873fd2..7bd7d9d4f 100644 --- a/crates/hir_def/src/path.rs +++ b/crates/hir_def/src/path.rs @@ -165,7 +165,7 @@ pub struct AssociatedTypeBinding { /// Bounds for the associated type, like in `Iterator`. (This is the unstable `associated_type_bounds` /// feature.) - pub bounds: Vec, + pub bounds: Vec>, } /// A single generic argument. -- cgit v1.2.3 From 533e9207d39c27dc22de2645fc65891189a71739 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Mon, 24 May 2021 15:35:46 +0200 Subject: Intern `GenericArgs` This shaves off another ~4 mb or so --- crates/hir_def/src/path.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'crates/hir_def/src/path.rs') diff --git a/crates/hir_def/src/path.rs b/crates/hir_def/src/path.rs index 7bd7d9d4f..45ab9d0ff 100644 --- a/crates/hir_def/src/path.rs +++ b/crates/hir_def/src/path.rs @@ -4,7 +4,6 @@ mod lower; use std::{ fmt::{self, Display}, iter, - sync::Arc, }; use crate::{body::LowerCtx, db::DefDatabase, intern::Interned, type_ref::LifetimeRef}; @@ -136,7 +135,7 @@ pub struct Path { type_anchor: Option>, mod_path: Interned, /// Invariant: the same len as `self.mod_path.segments` - generic_args: Vec>>, + generic_args: Vec>>, } /// Generic arguments to a path segment (e.g. the `i32` in `Option`). This @@ -185,7 +184,7 @@ impl Path { /// Converts a known mod path to `Path`. pub(crate) fn from_known_path( path: ModPath, - generic_args: Vec>>, + generic_args: Vec>>, ) -> Path { Path { type_anchor: None, mod_path: Interned::new(path), generic_args } } @@ -239,7 +238,7 @@ pub struct PathSegment<'a> { pub struct PathSegments<'a> { segments: &'a [Name], - generic_args: &'a [Option>], + generic_args: &'a [Option>], } impl<'a> PathSegments<'a> { -- cgit v1.2.3