File tree 2 files changed +2
-17
lines changed
2 files changed +2
-17
lines changed Original file line number Diff line number Diff line change @@ -3054,7 +3054,7 @@ impl TryToRustTy for Type {
3054
3054
}
3055
3055
TypeKind :: Pointer ( inner) |
3056
3056
TypeKind :: Reference ( inner) => {
3057
- let is_const = self . is_const ( ) || ctx. resolve_type ( inner) . is_const ( ) ;
3057
+ let is_const = ctx. resolve_type ( inner) . is_const ( ) ;
3058
3058
3059
3059
let inner = inner. into_resolver ( ) . through_type_refs ( ) . resolve ( ctx) ;
3060
3060
let inner_ty = inner. expect_type ( ) ;
Original file line number Diff line number Diff line change @@ -1195,22 +1195,7 @@ impl Type {
1195
1195
1196
1196
let name = if name. is_empty ( ) { None } else { Some ( name) } ;
1197
1197
1198
- // Just using ty.is_const() is wrong here, because when we declare an
1199
- // argument like 'int* const arg0', arg0 is considered
1200
- // const but the pointer itself points to mutable data.
1201
- //
1202
- // Without canonicalizing the type to the pointer type, we'll get the
1203
- // following mapping:
1204
- //
1205
- // arg0: *const c_int
1206
- //
1207
- // So by canonicalizing the type first, we can check constness by
1208
- // calling is_const() on the pointer type.
1209
- let is_const = if let Some ( pty) = ty. pointee_type ( ) {
1210
- pty. is_const ( )
1211
- } else {
1212
- ty. is_const ( )
1213
- } ;
1198
+ let is_const = ty. is_const ( ) ;
1214
1199
1215
1200
let ty = Type :: new ( name, layout, kind, is_const) ;
1216
1201
// TODO: maybe declaration.canonical()?
You can’t perform that action at this time.
0 commit comments