You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compiler: Remove Struct::rust_attributes and make it an error if @rust-attr(...) doesn't lex (#10118)
The `rust_attributes` in langtype::Struct is a bit wierd as it is only
used for rust code generation, yet is stored in every Struct.
Instead, read the `node` while doing code generation like we do in C++.
The previous code was ignoring the error lexing the code in the
attribute, and now we add a compile_error!
Copy file name to clipboardExpand all lines: api/rs/slint/compile_fail_tests.rs
+24Lines changed: 24 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,30 @@ mod x {
26
26
#[cfg(doctest)]
27
27
const basic:u32 = 0;
28
28
29
+
/**
30
+
Test that invalid rust-attr are compilation error
31
+
32
+
This should result in a `compile_error!("Error parsing @rust-attr for struct 'Foo' declared at tests/invalid_rust_attr.slint:4:12"`
33
+
```compile_fail
34
+
use slint::*;
35
+
slint!{
36
+
export { Foo } from "tests/invalid_rust_attr.slint";
37
+
export component Hello inherits Window { }
38
+
}
39
+
```
40
+
41
+
But Foo is not used/generated, then we do not detect the error
42
+
(Having the test here to test that the previous test would otherwise work, but it would also be ok to detect the error and make it an actual slint compile error)
43
+
```
44
+
use slint::*;
45
+
slint!{
46
+
import { Foo } from "tests/invalid_rust_attr.slint";
0 commit comments