@@ -5,14 +5,10 @@ use bitflags::bitflags;
5
5
use cfg:: CfgOptions ;
6
6
use either:: Either ;
7
7
8
- use hir_expand:: {
9
- name:: { AsName , Name } ,
10
- InFile ,
11
- } ;
8
+ use hir_expand:: name:: Name ;
12
9
use intern:: { sym, Interned } ;
13
10
use la_arena:: Arena ;
14
11
use rustc_abi:: { Align , Integer , IntegerType , ReprFlags , ReprOptions } ;
15
- use syntax:: ast:: { self , HasName , HasVisibility } ;
16
12
use triomphe:: Arc ;
17
13
18
14
use crate :: {
@@ -22,9 +18,7 @@ use crate::{
22
18
AttrOwner , Field , FieldParent , FieldsShape , ItemTree , ModItem , RawVisibilityId , TreeId ,
23
19
} ,
24
20
lang_item:: LangItem ,
25
- lower:: LowerCtx ,
26
21
nameres:: diagnostics:: { DefDiagnostic , DefDiagnostics } ,
27
- trace:: Trace ,
28
22
tt:: { Delimiter , DelimiterKind , Leaf , Subtree , TokenTree } ,
29
23
type_ref:: TypeRef ,
30
24
visibility:: RawVisibility ,
@@ -409,64 +403,6 @@ pub enum StructKind {
409
403
Unit ,
410
404
}
411
405
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
-
470
406
fn lower_fields (
471
407
db : & dyn DefDatabase ,
472
408
krate : CrateId ,
0 commit comments