mirror of
https://github.com/topjohnwu/cxx.git
synced 2025-02-12 11:31:42 +00:00
Merge pull request #651 from dtolnay/slices
Enable slices and arrays containing str/slice
This commit is contained in:
commit
2e040531f3
@ -234,10 +234,10 @@ fn check_type_ref(cx: &mut Check, ty: &Ref) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn check_type_slice_ref(cx: &mut Check, ty: &SliceRef) {
|
fn check_type_slice_ref(cx: &mut Check, ty: &SliceRef) {
|
||||||
let supported = match &ty.inner {
|
let supported = !is_unsized(cx, &ty.inner)
|
||||||
Type::Str(_) | Type::SliceRef(_) => false,
|
|| match &ty.inner {
|
||||||
Type::Ident(ident) => !is_unsized(cx, &ty.inner) || cx.types.rust.contains(&ident.rust),
|
Type::Ident(ident) => cx.types.rust.contains(&ident.rust),
|
||||||
element => !is_unsized(cx, element),
|
_ => false,
|
||||||
};
|
};
|
||||||
|
|
||||||
if !supported {
|
if !supported {
|
||||||
@ -253,10 +253,7 @@ fn check_type_slice_ref(cx: &mut Check, ty: &SliceRef) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn check_type_array(cx: &mut Check, ty: &Array) {
|
fn check_type_array(cx: &mut Check, ty: &Array) {
|
||||||
let supported = match &ty.inner {
|
let supported = !is_unsized(cx, &ty.inner);
|
||||||
Type::Str(_) | Type::SliceRef(_) => false,
|
|
||||||
element => !is_unsized(cx, element),
|
|
||||||
};
|
|
||||||
|
|
||||||
if !supported {
|
if !supported {
|
||||||
cx.error(ty, "unsupported array element type");
|
cx.error(ty, "unsupported array element type");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user