{"record":{"id":"06dd6bcd5563de57","repo":"rust-lang/rust","slug":"polonius-output-is-unavailable-despite-z-poloniu","errorCode":null,"errorMessage":"Polonius output is unavailable despite `-Z polonius`","messagePattern":"Polonius output is unavailable despite `-Z polonius`","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"compiler/rustc_borrowck/src/region_infer/mod.rs","lineNumber":516,"sourceCode":"        // eagerly erroing.\n        let mut propagated_outlives_requirements =\n            infcx.tcx.is_typeck_child(mir_def_id).then(Vec::new);\n\n        self.check_type_tests(infcx, propagated_outlives_requirements.as_mut(), &mut errors_buffer);\n\n        debug!(?errors_buffer);\n        debug!(?propagated_outlives_requirements);\n\n        // In Polonius mode, the errors about missing universal region relations are in the output\n        // and need to be emitted or propagated. Otherwise, we need to check whether the\n        // constraints were too strong, and if so, emit or propagate those errors.\n        if infcx.tcx.sess.opts.unstable_opts.polonius.is_legacy_enabled() {\n            self.check_polonius_subset_errors(\n                propagated_outlives_requirements.as_mut(),\n                &mut errors_buffer,\n                polonius_output\n                    .as_ref()\n                    .expect(\"Polonius output is unavailable despite `-Z polonius`\"),\n            );\n        } else {\n            self.check_universal_regions(\n                propagated_outlives_requirements.as_mut(),\n                &mut errors_buffer,\n            );\n        }\n\n        debug!(?errors_buffer);\n\n        let propagated_outlives_requirements = propagated_outlives_requirements.unwrap_or_default();\n\n        if propagated_outlives_requirements.is_empty() {\n            (None, errors_buffer)\n        } else {\n            let num_external_vids = self.universal_regions().num_global_and_external_regions();\n            (\n                Some(ClosureRegionRequirements {","sourceCodeStart":498,"sourceCodeEnd":534,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/compiler/rustc_borrowck/src/region_infer/mod.rs#L498-L534","documentation":"This fires in `RegionInferenceContext::probe_*` when legacy Polonius (`-Zpolonius` without `=next`) is enabled. The code calls `check_polonius_subset_errors` and passes `polonius_output.as_ref().expect(...)`. Legacy polonius is expected to produce output (the subset errors / `child_outlives` facts). If the output is `None` despite the flag being set, the compiler panics — the analysis was requested but never ran or returned nothing.","triggerScenarios":"Compiling with the legacy `-Zpolonius` flag (the datafrog-based external polonius binary approach) where the polonius computation was requested but did not produce output — e.g., the polonius binary wasn't found, the input facts weren't dumped, or the output wasn't parsed back into `polonius_output`.","commonSituations":"Using the legacy `-Zpolonius` mode which requires an external `polonius` binary or the built-in datafrog solver. This can fail if the polonius solver silently failed, if the crate uses a feature that triggers polonius but the solver wasn't built into the toolchain, or after a rustc refactor that changed how polonius output is plumbed.","solutions":["Switch to `-Zpolonius=next` (the in-tree successor) instead of legacy `-Zpolonius`; the legacy path is deprecated.","Remove the `-Zpolonius` flag entirely to use the default NLL borrow checker.","Update to the latest nightly where legacy polonius output plumbing may be fixed.","If you need legacy polonius, ensure the polonius solver actually ran — check for stderr output or missing polonius binary."],"exampleFix":"# before (legacy polonius, output unavailable)\nRUSTFLAGS='-Zpolonius' cargo build\n\n# after (next-gen in-tree polonius)\nRUSTFLAGS='-Zpolonius=next' cargo build","handlingStrategy":"validation","validationCode":"// Validate that legacy polonius is not used without its solver\n// In CI:\n// if echo \"$RUSTFLAGS\" | grep -qE '(^| )-Zpolonius( |$)'; then\n//   echo \"Legacy polonius requires the external solver; consider -Zpolonius=next\"\n//   # or: unset RUSTFLAGS to use default NLL\n// fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer -Zpolonius=next over legacy -Zpolonius.","If using legacy polonius, verify the solver binary is available.","Don't mix legacy and next-gen polonius flags.","Remove polonius flags entirely for production builds unless actively testing the borrow checker."],"tags":["rustc","borrowck","polonius","ice","nightly","compiler-internal"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}