{"id":13484739,"url":"https://github.com/rust-lang/polonius","last_synced_at":"2025-05-15T18:11:22.466Z","repository":{"id":37706418,"uuid":"131730961","full_name":"rust-lang/polonius","owner":"rust-lang","description":"Defines the Rust borrow checker.","archived":false,"fork":false,"pushed_at":"2024-06-19T04:39:51.000Z","size":351777,"stargazers_count":1436,"open_issues_count":42,"forks_count":76,"subscribers_count":66,"default_branch":"master","last_synced_at":"2025-05-15T00:05:40.218Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/rust-lang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2018-05-01T15:40:59.000Z","updated_at":"2025-05-13T07:10:42.000Z","dependencies_parsed_at":"2024-06-01T04:47:02.390Z","dependency_job_id":"32581582-4901-421d-ae8c-2c953bd90b04","html_url":"https://github.com/rust-lang/polonius","commit_stats":null,"previous_names":["rust-lang-nursery/polonius"],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang%2Fpolonius","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang%2Fpolonius/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang%2Fpolonius/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang%2Fpolonius/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rust-lang","download_url":"https://codeload.github.com/rust-lang/polonius/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254394724,"owners_count":22063984,"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-07-31T17:01:32.068Z","updated_at":"2025-05-15T18:11:22.419Z","avatar_url":"https://github.com/rust-lang.png","language":"Rust","readme":"This is a core library that models the borrow check. It implements the analysis\ndescribed in this [blogpost][post] and in this [talk]. Details are [in the Polonius book][book].\n\n[post]: http://smallcultfollowing.com/babysteps/blog/2018/04/27/an-alias-based-formulation-of-the-borrow-checker/\n[talk]: https://youtu.be/_agDeiWek8w\n[book]: https://rust-lang.github.io/polonius/\n\n### Why the name \"Polonius\"?\n\nThe name comes from the famous quote [\"Neither a borrower nor a lender\nbe\"][nblnb], which comes from the character Polonius in Shakespeare's\n*Hamlet*.\n\n[nblnb]: https://literarydevices.net/neither-a-borrower-nor-a-lender-be/\n\n### Want to run the code?\n\nOne of the goals with this repo is to experiment and compare different\nimplementations of the same algorithm. You can run the analysis by using `cargo run`\nand you can choose the analysis with `-a`. So for example to run against an example\nextract from clap, you might do:\n\n```bash\n\u003e cargo +nightly run --release -- -a DatafrogOpt inputs/clap-rs/app-parser-{{impl}}-add_defaults/\n    Finished release [optimized] target(s) in 0.05 secs\n     Running `target/release/borrow-check 'inputs/clap-rs/app-parser-{{impl}}-add_defaults/'`\n--------------------------------------------------\nDirectory: inputs/clap-rs/app-parser-{{impl}}-add_defaults/\nTime: 3.856s\n```\n\nYou could also try `-a Naive` to get the naive rules (more readable,\nslower) -- these are the exact rules described in [the\nblogpost][post]. You can also use `-a LocationInsensitive` to use a\nlocation insensitive analysis (faster, but may yield spurious errors).\n\nBy default, `cargo run` just prints timing. If you also want to see\nthe results, try `--show-tuples` (which will show errors) and maybe\n`-v` (to show more intermediate computations). You can supply `--help`\nto get more docs.\n\n### How to generate your own inputs\n\nTo run the borrow checker on an input, you first need to generate the\ninput facts.  For that, you will need to run rustc with the\n`-Znll-facts` option:\n\n```\n\u003e rustc -Znll-facts inputs/issue-47680/issue-47680.rs\n```\n\nOr, for generating the input facts of a crate using the `#![feature(nll)]` flag:\n\n```\n\u003e cargo rustc -- -Znll-facts\n```\n\nThis will generate a `nll-facts` directory with one subdirectory per function:\n\n```bash\n\u003e ls -F nll-facts\n{{impl}}-maybe_next/  main/\n```\n\nYou can then run on these directories.\n","funding_links":[],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-lang%2Fpolonius","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frust-lang%2Fpolonius","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-lang%2Fpolonius/lists"}