{"record":{"id":"7c0dcd751519a6b6","repo":"rust-lang/rust","slug":"fixme-unsafe-binder-7c0dcd","errorCode":null,"errorMessage":"FIXME(unsafe_binder)","messagePattern":"FIXME\\(unsafe_binder\\)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/rustc_trait_selection/src/traits/project.rs","lineNumber":1077,"sourceCode":"                        | ty::Str\n                        | ty::Array(..)\n                        | ty::Pat(..)\n                        | ty::Slice(_)\n                        | ty::RawPtr(..)\n                        | ty::Ref(..)\n                        | ty::FnDef(..)\n                        | ty::FnPtr(..)\n                        | ty::Dynamic(..)\n                        | ty::Closure(..)\n                        | ty::CoroutineClosure(..)\n                        | ty::Coroutine(..)\n                        | ty::CoroutineWitness(..)\n                        | ty::Never\n                        | ty::Tuple(..)\n                        // Integers and floats always have `u8` as their discriminant.\n                        | ty::Infer(ty::InferTy::IntVar(_) | ty::InferTy::FloatVar(..)) => true,\n\n                        ty::UnsafeBinder(_) => unimplemented!(\"FIXME(unsafe_binder)\"),\n\n                        // type parameters, opaques, and unnormalized projections don't have\n                        // a known discriminant and may need to be normalized further or rely\n                        // on param env for discriminant projections\n                        ty::Param(_)\n                        | ty::Alias(..)\n                        | ty::Bound(..)\n                        | ty::Placeholder(..)\n                        | ty::Infer(..)\n                        | ty::Error(_) => false,\n                    },\n                    Some(LangItem::PointeeTrait) => {\n                        let tail = selcx.tcx().struct_tail_raw(\n                            self_ty,\n                            &obligation.cause,\n                            |ty| {\n                                // We throw away any obligations we get from this, since we normalize\n                                // and confirm these obligations once again during confirmation","sourceCodeStart":1059,"sourceCodeEnd":1095,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/compiler/rustc_trait_selection/src/traits/project.rs#L1059-L1095","documentation":"An `unimplemented!(\"FIXME(unsafe_binder)\")` ICE in `rustc_trait_selection`'s projection code. While computing whether a type has a known discriminant (for the `Discriminant` trait) during a projection obligation, a `ty::UnsafeBinder` pointee reaches project.rs:1077 and panics. The discriminant logic is unfinished for binder types.","triggerScenarios":"A trait-obligation involving `std::mem::Discriminant` (or the `Discriminant` lang item) where the self-type contains `ty::UnsafeBinder`, under the `unsafe binder` feature.","commonSituations":"Using `mem::discriminant` / `Discriminant<T>` on a binder-wrapped type during trait solving on nightly with `#![feature(unsafe_binder)]`.","solutions":["Do not query `Discriminant` on `UnsafeBinder`-typed values; extract the inner type first.","Disable the `unsafe_binder` feature.","Track the upstream FIXME; upgrade when implemented."],"exampleFix":"// before (Discriminant of unsafe-binder type -> ICE)\n#![feature(unsafe_binder)]\nlet d = std::mem::discriminant(&binder_value);\n\n// after — take discriminant of the inner (unwrapped) type\nlet d = std::mem::discriminant(&binder_value.inner());","handlingStrategy":"validation","validationCode":"# Detect Discriminant use on binder-typed values\nrg -nE 'mem::discriminant|Discriminant<' src/  # review for unsafe-binder self types","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not call `mem::discriminant` on `UnsafeBinder`-typed values.","Extract the inner type before querying `Discriminant`.","Disable `unsafe_binder` where discriminant queries are needed."],"tags":["rustc","trait-selection","projection","discriminant","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"}