Skip to content

Commit a1d5720

Browse files
committed
Add test for lowering raw pointer types
1 parent 1c546b3 commit a1d5720

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/lowering/mod.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,3 +475,37 @@ fn scalars() {
475475
}
476476
}
477477
}
478+
479+
#[test]
480+
fn raw_pointers() {
481+
lowering_success! {
482+
program {
483+
trait Quux { }
484+
struct Foo<T> { a: *const T }
485+
486+
struct Bar<T> { a: *mut T }
487+
488+
impl<T> Quux for Foo<*mut T> { }
489+
impl<T> Quux for Bar<*const T> { }
490+
}
491+
}
492+
493+
lowering_error! {
494+
program {
495+
struct *const i32 { }
496+
}
497+
error_msg {
498+
"parse error: UnrecognizedToken { token: (8, Token(7, \"*\"), 9), expected: [\"r#\\\"([A-Za-z]|_)([A-Za-z0-9]|_)*\\\"#\"] }"
499+
}
500+
}
501+
502+
lowering_error! {
503+
program {
504+
trait Foo { }
505+
impl Foo for *i32 { }
506+
}
507+
error_msg {
508+
"parse error: UnrecognizedToken { token: (30, Token(51, \"i32\"), 33), expected: [\"\\\"const\\\"\", \"\\\"mut\\\"\"] }"
509+
}
510+
}
511+
}

0 commit comments

Comments
 (0)