{"id":15994689,"url":"https://github.com/taiki-e/negative-impl","last_synced_at":"2025-10-06T18:35:05.736Z","repository":{"id":44606224,"uuid":"304655715","full_name":"taiki-e/negative-impl","owner":"taiki-e","description":"Negative trait implementations on stable Rust.","archived":false,"fork":false,"pushed_at":"2024-04-24T16:09:02.000Z","size":178,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-01T23:58:17.248Z","etag":null,"topics":["no-std","proc-macro","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/negative-impl","language":"Shell","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},"funding":{"github":"taiki-e"}},"created_at":"2020-10-16T14:46:02.000Z","updated_at":"2024-06-01T08:30:53.697Z","dependencies_parsed_at":"2023-02-15T10:31:06.393Z","dependency_job_id":"971f46ed-04c8-4bdb-9355-4ef09d1e6753","html_url":"https://github.com/taiki-e/negative-impl","commit_stats":{"total_commits":107,"total_committers":1,"mean_commits":107.0,"dds":0.0,"last_synced_commit":"ac2121c84fe5db37c8fc45f9cd3c554415095aac"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fnegative-impl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fnegative-impl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fnegative-impl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fnegative-impl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taiki-e","download_url":"https://codeload.github.com/taiki-e/negative-impl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243806045,"owners_count":20350775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["no-std","proc-macro","rust"],"created_at":"2024-10-08T07:09:50.502Z","updated_at":"2025-10-06T18:35:05.730Z","avatar_url":"https://github.com/taiki-e.png","language":"Shell","readme":"# negative-impl\n\n[![crates.io](https://img.shields.io/crates/v/negative-impl?style=flat-square\u0026logo=rust)](https://crates.io/crates/negative-impl)\n[![docs.rs](https://img.shields.io/badge/docs.rs-negative--impl-blue?style=flat-square\u0026logo=docs.rs)](https://docs.rs/negative-impl)\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.61-blue?style=flat-square\u0026logo=rust)](https://www.rust-lang.org)\n[![github actions](https://img.shields.io/github/actions/workflow/status/taiki-e/negative-impl/ci.yml?branch=main\u0026style=flat-square\u0026logo=github)](https://github.com/taiki-e/negative-impl/actions)\n\n\u003c!-- tidy:sync-markdown-to-rustdoc:start:src/lib.rs --\u003e\n\nNegative trait implementations on stable Rust.\n\nThis crate emulates the [unstable `negative_impls` feature](https://doc.rust-lang.org/nightly/unstable-book/language-features/negative-impls.html)\nby [generating a trait implementation with a condition that will never be true](https://github.com/taiki-e/negative-impl/issues/6#issuecomment-1669714453).\n\n## Usage\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nnegative-impl = \"0.1\"\n```\n\n## Examples\n\n```rust\nuse negative_impl::negative_impl;\n\npub struct Type {}\n\n#[negative_impl]\nimpl !Send for Type {}\n#[negative_impl]\nimpl !Sync for Type {}\n```\n\n## Supported traits\n\nCurrently this crate only supports [auto traits](https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits).\n\n- [`Send`](https://doc.rust-lang.org/std/marker/trait.Send.html)\n- [`Sync`](https://doc.rust-lang.org/std/marker/trait.Sync.html)\n- [`Unpin`](https://doc.rust-lang.org/std/marker/trait.Unpin.html)\n- [`UnwindSafe`](https://doc.rust-lang.org/std/panic/trait.UnwindSafe.html)\n- [`RefUnwindSafe`](https://doc.rust-lang.org/std/panic/trait.RefUnwindSafe.html)\n\n## Limitations\n\n### Conflicting implementations\n\nThe following code cannot compile due to `impl\u003cT: Send\u003e Trait for T` and\n`impl Trait for Type` conflict.\n\n\u003c!-- tidy:sync-markdown-to-rustdoc:code-block:compile_fail,E0119 --\u003e\n```rust\nuse negative_impl::negative_impl;\n\npub struct Type {}\n\n#[negative_impl]\nimpl !Send for Type {}\n\ntrait Trait {}\n\nimpl\u003cT: Send\u003e Trait for T {}\nimpl Trait for Type {}\n```\n\n```text\nerror[E0119]: conflicting implementations of trait `Trait` for type `Type`:\n  --\u003e src/lib.rs:60:1\n   |\n14 | impl\u003cT: Send\u003e Trait for T {}\n   | ------------------------- first implementation here\n15 | impl Trait for Type {}\n   | ^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Type`\n```\n\nThe above code can be compiled using the unstable `negative_impls` feature.\n\n```rust\n#![feature(negative_impls)]\n\npub struct Type {}\n\nimpl !Send for Type {}\n\ntrait Trait {}\n\nimpl\u003cT: Send\u003e Trait for T {}\nimpl Trait for Type {}\n```\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","funding_links":["https://github.com/sponsors/taiki-e"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaiki-e%2Fnegative-impl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaiki-e%2Fnegative-impl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaiki-e%2Fnegative-impl/lists"}