Skip to content

Commit f65b241

Browse files
committed
Indicate that extern type with lifetimes is not implemented yet
1 parent 3b8aedc commit f65b241

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

syntax/check.rs

+8
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,10 @@ fn check_api_type(cx: &mut Check, ety: &ExternType) {
337337
cx.error(derive, msg);
338338
}
339339

340+
if let Some(lifetime) = ety.lifetimes.first() {
341+
cx.error(lifetime, "extern type with lifetimes is not supported yet");
342+
}
343+
340344
if !ety.bounds.is_empty() {
341345
let bounds = &ety.bounds;
342346
let span = quote!(#(#bounds)*);
@@ -440,6 +444,10 @@ fn check_api_type_alias(cx: &mut Check, alias: &TypeAlias) {
440444
let msg = format!("derive({}) on extern type alias is not supported", derive);
441445
cx.error(derive, msg);
442446
}
447+
448+
if let Some(lifetime) = alias.lifetimes.first() {
449+
cx.error(lifetime, "extern type with lifetimes is not supported yet");
450+
}
443451
}
444452

445453
fn check_api_impl(cx: &mut Check, imp: &Impl) {

tests/ui/extern_type_lifetime.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#[cxx::bridge]
2+
mod ffi {
3+
extern "C++" {
4+
type Complex<'a, 'b>;
5+
}
6+
}
7+
8+
fn main() {}

tests/ui/extern_type_lifetime.stderr

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
error: extern type with lifetimes is not supported yet
2+
--> $DIR/extern_type_lifetime.rs:4:22
3+
|
4+
4 | type Complex<'a, 'b>;
5+
| ^^

0 commit comments

Comments
 (0)