summaryrefslogtreecommitdiff
path: root/crates/tor-basic-utils/src
Commit message (Collapse)AuthorAgeFilesLines
* 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 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-241-0/+3
| | | | 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 '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-111-4/+4
| |
* | 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-101-0/+42
|/ | | | | | | 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-082-0/+840
| | | | Signed-off-by: David Goulet <[email protected]>
* 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-122-3/+4
| | | | | | | | | | | 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-071-15/+0
| | | | | 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.
* tor-cert-x509: Port to web-time-compat.Nick Mathewson2026-03-261-2/+2
|
* tor-basic-utils: Remove IoErrorExt and BinaryHeapExt.Nick Mathewson2026-03-251-50/+0
| | | | | | | | | | 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
* tor-basic-utils: clean up `iter_join`Steven Engler2026-03-031-8/+6
|
* tor-basic-utils: move `iter_join` from arti-relaySteven Engler2026-03-031-0/+33
| | | | Will clean this up in the following commit.
* Merge branch 'ticket_2338' into 'main'Nick Mathewson2026-02-191-10/+2
|\ | | | | | | | | | | | | Use ErrorSources where appropriate to walk an error stack. Closes #2338 See merge request tpo/core/arti!3685
| * tor-basic-utils: Simplify ErrorSources iterator.Nick Mathewson2026-02-161-10/+2
| |
* | Allow clippy::collapsible_if to triggerGabriela Moldovan2026-02-161-0/+1
|/ | | | | | | | | `clippy::collapsible_if` started triggering after bumping the MSRV to 1.88. Since this triggers from a lot of places, and since there even are a couple of instances where we explicitly allow `clippy::collapsible_ifs`, I've opened #2342 for deciding what to do about it.
* tor-basic-utils: Add utility to iterate over error sourcesRobert Bartlensky2026-02-142-0/+113
|
* maint/add_warning: Run script to add new warningGabriela Moldovan2026-01-271-0/+1
| | | | This adds the lint to all our crates.
* Move intern from tor-netdir to tor-basic-utils and make it pubNick Mathewson2025-12-032-0/+132
|
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-069-10/+10
| | | | Run maint/add_warning
* tor-basic-utils: New function to generate random hostname.Nick Mathewson2025-10-072-0/+81
| | | | | | We'll be using this for x509 certificates in #2197. We might also use it for SNI/ESNI as in !198.
* Remove "doc_auto_cfg" incantation from all crates.Nick Mathewson2025-09-291-1/+1
| | | | This feature has been removed from nightly, in favor of doc_cfg.
* Merge branch 'note_result_flatten_msrv' into 'main'David Goulet2025-08-071-2/+3
|\ | | | | | | | | Fix a comment about Result::flatten See merge request tpo/core/arti!3138
| * Fix a comment about Result::flattenNick Mathewson2025-08-071-2/+3
| | | | | | | | Previously this API was nightly-only; now it's in 1.89.