@@ -69,7 +69,7 @@ impl<'tcx> GotocCtx<'tcx> {
69
69
/// Handles codegen for non returning intrinsics
70
70
/// Non returning intrinsics are not associated with a destination
71
71
pub fn codegen_never_return_intrinsic ( & mut self , instance : Instance , span : Span ) -> Stmt {
72
- let intrinsic = instance. mangled_name ( ) ;
72
+ let intrinsic = instance. intrinsic_name ( ) . unwrap ( ) ;
73
73
74
74
debug ! ( "codegen_never_return_intrinsic:\n \t instance {:?}\n \t span {:?}" , instance, span) ;
75
75
@@ -112,8 +112,8 @@ impl<'tcx> GotocCtx<'tcx> {
112
112
place : & Place ,
113
113
span : Span ,
114
114
) -> Stmt {
115
- let intrinsic_sym = instance. trimmed_name ( ) ;
116
- let intrinsic = intrinsic_sym . as_str ( ) ;
115
+ let intrinsic_name = instance. intrinsic_name ( ) . unwrap ( ) ;
116
+ let intrinsic = intrinsic_name . as_str ( ) ;
117
117
let loc = self . codegen_span_stable ( span) ;
118
118
debug ! ( ?instance, "codegen_intrinsic" ) ;
119
119
debug ! ( ?fargs, "codegen_intrinsic" ) ;
@@ -288,23 +288,6 @@ impl<'tcx> GotocCtx<'tcx> {
288
288
} } ;
289
289
}
290
290
291
- /// Gets the basename of an intrinsic given its trimmed name.
292
- ///
293
- /// For example, given `arith_offset::<u8>` this returns `arith_offset`.
294
- fn intrinsic_basename ( name : & str ) -> & str {
295
- let scope_sep_count = name. matches ( "::" ) . count ( ) ;
296
- // We expect at most one `::` separator from trimmed intrinsic names
297
- debug_assert ! (
298
- scope_sep_count < 2 ,
299
- "expected at most one `::` in intrinsic name, but found {scope_sep_count} in `{name}`"
300
- ) ;
301
- let name_split = name. split_once ( "::" ) ;
302
- if let Some ( ( base_name, _type_args) ) = name_split { base_name } else { name }
303
- }
304
- // The trimmed name includes type arguments if the intrinsic was defined
305
- // on generic types, but we only need the basename for the match below.
306
- let intrinsic = intrinsic_basename ( intrinsic) ;
307
-
308
291
if let Some ( stripped) = intrinsic. strip_prefix ( "simd_shuffle" ) {
309
292
assert ! ( fargs. len( ) == 3 , "`simd_shuffle` had unexpected arguments {fargs:?}" ) ;
310
293
let n: u64 = self . simd_shuffle_length ( stripped, farg_types, span) ;
0 commit comments