1
1
// HACK(eddyb) start of `rustc_codegen_ssa` crate-level attributes (see `build.rs`).
2
- #![ feature( rustdoc_internals) ]
3
2
#![ allow( internal_features) ]
4
3
#![ allow( rustc:: diagnostic_outside_of_impl) ]
5
4
#![ allow( rustc:: untranslatable_diagnostic) ]
6
5
#![ feature( box_patterns) ]
7
6
#![ feature( if_let_guard) ]
8
7
#![ feature( let_chains) ]
9
8
#![ feature( negative_impls) ]
9
+ #![ feature( rustdoc_internals) ]
10
10
#![ feature( strict_provenance) ]
11
11
#![ feature( try_blocks) ]
12
12
// HACK(eddyb) end of `rustc_codegen_ssa` crate-level attributes (see `build.rs`).
31
31
#![ feature( rustc_private) ]
32
32
#![ feature( assert_matches) ]
33
33
#![ feature( result_flattening) ]
34
- #![ feature( lint_reasons) ]
35
34
// crate-specific exceptions:
36
35
#![ allow(
37
36
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
146
145
use rspirv:: binary:: Assemble ;
147
146
use rustc_ast:: expand:: allocator:: AllocatorKind ;
148
147
use rustc_data_structures:: fx:: FxIndexMap ;
149
- use rustc_errors:: { DiagCtxt , ErrorGuaranteed , FatalError } ;
148
+ use rustc_errors:: { DiagCtxtHandle , ErrorGuaranteed , FatalError } ;
150
149
use rustc_metadata:: EncodedMetadata ;
151
150
use rustc_middle:: dep_graph:: { WorkProduct , WorkProductId } ;
152
151
use rustc_middle:: mir:: mono:: { MonoItem , MonoItemData } ;
153
152
use rustc_middle:: mir:: pretty:: write_mir_pretty;
154
153
use 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 } ;
156
155
use rustc_session:: config:: { self , OutputFilenames , OutputType } ;
157
156
use rustc_session:: Session ;
158
157
use rustc_span:: symbol:: { sym, Symbol } ;
@@ -168,7 +167,7 @@ fn dump_mir(tcx: TyCtxt<'_>, mono_items: &[(MonoItem<'_>, MonoItemData)], path:
168
167
let mut file = File :: create ( path) . unwrap ( ) ;
169
168
for & ( mono_item, _) in mono_items {
170
169
if let MonoItem :: Fn ( instance) = mono_item {
171
- if matches ! ( instance. def, InstanceDef :: Item ( _) ) {
170
+ if matches ! ( instance. def, InstanceKind :: Item ( _) ) {
172
171
let mut mir = Cursor :: new ( Vec :: new ( ) ) ;
173
172
if write_mir_pretty ( tcx, Some ( instance. def_id ( ) ) , & mut mir) . is_ok ( ) {
174
173
writeln ! ( file, "{}" , String :: from_utf8( mir. into_inner( ) ) . unwrap( ) ) . unwrap ( ) ;
@@ -184,7 +183,7 @@ fn is_blocklisted_fn<'tcx>(
184
183
instance : Instance < ' tcx > ,
185
184
) -> bool {
186
185
// 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 {
188
187
if let Some ( debug_trait_def_id) = tcx. get_diagnostic_item ( sym:: Debug ) {
189
188
// Helper for detecting `<_ as core::fmt::Debug>::fmt` (in impls).
190
189
let is_debug_fmt_method = |def_id| match tcx. opt_associated_item ( def_id) {
@@ -328,7 +327,7 @@ impl WriteBackendMethods for SpirvCodegenBackend {
328
327
329
328
fn run_link (
330
329
_cgcx : & CodegenContext < Self > ,
331
- _diag_handler : & DiagCtxt ,
330
+ _diag_handler : DiagCtxtHandle < ' _ > ,
332
331
_modules : Vec < ModuleCodegen < Self :: Module > > ,
333
332
) -> Result < ModuleCodegen < Self :: Module > , FatalError > {
334
333
todo ! ( )
@@ -360,7 +359,7 @@ impl WriteBackendMethods for SpirvCodegenBackend {
360
359
361
360
unsafe fn optimize (
362
361
_: & CodegenContext < Self > ,
363
- _: & DiagCtxt ,
362
+ _: DiagCtxtHandle < ' _ > ,
364
363
_: & ModuleCodegen < Self :: Module > ,
365
364
_: & ModuleConfig ,
366
365
) -> Result < ( ) , FatalError > {
@@ -391,7 +390,7 @@ impl WriteBackendMethods for SpirvCodegenBackend {
391
390
392
391
unsafe fn codegen (
393
392
cgcx : & CodegenContext < Self > ,
394
- _diag_handler : & DiagCtxt ,
393
+ _diag_handler : DiagCtxtHandle < ' _ > ,
395
394
module : ModuleCodegen < Self :: Module > ,
396
395
_config : & ModuleConfig ,
397
396
) -> Result < CompiledModule , FatalError > {
@@ -536,16 +535,13 @@ impl Drop for DumpModuleOnPanic<'_, '_, '_> {
536
535
#[ no_mangle]
537
536
pub fn __rustc_codegen_backend ( ) -> Box < dyn CodegenBackend > {
538
537
// 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
+ } ) ;
549
545
550
546
Box :: new ( SpirvCodegenBackend )
551
547
}
0 commit comments