{"record":{"id":"4d71b8d55885732f","repo":"rust-lang/rust","slug":"fixme-unsafe-binder-4d71b8","errorCode":null,"errorMessage":"FIXME(unsafe_binder)","messagePattern":"FIXME\\(unsafe_binder\\)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/rustc_hir_typeck/src/cast.rs","lineNumber":121,"sourceCode":"\n        let t = self.resolve_vars_with_obligations(t);\n\n        Ok(match *t.kind() {\n            ty::Slice(_) | ty::Str => Some(PointerKind::Length),\n            ty::Dynamic(tty, _) => Some(PointerKind::VTable(tty)),\n            ty::Adt(def, args) if def.is_struct() => match def.non_enum_variant().tail_opt() {\n                None => Some(PointerKind::Thin),\n                Some(f) => {\n                    let field_ty = self.field_ty(span, f, args);\n                    self.pointer_kind(field_ty, span)?\n                }\n            },\n            ty::Tuple(fields) => match fields.last() {\n                None => Some(PointerKind::Thin),\n                Some(&f) => self.pointer_kind(f, span)?,\n            },\n\n            ty::UnsafeBinder(_) => unimplemented!(\"FIXME(unsafe_binder)\"),\n\n            // Pointers to foreign types are thin, despite being unsized\n            ty::Foreign(..) => Some(PointerKind::Thin),\n            // We should really try to normalize here.\n            ty::Alias(_, pi) => Some(PointerKind::OfAlias(pi)),\n            ty::Param(p) => Some(PointerKind::OfParam(p)),\n            // Insufficient type information.\n            ty::Placeholder(..) | ty::Bound(..) | ty::Infer(_) => None,\n\n            ty::Bool\n            | ty::Char\n            | ty::Int(..)\n            | ty::Uint(..)\n            | ty::Float(_)\n            | ty::Array(..)\n            | ty::CoroutineWitness(..)\n            | ty::RawPtr(_, _)\n            | ty::Ref(..)","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/compiler/rustc_hir_typeck/src/cast.rs#L103-L139","documentation":"An `unimplemented!(\"FIXME(unsafe_binder)\")` ICE in `rustc_hir_typeck`'s cast-checking code (`pointer_kind`). When type-checking a pointer cast whose pointee type is `ty::UnsafeBinder`, the compiler cannot yet decide whether the pointer is thin/fat and panics. The `UnsafeBinder` arm has no handling implemented.","triggerScenarios":"Writing an `as` cast (or raw-pointer cast) to or from a type whose pointee involves `ty::UnsafeBinder`, while the `unsafe binder` nightly feature is enabled. The type-checker's `pointer_kind` recurses into the pointee and hits cast.rs:121.","commonSituations":"Using the `#![feature(unsafe_binder)]` feature and casting raw pointers to/from binder-wrapped types during type checking.","solutions":["Avoid casting raw pointers to/from `UnsafeBinder`-typed points; access through the binder's documented API instead.","Disable the `unsafe_binder` feature for the affected module.","Track the upstream FIXME; update nightly once the cast path is implemented."],"exampleFix":"// before (cast to unsafe-binder pointee -> ICE)\n#![feature(unsafe_binder)]\nlet p = &x as *const _ as *const unsafe<'a> Wrap<'a, u8>;\n\n// after — do not cast; obtain the pointer through the binder API\n#![feature(unsafe_binder)]\nlet p: *const u8 = &x;","handlingStrategy":"validation","validationCode":"# Audit casts involving unsafe binder pointees\nrg -n 'as \\*const .*(unsafe|Wrap)' src/  # review matches by hand","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not cast raw pointers to/from `UnsafeBinder`-typed points.","Use the binder's provided access functions instead of `as`.","Disable `unsafe_binder` where casts are unavoidable."],"tags":["rustc","hir-typeck","cast","unsafe-binder","nightly","ice","compiler-internal","unfinished-feature"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}