{"record":{"id":"616a373020631546","repo":"rust-lang/rust-clippy","slug":"changing-this-function-will-impact-semver-compatib","errorCode":null,"errorMessage":"changing this function will impact semver compatibility","messagePattern":"changing this function will impact semver compatibility","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"clippy_lints/src/needless_pass_by_ref_mut.rs","lineNumber":294,"sourceCode":"                        return;\n                    };\n                    let mut_span = after_mut_span.with_lo(after_mut_span.lo() - BytePos(3));\n                    let is_cfged = is_cfged.get_or_insert_with(|| inherits_cfg(cx.tcx, *fn_def_id));\n                    span_lint_hir_and_then(\n                        cx,\n                        NEEDLESS_PASS_BY_REF_MUT,\n                        cx.tcx.local_def_id_to_hir_id(*fn_def_id),\n                        sp,\n                        \"this parameter is a mutable reference but is not used mutably\",\n                        |diag| {\n                            diag.span_suggestion(\n                                mut_span,\n                                \"consider removing this `mut`\",\n                                \"\",\n                                Applicability::Unspecified,\n                            );\n                            if cx.effective_visibilities.is_exported(*fn_def_id) {\n                                diag.warn(\"changing this function will impact semver compatibility\");\n                            }\n                            if *is_cfged {\n                                diag.note(\"this is cfg-gated and may require further changes\");\n                            }\n                        },\n                    );\n                }\n            }\n        }\n    }\n}\n\nstruct MutablyUsedVariablesCtxt<'tcx> {\n    mutably_used_vars: HirIdSet,\n    prev_bind: Option<HirId>,\n    /// In async functions, the inner AST is composed of multiple layers until we reach the code\n    /// defined by the user. Because of that, some variables are marked as mutably borrowed even\n    /// though they're not. This field lists the `HirId` that should not be considered as mutable","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/rust-lang/rust-clippy/blob/13aece11388703700981f29d9480ffd6409a3192/clippy_lints/src/needless_pass_by_ref_mut.rs#L276-L312","documentation":"A semver note attached to the needless_pass_by_ref_mut lint: the suggested change rewrites a parameter from &mut T to &T in a public function signature. Rust treats &mut T and &T as distinct types in the public API, so accepting the suggestion is a breaking change for external callers even though the function never used the parameter mutably. The note fires on publicly reachable items (subject to cfg/visibility) to warn before the fix is applied.","triggerScenarios":"Thrown at clippy_lints/src/needless_pass_by_ref_mut.rs:294 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["If the crate is pre-1.0 or a major bump is planned, accept the &mut -> &T change","Otherwise suppress the lint on that item with #[allow(clippy::needless_pass_by_ref_mut)] and fix it at the next breaking release","Audit external callers and published trait implementations that may reference the &mut signature before changing it"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"13aece11388703700981f29d9480ffd6409a3192","analyzedAt":"2026-09-07T23:08:18.134Z","contentChangedAt":"2026-09-07T23:08:18.134Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}