@@ -6,7 +6,7 @@ use crate::spirv_source::{
6
6
use crate :: target_specs:: update_target_specs_files;
7
7
use crate :: { cache_dir, spirv_source:: SpirvSource } ;
8
8
use anyhow:: Context as _;
9
- use spirv_builder:: SpirvBuilder ;
9
+ use spirv_builder:: { IntoSpirvTarget , SpirvBuilder } ;
10
10
use std:: path:: { Path , PathBuf } ;
11
11
12
12
/// Represents a functional backend installation, whether it was cached or just installed.
@@ -32,7 +32,7 @@ impl InstalledBackend {
32
32
pub fn to_spirv_builder (
33
33
& self ,
34
34
path_to_crate : impl AsRef < Path > ,
35
- target : impl Into < String > ,
35
+ target : impl IntoSpirvTarget ,
36
36
) -> SpirvBuilder {
37
37
let mut builder = SpirvBuilder :: new ( path_to_crate, target) ;
38
38
self . configure_spirv_builder ( & mut builder)
@@ -48,10 +48,12 @@ impl InstalledBackend {
48
48
pub fn configure_spirv_builder ( & self , builder : & mut SpirvBuilder ) -> anyhow:: Result < ( ) > {
49
49
builder. rustc_codegen_spirv_location = Some ( self . rustc_codegen_spirv_location . clone ( ) ) ;
50
50
builder. toolchain_overwrite = Some ( self . toolchain_channel . clone ( ) ) ;
51
- builder. path_to_target_spec = Some ( self . target_spec_dir . join ( format ! (
52
- "{}.json" ,
53
- builder. target. as_ref( ) . context( "expect target to be set" ) ?
54
- ) ) ) ;
51
+ let file_name = builder
52
+ . target
53
+ . clone ( )
54
+ . context ( "expect target to be set" ) ??
55
+ . target_json_file_name ( ) ;
56
+ builder. path_to_target_spec = Some ( self . target_spec_dir . join ( file_name) ) ;
55
57
Ok ( ( ) )
56
58
}
57
59
}
0 commit comments