miniextendr_lint/rules/
lifetime_param.rs1use crate::crate_index::CrateIndex;
9use crate::diagnostic::Diagnostic;
10use crate::lint_code::LintCode;
11
12pub fn check(index: &CrateIndex, diagnostics: &mut Vec<Diagnostic>) {
13 for (path, data) in &index.file_data {
14 for (name, line) in &data.lifetime_param_items {
15 diagnostics.push(
16 Diagnostic::new(
17 LintCode::MXL112,
18 path,
19 *line,
20 format!(
21 "`{name}` has an explicit lifetime parameter on a `#[miniextendr]` \
22 item; lifetime parameters are not supported at the FFI boundary",
23 ),
24 )
25 .with_help(
26 "use owned types (`Vec<T>` instead of `&[T]`, `String` instead of `&str`) \
27 or remove the explicit lifetime annotation — `&[T]` and `&str` arguments \
28 work without explicit lifetime params",
29 ),
30 );
31 }
32 }
33}