{"record":{"id":"ffc8b289e33c4db5","repo":"rust-lang/rust","slug":"fixme-unsafe-binder-ffc8b2","errorCode":null,"errorMessage":"FIXME(unsafe_binder)","messagePattern":"FIXME\\(unsafe_binder\\)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/rustc_middle/src/ty/sty.rs","lineNumber":1830,"sourceCode":"            // If returned by `struct_tail_raw` this is a unit struct\n            // without any fields, or not a struct, and therefore is Sized.\n            ty::Adt(..) => Ok(tcx.types.unit),\n            // If returned by `struct_tail_raw` this is the empty tuple,\n            // a.k.a. unit type, which is Sized\n            ty::Tuple(..) => Ok(tcx.types.unit),\n\n            ty::Str | ty::Slice(_) => Ok(tcx.types.usize),\n\n            ty::Dynamic(_, _) => {\n                let dyn_metadata = tcx.require_lang_item(LangItem::DynMetadata, DUMMY_SP);\n                Ok(tcx.type_of(dyn_metadata).instantiate(tcx, &[tail.into()]).skip_norm_wip())\n            }\n\n            // We don't know the metadata of `self`, but it must be equal to the\n            // metadata of `tail`.\n            ty::Param(_) | ty::Alias(..) => Err(tail),\n\n            ty::UnsafeBinder(_) => unimplemented!(\"FIXME(unsafe_binder)\"),\n\n            ty::Infer(ty::TyVar(_))\n            | ty::Pat(..)\n            | ty::Bound(..)\n            | ty::Placeholder(..)\n            | ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => bug!(\n                \"`ptr_metadata_ty_or_tail` applied to unexpected type: {self:?} (tail = {tail:?})\"\n            ),\n        }\n    }\n\n    /// Returns the type of metadata for (potentially wide) pointers to this type.\n    /// Causes an ICE if the metadata type cannot be determined.\n    pub fn ptr_metadata_ty(\n        self,\n        tcx: TyCtxt<'tcx>,\n        normalize: impl FnMut(Unnormalized<'tcx, Ty<'tcx>>) -> Ty<'tcx>,\n    ) -> Ty<'tcx> {","sourceCodeStart":1812,"sourceCodeEnd":1848,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/compiler/rustc_middle/src/ty/sty.rs#L1812-L1848","documentation":"An `unimplemented!(\"FIXME(unsafe_binder)\")` ICE in `rustc_middle`'s `ptr_metadata_ty_or_tail`. When computing the metadata type (or struct tail) of a pointer whose pointee is `ty::UnsafeBinder`, the function has no handling and panics. All other primitive/compound tails are handled; `UnsafeBinder` is the unfinished arm.","triggerScenarios":"Calling `ptr::metadata` on, or computing fat-pointer metadata for, a type that is or contains `ty::UnsafeBinder` (e.g. `&unsafe<'a> Wrap<'a, T>` or `*const unsafe<'a> _`), while the `unsafe binder` feature is enabled.","commonSituations":"Using `std::ptr::metadata` or building wide pointers to unsafe-binder-typed points; part of exercising the unstable `unsafe_binder` feature.","solutions":["Do not take pointers (or metadata) of `UnsafeBinder`-typed points; convert out of the binder first.","Disable the `unsafe_binder` feature for the affected crate.","Track the upstream FIXME and upgrade nightly when implemented."],"exampleFix":"// before (metadata of unsafe-binder pointee -> ICE)\n#![feature(unsafe_binder)]\nlet m = std::ptr::metadata(p as *const unsafe<'a> Wrap<'a, [u8]>);\n\n// after — take metadata of the underlying tail type\nlet m = std::ptr::metadata(p as *const [u8]);","handlingStrategy":"validation","validationCode":"# Detect pointer/metadata use on unsafe-binder types\nrg -nE 'ptr::metadata|size_of_val|align_of_val' src/ | xargs -r grep -l unsafe_binder 2>/dev/null","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not take `ptr::metadata` of binder-typed points.","Unwrap the binder before computing metadata.","Reserve `unsafe_binder` for runtime code."],"tags":["rustc","pointer-metadata","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-14T05:17:10.506Z"}