{"id":13595303,"url":"https://github.com/tokio-rs/loom","last_synced_at":"2025-05-14T21:02:23.017Z","repository":{"id":33974257,"uuid":"161875917","full_name":"tokio-rs/loom","owner":"tokio-rs","description":"Concurrency permutation testing tool for Rust.","archived":false,"fork":false,"pushed_at":"2025-04-17T13:48:28.000Z","size":526,"stargazers_count":2331,"open_issues_count":98,"forks_count":120,"subscribers_count":34,"default_branch":"master","last_synced_at":"2025-05-07T20:35:19.765Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tokio-rs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2018-12-15T06:11:47.000Z","updated_at":"2025-05-07T14:53:24.000Z","dependencies_parsed_at":"2024-01-17T16:57:16.983Z","dependency_job_id":"672c83b0-e649-4953-b9f1-df985308513b","html_url":"https://github.com/tokio-rs/loom","commit_stats":{"total_commits":225,"total_committers":54,"mean_commits":4.166666666666667,"dds":0.5866666666666667,"last_synced_commit":"31dfebdf5b6e6749108b229e7d506c5da6ba2153"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokio-rs%2Floom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokio-rs%2Floom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokio-rs%2Floom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokio-rs%2Floom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tokio-rs","download_url":"https://codeload.github.com/tokio-rs/loom/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253729089,"owners_count":21954554,"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":[],"created_at":"2024-08-01T16:01:47.341Z","updated_at":"2025-05-14T21:02:22.896Z","avatar_url":"https://github.com/tokio-rs.png","language":"Rust","funding_links":[],"categories":["Projects","Rust","Testing","Programming Languages","Dynamic Checkers"],"sub_categories":["Verification","Concurrent"],"readme":"# Loom\n\nLoom is a testing tool for concurrent Rust code. It runs a test many\ntimes, permuting the possible concurrent executions of that test under\nthe [C11 memory model][spec]. It uses [state reduction\ntechniques][cdschecker] to avoid combinatorial explosion.\n\n[![Crates.io](https://img.shields.io/crates/v/loom.svg)](https://crates.io/crates/loom)\n[![Documentation](https://docs.rs/loom/badge.svg)][docs]\n[![License](https://img.shields.io/github/license/tokio-rs/loom)](https://github.com/tokio-rs/loom/blob/master/LICENSE)\n[![Build Status](https://github.com/tokio-rs/loom/actions/workflows/ci.yml/badge.svg)](https://github.com/tokio-rs/loom/actions)\n[![Discord chat](https://img.shields.io/discord/500028886025895936.svg?logo=discord\u0026style=flat-square)](https://discord.com/invite/tokio)\n\n[docs]: https://docs.rs/loom\n[spec]: https://en.cppreference.com/w/cpp/atomic/memory_order\n[cdschecker]: http://plrg.eecs.uci.edu/publications/toplas16.pdf\n\n## Quickstart\n\nThe [loom documentation][docs] has significantly more documentation on\nhow to use loom. But if you just want a jump-start, first add this to\nyour `Cargo.toml`.\n\n```toml\n[target.'cfg(loom)'.dependencies]\nloom = \"0.7\"\n```\n\nNext, create a test file and add a test:\n\n```rust\nuse loom::sync::Arc;\nuse loom::sync::atomic::AtomicUsize;\nuse loom::sync::atomic::Ordering::{Acquire, Release, Relaxed};\nuse loom::thread;\n\n#[test]\n#[should_panic]\nfn buggy_concurrent_inc() {\n    loom::model(|| {\n        let num = Arc::new(AtomicUsize::new(0));\n\n        let ths: Vec\u003c_\u003e = (0..2)\n            .map(|_| {\n                let num = num.clone();\n                thread::spawn(move || {\n                    let curr = num.load(Acquire);\n                    num.store(curr + 1, Release);\n                })\n            })\n            .collect();\n\n        for th in ths {\n            th.join().unwrap();\n        }\n\n        assert_eq!(2, num.load(Relaxed));\n    });\n}\n```\n\nThen, run the test with\n\n```console\nRUSTFLAGS=\"--cfg loom\" cargo test --test buggy_concurrent_inc --release\n```\n\n## Unsupported features\nLoom currently does not implement the full C11 memory model.\nHere is the (incomplete) list of unsupported features.\n* `SeqCst` accesses (e.g. `load`, `store`, ..):\n  They are regarded as `AcqRel`. That is, they impose weaker\n  synchronization, causing Loom to generate false alarms (not complete). See\n  [#180](https://github.com/tokio-rs/loom/issues/180) for example. On the other\n  hand, `fence(SeqCst)` is supported.\n* Load buffering behavior:\n  Loom does not explore some executions that are possible in the C11 memory\n  model. That is, there can be a bug in the checked code even if Loom says\n  there is no bug (not sound).  See the `load_buffering` test case in\n  `tests/litmus.rs`.\n\n## License\n\nThis project is licensed under the [MIT license](LICENSE).\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally\nsubmitted for inclusion in `loom` by you, shall be licensed as MIT,\nwithout any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftokio-rs%2Floom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftokio-rs%2Floom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftokio-rs%2Floom/lists"}