{"record":{"id":"4a6740ec4efe5dbd","repo":"rust-lang/rust","slug":"not-implemented-4a6740","errorCode":null,"errorMessage":"not implemented","messagePattern":"not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/rustc_codegen_gcc/src/gcc_util.rs","lineNumber":130,"sourceCode":"        \"M68000\" => \"68000\",\n        \"M68020\" => \"68020\",\n        _ => name,\n    }\n}\n\nfn handle_native(name: &str) -> &str {\n    if name != NATIVE_CPU {\n        return arch_to_gcc(name);\n    }\n\n    #[cfg(feature = \"master\")]\n    {\n        // Get the native arch.\n        let context = Context::default();\n        context.get_target_info().arch().unwrap().to_str().unwrap()\n    }\n    #[cfg(not(feature = \"master\"))]\n    unimplemented!();\n}\n\npub fn target_cpu(sess: &Session) -> &str {\n    match sess.opts.cg.target_cpu {\n        Some(ref name) => handle_native(name),\n        None => handle_native(sess.target.cpu.as_ref()),\n    }\n}\n","sourceCodeStart":112,"sourceCodeEnd":139,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/compiler/rustc_codegen_gcc/src/gcc_util.rs#L112-L139","documentation":"An `unimplemented!()` ICE in rustc_codegen_gcc's `handle_native`. When the user requests `target-cpu=native`, the backend must query libgccjit's target info for the host CPU arch. That query only exists under the crate's `master` feature (a recent libgccjit build). Without `master`, `handle_native` has no way to detect the native CPU and panics. The non-master build is a stripped-down fallback that intentionally lacks this capability.","triggerScenarios":"Compiling with the GCC backend that was built without the `master` cargo feature, while passing `-Ctarget-cpu=native` (or a target spec whose CPU is `NATIVE_CPU`). `target_cpu(sess)` calls `handle_native`, which hits the `#[cfg(not(feature = \"master\"))] unimplemented!()`.","commonSituations":"A distro or local build of rustc_codegen_gcc linked against an older/stock libgccjit (no master feature), combined with a build script, profile-guided optimization pass, or user flag that sets `-Ctarget-cpu=native`.","solutions":["Stop passing `-Ctarget-cpu=native`; pass an explicit CPU name (e.g. `-Ctarget-cpu=x86-64`) so `handle_native` returns early via `arch_to_gcc`.","Rebuild rustc_codegen_gcc with the `master` cargo feature against a libgccjit that supports `get_target_info()`.","Switch to the LLVM backend, where `target-cpu=native` is fully supported."],"exampleFix":"# before (non-master cg_gcc -> ICE on native)\nrustc -Ctarget-cpu=native -Zcodegen-backend=gcc crate.rs\n\n# after — explicit CPU\nrustc -Ctarget-cpu=x86-64 -Zcodegen-backend=gcc crate.rs","handlingStrategy":"validation","validationCode":"# Do not pass target-cpu=native to a non-master cg_gcc build\nif [[ \"${RUSTFLAGS:-}\" == *target-cpu=native* && \"${RUSTFLAGS:-}\" == *codegen-backend=gcc* ]]; then\n  echo \"avoid: pass an explicit -Ctarget-cpu=<name>, not 'native', unless cg_gcc is built with the master feature\"\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass an explicit `-Ctarget-cpu=<name>` instead of `native` when using cg_gcc.","Confirm the `master` cargo feature is enabled in your rustc_codegen_gcc build before relying on native detection.","Keep build scripts / PGO from injecting `target-cpu=native` when the GCC backend is selected."],"tags":["rustc","codegen-gcc","target-cpu","libgccjit","ice","compiler-internal","config"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}