19
19
#![ feature( assert_matches) ]
20
20
#![ feature( result_flattening) ]
21
21
#![ feature( lint_reasons) ]
22
- #![ feature( lazy_cell) ]
23
22
// crate-specific exceptions:
24
23
#![ allow(
25
24
unsafe_code, // rustc_codegen_ssa requires unsafe functions in traits to be impl'd
@@ -98,13 +97,13 @@ use rustc_codegen_ssa::traits::{
98
97
} ;
99
98
use rustc_codegen_ssa:: { CodegenResults , CompiledModule , ModuleCodegen , ModuleKind } ;
100
99
use rustc_data_structures:: fx:: FxIndexMap ;
101
- use rustc_errors:: { DiagCtxt , ErrorGuaranteed , FatalError } ;
100
+ use rustc_errors:: { DiagCtxtHandle , ErrorGuaranteed , FatalError } ;
102
101
use rustc_metadata:: EncodedMetadata ;
103
102
use rustc_middle:: dep_graph:: { WorkProduct , WorkProductId } ;
104
103
use rustc_middle:: mir:: mono:: { MonoItem , MonoItemData } ;
105
104
use rustc_middle:: mir:: pretty:: write_mir_pretty;
106
105
use rustc_middle:: ty:: print:: with_no_trimmed_paths;
107
- use rustc_middle:: ty:: { self , Instance , InstanceDef , TyCtxt } ;
106
+ use rustc_middle:: ty:: { self , Instance , InstanceKind , TyCtxt } ;
108
107
use rustc_session:: config:: { self , OutputFilenames , OutputType } ;
109
108
use rustc_session:: Session ;
110
109
use rustc_span:: symbol:: { sym, Symbol } ;
@@ -120,7 +119,7 @@ fn dump_mir(tcx: TyCtxt<'_>, mono_items: &[(MonoItem<'_>, MonoItemData)], path:
120
119
let mut file = File :: create ( path) . unwrap ( ) ;
121
120
for & ( mono_item, _) in mono_items {
122
121
if let MonoItem :: Fn ( instance) = mono_item {
123
- if matches ! ( instance. def, InstanceDef :: Item ( _) ) {
122
+ if matches ! ( instance. def, InstanceKind :: Item ( _) ) {
124
123
let mut mir = Cursor :: new ( Vec :: new ( ) ) ;
125
124
if write_mir_pretty ( tcx, Some ( instance. def_id ( ) ) , & mut mir) . is_ok ( ) {
126
125
writeln ! ( file, "{}" , String :: from_utf8( mir. into_inner( ) ) . unwrap( ) ) . unwrap ( ) ;
@@ -136,7 +135,7 @@ fn is_blocklisted_fn<'tcx>(
136
135
instance : Instance < ' tcx > ,
137
136
) -> bool {
138
137
// TODO: These sometimes have a constant value of an enum variant with a hole
139
- if let InstanceDef :: Item ( def_id) = instance. def {
138
+ if let InstanceKind :: Item ( def_id) = instance. def {
140
139
if let Some ( debug_trait_def_id) = tcx. get_diagnostic_item ( sym:: Debug ) {
141
140
// Helper for detecting `<_ as core::fmt::Debug>::fmt` (in impls).
142
141
let is_debug_fmt_method = |def_id| match tcx. opt_associated_item ( def_id) {
@@ -185,6 +184,9 @@ impl ThinBufferMethods for SpirvThinBuffer {
185
184
fn data ( & self ) -> & [ u8 ] {
186
185
spirv_tools:: binary:: from_binary ( & self . 0 )
187
186
}
187
+ fn thin_link_data ( & self ) -> & [ u8 ] {
188
+ unimplemented ! ( ) ;
189
+ }
188
190
}
189
191
190
192
#[ derive( Clone ) ]
@@ -277,7 +279,7 @@ impl WriteBackendMethods for SpirvCodegenBackend {
277
279
278
280
fn run_link (
279
281
_cgcx : & CodegenContext < Self > ,
280
- _diag_handler : & DiagCtxt ,
282
+ _diag_handler : DiagCtxtHandle < ' _ > ,
281
283
_modules : Vec < ModuleCodegen < Self :: Module > > ,
282
284
) -> Result < ModuleCodegen < Self :: Module > , FatalError > {
283
285
todo ! ( )
@@ -309,7 +311,7 @@ impl WriteBackendMethods for SpirvCodegenBackend {
309
311
310
312
unsafe fn optimize (
311
313
_: & CodegenContext < Self > ,
312
- _: & DiagCtxt ,
314
+ _: DiagCtxtHandle < ' _ > ,
313
315
_: & ModuleCodegen < Self :: Module > ,
314
316
_: & ModuleConfig ,
315
317
) -> Result < ( ) , FatalError > {
@@ -340,7 +342,7 @@ impl WriteBackendMethods for SpirvCodegenBackend {
340
342
341
343
unsafe fn codegen (
342
344
cgcx : & CodegenContext < Self > ,
343
- _diag_handler : & DiagCtxt ,
345
+ _diag_handler : DiagCtxtHandle < ' _ > ,
344
346
module : ModuleCodegen < Self :: Module > ,
345
347
_config : & ModuleConfig ,
346
348
) -> Result < CompiledModule , FatalError > {
@@ -364,7 +366,7 @@ impl WriteBackendMethods for SpirvCodegenBackend {
364
366
} )
365
367
}
366
368
367
- fn prepare_thin ( module : ModuleCodegen < Self :: Module > ) -> ( String , Self :: ThinBuffer ) {
369
+ fn prepare_thin ( module : ModuleCodegen < Self :: Module > , _want_summary : bool ) -> ( String , Self :: ThinBuffer ) {
368
370
( module. name , SpirvThinBuffer ( module. module_llvm ) )
369
371
}
370
372
@@ -484,8 +486,8 @@ pub fn __rustc_codegen_backend() -> Box<dyn CodegenBackend> {
484
486
// Tweak rustc's default ICE panic hook, to direct people to `rust-gpu`.
485
487
rustc_driver:: install_ice_hook (
486
488
"https://github.com/rust-gpu/rust-gpu/issues/new" ,
487
- |handler | {
488
- handler . note ( concat ! (
489
+ |dcx | {
490
+ dcx . handle ( ) . note ( concat ! (
489
491
"`rust-gpu` version `" ,
490
492
env!( "CARGO_PKG_VERSION" ) ,
491
493
"`"
0 commit comments