| commit | 2a2264c483399816fba50f4a232357c6e376c3ba | [log] [tgz] |
|---|---|---|
| author | David Tolnay <dtolnay@gmail.com> | Mon Mar 22 17:13:22 2021 -0700 |
| committer | David Tolnay <dtolnay@gmail.com> | Mon Mar 22 19:23:50 2021 -0700 |
| tree | 84616aadcdda08225f13e4b66c88b1315eb0ef19 | |
| parent | d91d2a8d4a53acd861045b736d270998c3dd9c0f [diff] [blame] |
Add dedicated error message for pointer to reference
diff --git a/syntax/check.rs b/syntax/check.rs index c76ef19..eba6565 100644 --- a/syntax/check.rs +++ b/syntax/check.rs
@@ -235,7 +235,11 @@ fn check_type_ptr(cx: &mut Check, ty: &Ptr) { match ty.inner { - Type::Ref(_) | Type::Ptr(_) | Type::Fn(_) | Type::Void(_) => {} + Type::Ptr(_) | Type::Fn(_) | Type::Void(_) => {} + Type::Ref(_) => { + cx.error(ty, "C++ does not allow pointer to reference as a type"); + return; + } _ => return, }