@@ -5,14 +5,10 @@ use bitflags::bitflags;
55use cfg:: CfgOptions ;
66use either:: Either ;
77
8- use hir_expand:: {
9- name:: { AsName , Name } ,
10- InFile ,
11- } ;
8+ use hir_expand:: name:: Name ;
129use intern:: { sym, Interned } ;
1310use la_arena:: Arena ;
1411use rustc_abi:: { Align , Integer , IntegerType , ReprFlags , ReprOptions } ;
15- use syntax:: ast:: { self , HasName , HasVisibility } ;
1612use triomphe:: Arc ;
1713
1814use crate :: {
@@ -22,9 +18,7 @@ use crate::{
2218 AttrOwner , Field , FieldParent , FieldsShape , ItemTree , ModItem , RawVisibilityId , TreeId ,
2319 } ,
2420 lang_item:: LangItem ,
25- lower:: LowerCtx ,
2621 nameres:: diagnostics:: { DefDiagnostic , DefDiagnostics } ,
27- trace:: Trace ,
2822 tt:: { Delimiter , DelimiterKind , Leaf , Subtree , TokenTree } ,
2923 type_ref:: TypeRef ,
3024 visibility:: RawVisibility ,
@@ -409,64 +403,6 @@ pub enum StructKind {
409403 Unit ,
410404}
411405
412- // FIXME This is only used for mapping back source now?
413- pub ( crate ) fn lower_struct (
414- db : & dyn DefDatabase ,
415- trace : & mut Trace < FieldData , Either < ast:: TupleField , ast:: RecordField > > ,
416- ast : & InFile < ast:: StructKind > ,
417- krate : CrateId ,
418- item_tree : & ItemTree ,
419- parent : FieldParent ,
420- ) -> StructKind {
421- let ctx = LowerCtx :: new ( db, ast. file_id ) ;
422-
423- match & ast. value {
424- ast:: StructKind :: Tuple ( fl) => {
425- let cfg_options = & db. crate_graph ( ) [ krate] . cfg_options ;
426- for ( i, fd) in fl. fields ( ) . enumerate ( ) {
427- let attrs = item_tree. attrs ( db, krate, AttrOwner :: make_field_indexed ( parent, i) ) ;
428- if !attrs. is_cfg_enabled ( cfg_options) {
429- continue ;
430- }
431-
432- trace. alloc (
433- || Either :: Left ( fd. clone ( ) ) ,
434- || FieldData {
435- name : Name :: new_tuple_field ( i) ,
436- type_ref : Interned :: new ( TypeRef :: from_ast_opt ( & ctx, fd. ty ( ) ) ) ,
437- visibility : RawVisibility :: from_ast ( db, fd. visibility ( ) , & mut |range| {
438- ctx. span_map ( ) . span_for_range ( range) . ctx
439- } ) ,
440- } ,
441- ) ;
442- }
443- StructKind :: Tuple
444- }
445- ast:: StructKind :: Record ( fl) => {
446- let cfg_options = & db. crate_graph ( ) [ krate] . cfg_options ;
447- for ( i, fd) in fl. fields ( ) . enumerate ( ) {
448- let attrs = item_tree. attrs ( db, krate, AttrOwner :: make_field_indexed ( parent, i) ) ;
449- if !attrs. is_cfg_enabled ( cfg_options) {
450- continue ;
451- }
452-
453- trace. alloc (
454- || Either :: Right ( fd. clone ( ) ) ,
455- || FieldData {
456- name : fd. name ( ) . map ( |n| n. as_name ( ) ) . unwrap_or_else ( Name :: missing) ,
457- type_ref : Interned :: new ( TypeRef :: from_ast_opt ( & ctx, fd. ty ( ) ) ) ,
458- visibility : RawVisibility :: from_ast ( db, fd. visibility ( ) , & mut |range| {
459- ctx. span_map ( ) . span_for_range ( range) . ctx
460- } ) ,
461- } ,
462- ) ;
463- }
464- StructKind :: Record
465- }
466- _ => StructKind :: Unit ,
467- }
468- }
469-
470406fn lower_fields (
471407 db : & dyn DefDatabase ,
472408 krate : CrateId ,
0 commit comments