diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-15 16:37:08 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-17 16:30:22 -0600 |
| commit | 45df4d0d9b577fecee798d672695fe24ff57fb1b (patch) | |
| tree | 1b99bf645035b58e0d6db08c7a83521f41f7a75b /vendor/stacker | |
| parent | f94f79608393d4ab127db63cc41668445ef6b243 (diff) | |
feat: migrate from Cedar to SpiceDB authorization system
This is a major architectural change that replaces the Cedar policy-based
authorization system with SpiceDB's relation-based authorization.
Key changes:
- Migrate from Rust to Go implementation
- Replace Cedar policies with SpiceDB schema and relationships
- Switch from envoy `ext_authz` with Cedar to SpiceDB permission checks
- Update build system and dependencies for Go ecosystem
- Maintain Envoy integration for external authorization
This change enables more flexible permission modeling through SpiceDB's
Google Zanzibar inspired relation-based system, supporting complex
hierarchical permissions that were difficult to express in Cedar.
Breaking change: Existing Cedar policies and Rust-based configuration
will no longer work and need to be migrated to SpiceDB schema.
Diffstat (limited to 'vendor/stacker')
| -rw-r--r-- | vendor/stacker/.cargo-checksum.json | 1 | ||||
| -rw-r--r-- | vendor/stacker/Cargo.lock | 123 | ||||
| -rw-r--r-- | vendor/stacker/Cargo.toml | 69 | ||||
| -rw-r--r-- | vendor/stacker/LICENSE-APACHE | 201 | ||||
| -rw-r--r-- | vendor/stacker/LICENSE-MIT | 25 | ||||
| -rw-r--r-- | vendor/stacker/README.md | 44 | ||||
| -rw-r--r-- | vendor/stacker/build.rs | 13 | ||||
| -rw-r--r-- | vendor/stacker/src/alloc_stack_restore_guard.rs | 47 | ||||
| -rw-r--r-- | vendor/stacker/src/arch/asm.h | 5 | ||||
| -rw-r--r-- | vendor/stacker/src/arch/windows.c | 5 | ||||
| -rw-r--r-- | vendor/stacker/src/backends/fallback.rs | 4 | ||||
| -rw-r--r-- | vendor/stacker/src/backends/macos.rs | 6 | ||||
| -rw-r--r-- | vendor/stacker/src/backends/mod.rs | 28 | ||||
| -rw-r--r-- | vendor/stacker/src/backends/openbsd.rs | 9 | ||||
| -rw-r--r-- | vendor/stacker/src/backends/unix.rs | 40 | ||||
| -rw-r--r-- | vendor/stacker/src/backends/windows.rs | 142 | ||||
| -rw-r--r-- | vendor/stacker/src/lib.rs | 181 | ||||
| -rw-r--r-- | vendor/stacker/src/mmap_stack_restore_guard.rs | 105 | ||||
| -rw-r--r-- | vendor/stacker/tests/simple.rs | 28 | ||||
| -rw-r--r-- | vendor/stacker/tests/smoke.rs | 95 |
20 files changed, 0 insertions, 1171 deletions
diff --git a/vendor/stacker/.cargo-checksum.json b/vendor/stacker/.cargo-checksum.json deleted file mode 100644 index a706ba2a..00000000 --- a/vendor/stacker/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"Cargo.lock":"173c0612229ed8202ec68bc97c952948e9f2e9c26f92c541c3c79ec9414fc0fa","Cargo.toml":"8542687e73de565bfba6df183503c77ac80453211cca98779dca9ca01e76b7bd","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"3b4db90523bcff7d1381367418fdbdb3c866d13c95f1c4aa8185f2280ae33abb","build.rs":"8a9274309128a737566386f2534a93c69d2991da19a4543113790bc819448a53","src/alloc_stack_restore_guard.rs":"5bc62493772e407494ad48b9bf316688b7eb1b9c85f1f7a8fc183c80903697b6","src/arch/asm.h":"4c4db945e854e4ce3f0b7ba8da3755613c0e4513a7aab0604bd6a67c0ff2192d","src/arch/windows.c":"e98e08f6b5102480b8fa4dfa7ee13441845202f5ba81c60b13da2800e0a8630c","src/backends/fallback.rs":"9314cb7646b0542bf7bafd576c4aa98d6e1dd0e0e0e3632618165487062f6f18","src/backends/macos.rs":"f6a504461e951c14e1cb7c4dc5153c516a2a62039e1293ad3e66cf38a660f878","src/backends/mod.rs":"09286439a8458121cbba1aefc2893951004de40b1863e0cbcbc3dfc6665f58aa","src/backends/openbsd.rs":"bf5f1f9ff35e8b514aadf430004dc5994a8c36a6ca445d30c02595c287d1bef8","src/backends/unix.rs":"547ed9dd5facb3ea15b77f75ce64c1889dec98c3516fff73bb1c6a49be357d26","src/backends/windows.rs":"5224401ef6a157a1caaee4eda3d8a55f3337d73a31b7b0d36ba25ed1d62b66db","src/lib.rs":"509bc15f5f83a74c2bc674631ead30a0737fcc9689c0ca5b6e619cf9081a3be2","src/mmap_stack_restore_guard.rs":"73c578f5345c12263ba693837b0bfd14f32bba333448f54e3c2bd9b4d7d721f1","tests/simple.rs":"672b92078462d762441c7d50c076bdb9135ccb2d9858314af41c43925d237e55","tests/smoke.rs":"db4fd5b210123d9643aefd703be324d626d4b0f9398d7cae7f30871fba71f65b"},"package":"cddb07e32ddb770749da91081d8d0ac3a16f1a569a18b20348cd371f5dead06b"}
\ No newline at end of file diff --git a/vendor/stacker/Cargo.lock b/vendor/stacker/Cargo.lock deleted file mode 100644 index d3a7dbff..00000000 --- a/vendor/stacker/Cargo.lock +++ /dev/null @@ -1,123 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "cc" -version = "1.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04da6a0d40b948dfc4fa8f5bbf402b0fc1a64a28dbf7d12ffd683550f2c1b63a" -dependencies = [ - "shlex", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "libc" -version = "0.2.172" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" - -[[package]] -name = "psm" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e944464ec8536cd1beb0bbfd96987eb5e3b72f2ecdafdc5c769a37f1fa2ae1f" -dependencies = [ - "cc", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "stacker" -version = "0.1.21" -dependencies = [ - "cc", - "cfg-if", - "libc", - "psm", - "windows-sys", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" diff --git a/vendor/stacker/Cargo.toml b/vendor/stacker/Cargo.toml deleted file mode 100644 index 14caa1a8..00000000 --- a/vendor/stacker/Cargo.toml +++ /dev/null @@ -1,69 +0,0 @@ -# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO -# -# When uploading crates to the registry Cargo will automatically -# "normalize" Cargo.toml files for maximal compatibility -# with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies. -# -# If you are reading this file be aware that the original Cargo.toml -# will likely look very different (and much more reasonable). -# See Cargo.toml.orig for the original contents. - -[package] -edition = "2021" -rust-version = "1.63" -name = "stacker" -version = "0.1.21" -authors = [ - "Alex Crichton <alex@alexcrichton.com>", - "Simonas Kazlauskas <stacker@kazlauskas.me>", -] -build = "build.rs" -autolib = false -autobins = false -autoexamples = false -autotests = false -autobenches = false -description = """ -A stack growth library useful when implementing deeply recursive algorithms that -may accidentally blow the stack. -""" -homepage = "https://github.com/rust-lang/stacker" -documentation = "https://docs.rs/stacker/0.1.20" -readme = "README.md" -license = "MIT OR Apache-2.0" -repository = "https://github.com/rust-lang/stacker" - -[lib] -name = "stacker" -path = "src/lib.rs" -test = false -doctest = false - -[[test]] -name = "simple" -path = "tests/simple.rs" - -[[test]] -name = "smoke" -path = "tests/smoke.rs" - -[dependencies.cfg-if] -version = "1.0.0" - -[dependencies.libc] -version = "0.2.156" - -[dependencies.psm] -version = "0.1.7" - -[build-dependencies.cc] -version = "1.1.22" - -[target."cfg(windows)".dependencies.windows-sys] -version = ">=0.52.0, <0.60.0" -features = [ - "Win32_System_Memory", - "Win32_System_Threading", - "Win32_Foundation", -] diff --git a/vendor/stacker/LICENSE-APACHE b/vendor/stacker/LICENSE-APACHE deleted file mode 100644 index 16fe87b0..00000000 --- a/vendor/stacker/LICENSE-APACHE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/vendor/stacker/LICENSE-MIT b/vendor/stacker/LICENSE-MIT deleted file mode 100644 index 39e0ed66..00000000 --- a/vendor/stacker/LICENSE-MIT +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) 2014 Alex Crichton - -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/vendor/stacker/README.md b/vendor/stacker/README.md deleted file mode 100644 index d280fa17..00000000 --- a/vendor/stacker/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# stacker - -[](https://github.com/rust-lang/stacker/actions) - -[Documentation](https://docs.rs/stacker) - -A stack-growth library for Rust. Enables annotating fixed points in programs -where the stack may want to grow larger. Spills over to the heap if the stack -has hit its limit. - -This library is intended on helping implement recursive algorithms. - -```toml -# Cargo.toml -[dependencies] -stacker = "0.1" -``` - -## Platform Support - -This library currently uses psm for its cross platform capabilities, with a -notable exception of Windows, which uses an implementation based on Fibers. See -the README for psm for the support table. - -On all unsupported platforms this library is a noop. It should compile and run, -but it won't actually grow the stack and code will continue to hit the guard -pages typically in place. - -# License - -This project is licensed under either of - - * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or - https://www.apache.org/licenses/LICENSE-2.0) - * MIT license ([LICENSE-MIT](LICENSE-MIT) or - https://opensource.org/license/mit) - -at your option. - -### Contribution - -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in this project by you, as defined in the Apache-2.0 license, -shall be dual licensed as above, without any additional terms or conditions. diff --git a/vendor/stacker/build.rs b/vendor/stacker/build.rs deleted file mode 100644 index abaefe58..00000000 --- a/vendor/stacker/build.rs +++ /dev/null @@ -1,13 +0,0 @@ -use std::env; - -fn main() { - let target = env::var("TARGET").unwrap(); - let mut cfg = cc::Build::new(); - if target.contains("windows") { - cfg.define("WINDOWS", None); - cfg.file("src/arch/windows.c"); - cfg.include("src/arch").compile("libstacker.a"); - } else { - return; - } -} diff --git a/vendor/stacker/src/alloc_stack_restore_guard.rs b/vendor/stacker/src/alloc_stack_restore_guard.rs deleted file mode 100644 index ef2babb7..00000000 --- a/vendor/stacker/src/alloc_stack_restore_guard.rs +++ /dev/null @@ -1,47 +0,0 @@ -use crate::{get_stack_limit, set_stack_limit}; - -pub struct StackRestoreGuard { - new_stack: *mut u8, - stack_bytes: usize, - old_stack_limit: Option<usize>, -} - -const ALIGNMENT: usize = 16; - -impl StackRestoreGuard { - pub fn new(stack_bytes: usize) -> StackRestoreGuard { - // On these platforms we do not use stack guards. this is very unfortunate, - // but there is not much we can do about it without OS support. - // We simply allocate the requested size from the global allocator with a suitable - // alignment. - let stack_bytes = stack_bytes - .checked_add(ALIGNMENT - 1) - .expect("unreasonably large stack requested") - / ALIGNMENT - * ALIGNMENT; - let layout = std::alloc::Layout::from_size_align(stack_bytes, ALIGNMENT).unwrap(); - let ptr = unsafe { std::alloc::alloc(layout) }; - assert!(!ptr.is_null(), "unable to allocate stack"); - StackRestoreGuard { - new_stack: ptr, - stack_bytes, - old_stack_limit: get_stack_limit(), - } - } - - pub fn stack_area(&self) -> (*mut u8, usize) { - (self.new_stack, self.stack_bytes) - } -} - -impl Drop for StackRestoreGuard { - fn drop(&mut self) { - unsafe { - std::alloc::dealloc( - self.new_stack, - std::alloc::Layout::from_size_align_unchecked(self.stack_bytes, ALIGNMENT), - ); - } - set_stack_limit(self.old_stack_limit); - } -} diff --git a/vendor/stacker/src/arch/asm.h b/vendor/stacker/src/arch/asm.h deleted file mode 100644 index 56c9d289..00000000 --- a/vendor/stacker/src/arch/asm.h +++ /dev/null @@ -1,5 +0,0 @@ -#if defined(APPLE) || (defined(WINDOWS) && defined(X86)) -#define GLOBAL(name) .globl _ ## name; _ ## name -#else -#define GLOBAL(name) .globl name; name -#endif diff --git a/vendor/stacker/src/arch/windows.c b/vendor/stacker/src/arch/windows.c deleted file mode 100644 index 89485a0c..00000000 --- a/vendor/stacker/src/arch/windows.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <windows.h>
-
-PVOID __stacker_get_current_fiber() {
- return GetCurrentFiber();
-}
diff --git a/vendor/stacker/src/backends/fallback.rs b/vendor/stacker/src/backends/fallback.rs deleted file mode 100644 index a812cbc9..00000000 --- a/vendor/stacker/src/backends/fallback.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[inline(always)] -pub unsafe fn guess_os_stack_limit() -> Option<usize> { - None -} diff --git a/vendor/stacker/src/backends/macos.rs b/vendor/stacker/src/backends/macos.rs deleted file mode 100644 index 42b28516..00000000 --- a/vendor/stacker/src/backends/macos.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub unsafe fn guess_os_stack_limit() -> Option<usize> { - Some( - libc::pthread_get_stackaddr_np(libc::pthread_self()) as usize - - libc::pthread_get_stacksize_np(libc::pthread_self()) as usize, - ) -} diff --git a/vendor/stacker/src/backends/mod.rs b/vendor/stacker/src/backends/mod.rs deleted file mode 100644 index 8da895d6..00000000 --- a/vendor/stacker/src/backends/mod.rs +++ /dev/null @@ -1,28 +0,0 @@ -cfg_if! { - if #[cfg(miri)] { - mod fallback; - pub use fallback::guess_os_stack_limit; - } else if #[cfg(windows)] { - pub(crate) mod windows; - pub use windows::guess_os_stack_limit; - } else if #[cfg(any( - target_os = "linux", - target_os = "solaris", - target_os = "netbsd", - target_os = "freebsd", - target_os = "dragonfly", - target_os = "illumos" - ))] { - mod unix; - pub use unix::guess_os_stack_limit; - } else if #[cfg(target_os = "openbsd")] { - mod openbsd; - pub use openbsd::guess_os_stack_limit; - } else if #[cfg(target_os = "macos")] { - mod macos; - pub use macos::guess_os_stack_limit; - } else { - mod fallback; - pub use fallback::guess_os_stack_limit; - } -} diff --git a/vendor/stacker/src/backends/openbsd.rs b/vendor/stacker/src/backends/openbsd.rs deleted file mode 100644 index ee582d84..00000000 --- a/vendor/stacker/src/backends/openbsd.rs +++ /dev/null @@ -1,9 +0,0 @@ -pub unsafe fn guess_os_stack_limit() -> Option<usize> { - let mut stackinfo = std::mem::MaybeUninit::<libc::stack_t>::uninit(); - let res = libc::pthread_stackseg_np(libc::pthread_self(), stackinfo.as_mut_ptr()); - if res != 0 { - return None; - } - let stackinfo = stackinfo.assume_init(); - Some(stackinfo.ss_sp as usize - stackinfo.ss_size) -} diff --git a/vendor/stacker/src/backends/unix.rs b/vendor/stacker/src/backends/unix.rs deleted file mode 100644 index 97ef209f..00000000 --- a/vendor/stacker/src/backends/unix.rs +++ /dev/null @@ -1,40 +0,0 @@ -#[cfg(any(target_os = "freebsd", target_os = "dragonfly", target_os = "illumos"))] -use libc::pthread_attr_get_np as get_attr; -#[cfg(any(target_os = "linux", target_os = "solaris", target_os = "netbsd"))] -use libc::pthread_getattr_np as get_attr; - -pub unsafe fn guess_os_stack_limit() -> Option<usize> { - let mut attr = PthreadAttr::new()?; - (get_attr(libc::pthread_self(), &mut attr.0) == 0).then_some(())?; - let mut stackaddr = std::ptr::null_mut(); - let mut stacksize = 0; - (libc::pthread_attr_getstack(&attr.0, &mut stackaddr, &mut stacksize) == 0).then_some(())?; - Some(stackaddr as usize) -} - -struct PthreadAttr(libc::pthread_attr_t); - -impl Drop for PthreadAttr { - fn drop(&mut self) { - unsafe { - let ret = libc::pthread_attr_destroy(&mut self.0); - if ret != 0 { - let err = std::io::Error::last_os_error(); - panic!( - "pthread_attr_destroy failed with error code {}: {}", - ret, err - ); - } - } - } -} - -impl PthreadAttr { - unsafe fn new() -> Option<Self> { - let mut attr = std::mem::MaybeUninit::<libc::pthread_attr_t>::uninit(); - if libc::pthread_attr_init(attr.as_mut_ptr()) != 0 { - return None; - } - Some(PthreadAttr(attr.assume_init())) - } -} diff --git a/vendor/stacker/src/backends/windows.rs b/vendor/stacker/src/backends/windows.rs deleted file mode 100644 index 69c76133..00000000 --- a/vendor/stacker/src/backends/windows.rs +++ /dev/null @@ -1,142 +0,0 @@ -use libc::c_void; -use std::io; -use std::ptr; -use windows_sys::Win32::Foundation::BOOL; -use windows_sys::Win32::System::Memory::VirtualQuery; -use windows_sys::Win32::System::Threading::{ - ConvertFiberToThread, ConvertThreadToFiber, CreateFiber, DeleteFiber, IsThreadAFiber, - SetThreadStackGuarantee, SwitchToFiber, -}; - -// Make sure the libstacker.a (implemented in C) is linked. -// See https://github.com/rust-lang/rust/issues/65610 -#[link(name = "stacker")] -extern "C" { - fn __stacker_get_current_fiber() -> *mut c_void; -} - -struct FiberInfo<F> { - callback: std::mem::MaybeUninit<F>, - panic: Option<Box<dyn std::any::Any + Send + 'static>>, - parent_fiber: *mut c_void, -} - -unsafe extern "system" fn fiber_proc<F: FnOnce()>(data: *mut c_void) { - // This function is the entry point to our inner fiber, and as argument we get an - // instance of `FiberInfo`. We will set-up the "runtime" for the callback and execute - // it. - let data = &mut *(data as *mut FiberInfo<F>); - let old_stack_limit = crate::get_stack_limit(); - crate::set_stack_limit(guess_os_stack_limit()); - let callback = data.callback.as_ptr(); - data.panic = std::panic::catch_unwind(std::panic::AssertUnwindSafe(callback.read())).err(); - - // Restore to the previous Fiber - crate::set_stack_limit(old_stack_limit); - SwitchToFiber(data.parent_fiber); -} - -pub fn _grow(stack_size: usize, callback: &mut dyn FnMut()) { - // Fibers (or stackful coroutines) is the only official way to create new stacks on the - // same thread on Windows. So in order to extend the stack we create fiber and switch - // to it so we can use it's stack. After running `callback` within our fiber, we switch - // back to the current stack and destroy the fiber and its associated stack. - unsafe { - let was_fiber = IsThreadAFiber() == 1 as BOOL; - let mut data = FiberInfo { - callback: std::mem::MaybeUninit::new(callback), - panic: None, - parent_fiber: { - if was_fiber { - // Get a handle to the current fiber. We need to use a C implementation - // for this as GetCurrentFiber is an header only function. - __stacker_get_current_fiber() - } else { - // Convert the current thread to a fiber, so we are able to switch back - // to the current stack. Threads coverted to fibers still act like - // regular threads, but they have associated fiber data. We later - // convert it back to a regular thread and free the fiber data. - ConvertThreadToFiber(ptr::null_mut()) - } - }, - }; - - if data.parent_fiber.is_null() { - panic!( - "unable to convert thread to fiber: {}", - io::Error::last_os_error() - ); - } - - let fiber = CreateFiber( - stack_size as usize, - Some(fiber_proc::<&mut dyn FnMut()>), - &mut data as *mut FiberInfo<&mut dyn FnMut()> as *mut _, - ); - if fiber.is_null() { - panic!("unable to allocate fiber: {}", io::Error::last_os_error()); - } - - // Switch to the fiber we created. This changes stacks and starts executing - // fiber_proc on it. fiber_proc will run `callback` and then switch back to run the - // next statement. - SwitchToFiber(fiber); - DeleteFiber(fiber); - - // Clean-up. - if !was_fiber && ConvertFiberToThread() == 0 { - // FIXME: Perhaps should not panic here? - panic!( - "unable to convert back to thread: {}", - io::Error::last_os_error() - ); - } - - if let Some(p) = data.panic { - std::panic::resume_unwind(p); - } - } -} - -#[inline(always)] -fn get_thread_stack_guarantee() -> Option<usize> { - let min_guarantee = if cfg!(target_pointer_width = "32") { - 0x1000 - } else { - 0x2000 - }; - let mut stack_guarantee = 0; - unsafe { - // Read the current thread stack guarantee - // This is the stack reserved for stack overflow - // exception handling. - // This doesn't return the true value so we need - // some further logic to calculate the real stack - // guarantee. This logic is what is used on x86-32 and - // x86-64 Windows 10. Other versions and platforms may differ - let ret = SetThreadStackGuarantee(&mut stack_guarantee); - if ret == 0 { - return None; - } - }; - Some(std::cmp::max(stack_guarantee, min_guarantee) as usize + 0x1000) -} - -#[inline(always)] -pub unsafe fn guess_os_stack_limit() -> Option<usize> { - // Query the allocation which contains our stack pointer in order - // to discover the size of the stack - // - // FIXME: we could read stack base from the TIB, specifically the 3rd element of it. - type QueryT = windows_sys::Win32::System::Memory::MEMORY_BASIC_INFORMATION; - let mut mi = std::mem::MaybeUninit::<QueryT>::uninit(); - let res = VirtualQuery( - psm::stack_pointer() as *const _, - mi.as_mut_ptr(), - std::mem::size_of::<QueryT>() as usize, - ); - if res == 0 { - return None; - } - Some(mi.assume_init().AllocationBase as usize + get_thread_stack_guarantee()? + 0x1000) -} diff --git a/vendor/stacker/src/lib.rs b/vendor/stacker/src/lib.rs deleted file mode 100644 index ee5803c3..00000000 --- a/vendor/stacker/src/lib.rs +++ /dev/null @@ -1,181 +0,0 @@ -//! A library to help grow the stack when it runs out of space. -//! -//! This is an implementation of manually instrumented segmented stacks where points in a program's -//! control flow are annotated with "maybe grow the stack here". Each point of annotation indicates -//! how far away from the end of the stack it's allowed to be, plus the amount of stack to allocate -//! if it does reach the end. -//! -//! Once a program has reached the end of its stack, a temporary stack on the heap is allocated and -//! is switched to for the duration of a closure. -//! -//! For a set of lower-level primitives, consider the `psm` crate. -//! -//! # Examples -//! -//! ``` -//! // Grow the stack if we are within the "red zone" of 32K, and if we allocate -//! // a new stack allocate 1MB of stack space. -//! // -//! // If we're already in bounds, just run the provided closure on current stack. -//! stacker::maybe_grow(32 * 1024, 1024 * 1024, || { -//! // guaranteed to have at least 32K of stack -//! }); -//! ``` - -#![allow(improper_ctypes)] - -#[macro_use] -extern crate cfg_if; -extern crate libc; -#[cfg(windows)] -extern crate windows_sys; -#[macro_use] -extern crate psm; - -mod backends; - -use std::cell::Cell; - -/// Grows the call stack if necessary. -/// -/// This function is intended to be called at manually instrumented points in a program where -/// recursion is known to happen quite a bit. This function will check to see if we're within -/// `red_zone` bytes of the end of the stack, and if so it will allocate a new stack of at least -/// `stack_size` bytes. -/// -/// The closure `f` is guaranteed to run on a stack with at least `red_zone` bytes, and it will be -/// run on the current stack if there's space available. -#[inline(always)] -pub fn maybe_grow<R, F: FnOnce() -> R>(red_zone: usize, stack_size: usize, callback: F) -> R { - // if we can't guess the remaining stack (unsupported on some platforms) we immediately grow - // the stack and then cache the new stack size (which we do know now because we allocated it. - let enough_space = match remaining_stack() { - Some(remaining) => remaining >= red_zone, - None => false, - }; - if enough_space { - callback() - } else { - grow(stack_size, callback) - } -} - -/// Always creates a new stack for the passed closure to run on. -/// The closure will still be on the same thread as the caller of `grow`. -/// This will allocate a new stack with at least `stack_size` bytes. -pub fn grow<R, F: FnOnce() -> R>(stack_size: usize, callback: F) -> R { - // To avoid monomorphizing `_grow()` and everything it calls, - // we convert the generic callback to a dynamic one. - let mut opt_callback = Some(callback); - let mut ret = None; - let ret_ref = &mut ret; - - // This wrapper around `callback` achieves two things: - // * It converts the `impl FnOnce` to a `dyn FnMut`. - // `dyn` because we want it to not be generic, and - // `FnMut` because we can't pass a `dyn FnOnce` around without boxing it. - // * It eliminates the generic return value, by writing it to the stack of this function. - // Otherwise the closure would have to return an unsized value, which isn't possible. - let dyn_callback: &mut dyn FnMut() = &mut || { - let taken_callback = opt_callback.take().unwrap(); - *ret_ref = Some(taken_callback()); - }; - - _grow(stack_size, dyn_callback); - ret.unwrap() -} - -/// Queries the amount of remaining stack as interpreted by this library. -/// -/// This function will return the amount of stack space left which will be used -/// to determine whether a stack switch should be made or not. -pub fn remaining_stack() -> Option<usize> { - let current_ptr = current_stack_ptr(); - get_stack_limit().map(|limit| current_ptr.saturating_sub(limit)) -} - -psm_stack_information!( - yes { - fn current_stack_ptr() -> usize { - psm::stack_pointer() as usize - } - } - no { - #[inline(always)] - fn current_stack_ptr() -> usize { - unsafe { - let mut x = std::mem::MaybeUninit::<u8>::uninit(); - // Unlikely to be ever exercised. As a fallback we execute a volatile read to a - // local (to hopefully defeat the optimisations that would make this local a static - // global) and take its address. This way we get a very approximate address of the - // current frame. - x.as_mut_ptr().write_volatile(42); - x.as_ptr() as usize - } - } - } -); - -thread_local! { - static STACK_LIMIT: Cell<Option<usize>> = Cell::new(unsafe { - backends::guess_os_stack_limit() - }) -} - -#[inline(always)] -fn get_stack_limit() -> Option<usize> { - STACK_LIMIT.with(|s| s.get()) -} - -#[inline(always)] -#[allow(unused)] -fn set_stack_limit(l: Option<usize>) { - STACK_LIMIT.with(|s| s.set(l)) -} - -psm_stack_manipulation! { - yes { - #[cfg(not(any(target_arch = "wasm32",target_os = "hermit")))] - #[path = "mmap_stack_restore_guard.rs"] - mod stack_restore_guard; - - #[cfg(any(target_arch = "wasm32",target_os = "hermit"))] - #[path = "alloc_stack_restore_guard.rs"] - mod stack_restore_guard; - - use stack_restore_guard::StackRestoreGuard; - - fn _grow(requested_stack_size: usize, callback: &mut dyn FnMut()) { - // Other than that this code has no meaningful gotchas. - unsafe { - // We use a guard pattern to ensure we deallocate the allocated stack when we leave - // this function and also try to uphold various safety invariants required by `psm` - // (such as not unwinding from the callback we pass to it). - // `StackRestoreGuard` allocates a memory area with suitable size and alignment. - // It also sets up stack guards if supported on target. - let guard = StackRestoreGuard::new(requested_stack_size); - let (stack_base, allocated_stack_size) = guard.stack_area(); - debug_assert!(allocated_stack_size >= requested_stack_size); - set_stack_limit(Some(stack_base as usize)); - // TODO should we not pass `allocated_stack_size` here? - let panic = psm::on_stack(stack_base, requested_stack_size, move || { - std::panic::catch_unwind(std::panic::AssertUnwindSafe(callback)).err() - }); - drop(guard); - if let Some(p) = panic { - std::panic::resume_unwind(p); - } - } - } - } - - no { - #[cfg(not(windows))] - fn _grow(stack_size: usize, callback: &mut dyn FnMut()) { - let _ = stack_size; - callback(); - } - #[cfg(windows)] - use backends::windows::_grow; - } -} diff --git a/vendor/stacker/src/mmap_stack_restore_guard.rs b/vendor/stacker/src/mmap_stack_restore_guard.rs deleted file mode 100644 index 1e021c2d..00000000 --- a/vendor/stacker/src/mmap_stack_restore_guard.rs +++ /dev/null @@ -1,105 +0,0 @@ -use crate::{get_stack_limit, set_stack_limit}; - -pub struct StackRestoreGuard { - mapping: *mut u8, - size_with_guard: usize, - page_size: usize, - old_stack_limit: Option<usize>, -} - -impl StackRestoreGuard { - pub fn new(requested_size: usize) -> StackRestoreGuard { - // For maximum portability we want to produce a stack that is aligned to a page and has - // a size that’s a multiple of page size. It is natural to use mmap to allocate - // these pages. Furthermore, we want to allocate two extras pages for the stack guard. - // To achieve that we do our calculations in number of pages and convert to bytes last. - let page_size = page_size(); - let requested_pages = requested_size - .checked_add(page_size - 1) - .expect("unreasonably large stack requested") - / page_size; - let page_count_with_guard = std::cmp::max(1, requested_pages) + 2; - let size_with_guard = page_count_with_guard - .checked_mul(page_size) - .expect("unreasonably large stack requested"); - - unsafe { - let new_stack = libc::mmap( - std::ptr::null_mut(), - size_with_guard, - libc::PROT_NONE, - libc::MAP_PRIVATE | libc::MAP_ANON, - -1, // Some implementations assert fd = -1 if MAP_ANON is specified - 0, - ); - assert_ne!( - new_stack, - libc::MAP_FAILED, - "mmap failed to allocate stack: {}", - std::io::Error::last_os_error() - ); - let guard = StackRestoreGuard { - mapping: new_stack as *mut u8, - page_size, - size_with_guard, - old_stack_limit: get_stack_limit(), - }; - // We leave two guard pages without read/write access in our allocation. - // There is one guard page below the stack and another above it. - let above_guard_page = new_stack.add(page_size); - #[cfg(not(target_os = "openbsd"))] - let result = libc::mprotect( - above_guard_page, - size_with_guard - 2 * page_size, - libc::PROT_READ | libc::PROT_WRITE, - ); - #[cfg(target_os = "openbsd")] - let result = if libc::mmap( - above_guard_page, - size_with_guard - 2 * page_size, - libc::PROT_READ | libc::PROT_WRITE, - libc::MAP_FIXED | libc::MAP_PRIVATE | libc::MAP_ANON | libc::MAP_STACK, - -1, - 0, - ) == above_guard_page - { - 0 - } else { - -1 - }; - assert_ne!( - result, - -1, - "mprotect/mmap failed: {}", - std::io::Error::last_os_error() - ); - guard - } - } - - // TODO this should return a *mut [u8], but pointer slices only got proper support with Rust 1.79. - pub fn stack_area(&self) -> (*mut u8, usize) { - unsafe { - ( - self.mapping.add(self.page_size), - self.size_with_guard - self.page_size, - ) - } - } -} - -impl Drop for StackRestoreGuard { - fn drop(&mut self) { - unsafe { - // FIXME: check the error code and decide what to do with it. - // Perhaps a debug_assertion? - libc::munmap(self.mapping as *mut std::ffi::c_void, self.size_with_guard); - } - set_stack_limit(self.old_stack_limit); - } -} - -fn page_size() -> usize { - // FIXME: consider caching the page size. - unsafe { libc::sysconf(libc::_SC_PAGE_SIZE) as usize } -} diff --git a/vendor/stacker/tests/simple.rs b/vendor/stacker/tests/simple.rs deleted file mode 100644 index bb10937a..00000000 --- a/vendor/stacker/tests/simple.rs +++ /dev/null @@ -1,28 +0,0 @@ -extern crate stacker; - -const RED_ZONE: usize = 100 * 1024; // 100k -const STACK_PER_RECURSION: usize = 1 * 1024 * 1024; // 1MB - -pub fn ensure_sufficient_stack<R, F: FnOnce() -> R + std::panic::UnwindSafe>(f: F) -> R { - stacker::maybe_grow(RED_ZONE, STACK_PER_RECURSION, f) -} - -#[inline(never)] -fn recurse(n: usize) { - let x = [42u8; 50000]; - if n != 0 { - ensure_sufficient_stack(|| recurse(n - 1)); - } - #[allow(dropping_copy_types)] - drop(x); -} - -#[test] -fn foo() { - let limit = if cfg!(target_arch = "wasm32") { - 2000 - } else { - 10000 - }; - recurse(limit); -} diff --git a/vendor/stacker/tests/smoke.rs b/vendor/stacker/tests/smoke.rs deleted file mode 100644 index 2ec0de24..00000000 --- a/vendor/stacker/tests/smoke.rs +++ /dev/null @@ -1,95 +0,0 @@ -extern crate stacker; - -use std::sync::mpsc; -use std::thread; - -#[inline(never)] -fn __stacker_black_box(_: *const u8) {} - -#[test] -fn deep() { - fn foo(n: usize, s: &mut [u8]) { - __stacker_black_box(s.as_ptr()); - if n > 0 { - stacker::maybe_grow(64 * 1024, 1024 * 1024, || { - let mut s = [0u8; 1024]; - foo(n - 1, &mut s); - __stacker_black_box(s.as_ptr()); - }) - } else { - println!("bottom"); - } - } - - let limit = if cfg!(target_arch = "wasm32") { - 2000 - } else { - 256 * 1024 - }; - foo(limit, &mut []); -} - -#[test] -#[cfg_attr(target_arch = "wasm32", ignore)] -fn panic() { - fn foo(n: usize, s: &mut [u8]) { - __stacker_black_box(s.as_ptr()); - if n > 0 { - stacker::maybe_grow(64 * 1024, 1024 * 1024, || { - let mut s = [0u8; 1024]; - foo(n - 1, &mut s); - __stacker_black_box(s.as_ptr()); - }) - } else { - panic!("bottom"); - } - } - - let (tx, rx) = mpsc::channel::<()>(); - thread::spawn(move || { - foo(64 * 1024, &mut []); - drop(tx); - }) - .join() - .unwrap_err(); - - assert!(rx.recv().is_err()); -} - -fn recursive<F: FnOnce()>(n: usize, f: F) -> usize { - if n > 0 { - stacker::grow(64 * 1024, || recursive(n - 1, f) + 1) - } else { - f(); - 0 - } -} - -#[test] -#[cfg_attr(target_arch = "wasm32", ignore)] -fn catch_panic() { - let panic_result = std::panic::catch_unwind(|| { - recursive(100, || panic!()); - }); - assert!(panic_result.is_err()); -} - -#[test] -#[cfg_attr(target_arch = "wasm32", ignore)] -fn catch_panic_inside() { - stacker::grow(64 * 1024, || { - let panic_result = std::panic::catch_unwind(|| { - recursive(100, || panic!()); - }); - assert!(panic_result.is_err()); - }); -} - -#[test] -#[cfg_attr(target_arch = "wasm32", ignore)] -fn catch_panic_leaf() { - stacker::grow(64 * 1024, || { - let panic_result = std::panic::catch_unwind(|| panic!()); - assert!(panic_result.is_err()); - }); -} |
