summaryrefslogtreecommitdiff
path: root/crates/tor-basic-utils
Commit message (Collapse)AuthorAgeFilesLines
* Version bumps for 2.5.0Nick Mathewson2026-06-301-2/+2
| | | | | | | | | | | | | Closes #2617. We've lucked out this time, and it turns out that every one of our published crates gets a minor bump. So this was generated with: ``` for cr in $(./maint/list-crates); do cargo set-version -p $cr --bump minor done ```
* tor-basic-utils: don't include '-' in random hostnamesSteven Engler2026-06-291-2/+5
|
* Make &Arc comment less controverisalClara Engler2026-06-241-1/+1
|
* Improve GloballyInternable::intern_cache() rustdocClara Engler2026-06-241-0/+3
|
* Fix GloballyInternable rustdoc commentClara Engler2026-06-241-1/+1
|
* Remove no longer required AsRef implClara Engler2026-06-241-9/+0
| | | | This is no longer required due to Deref
* Derive Clone for InternClara Engler2026-06-241-7/+1
| | | | We can do so now directly.
* Derive Deref for InternClara Engler2026-06-241-10/+2
| | | | If we derive it, we get access to Arc<T>, which is okay.
* Add Intern::new_uncached_uninterned()Clara Engler2026-06-241-1/+13
| | | | If one really wants to circumvent the guarantees ...
* tor-basic-utils: Add GloballyInternable::into_intern()Clara Engler2026-06-241-0/+10
| | | | As a shorthand for T::intern_cache().intern(value).
* Derive From Intern for Arc using derive-moreClara Engler2026-06-241-11/+2
|
* tor-netdoc: Intern rational improvementClara Engler2026-06-241-2/+5
|
* Add missing semver.md entriesClara Engler2026-06-241-0/+3
|
* Add derive-deftly for GloballyInternableClara Engler2026-06-241-0/+16
| | | | | | Adds a derive-deftly based macro so that interfacing code can derive GloballyInternable on structs in order to save redundant and repetitive implementation calls.
* Add derive-deftly to tor-basic-utilsClara Engler2026-06-242-0/+4
| | | | We will make use of it in the next commit.
* Define GloballyInternable traitClara Engler2026-06-241-0/+8
| | | | | | | | This defines a trait called GloballyInternable with a single method `.intern_cache()` returning a static reference to the globally available cache. The next commit will add a derive-deftly based macro for it.
* Use Intern<T>Clara Engler2026-06-241-12/+12
| | | | | This commit modifies the codebase to actually return Intern<T> in InternCache<T> and adds calls to .into() accordingly.
* Introduce Intern<T>Clara Engler2026-06-241-0/+58
| | | | | | | | | | | | | This commit introduces a new type for use with InternCache<T>: Intern<T>. Right now, we have the problem that this cache returns a general Arc<T>, which leads to the issue that we quickly loose overview from where values originate. With this type, it becomes clearer from where they come. In the next commit, we will adjust InternCache and the remaining codebase accordingly.
* Merge branch 'msrv-1.91' into 'main'gabi-2502026-06-181-1/+1
|\ | | | | | | | | Bump MSRV to 1.91 See merge request tpo/core/arti!4105
| * Bump MSRV to 1.91Clara Engler2026-06-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit bumps the MSRV to 1.91 which was released on 2025-10-30. The Cargo.toml files were updated as follows: ```sh git ls-files | \ grep ".*Cargo\.toml$" | \ xargs sed -i '' 's/^rust-version = "1\.89"$/rust-version = "1\.91"/g' ``` The following files were updated manually: ``` modified: .gitlab-ci.yml modified: README.md modified: flake.nix modified: maint/docker-android/Dockerfile ```
* | Merge branch 'misc_string_slices_1' into 'main'Clara Engler2026-06-181-4/+2
|\ \ | |/ |/| | | | | Fix string_slice exceptions outside of netdoc See merge request tpo/core/arti!4092
| * basic-utils: remove str slice usageNick Mathewson2026-06-101-4/+2
| |
* | tor-basic-utils: iter_join: Take IntoIterator, not just IteratorIan Jackson2026-06-112-4/+5
| |
* | assert_not_impl: Support genericsIan Jackson2026-06-101-5/+22
| | | | | | | | | | I want to call this in one of tor-netdoc's parse2 derives, which *do* support generics.
* | assert_not_impl: Support generics - prepIan Jackson2026-06-101-2/+5
| | | | | | | | | | If we move this let into the item impl, it will have access to the generics we're about to add to the `impl $rule`.
* | assert_not_impl: Formally document input syntaxIan Jackson2026-06-101-1/+15
| | | | | | | | | | | | | | Previously we were relying on the macro_rules pattern being in the rustdoc. But it's about to get more complex. Document it manually.
* | assert_not_impl: Regularise example syntaxIan Jackson2026-06-101-4/+4
| | | | | | | | | | Usually Rust doesn't put a space after `:` in trait bounds. But it does when calling a macro with { } syntax.
* | assert_not_impl: Fix a mendacious headingIan Jackson2026-06-101-1/+1
| | | | | | | | | | This bit of the doc contains both succeeding and failing examples, each marked with an appropriate comment.
* | assert_not_impl: Promote to tor-basic-utilsIan Jackson2026-06-102-0/+43
|/ | | | | | | I want this in tor-netdoc (which doesn't use tor-config and probably shouldn't). Almost entirely code motion. Review with --color-moved.
* everywhere: Add #[allow(clippy::string_slice)]Clara Engler2026-06-091-0/+1
| | | | | | | | This commit adds #[allow(clippy::string_slice)] to all functions in the code where string slices are used, alongside a TODO comment. We do this add the function header to have it consistent, as things like expression based allow's are still experimental.
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-0911-0/+12
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* proto: Move TokenBucket to tor-basic-utilsDavid Goulet2026-06-083-0/+841
| | | | Signed-off-by: David Goulet <[email protected]>
* Remove semver.md files post-releaseGabriela Moldovan2026-06-011-2/+0
|
* Bump all the unstable tor- and arti- crates to 0.43.0Gabriela Moldovan2026-06-011-1/+1
| | | | | | | | | | Done using: ``` for crate in $(./maint/list-crates | rg '^(tor|arti-)'); do cargo set-version -p $crate 0.43.0 done ```
* tor-basic-utils: Add an if_empty helper macroNick Mathewson2026-05-271-0/+16
| | | | | We need this pattern in a lot of places; we might as well just define it once.
* tor-basic-utils: Correct documentation for macro_first_nonempty.Nick Mathewson2026-05-271-5/+5
| | | | | It looks like we renamed this macro, but didn't rename it in its documentation.
* clippy: Work around bug where it claims method doesn't existIan Jackson2026-05-131-0/+6
| | | | | | | | | | | | Fixes warning: `rand::RngExt::random_range` does not refer to a reachable function --> /volatile/rustcargo/Rustup/Arti/arti/clippy.toml:7:5 | 7 | { path = "rand::RngExt::random_range", reason = "Prefer tor_basic_utils::RngExt::gen_range_checked to avoid uncontrolled panics, or gen_range_infallible if applicable" }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add `allow-invalid = true` to the entry to suppress this warning
* Upgrade rand crates to 0.10.Wesley Aptekar-Cassels2026-05-123-5/+6
| | | | | | | | | | | When the circ-padding feature is enabled, we use maybenot, which does not yet support rand 0.10. In the meantime, enabling this feature pulls in rand 0.9. This is not ideal, but should be okay as a temporary situation. This also replaces the use of ReseedingRng (which was removed in 0.10) with the reseeding_rng crate. This is somewhat less performant, but it should be okay.
* tor-basic-utils: remove `flatten`Nick Mathewson2026-05-072-15/+2
| | | | | It is no longer needed since we require Rust 1.89. Nobody was using it.
* tor-basic-utils: Update comment about std::fmt::from_fn.Nick Mathewson2026-05-071-1/+1
| | | | We now know when it was stabilized, so we can say when to use it.
* release: Bump tor- and arti- crate versions.Wesley Aptekar-Cassels2026-05-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cargo set-version -p arti-client 0.42.0 cargo set-version -p arti-config 0.42.0 cargo set-version -p arti-relay 0.42.0 cargo set-version -p arti-rpc-client-core 0.42.0 cargo set-version -p arti-rpcserver 0.42.0 cargo set-version -p arti-testing 0.42.0 cargo set-version -p arti-ureq 0.42.0 cargo set-version -p tor-async-utils 0.42.0 cargo set-version -p tor-basic-utils 0.42.0 cargo set-version -p tor-bytes 0.42.0 cargo set-version -p tor-cell 0.42.0 cargo set-version -p tor-cert 0.42.0 cargo set-version -p tor-cert-x509 0.42.0 cargo set-version -p tor-chanmgr 0.42.0 cargo set-version -p tor-checkable 0.42.0 cargo set-version -p tor-circmgr 0.42.0 cargo set-version -p tor-config 0.42.0 cargo set-version -p tor-config-path 0.42.0 cargo set-version -p tor-consdiff 0.42.0 cargo set-version -p tor-dirclient 0.42.0 cargo set-version -p tor-dircommon 0.42.0 cargo set-version -p tor-dirmgr 0.42.0 cargo set-version -p tor-dirserver 0.42.0 cargo set-version -p tor-error 0.42.0 cargo set-version -p tor-events 0.42.0 cargo set-version -p tor-general-addr 0.42.0 cargo set-version -p tor-geoip 0.42.0 cargo set-version -p tor-guardmgr 0.42.0 cargo set-version -p tor-hsclient 0.42.0 cargo set-version -p tor-hscrypto 0.42.0 cargo set-version -p tor-hsrproxy 0.42.0 cargo set-version -p tor-hsservice 0.42.0 cargo set-version -p tor-key-forge 0.42.0 cargo set-version -p tor-keymgr 0.42.0 cargo set-version -p tor-linkspec 0.42.0 cargo set-version -p tor-llcrypto 0.42.0 cargo set-version -p tor-log-ratelim 0.42.0 cargo set-version -p tor-memquota 0.42.0 cargo set-version -p tor-memquota-cost 0.42.0 cargo set-version -p tor-netdir 0.42.0 cargo set-version -p tor-netdoc 0.42.0 cargo set-version -p tor-persist 0.42.0 cargo set-version -p tor-proto 0.42.0 cargo set-version -p tor-protover 0.42.0 cargo set-version -p tor-ptmgr 0.42.0 cargo set-version -p tor-relay-crypto 0.42.0 cargo set-version -p tor-relay-selection 0.42.0 cargo set-version -p tor-rpcbase 0.42.0 cargo set-version -p tor-rpc-connect 0.42.0 cargo set-version -p tor-rtcompat 0.42.0 cargo set-version -p tor-rtmock 0.42.0 cargo set-version -p tor-socksproto 0.42.0 cargo set-version -p tor-units 0.42.0
* Update getrandom dependeencyIan Jackson2026-03-311-1/+1
|
* Remove semver.md files after releaseIan Jackson2026-03-301-2/+0
|
* Bump versions: tor-* and arti-* unstable cratesIan Jackson2026-03-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/issues/2436#note_3384773 Made with nailing-cargo -Eu set-version -p arti-client 0.41.0 nailing-cargo -Eu set-version -p arti-relay 0.41.0 nailing-cargo -Eu set-version -p arti-rpcserver 0.41.0 nailing-cargo -Eu set-version -p arti-ureq 0.41.0 nailing-cargo -Eu set-version -p arti-rpc-client-core 0.41.0 nailing-cargo -Eu set-version -p tor-basic-utils 0.41.0 nailing-cargo -Eu set-version -p tor-error 0.41.0 nailing-cargo -Eu set-version -p tor-general-addr 0.41.0 nailing-cargo -Eu set-version -p tor-geoip 0.41.0 nailing-cargo -Eu set-version -p tor-memquota-cost 0.41.0 nailing-cargo -Eu set-version -p tor-llcrypto 0.41.0 nailing-cargo -Eu set-version -p tor-cert-x509 0.41.0 nailing-cargo -Eu set-version -p tor-rtcompat 0.41.0 nailing-cargo -Eu set-version -p tor-rtmock 0.41.0 nailing-cargo -Eu set-version -p tor-async-utils 0.41.0 nailing-cargo -Eu set-version -p tor-config 0.41.0 nailing-cargo -Eu set-version -p tor-config-path 0.41.0 nailing-cargo -Eu set-version -p tor-rpc-connect 0.41.0 nailing-cargo -Eu set-version -p tor-log-ratelim 0.41.0 nailing-cargo -Eu set-version -p tor-rpcbase 0.41.0 nailing-cargo -Eu set-version -p tor-memquota 0.41.0 nailing-cargo -Eu set-version -p tor-units 0.41.0 nailing-cargo -Eu set-version -p tor-bytes 0.41.0 nailing-cargo -Eu set-version -p tor-protover 0.41.0 nailing-cargo -Eu set-version -p tor-checkable 0.41.0 nailing-cargo -Eu set-version -p tor-cert 0.41.0 nailing-cargo -Eu set-version -p tor-key-forge 0.41.0 nailing-cargo -Eu set-version -p tor-hscrypto 0.41.0 nailing-cargo -Eu set-version -p tor-socksproto 0.41.0 nailing-cargo -Eu set-version -p tor-linkspec 0.41.0 nailing-cargo -Eu set-version -p tor-cell 0.41.0 nailing-cargo -Eu set-version -p tor-persist 0.41.0 nailing-cargo -Eu set-version -p tor-keymgr 0.41.0 nailing-cargo -Eu set-version -p tor-relay-crypto 0.41.0 nailing-cargo -Eu set-version -p tor-proto 0.41.0 nailing-cargo -Eu set-version -p tor-netdoc 0.41.0 nailing-cargo -Eu set-version -p tor-consdiff 0.41.0 nailing-cargo -Eu set-version -p tor-netdir 0.41.0 nailing-cargo -Eu set-version -p tor-relay-selection 0.41.0 nailing-cargo -Eu set-version -p tor-chanmgr 0.41.0 nailing-cargo -Eu set-version -p tor-ptmgr 0.41.0 nailing-cargo -Eu set-version -p tor-dircommon 0.41.0 nailing-cargo -Eu set-version -p tor-guardmgr 0.41.0 nailing-cargo -Eu set-version -p tor-circmgr 0.41.0 nailing-cargo -Eu set-version -p tor-dirclient 0.41.0 nailing-cargo -Eu set-version -p tor-dirmgr 0.41.0 nailing-cargo -Eu set-version -p tor-dirserver 0.41.0 nailing-cargo -Eu set-version -p tor-hsclient 0.41.0 nailing-cargo -Eu set-version -p tor-hsservice 0.41.0 nailing-cargo -Eu set-version -p tor-hsrproxy 0.41.0
* Run cargo sort --workspace and commit the parts we wantIan Jackson2026-03-301-1/+1
|
* Plumb web-time-compat/full dependency through everywhere.Ian Jackson2026-03-301-1/+1
| | | | As generated by maint/fixup-features.
* tor-cert-x509: Port to web-time-compat.Nick Mathewson2026-03-262-2/+3
|
* WASM: Enable `wasm_js` feature for getrandom for tor-basic-utils.Alexander Hansen Færøy2026-03-261-0/+3
|
* tor-basic-utils: Remove IoErrorExt and BinaryHeapExt.Nick Mathewson2026-03-252-50/+2
| | | | | | | | | | IoErrorExt existed to provide a workaround for Rust versions that didn't have io::ErrorKind::NotADirectory. But NotADirectory was stabilized in 1.83 and our MSRV is 1.89. BinaryHeapExt existed to provide an implementation for Rust versions that didn't have BinaryHeap::retain. But BinaryHeap::retain was stabilized in 1.70 and our MSRV is 1.70.
* Force use of standard hasher with weak_tables.Nick Mathewson2026-03-241-1/+5
| | | | | | | | | | | | | Closes #2418. Fixes TROVE-2026-005, where we would use a less cryptographically secure (and probably less DoS resistant) hash function for these tables if: - We are built alongside another crate that uses `weak-table` - That crate enables the `weak-table/ahash` feature. - We are running on a system without hardware AES. Severity: Low