@@ -168,6 +168,10 @@ impl<'a, 'tcx> SpanEncoder for EncodeContext<'a, 'tcx> {
168168 }
169169
170170 fn encode_span ( & mut self , span : Span ) {
171+ if self . tcx . sess . is_split_rmeta_enabled ( ) {
172+ return ;
173+ }
174+
171175 match self . span_shorthands . entry ( span) {
172176 Entry :: Occupied ( o) => {
173177 // If an offset is smaller than the absolute position, we encode with the offset.
@@ -436,7 +440,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
436440 assert ! (
437441 last_pos <= position,
438442 "make sure that the calls to `lazy*` \
439- are in the same order as the metadata fields",
443+ are in the same order as the metadata fields",
440444 ) ;
441445 position. get ( ) - last_pos. get ( )
442446 }
@@ -603,6 +607,13 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
603607 adapted. encode ( & mut self . opaque )
604608 }
605609
610+ fn dont_encode_source_map (
611+ & mut self ,
612+ ) -> LazyTable < u32 , Option < LazyValue < rustc_span:: SourceFile > > > {
613+ let adapted = TableBuilder :: default ( ) ;
614+ adapted. encode ( & mut self . opaque )
615+ }
616+
606617 fn encode_crate_root ( & mut self ) -> LazyValue < CrateRoot > {
607618 let tcx = self . tcx ;
608619 let mut stats: Vec < ( & ' static str , usize ) > = Vec :: with_capacity ( 32 ) ;
@@ -708,7 +719,11 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
708719
709720 // Encode source_map. This needs to be done last, because encoding `Span`s tells us which
710721 // `SourceFiles` we actually need to encode.
711- let source_map = stat ! ( "source-map" , || self . encode_source_map( ) ) ;
722+ let source_map = if tcx. sess . is_split_rmeta_enabled ( ) {
723+ stat ! ( "source-map" , || self . dont_encode_source_map( ) )
724+ } else {
725+ stat ! ( "source-map" , || self . encode_source_map( ) )
726+ } ;
712727 let target_modifiers = stat ! ( "target-modifiers" , || self . encode_target_modifiers( ) ) ;
713728
714729 let root = stat ! ( "final" , || {
@@ -733,6 +748,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
733748 attrs,
734749 sym:: default_lib_allocator,
735750 ) ,
751+ has_rmeta_extras: !tcx. sess. is_split_rmeta_enabled( ) ,
736752 proc_macro_data,
737753 debugger_visualizers,
738754 compiler_builtins: ast:: attr:: contains_name( attrs, sym:: compiler_builtins) ,
@@ -1706,7 +1722,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
17061722
17071723 record_array ! ( self . tables. module_children_non_reexports[ def_id] <-
17081724 module_children. iter( ) . filter( |child| child. reexport_chain. is_empty( ) )
1709- . map( |child| child. res. def_id( ) . index) ) ;
1725+ . map( |child| child. res. def_id( ) . index) ) ;
17101726
17111727 record_defaulted_array ! ( self . tables. module_children_reexports[ def_id] <-
17121728 module_children. iter( ) . filter( |child| !child. reexport_chain. is_empty( ) ) ) ;
@@ -1755,7 +1771,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
17551771 if matches ! ( rpitit_info, ty:: ImplTraitInTraitData :: Trait { .. } ) {
17561772 record_array ! (
17571773 self . tables. assumed_wf_types_for_rpitit[ def_id]
1758- <- self . tcx. assumed_wf_types_for_rpitit( def_id)
1774+ <- self . tcx. assumed_wf_types_for_rpitit( def_id)
17591775 ) ;
17601776 self . encode_precise_capturing_args ( def_id) ;
17611777 }
@@ -1838,7 +1854,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
18381854 for & local_def_id in tcx. mir_keys ( ( ) ) {
18391855 if let DefKind :: AssocFn | DefKind :: Fn = tcx. def_kind ( local_def_id) {
18401856 record_array ! ( self . tables. deduced_param_attrs[ local_def_id. to_def_id( ) ] <-
1841- self . tcx. deduced_param_attrs( local_def_id. to_def_id( ) ) ) ;
1857+ self . tcx. deduced_param_attrs( local_def_id. to_def_id( ) ) ) ;
18421858 }
18431859 }
18441860 }
0 commit comments