{"record":{"id":"38f7d31b47083136","repo":"oxc-project/oxc","slug":"capacity-overflow","errorCode":null,"errorMessage":"capacity overflow","messagePattern":"capacity overflow","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/oxc_allocator/src/vec2/raw_vec.rs","lineNumber":858,"sourceCode":"#[inline]\nfn alloc_guard(alloc_size: usize) -> Result<(), AllocError> {\n    if size_of::<usize>() < 8 {\n        if alloc_size > isize::MAX as usize {\n            return Err(AllocError::CapacityOverflow);\n        }\n    } else if alloc_size > u32::MAX as usize {\n        return Err(AllocError::CapacityOverflow);\n    }\n    Ok(())\n}\n\n// One central function responsible for reporting capacity overflows. This'll\n// ensure that the code generation related to these panics is minimal as there's\n// only one location which panics rather than a bunch throughout the module.\n#[cold]\n#[inline(never)]\nfn capacity_overflow() -> ! {\n    panic!(\"capacity overflow\")\n}\n\n/// Handle collection allocation errors\n///\n// Causing a collection alloc error is rare case, so marked as `#[cold]` and `#[inline(never)]`\n// to make the call site function as small as possible, so it can be inlined.\n#[inline(never)]\n#[cold]\nfn handle_error(error: AllocError) -> ! {\n    match error {\n        AllocError::CapacityOverflow => capacity_overflow(),\n        // TODO: call `handle_alloc_error` instead of `panic!` once the AllocErr stored a Layout,\n        AllocError::AllocErr => panic!(\"encountered allocation error\"),\n    }\n}\n\n#[cfg(test)]\nmod tests {","sourceCodeStart":840,"sourceCodeEnd":876,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_allocator/src/vec2/raw_vec.rs#L840-L876","documentation":"Diagnostic from oxlint's vue/require-slots-as-functions rule (crates/oxc_linter/src/rules/vue/require_slots_as_functions.rs). In Vue 3 each entry of `this.$slots` is a function returning VNodes (in Vue 2 it was a VNode or array). Using a slot as a plain property — rendering or passing `this.$slots.default` without calling it — breaks under Vue 3. The rule flags member reads on `$slots` (via `this`-object analysis in component options) that are not invoked as functions.","triggerScenarios":"Inside a Vue component options object (methods, computed, render): `this.$slots.default` used as a value, e.g. `h('div', this.$slots.default)` or `renderIt(this.$slots.default)` without a call. The correct form is `this.$slots.default?.()`.","commonSituations":"Vue 2 to Vue 3 migrations where slots were arrays/vnodes; render functions and functional components reading slots; library code that supported both Vue versions.","solutions":["Invoke the slot: `this.$slots.default?.()`.","When only testing presence, `!!this.$slots.default` is fine, but rendering must call it.","In setup-style code use `const slots = useSlots(); slots.default?.()` for the same access."],"exampleFix":"// before\nrender() { return h('div', this.$slots.default); }\n\n// after\nrender() { return h('div', this.$slots.default?.()); }","handlingStrategy":"validation","validationCode":"// warn on $slots member reads that are not immediately called\nconst re = /\\$slots\\.[A-Za-z_$][\\w$]*(\\?)?\\s*(?!\\()/g;\nfor (const m of source.matchAll(re)) {\n  console.warn(`call the slot function: ${m[0]}()`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat every $slots member as a function in Vue 3 code.","Use useSlots() and the optional-call form `slots.default?.()`.","Enable the vue3-migration ruleset when upgrading from Vue 2."],"tags":["vue","oxlint","lint","slots","vue3-migration","render"],"backgroundTag":"vue-slots-function-usage","analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}