@@ -97,7 +97,7 @@ fn t6() {
9797#[ test]
9898fn t7 ( ) {
9999 let sm = init_source_map ( ) ;
100- let span = Span :: new ( BytePos ( 12 ) , BytePos ( 23 ) , NO_EXPANSION ) ;
100+ let span = Span :: with_root_ctxt ( BytePos ( 12 ) , BytePos ( 23 ) ) ;
101101 let file_lines = sm. span_to_lines ( span) . unwrap ( ) ;
102102
103103 assert_eq ! ( file_lines. file. name, PathBuf :: from( "blork.rs" ) . into( ) ) ;
@@ -113,7 +113,7 @@ fn span_from_selection(input: &str, selection: &str) -> Span {
113113 assert_eq ! ( input. len( ) , selection. len( ) ) ;
114114 let left_index = selection. find ( '~' ) . unwrap ( ) as u32 ;
115115 let right_index = selection. rfind ( '~' ) . map ( |x|x as u32 ) . unwrap_or ( left_index) ;
116- Span :: new ( BytePos ( left_index) , BytePos ( right_index + 1 ) , NO_EXPANSION )
116+ Span :: with_root_ctxt ( BytePos ( left_index) , BytePos ( right_index + 1 ) )
117117}
118118
119119/// Tests `span_to_snippet` and `span_to_lines` for a span converting 3
@@ -143,7 +143,7 @@ fn span_to_snippet_and_lines_spanning_multiple_lines() {
143143#[ test]
144144fn t8 ( ) {
145145 let sm = init_source_map ( ) ;
146- let span = Span :: new ( BytePos ( 12 ) , BytePos ( 23 ) , NO_EXPANSION ) ;
146+ let span = Span :: with_root_ctxt ( BytePos ( 12 ) , BytePos ( 23 ) ) ;
147147 let snippet = sm. span_to_snippet ( span) ;
148148
149149 assert_eq ! ( snippet, Ok ( "second line" . to_string( ) ) ) ;
@@ -153,7 +153,7 @@ fn t8() {
153153#[ test]
154154fn t9 ( ) {
155155 let sm = init_source_map ( ) ;
156- let span = Span :: new ( BytePos ( 12 ) , BytePos ( 23 ) , NO_EXPANSION ) ;
156+ let span = Span :: with_root_ctxt ( BytePos ( 12 ) , BytePos ( 23 ) ) ;
157157 let sstr = sm. span_to_string ( span) ;
158158
159159 assert_eq ! ( sstr, "blork.rs:2:1: 2:12" ) ;
@@ -176,7 +176,7 @@ fn span_merging_fail() {
176176/// Returns the span corresponding to the `n`th occurrence of `substring` in `source_text`.
177177trait SourceMapExtension {
178178 fn span_substr (
179- self ,
179+ & self ,
180180 file : & Lrc < SourceFile > ,
181181 source_text : & str ,
182182 substring : & str ,
@@ -208,10 +208,9 @@ impl SourceMapExtension for SourceMap {
208208 let lo = hi + offset;
209209 hi = lo + substring. len ( ) ;
210210 if i == n {
211- let span = Span :: new (
211+ let span = Span :: with_root_ctxt (
212212 BytePos ( lo as u32 + file. start_pos . 0 ) ,
213213 BytePos ( hi as u32 + file. start_pos . 0 ) ,
214- NO_EXPANSION ,
215214 ) ;
216215 assert_eq ! ( & self . span_to_snippet( span) . unwrap( ) [ ..] , substring) ;
217216 return span;
0 commit comments