11use super :: { LinkResult , link} ;
22use rspirv:: dr:: Module ;
3- use rustc_errors:: registry:: Registry ;
43use rustc_session:: CompilerIO ;
54use rustc_session:: config:: { Input , OutputFilenames , OutputTypes } ;
65use rustc_span:: FileName ;
76use std:: io:: Write ;
87use std:: sync:: { Arc , Mutex } ;
9- use termcolor:: { ColorSpec , WriteColor } ;
108
119// https://github.com/colin-kiegel/rust-pretty-assertions/issues/24
1210#[ derive( PartialEq , Eq ) ]
@@ -91,19 +89,6 @@ fn link_with_linker_opts(
9189 self . 0 . lock ( ) . unwrap ( ) . flush ( )
9290 }
9391 }
94- impl WriteColor for BufWriter {
95- fn supports_color ( & self ) -> bool {
96- false
97- }
98-
99- fn set_color ( & mut self , _spec : & ColorSpec ) -> std:: io:: Result < ( ) > {
100- Ok ( ( ) )
101- }
102-
103- fn reset ( & mut self ) -> std:: io:: Result < ( ) > {
104- Ok ( ( ) )
105- }
106- }
10792 let buf = BufWriter :: default ( ) ;
10893 let output = buf. clone ( ) ;
10994
@@ -119,8 +104,13 @@ fn link_with_linker_opts(
119104 let mut early_dcx =
120105 rustc_session:: EarlyDiagCtxt :: new ( rustc_session:: config:: ErrorOutputType :: default ( ) ) ;
121106 let matches =
122- rustc_driver:: handle_options ( & early_dcx, & [ "" . to_string ( ) , "x.rs" . to_string ( ) ] )
123- . unwrap ( ) ;
107+ match rustc_driver:: handle_options ( & early_dcx, & [ "" . to_string ( ) , "x.rs" . to_string ( ) ] ) {
108+ rustc_driver:: HandledOptions :: Normal ( matches)
109+ | rustc_driver:: HandledOptions :: HelpOnly ( matches) => matches,
110+ rustc_driver:: HandledOptions :: None => {
111+ unreachable ! ( "failed to parse test rustc args" )
112+ }
113+ } ;
124114 let sopts = rustc_session:: config:: build_session_options ( & mut early_dcx, & matches) ;
125115
126116 let target = "spirv-unknown-spv1.0"
@@ -148,12 +138,9 @@ fn link_with_linker_opts(
148138 temps_dir : None ,
149139 } ,
150140 Default :: default ( ) ,
151- Registry :: new ( & [ ] ) ,
152- Default :: default ( ) ,
153- Default :: default ( ) ,
154141 target,
155142 rustc_interface:: util:: rustc_version_str ( ) . unwrap_or ( "unknown" ) ,
156- Default :: default ( ) ,
143+ None ,
157144 & rustc_driver_impl:: USING_INTERNAL_FEATURES ,
158145 ) ;
159146
@@ -162,11 +149,14 @@ fn link_with_linker_opts(
162149 sess. psess = {
163150 let source_map = sess. psess . clone_source_map ( ) ;
164151
165- let emitter = rustc_errors:: emitter:: HumanEmitter :: new (
166- rustc_errors:: AutoStream :: new ( Box :: new ( buf) , rustc_errors:: ColorChoice :: Never ) ,
167- rustc_driver_impl:: default_translator ( ) ,
168- )
169- . sm ( Some ( source_map. clone ( ) ) ) ;
152+ let emitter =
153+ rustc_errors:: annotate_snippet_emitter_writer:: AnnotateSnippetEmitter :: new (
154+ rustc_errors:: AutoStream :: new (
155+ Box :: new ( buf) as Box < dyn std:: io:: Write + Send > ,
156+ rustc_errors:: ColorChoice :: Never ,
157+ ) ,
158+ )
159+ . sm ( Some ( source_map. clone ( ) ) ) ;
170160
171161 rustc_session:: parse:: ParseSess :: with_dcx (
172162 rustc_errors:: DiagCtxt :: new ( Box :: new ( emitter) )
0 commit comments