@@ -42,12 +42,9 @@ pub struct Analysis {
4242 pub refs : Vec < Ref > ,
4343 pub macro_refs : Vec < MacroRef > ,
4444 pub relations : Vec < Relation > ,
45- #[ cfg( feature = "borrows" ) ]
46- pub per_fn_borrows : Vec < BorrowData > ,
4745}
4846
4947impl Analysis {
50- #[ cfg( not( feature = "borrows" ) ) ]
5148 pub fn new ( config : Config ) -> Analysis {
5249 Analysis {
5350 config,
@@ -62,22 +59,6 @@ impl Analysis {
6259 relations : vec ! [ ] ,
6360 }
6461 }
65-
66- #[ cfg( feature = "borrows" ) ]
67- pub fn new ( config : Config ) -> Analysis {
68- Analysis {
69- config,
70- version : option_env ! ( "CARGO_PKG_VERSION" ) . map ( |s| s. to_string ( ) ) ,
71- prelude : None ,
72- imports : vec ! [ ] ,
73- defs : vec ! [ ] ,
74- impls : vec ! [ ] ,
75- refs : vec ! [ ] ,
76- macro_refs : vec ! [ ] ,
77- relations : vec ! [ ] ,
78- per_fn_borrows : vec ! [ ] ,
79- }
80- }
8162}
8263
8364// DefId::index is a newtype and so the JSON serialisation is ugly. Therefore
@@ -333,63 +314,3 @@ pub struct SigElement {
333314 pub start : usize ,
334315 pub end : usize ,
335316}
336-
337- // Each `BorrowData` represents all of the scopes, loans and moves
338- // within an fn or closure referred to by `ref_id`.
339- #[ cfg( feature = "borrows" ) ]
340- #[ cfg_attr( feature = "serialize-serde" , derive( Serialize , Deserialize ) ) ]
341- #[ cfg_attr( feature = "serialize-rustc" , derive( RustcDecodable , RustcEncodable ) ) ]
342- #[ derive( Debug , Clone ) ]
343- pub struct BorrowData {
344- pub ref_id : Id ,
345- pub scopes : Vec < Scope > ,
346- pub loans : Vec < Loan > ,
347- pub moves : Vec < Move > ,
348- pub span : Option < SpanData > ,
349- }
350-
351- #[ cfg( feature = "borrows" ) ]
352- #[ cfg_attr( feature = "serialize-serde" , derive( Serialize , Deserialize ) ) ]
353- #[ cfg_attr( feature = "serialize-rustc" , derive( RustcDecodable , RustcEncodable ) ) ]
354- #[ derive( Debug , Clone , Copy ) ]
355- pub enum BorrowKind {
356- ImmBorrow ,
357- MutBorrow ,
358- }
359-
360- // Each `Loan` is either temporary or assigned to a variable.
361- // The `ref_id` refers to the value that is being loaned/borrowed.
362- // Not all loans will be valid. Invalid loans can be used to help explain
363- // improper usage.
364- #[ cfg( feature = "borrows" ) ]
365- #[ cfg_attr( feature = "serialize-serde" , derive( Serialize , Deserialize ) ) ]
366- #[ cfg_attr( feature = "serialize-rustc" , derive( RustcDecodable , RustcEncodable ) ) ]
367- #[ derive( Debug , Clone ) ]
368- pub struct Loan {
369- pub ref_id : Id ,
370- pub kind : BorrowKind ,
371- pub span : SpanData ,
372- }
373-
374- // Each `Move` represents an attempt to move the value referred to by `ref_id`.
375- // Not all `Move`s will be valid but can be used to help explain improper usage.
376- #[ cfg( feature = "borrows" ) ]
377- #[ cfg_attr( feature = "serialize-serde" , derive( Serialize , Deserialize ) ) ]
378- #[ cfg_attr( feature = "serialize-rustc" , derive( RustcDecodable , RustcEncodable ) ) ]
379- #[ derive( Debug , Clone ) ]
380- pub struct Move {
381- pub ref_id : Id ,
382- pub span : SpanData ,
383- }
384-
385- // Each `Scope` refers to "scope" of a variable (we don't track all values here).
386- // Its ref_id refers to the variable, and the span refers to the scope/region where
387- // the variable is "live".
388- #[ cfg( feature = "borrows" ) ]
389- #[ cfg_attr( feature = "serialize-serde" , derive( Serialize , Deserialize ) ) ]
390- #[ cfg_attr( feature = "serialize-rustc" , derive( RustcDecodable , RustcEncodable ) ) ]
391- #[ derive( Debug , Clone ) ]
392- pub struct Scope {
393- pub ref_id : Id ,
394- pub span : SpanData ,
395- }
0 commit comments