1919#![ feature( assert_matches) ]
2020#![ feature( result_flattening) ]
2121#![ feature( lint_reasons) ]
22- #![ feature( lazy_cell) ]
2322// crate-specific exceptions:
2423#![ allow(
2524 unsafe_code, // rustc_codegen_ssa requires unsafe functions in traits to be impl'd
@@ -98,13 +97,13 @@ use rustc_codegen_ssa::traits::{
9897} ;
9998use rustc_codegen_ssa:: { CodegenResults , CompiledModule , ModuleCodegen , ModuleKind } ;
10099use rustc_data_structures:: fx:: FxIndexMap ;
101- use rustc_errors:: { DiagCtxt , ErrorGuaranteed , FatalError } ;
100+ use rustc_errors:: { DiagCtxtHandle , ErrorGuaranteed , FatalError } ;
102101use rustc_metadata:: EncodedMetadata ;
103102use rustc_middle:: dep_graph:: { WorkProduct , WorkProductId } ;
104103use rustc_middle:: mir:: mono:: { MonoItem , MonoItemData } ;
105104use rustc_middle:: mir:: pretty:: write_mir_pretty;
106105use 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 } ;
108107use rustc_session:: config:: { self , OutputFilenames , OutputType } ;
109108use rustc_session:: Session ;
110109use rustc_span:: symbol:: { sym, Symbol } ;
@@ -120,7 +119,7 @@ fn dump_mir(tcx: TyCtxt<'_>, mono_items: &[(MonoItem<'_>, MonoItemData)], path:
120119 let mut file = File :: create ( path) . unwrap ( ) ;
121120 for & ( mono_item, _) in mono_items {
122121 if let MonoItem :: Fn ( instance) = mono_item {
123- if matches ! ( instance. def, InstanceDef :: Item ( _) ) {
122+ if matches ! ( instance. def, InstanceKind :: Item ( _) ) {
124123 let mut mir = Cursor :: new ( Vec :: new ( ) ) ;
125124 if write_mir_pretty ( tcx, Some ( instance. def_id ( ) ) , & mut mir) . is_ok ( ) {
126125 writeln ! ( file, "{}" , String :: from_utf8( mir. into_inner( ) ) . unwrap( ) ) . unwrap ( ) ;
@@ -136,7 +135,7 @@ fn is_blocklisted_fn<'tcx>(
136135 instance : Instance < ' tcx > ,
137136) -> bool {
138137 // 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 {
140139 if let Some ( debug_trait_def_id) = tcx. get_diagnostic_item ( sym:: Debug ) {
141140 // Helper for detecting `<_ as core::fmt::Debug>::fmt` (in impls).
142141 let is_debug_fmt_method = |def_id| match tcx. opt_associated_item ( def_id) {
@@ -185,6 +184,9 @@ impl ThinBufferMethods for SpirvThinBuffer {
185184 fn data ( & self ) -> & [ u8 ] {
186185 spirv_tools:: binary:: from_binary ( & self . 0 )
187186 }
187+ fn thin_link_data ( & self ) -> & [ u8 ] {
188+ unimplemented ! ( ) ;
189+ }
188190}
189191
190192#[ derive( Clone ) ]
@@ -277,7 +279,7 @@ impl WriteBackendMethods for SpirvCodegenBackend {
277279
278280 fn run_link (
279281 _cgcx : & CodegenContext < Self > ,
280- _diag_handler : & DiagCtxt ,
282+ _diag_handler : DiagCtxtHandle < ' _ > ,
281283 _modules : Vec < ModuleCodegen < Self :: Module > > ,
282284 ) -> Result < ModuleCodegen < Self :: Module > , FatalError > {
283285 todo ! ( )
@@ -309,7 +311,7 @@ impl WriteBackendMethods for SpirvCodegenBackend {
309311
310312 unsafe fn optimize (
311313 _: & CodegenContext < Self > ,
312- _: & DiagCtxt ,
314+ _: DiagCtxtHandle < ' _ > ,
313315 _: & ModuleCodegen < Self :: Module > ,
314316 _: & ModuleConfig ,
315317 ) -> Result < ( ) , FatalError > {
@@ -340,7 +342,7 @@ impl WriteBackendMethods for SpirvCodegenBackend {
340342
341343 unsafe fn codegen (
342344 cgcx : & CodegenContext < Self > ,
343- _diag_handler : & DiagCtxt ,
345+ _diag_handler : DiagCtxtHandle < ' _ > ,
344346 module : ModuleCodegen < Self :: Module > ,
345347 _config : & ModuleConfig ,
346348 ) -> Result < CompiledModule , FatalError > {
@@ -364,7 +366,7 @@ impl WriteBackendMethods for SpirvCodegenBackend {
364366 } )
365367 }
366368
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 ) {
368370 ( module. name , SpirvThinBuffer ( module. module_llvm ) )
369371 }
370372
@@ -484,8 +486,8 @@ pub fn __rustc_codegen_backend() -> Box<dyn CodegenBackend> {
484486 // Tweak rustc's default ICE panic hook, to direct people to `rust-gpu`.
485487 rustc_driver:: install_ice_hook (
486488 "https://github.com/rust-gpu/rust-gpu/issues/new" ,
487- |handler | {
488- handler . note ( concat ! (
489+ |dcx | {
490+ dcx . handle ( ) . note ( concat ! (
489491 "`rust-gpu` version `" ,
490492 env!( "CARGO_PKG_VERSION" ) ,
491493 "`"
0 commit comments