11// HACK(eddyb) start of `rustc_codegen_ssa` crate-level attributes (see `build.rs`).
2- #![ feature( rustdoc_internals) ]
32#![ allow( internal_features) ]
43#![ allow( rustc:: diagnostic_outside_of_impl) ]
54#![ allow( rustc:: untranslatable_diagnostic) ]
65#![ feature( box_patterns) ]
76#![ feature( if_let_guard) ]
87#![ feature( let_chains) ]
98#![ feature( negative_impls) ]
9+ #![ feature( rustdoc_internals) ]
1010#![ feature( strict_provenance) ]
1111#![ feature( try_blocks) ]
1212// HACK(eddyb) end of `rustc_codegen_ssa` crate-level attributes (see `build.rs`).
3131#![ feature( rustc_private) ]
3232#![ feature( assert_matches) ]
3333#![ feature( result_flattening) ]
34- #![ feature( lint_reasons) ]
3534// crate-specific exceptions:
3635#![ allow(
3736 unsafe_code, // rustc_codegen_ssa requires unsafe functions in traits to be impl'd
@@ -146,13 +145,13 @@ use maybe_pqp_cg_ssa::{CodegenResults, CompiledModule, ModuleCodegen, ModuleKind
146145use rspirv:: binary:: Assemble ;
147146use rustc_ast:: expand:: allocator:: AllocatorKind ;
148147use rustc_data_structures:: fx:: FxIndexMap ;
149- use rustc_errors:: { DiagCtxt , ErrorGuaranteed , FatalError } ;
148+ use rustc_errors:: { DiagCtxtHandle , ErrorGuaranteed , FatalError } ;
150149use rustc_metadata:: EncodedMetadata ;
151150use rustc_middle:: dep_graph:: { WorkProduct , WorkProductId } ;
152151use rustc_middle:: mir:: mono:: { MonoItem , MonoItemData } ;
153152use rustc_middle:: mir:: pretty:: write_mir_pretty;
154153use rustc_middle:: ty:: print:: with_no_trimmed_paths;
155- use rustc_middle:: ty:: { self , Instance , InstanceDef , TyCtxt } ;
154+ use rustc_middle:: ty:: { self , Instance , InstanceKind , TyCtxt } ;
156155use rustc_session:: config:: { self , OutputFilenames , OutputType } ;
157156use rustc_session:: Session ;
158157use rustc_span:: symbol:: { sym, Symbol } ;
@@ -168,7 +167,7 @@ fn dump_mir(tcx: TyCtxt<'_>, mono_items: &[(MonoItem<'_>, MonoItemData)], path:
168167 let mut file = File :: create ( path) . unwrap ( ) ;
169168 for & ( mono_item, _) in mono_items {
170169 if let MonoItem :: Fn ( instance) = mono_item {
171- if matches ! ( instance. def, InstanceDef :: Item ( _) ) {
170+ if matches ! ( instance. def, InstanceKind :: Item ( _) ) {
172171 let mut mir = Cursor :: new ( Vec :: new ( ) ) ;
173172 if write_mir_pretty ( tcx, Some ( instance. def_id ( ) ) , & mut mir) . is_ok ( ) {
174173 writeln ! ( file, "{}" , String :: from_utf8( mir. into_inner( ) ) . unwrap( ) ) . unwrap ( ) ;
@@ -184,7 +183,7 @@ fn is_blocklisted_fn<'tcx>(
184183 instance : Instance < ' tcx > ,
185184) -> bool {
186185 // TODO: These sometimes have a constant value of an enum variant with a hole
187- if let InstanceDef :: Item ( def_id) = instance. def {
186+ if let InstanceKind :: Item ( def_id) = instance. def {
188187 if let Some ( debug_trait_def_id) = tcx. get_diagnostic_item ( sym:: Debug ) {
189188 // Helper for detecting `<_ as core::fmt::Debug>::fmt` (in impls).
190189 let is_debug_fmt_method = |def_id| match tcx. opt_associated_item ( def_id) {
@@ -328,7 +327,7 @@ impl WriteBackendMethods for SpirvCodegenBackend {
328327
329328 fn run_link (
330329 _cgcx : & CodegenContext < Self > ,
331- _diag_handler : & DiagCtxt ,
330+ _diag_handler : DiagCtxtHandle < ' _ > ,
332331 _modules : Vec < ModuleCodegen < Self :: Module > > ,
333332 ) -> Result < ModuleCodegen < Self :: Module > , FatalError > {
334333 todo ! ( )
@@ -360,7 +359,7 @@ impl WriteBackendMethods for SpirvCodegenBackend {
360359
361360 unsafe fn optimize (
362361 _: & CodegenContext < Self > ,
363- _: & DiagCtxt ,
362+ _: DiagCtxtHandle < ' _ > ,
364363 _: & ModuleCodegen < Self :: Module > ,
365364 _: & ModuleConfig ,
366365 ) -> Result < ( ) , FatalError > {
@@ -391,7 +390,7 @@ impl WriteBackendMethods for SpirvCodegenBackend {
391390
392391 unsafe fn codegen (
393392 cgcx : & CodegenContext < Self > ,
394- _diag_handler : & DiagCtxt ,
393+ _diag_handler : DiagCtxtHandle < ' _ > ,
395394 module : ModuleCodegen < Self :: Module > ,
396395 _config : & ModuleConfig ,
397396 ) -> Result < CompiledModule , FatalError > {
@@ -536,16 +535,13 @@ impl Drop for DumpModuleOnPanic<'_, '_, '_> {
536535#[ no_mangle]
537536pub fn __rustc_codegen_backend ( ) -> Box < dyn CodegenBackend > {
538537 // Tweak rustc's default ICE panic hook, to direct people to `rust-gpu`.
539- rustc_driver:: install_ice_hook (
540- "https://github.com/rust-gpu/rust-gpu/issues/new" ,
541- |handler| {
542- handler. note ( concat ! (
543- "`rust-gpu` version `" ,
544- env!( "CARGO_PKG_VERSION" ) ,
545- "`"
546- ) ) ;
547- } ,
548- ) ;
538+ rustc_driver:: install_ice_hook ( "https://github.com/rust-gpu/rust-gpu/issues/new" , |dcx| {
539+ dcx. handle ( ) . note ( concat ! (
540+ "`rust-gpu` version `" ,
541+ env!( "CARGO_PKG_VERSION" ) ,
542+ "`"
543+ ) ) ;
544+ } ) ;
549545
550546 Box :: new ( SpirvCodegenBackend )
551547}
0 commit comments