{"record":{"id":"ec7917cb3fd46e9d","repo":"swc-project/swc","slug":"unsafeid-into-id-is-not-allowed-because-it-is-ve","errorCode":null,"errorMessage":"UnsafeId.into_id() is not allowed because it is very likely to be unsafe","messagePattern":"UnsafeId\\.into_id\\(\\) is not allowed because it is very likely to be unsafe","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_ecma_utils/src/ident.rs","lineNumber":83,"sourceCode":"    }\n\n    #[inline]\n    fn into_id(self) -> Id {\n        (self.sym, self.ctxt)\n    }\n}\n\nimpl IdentLike for UnsafeId {\n    fn from_ident(i: &Ident) -> Self {\n        unsafe { unsafe_id_from_ident(i) }\n    }\n\n    fn to_id(&self) -> Id {\n        unreachable!(\"UnsafeId.to_id() is not allowed because it is very likely to be unsafe\")\n    }\n\n    fn into_id(self) -> Id {\n        unreachable!(\"UnsafeId.into_id() is not allowed because it is very likely to be unsafe\")\n    }\n}\n","sourceCodeStart":65,"sourceCodeEnd":86,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_ecma_utils/src/ident.rs#L65-L86","documentation":"A deliberate guard in the IdentLike impl for UnsafeId (swc_ecma_utils ident.rs:83). UnsafeId is an identifier wrapper constructed via unsafe code that skips hygiene/symbol interning guarantees; converting it back into an Id would launder an unsound identifier into safe APIs, which is 'very likely to be unsafe'. The unreachable!() therefore fires whenever code attempts into_id() on an UnsafeId, marking that call path a programming error.","triggerScenarios":"Thrown at crates/swc_ecma_utils/src/ident.rs:83 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Do not call into_id()/to_id() on UnsafeId; keep UnsafeId confined to the unsafe fast paths that created it","Convert through a safe Ident (via from_ident on a validated ident) if an Id is genuinely required","Audit the call site that reaches into_id and switch it to a safe IdentLike implementation"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5176682b65416c6b5de6b47379ae1588ea3ecb3f","analyzedAt":"2026-08-17T16:16:52.067Z","contentChangedAt":"2026-08-17T16:16:52.067Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}