{"id":15994687,"url":"https://github.com/taiki-e/assert-unmoved","last_synced_at":"2026-03-17T18:36:28.553Z","repository":{"id":45773912,"uuid":"304660786","full_name":"taiki-e/assert-unmoved","owner":"taiki-e","description":"A type that asserts that the underlying type is not moved after being pinned and mutably accessed.","archived":false,"fork":false,"pushed_at":"2026-02-06T17:17:38.000Z","size":245,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-23T18:50:44.987Z","etag":null,"topics":["rust","testing"],"latest_commit_sha":null,"homepage":"https://docs.rs/assert-unmoved","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/taiki-e.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"taiki-e"}},"created_at":"2020-10-16T15:05:29.000Z","updated_at":"2026-02-06T17:17:41.000Z","dependencies_parsed_at":"2023-10-18T21:30:41.169Z","dependency_job_id":"cd59c432-5929-4c68-acfc-e8b2f781f39e","html_url":"https://github.com/taiki-e/assert-unmoved","commit_stats":{"total_commits":186,"total_committers":1,"mean_commits":186.0,"dds":0.0,"last_synced_commit":"68644c272186c0a2fa5970fa3300f5cb1d567645"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/taiki-e/assert-unmoved","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fassert-unmoved","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fassert-unmoved/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fassert-unmoved/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fassert-unmoved/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taiki-e","download_url":"https://codeload.github.com/taiki-e/assert-unmoved/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fassert-unmoved/sbom","scorecard":{"id":865826,"data":{"date":"2025-08-11","repo":{"name":"github.com/taiki-e/assert-unmoved","commit":"532d379a6bd0c6bc8d91f9deb928db83c366fa64"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.6,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":1,"reason":"2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":10,"reason":"GitHub workflow tokens follow principle of least privilege","details":["Info: jobLevel 'contents' permission set to 'read': .github/workflows/ci.yml:54","Info: jobLevel 'repository-projects' permission set to 'read': .github/workflows/ci.yml:56","Warn: jobLevel 'contents' permission set to 'write': .github/workflows/release.yml:20","Info: topLevel 'contents' permission set to 'read': .github/workflows/ci.yml:4","Info: topLevel 'contents' permission set to 'read': .github/workflows/release.yml:4"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/taiki-e/assert-unmoved/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/taiki-e/assert-unmoved/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/taiki-e/assert-unmoved/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:52: update your workflow using https://app.stepsecurity.io/secureworkflow/taiki-e/assert-unmoved/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/taiki-e/assert-unmoved/release.yml/main?enable=pin","Info:   0 out of   5 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE-APACHE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE-APACHE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: github.com/taiki-e/.github/SECURITY.md:1","Info: Found linked content: github.com/taiki-e/.github/SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/taiki-e/.github/SECURITY.md:1","Info: Found text in security policy: github.com/taiki-e/.github/SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-24T02:40:33.156Z","repository_id":45773912,"created_at":"2025-08-24T02:40:33.156Z","updated_at":"2025-08-24T02:40:33.156Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30628418,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T17:32:55.572Z","status":"ssl_error","status_checked_at":"2026-03-17T17:32:38.732Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rust","testing"],"created_at":"2024-10-08T07:09:49.535Z","updated_at":"2026-03-17T18:36:28.532Z","avatar_url":"https://github.com/taiki-e.png","language":"Rust","funding_links":["https://github.com/sponsors/taiki-e"],"categories":[],"sub_categories":[],"readme":"# assert-unmoved\n\n[![crates.io](https://img.shields.io/crates/v/assert-unmoved?style=flat-square\u0026logo=rust)](https://crates.io/crates/assert-unmoved)\n[![docs.rs](https://img.shields.io/badge/docs.rs-assert--unmoved-blue?style=flat-square\u0026logo=docs.rs)](https://docs.rs/assert-unmoved)\n[![license](https://img.shields.io/badge/license-Apache--2.0_OR_MIT-blue?style=flat-square)](#license)\n[![msrv](https://img.shields.io/badge/msrv-1.46-blue?style=flat-square\u0026logo=rust)](https://www.rust-lang.org)\n[![github actions](https://img.shields.io/github/actions/workflow/status/taiki-e/assert-unmoved/ci.yml?branch=main\u0026style=flat-square\u0026logo=github)](https://github.com/taiki-e/assert-unmoved/actions)\n\n\u003c!-- tidy:sync-markdown-to-rustdoc:start:src/lib.rs --\u003e\n\nA type that asserts that the underlying type is not moved after being\n[pinned][pin] and mutably accessed.\n\nThis is a rewrite of [futures-test]'s `AssertUnmoved` to allow use in more\nuse cases. This also supports traits other than [futures][futures03].\n\nMany of the changes made in this project are also reflected upstream:\n[rust-lang/futures-rs#2148], [rust-lang/futures-rs#2208]\n\n## Usage\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nassert-unmoved = \"0.1\"\n```\n\n## Examples\n\nAn example of detecting incorrect [`Pin::new_unchecked`] use (**should panic**):\n\n\u003c!-- tidy:sync-markdown-to-rustdoc:code-block:should_panic --\u003e\n```rust\nuse std::pin::Pin;\n\nuse assert_unmoved::AssertUnmoved;\nuse futures::{\n    future::{self, Future},\n    task::{noop_waker, Context},\n};\n\nlet waker = noop_waker();\nlet mut cx = Context::from_waker(\u0026waker);\n\n// First we allocate the future on the stack and poll it.\nlet mut future = AssertUnmoved::new(future::pending::\u003c()\u003e());\nlet pinned_future = unsafe { Pin::new_unchecked(\u0026mut future) };\nassert!(pinned_future.poll(\u0026mut cx).is_pending());\n\n// Next we move it back to the heap and poll it again. This second call\n// should panic (as the future is moved).\nlet mut boxed_future = Box::new(future);\nlet pinned_boxed_future = unsafe { Pin::new_unchecked(\u0026mut *boxed_future) };\nlet _ = pinned_boxed_future.poll(\u0026mut cx).is_pending();\n```\n\nAn example of detecting incorrect [`StreamExt::next`] implementation (**should panic**):\n\n\u003c!-- tidy:sync-markdown-to-rustdoc:code-block:should_panic --\u003e\n```rust\nuse std::pin::Pin;\n\nuse assert_unmoved::AssertUnmoved;\nuse futures::{\n    future::Future,\n    stream::{self, Stream},\n    task::{noop_waker, Context, Poll},\n};\n\nstruct Next\u003c'a, S: Stream\u003e(\u0026'a mut S);\n\nimpl\u003cS: Stream\u003e Future for Next\u003c'_, S\u003e {\n    type Output = Option\u003cS::Item\u003e;\n\n    fn poll(self: Pin\u003c\u0026mut Self\u003e, cx: \u0026mut Context\u003c'_\u003e) -\u003e Poll\u003cSelf::Output\u003e {\n        // This is `Pin\u003c\u0026mut Type\u003e` to `Pin\u003cField\u003e` projection and is unsound\n        // if `S` is not `Unpin` (you can move `S` after `Next` dropped).\n        //\n        // The correct projection is `Pin\u003c\u0026mut Type\u003e` to `Pin\u003c\u0026mut Field\u003e`.\n        // In `Next`, it is `Pin\u003c\u0026mut Next\u003c'_, S\u003e\u003e` to `Pin\u003c\u0026mut \u0026mut S\u003e`,\n        // and it needs to add `S: Unpin` bounds to convert `Pin\u003c\u0026mut \u0026mut S\u003e`\n        // to `Pin\u003c\u0026mut S\u003e`.\n        let stream: Pin\u003c\u0026mut S\u003e = unsafe { self.map_unchecked_mut(|f| f.0) };\n        stream.poll_next(cx)\n    }\n}\n\nlet waker = noop_waker();\nlet mut cx = Context::from_waker(\u0026waker);\n\nlet mut stream = AssertUnmoved::new(stream::pending::\u003c()\u003e());\n\n{\n    let next = Next(\u0026mut stream);\n    let mut pinned_next = Box::pin(next);\n    assert!(pinned_next.as_mut().poll(\u0026mut cx).is_pending());\n}\n\n// Move stream to the heap.\nlet mut boxed_stream = Box::pin(stream);\n\nlet next = Next(\u0026mut boxed_stream);\nlet mut pinned_next = Box::pin(next);\n// This should panic (as the future is moved).\nlet _ = pinned_next.as_mut().poll(\u0026mut cx).is_pending();\n```\n\n## Optional features\n\n- **`futures03`** — Implements [futures v0.3][futures03] traits for assert-unmoved types.\n- **`tokio1`** — Implements [tokio v1][tokio1] traits for assert-unmoved types.\n- **`tokio03`** — Implements [tokio v0.3][tokio03] traits for assert-unmoved types.\n- **`tokio02`** — Implements [tokio v0.2][tokio02] traits for assert-unmoved types.\n\nNote: The MSRV when these features are enabled depends on the MSRV of these crates.\n\n[`Pin::new_unchecked`]: https://doc.rust-lang.org/std/pin/struct.Pin.html#method.new_unchecked\n[`StreamExt::next`]: https://docs.rs/futures/latest/futures/stream/trait.StreamExt.html#method.next\n[futures-test]: https://docs.rs/futures-test\n[futures03]: https://docs.rs/futures/0.3\n[pin]: https://doc.rust-lang.org/std/pin/index.html\n[rust-lang/futures-rs#2148]: https://github.com/rust-lang/futures-rs/pull/2148\n[rust-lang/futures-rs#2208]: https://github.com/rust-lang/futures-rs/pull/2208\n[tokio02]: https://docs.rs/tokio/0.2\n[tokio03]: https://docs.rs/tokio/0.3\n[tokio1]: https://docs.rs/tokio/1\n\n\u003c!-- tidy:sync-markdown-to-rustdoc:end --\u003e\n\n## License\n\nLicensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or\n[MIT license](LICENSE-MIT) at your option.\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaiki-e%2Fassert-unmoved","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaiki-e%2Fassert-unmoved","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaiki-e%2Fassert-unmoved/lists"}