{"record":{"id":"6532284cf2c12e7a","repo":"oxc-project/oxc","slug":"cannot-create-a-nonemptystack-from-an-empty-iter","errorCode":null,"errorMessage":"Cannot create a `NonEmptyStack` from an empty iterator","messagePattern":"Cannot create a `NonEmptyStack` from an empty iterator","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/oxc_data_structures/src/stack/non_empty.rs","lineNumber":564,"sourceCode":"    /// No allocation occurs, and no data is copied.\n    #[inline]\n    fn from(stack: NonEmptyStack<T>) -> Self {\n        stack.into_vec()\n    }\n}\n\nimpl<T> FromIterator<T> for NonEmptyStack<T> {\n    /// Create a [`NonEmptyStack`] from an iterator.\n    ///\n    /// # Panics\n    /// Panics if the iterator is empty.\n    #[inline] // It mostly just delegates to `Vec::from_iter`\n    fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self {\n        // Collect into a `Vec` first, because `Vec` has specialized implementations of `from_iter`\n        // for various kinds of iterators, which we cannot replicate in stable Rust\n        let vec = Vec::from_iter(iter);\n        Self::try_from(vec)\n            .unwrap_or_else(|_| panic!(\"Cannot create a `NonEmptyStack` from an empty iterator\"))\n    }\n}\n\n// SAFETY: `NonEmptyStack<T>` can be `Send` / `Sync` if `T` is `Send` / `Sync`.\n// It does not use interior mutability, and is essentially the same as `Vec<T>` in this respect,\n// which implements `Send` / `Sync` in the same way.\nunsafe impl<T: Send> Send for NonEmptyStack<T> {}\n// SAFETY: See above.\nunsafe impl<T: Sync> Sync for NonEmptyStack<T> {}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    macro_rules! assert_len_cap_last {\n        ($stack:ident, $len:expr, $capacity:expr, $last:expr) => {\n            assert_eq!($stack.len(), $len);\n            assert_eq!($stack.capacity(), $capacity);","sourceCodeStart":546,"sourceCodeEnd":582,"githubUrl":"https://github.com/oxc-project/oxc/blob/36ec0ef2bae567d1a8413ada2fe795f1af1f2785/crates/oxc_data_structures/src/stack/non_empty.rs#L546-L582","documentation":"Diagnostic from oxlint's vue/require-render-return rule (crates/oxc_linter/src/rules/vue/require_render_return.rs). A `render` function on a Vue component options object must return a value on every code path — Vue invokes it to produce the VNode tree, and a falling-through path yields `undefined`, rendering nothing. The rule runs control-flow analysis (definitely_returns_in_all_codepaths) over the render body.","triggerScenarios":"A `render()` method (or `render: function` / arrow form) on a Vue component options object where some branch lacks a return, e.g. `render(h) { if (this.x) return h('div'); }` — the implicit else path returns undefined. Returns inside callbacks (forEach, map callbacks) do not count as returns of the render function itself.","commonSituations":"Hand-written render functions and JSX components; early returns added during debugging then forgotten; refactors that move the return into a nested callback.","solutions":["Add a fallback `return h('div')` (or another VNode) after the conditionals so every path returns.","Return `null` for intentionally empty states — still a value, and Vue renders a placeholder.","Restructure to a single return: `return this.show ? h('div', this.msg) : h('span')`."],"exampleFix":"// before\nrender() {\n  if (this.show) return h('div', this.msg);\n}\n\n// after\nrender() {\n  if (this.show) return h('div', this.msg);\n  return h('div');\n}","handlingStrategy":"validation","validationCode":"// warn when a render function body has no return statement\nconst fn = source.slice(source.indexOf('render('));\nconst body = fn.slice(0, fn.indexOf('}'));\nif (body && !/\\breturn\\b/.test(body)) {\n  throw new Error('render() must return a VNode on every path');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["End every render function with an unconditional return.","Prefer templates or single-expression h()/JSX arrow bodies.","Cover render branches with snapshot tests — an empty render is caught immediately."],"tags":["vue","oxlint","lint","render","jsx","control-flow"],"backgroundTag":"vue-render-missing-return","analyzedSha":"36ec0ef2bae567d1a8413ada2fe795f1af1f2785","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}