Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/expr_store/pretty.rs')
| -rw-r--r-- | crates/hir-def/src/expr_store/pretty.rs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/crates/hir-def/src/expr_store/pretty.rs b/crates/hir-def/src/expr_store/pretty.rs index e386e8d0c5..5b9da3c5e6 100644 --- a/crates/hir-def/src/expr_store/pretty.rs +++ b/crates/hir-def/src/expr_store/pretty.rs @@ -12,8 +12,7 @@ use span::Edition; use syntax::ast::HasName; use crate::{ - AdtId, DefWithBodyId, FunctionId, GenericDefId, StructId, TypeParamId, VariantId, - attrs::AttrFlags, + AdtId, DefWithBodyId, GenericDefId, TypeParamId, VariantId, expr_store::path::{GenericArg, GenericArgs}, hir::{ Array, BindingAnnotation, CaptureBy, ClosureKind, Literal, Movability, Statement, @@ -168,7 +167,7 @@ pub fn print_signature(db: &dyn DefDatabase, owner: GenericDefId, edition: Editi GenericDefId::AdtId(id) => match id { AdtId::StructId(id) => { let signature = db.struct_signature(id); - print_struct(db, id, &signature, edition) + print_struct(db, &signature, edition) } AdtId::UnionId(id) => { format!("unimplemented {id:?}") @@ -180,7 +179,7 @@ pub fn print_signature(db: &dyn DefDatabase, owner: GenericDefId, edition: Editi GenericDefId::ConstId(id) => format!("unimplemented {id:?}"), GenericDefId::FunctionId(id) => { let signature = db.function_signature(id); - print_function(db, id, &signature, edition) + print_function(db, &signature, edition) } GenericDefId::ImplId(id) => format!("unimplemented {id:?}"), GenericDefId::StaticId(id) => format!("unimplemented {id:?}"), @@ -209,8 +208,7 @@ pub fn print_path( pub fn print_struct( db: &dyn DefDatabase, - id: StructId, - StructSignature { name, generic_params, store, flags, shape }: &StructSignature, + StructSignature { name, generic_params, store, flags, shape, repr }: &StructSignature, edition: Edition, ) -> String { let mut p = Printer { @@ -221,7 +219,7 @@ pub fn print_struct( line_format: LineFormat::Newline, edition, }; - if let Some(repr) = AttrFlags::repr(db, id.into()) { + if let Some(repr) = repr { if repr.c() { wln!(p, "#[repr(C)]"); } @@ -257,8 +255,7 @@ pub fn print_struct( pub fn print_function( db: &dyn DefDatabase, - id: FunctionId, - signature @ FunctionSignature { + FunctionSignature { name, generic_params, store, @@ -266,10 +263,10 @@ pub fn print_function( ret_type, abi, flags, + legacy_const_generics_indices, }: &FunctionSignature, edition: Edition, ) -> String { - let legacy_const_generics_indices = signature.legacy_const_generics_indices(db, id); let mut p = Printer { db, store, @@ -301,7 +298,7 @@ pub fn print_function( if i != 0 { w!(p, ", "); } - if legacy_const_generics_indices.is_some_and(|idx| idx.contains(&(i as u32))) { + if legacy_const_generics_indices.as_ref().is_some_and(|idx| idx.contains(&(i as u32))) { w!(p, "const: "); } p.print_type_ref(*param); |