Skip to content

Commit cc5d806

Browse files
bors[bot]lnicola
andauthored
Merge #9024
9024: internal: Don't store supertraits in ItemTree r=jonas-schievink a=lnicola Closes #9010 Co-authored-by: Laurențiu Nicola <[email protected]>
2 parents d0a4ba2 + 2268a22 commit cc5d806

File tree

6 files changed

+3
-17
lines changed

6 files changed

+3
-17
lines changed

crates/hir/src/display.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,6 @@ impl HirDisplay for Trait {
427427
write!(f, "trait {}", data.name)?;
428428
let def_id = GenericDefId::TraitId(self.id);
429429
write_generic_params(def_id, f)?;
430-
if !data.bounds.is_empty() {
431-
write!(f, ": ")?;
432-
f.write_joined(&*data.bounds, " + ")?;
433-
}
434430
write_where_clause(def_id, f)?;
435431
Ok(())
436432
}

crates/hir_def/src/data.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ pub struct TraitData {
141141
pub is_auto: bool,
142142
pub is_unsafe: bool,
143143
pub visibility: RawVisibility,
144-
pub bounds: Box<[Interned<TypeBound>]>,
145144
}
146145

147146
impl TraitData {
@@ -155,7 +154,6 @@ impl TraitData {
155154
let module_id = tr_loc.container;
156155
let container = AssocContainerId::TraitId(tr);
157156
let visibility = item_tree[tr_def.visibility].clone();
158-
let bounds = tr_def.bounds.clone();
159157
let mut expander = Expander::new(db, tr_loc.id.file_id(), module_id);
160158

161159
let items = collect_items(
@@ -168,7 +166,7 @@ impl TraitData {
168166
100,
169167
);
170168

171-
Arc::new(TraitData { name, items, is_auto, is_unsafe, visibility, bounds })
169+
Arc::new(TraitData { name, items, is_auto, is_unsafe, visibility })
172170
}
173171

174172
pub fn associated_types(&self) -> impl Iterator<Item = TypeAliasId> + '_ {

crates/hir_def/src/item_tree.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,6 @@ pub struct Trait {
661661
pub generic_params: Interned<GenericParams>,
662662
pub is_auto: bool,
663663
pub is_unsafe: bool,
664-
pub bounds: Box<[Interned<TypeBound>]>,
665664
pub items: Box<[AssocItem]>,
666665
pub ast_id: FileAstId<ast::Trait>,
667666
}

crates/hir_def/src/item_tree/lower.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,6 @@ impl<'a> Ctx<'a> {
474474
self.lower_generic_params_and_inner_items(GenericsOwner::Trait(trait_def), trait_def);
475475
let is_auto = trait_def.auto_token().is_some();
476476
let is_unsafe = trait_def.unsafe_token().is_some();
477-
let bounds = self.lower_type_bounds(trait_def);
478477
let items = trait_def.assoc_item_list().map(|list| {
479478
let db = self.db;
480479
self.with_inherited_visibility(visibility, |this| {
@@ -497,7 +496,6 @@ impl<'a> Ctx<'a> {
497496
generic_params,
498497
is_auto,
499498
is_unsafe,
500-
bounds: bounds.into(),
501499
items: items.unwrap_or_default(),
502500
ast_id,
503501
};

crates/hir_def/src/item_tree/pretty.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,6 @@ impl<'a> Printer<'a> {
345345
visibility,
346346
is_auto,
347347
is_unsafe,
348-
bounds,
349348
items,
350349
generic_params,
351350
ast_id: _,
@@ -359,10 +358,6 @@ impl<'a> Printer<'a> {
359358
}
360359
w!(self, "trait {}", name);
361360
self.print_generic_params(generic_params);
362-
if !bounds.is_empty() {
363-
w!(self, ": ");
364-
self.print_type_bounds(bounds);
365-
}
366361
self.print_where_clause_and_opening_brace(generic_params);
367362
self.indented(|this| {
368363
for item in &**items {

crates/hir_def/src/item_tree/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ trait Tr: SuperTrait + 'lifetime {
180180
_: (),
181181
) -> ();
182182
183-
pub(self) trait Tr<Self>: SuperTrait + 'lifetime
183+
pub(self) trait Tr<Self>
184184
where
185185
Self: SuperTrait,
186186
Self: 'lifetime
@@ -350,7 +350,7 @@ trait Tr<'a, T: 'a>: Super {}
350350
pub(self) union Union<'a, T, const U: u8> {
351351
}
352352
353-
pub(self) trait Tr<'a, Self, T>: Super
353+
pub(self) trait Tr<'a, Self, T>
354354
where
355355
Self: Super,
356356
T: 'a

0 commit comments

Comments
 (0)