-
Notifications
You must be signed in to change notification settings - Fork 33
Closed
Description
I am trying to reproduce an example from your doc https://extendr.rs/user-guide/default-args.html with rust_function() from the last version on rextendr 0.4.2.900 but got an error:
# R version 4.5.2 (2025-10-31) on Ubuntu 24.04
> rust_function('#[extendr]
fn check_default(#[extendr(default = "NULL")] x: Robj) -> bool {
x.is_null()
}')
ℹ build directory: /tmp/RtmpsaFvP6/file1aa31653369785
Error in `extract_meta()`:
! Rust code contains invalid attribute macros.
• ✖ No valid `fn` or `impl` block found in the following sample:
• #[extendr]
Run `rlang::last_trace()` to see where the error occurred.
> rlang::last_trace()
<error/rextendr_error>
Error in `extract_meta()`:
! Rust code contains invalid attribute macros.
• ✖ No valid `fn` or `impl` block found in the following sample:
• #[extendr]
---
Backtrace:
▆
1. └─rextendr::rust_function("#[extendr]\nfn check_default(#[extendr(default = \"NULL\")] x: Robj) -> bool {\n x.is_null()\n}")
2. └─rextendr::rust_source(...)
3. └─rextendr::make_module_macro(code, opts[["module_name"]])
4. └─rextendr:::find_exports(sanitize_rust_code(lines))
5. ├─dplyr::select(...)
6. ├─dplyr::mutate(...)
7. ├─dplyr::bind_rows(...)
8. │ └─rlang::list2(...)
9. ├─rextendr:::discard(...)
10. │ └─rextendr:::.rlang_purrr_probe(.x, .p, ...)
11. │ └─rextendr:::map_lgl(.x, .p, ...)
12. │ └─rextendr:::.rlang_purrr_map_mold(.x, .f, logical(1), ...)
13. │ └─base::vapply(.x, .f, .mold, ..., USE.NAMES = FALSE)
14. └─rextendr:::map2(start, end, function(.x, .y) extract_meta(clean_lns[.x:.y]))
15. └─base::mapply(.f, .x, .y, MoreArgs = list(...), SIMPLIFY = FALSE)
16. └─rextendr (local) `<fn>`(dots[[1L]][[1L]], dots[[2L]][[1L]])
17. └─rextendr:::extract_meta(clean_lns[.x:.y])
Run rlang::last_trace(drop = FALSE) to see 1 hidden frame.
Any help?
Metadata
Metadata
Assignees
Labels
No labels