We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
c2rust-analyze
PermissionSet::for_const_ref_ty
PermissionSet::for_const_ref
1 parent 3574ba4 commit 0025b02Copy full SHA for 0025b02
c2rust-analyze/src/context.rs
@@ -53,11 +53,10 @@ bitflags! {
53
}
54
55
impl PermissionSet {
56
- pub fn for_const_ref(constant: ConstantKind) -> Self {
57
- let ref_ty = constant.ty();
58
- let ty = match ref_ty.kind() {
+ pub fn for_const_ref_ty(ty: Ty) -> Self {
+ let ty = match ty.kind() {
59
ty::Ref(_, ty, _) => ty,
60
- _ => panic!("expected only `Ref`s for constants: {ref_ty:?}"),
+ _ => panic!("expected only `Ref`s for constants: {ty:?}"),
61
};
62
if ty.is_array() || ty.is_str() {
63
Self::READ | Self::OFFSET_ADD
@@ -67,6 +66,10 @@ impl PermissionSet {
67
66
panic!("expected an array, str, or primitive type: {ty:?}");
68
69
+
70
+ pub fn for_const_ref(constant: ConstantKind) -> Self {
71
+ Self::for_const_ref_ty(constant.ty())
72
+ }
73
74
75
bitflags! {
0 commit comments