rust-lang/rust · error
unsafe binders are not implemented yet
Error message
unsafe binders are not implemented yet
What it means
Clippy's author lint (clippy_lints::utils::author) prints Rust patterns that mirror the AST a lint author wants to match. It walks HIR expressions but has no handling for ExprKind::UnsafeBinderCast (the unstable unsafe_binders cast node), so it panics with unimplemented!("unsafe binders are not implemented yet") at author.rs:718.
Source
Thrown at src/tools/clippy/clippy_lints/src/utils/author.rs:718
self.expr(field!(field.expr));
});
base.if_some(|e| self.expr(e));
},
ExprKind::ConstBlock(_) => kind!("ConstBlock(_)"),
ExprKind::Repeat(value, length) => {
bind!(self, value, length);
kind!("Repeat({value}, {length})");
self.expr(value);
self.const_arg(length);
},
ExprKind::Err(_) => kind!("Err(_)"),
ExprKind::DropTemps(expr) => {
bind!(self, expr);
kind!("DropTemps({expr})");
self.expr(expr);
},
ExprKind::UnsafeBinderCast(..) => {
unimplemented!("unsafe binders are not implemented yet");
},
}
}
fn block(&self, block: &Binding<&hir::Block<'_>>) {
self.slice(field!(block.stmts), |stmt| self.stmt(stmt));
self.option(field!(block.expr), "trailing_expr", |expr| {
self.expr(expr);
});
}
fn body(&self, body_id: &Binding<hir::BodyId>) {
let expr = self.cx.tcx.hir_body(body_id.value).value;
bind!(self, expr);
chain!(self, "{expr} = &cx.tcx.hir_body({body_id}).value");
self.expr(expr);
}
View on GitHub (pinned to 7088e4b63a)
Solutions
- Do not run the author lint on code containing UnsafeBinderCast expressions.
- Remove/comment out the unsafe binder cast before invoking CLIPPY_AUTHOR.
- Isolate the snippet you want to learn about and author-lint only that part without the binder cast.
- Upstream an author.rs branch that emits the UnsafeBinderCast pattern.
Example fix
// before
#![feature(unsafe_binders)]
$ CLIPPY_AUTHOR=1 cargo clippy // hits UnsafeBinderCast -> panic
// after: drop the binder cast before author-linting
let v: &T = unsafe { value }; // ordinary expression, then author-lint Defensive patterns
Strategy: validation
Validate before calling
// Do not run the author lint on code with UnsafeBinderCast nodes. // Strip the #![feature(unsafe_binders)] cast expressions before CLIPPY_AUTHOR=1.
Prevention
- Do not author-lint code that uses unsafe binders.
- Isolate snippets for the author lint away from binder casts.
- Upstream the missing author.rs branch.
When it happens
Trigger: Running clippy with the author lint (-A clippy::author or CLIPPY_AUTHOR=...) on code that contains an unsafe binder cast expression (#![feature(unsafe_binders)] using the wrap/unwrap cast syntax).
Common situations: Lint authors experimenting with unsafe_binders code while using the author lint to learn the AST shape; running clippy author over a crate that enables the unstable feature.
Related errors
- discr subgoal...
- simd {}
- FIXME(unsafe_binder)
- FIXME(unsafe_binder)
- `async gen` closures not supported yet
AI-assisted analysis of rust-lang/rust@7088e4b63a (2026-08-10).
Data as JSON: /api/errors/f4bf6746b69f90d7.
Report an issue: GitHub.