summaryrefslogtreecommitdiff
path: root/crates/tor-rpcbase/src
Commit message (Collapse)AuthorAgeFilesLines
* Revert "rpc: Suppress a clippy false positive that appears with current beta"Nick Mathewson2026-05-041-2/+1
| | | | | | | | | | | | | | | This reverts commit 9447e48d0c698d51c75706d5efedcd6142c82f2a, which told Clippy to ignore a warning that (I think) no longer occurs. (Clippy was complaining that we were _naming_ a function in a const-context that wasn't const-stable at our MSRV. But it's fine to _name_ a non-const function in that case: we just can't _call_ it.) See https://github.com/rust-lang/rust-clippy/issues/15792 for more info on the clippy bug. AFAICT the warning no longer appears with current beta, nightly, or stable versions.
* rpc: Adjust invoke_rpc_method API and related lookups.Nick Mathewson2026-04-133-32/+64
| | | | | | | | | | | | The important thing here is that we need to look up the object _after_ we invoke any non-dispatched methods, since the object might be an expired weak reference. This required some related changes to tests and error types. Additionally, it required us to change the return value of Context::remove, since we can remove objects that are not completely present.
* rpc: Add context support for adding and removing weak refsNick Mathewson2026-04-132-3/+10
|
* Fix word duplicate typosTobias Stoeckmann2026-03-151-1/+1
|
* 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.
* maint/add_warning: Run script to add new warningGabriela Moldovan2026-01-271-0/+1
| | | | This adds the lint to all our crates.
* Remove unnecessary `doc(cfg(...))` attributesNeel Chauhan2025-12-041-2/+0
| | | | | | | | | Fixes part of #2193. (Edits from nickm: I selected the cases here that I could verify were correct from immediate context.) Edited-by: Nick Mathewson <[email protected]>
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-065-6/+6
| | | | Run maint/add_warning
* Merge branch 'doc_features_no_longer_there' into 'main'Nick Mathewson2025-09-301-1/+1
|\ | | | | | | | | | | | | Remove check_doc_features and doc_auto_cfg. Closes #1514 See merge request tpo/core/arti!3294
| * 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.
* | rpc: Suppress a clippy warning by making PossumCage usedIan Jackson2025-09-301-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Fixes warning: struct `PossumCage` is never constructed warning: associated function `make_cast_table` is never used with cargo +stable clippy --locked --offline -p tor-rpcbase --all-targets Most of our builds happen with --all-features so we don't notice. In that case I think something to do with method printing:(`describe-methods`) is using things enough for the compiler not to complain.
* | rpc: Suppress a clippy false positive that appears with current betaIan Jackson2025-09-301-1/+2
|/
* Rename variables named "gen"Nick Mathewson2025-08-071-2/+2
| | | | | | This is now a reserved identifier. The automatic migration changed it to a raw identifier (`r#gen`), but it's better to use a different name.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-075-7/+7
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* Update code for Edition 2024Nick Mathewson2025-08-071-2/+2
| | | | | | | | | | | | | | | | | | 1. Run cargo fix --edition 2. Selectively revert the "if let"->"match" changes. These changes are meant to protect us from the lifetime changes for "if let" bindings in Rust 2024. But we're not actually relying on the old lifetime rules anywhere, and the match syntax here is quite ugly. 3. Automatically revert `$pat:expr_2021` to `$pat:expr`. (We don't actually want to restrict the expression syntax that our macros accept). Done with `git grep -l expr_2021 | xargs perl -i -pe 's/expr_2021/expr/g;'` 4. Run cargo fmt.
* Temporarily suppress mismatched_lifetime_syntaxes.Gabriela Moldovan2025-07-071-0/+1
| | | | See #2060.
* tor-rpcbase: Remove unnecessary parentheses from around type.Gabriela Moldovan2025-07-071-2/+2
| | | | This fixes a nightly clippy warning.
* tor-rpcbase: Removed dependency on `once_cell`hashcatHitman2025-06-144-12/+13
| | | | | | - Replaced `once_cell::sync::Lazy` with `std::sync::LazyLock`. Signed-off-by: hashcatHitman <[email protected]>
* Merge branch 'rpc-references-cleanup' into 'main'Nick Mathewson2025-01-282-16/+1
|\ | | | | | | | | rpc: Move support for weak references behind an experimental feature See merge request tpo/core/arti!2742
| * rpc: Move support for weak references behind an experimental featureNick Mathewson2025-01-272-16/+1
| | | | | | | | | | We haven't decided how these should work (see #868), so having them present by default is a bad idea.
* | Merge branch 'strongrefs_are_not_deduped' into 'main'Nick Mathewson2025-01-281-6/+2
|\ \ | | | | | | | | | | | | rpc: Clean up comments surrounding strong references See merge request tpo/core/arti!2741
| * | rpc: Clean up comments surrounding strong referencesNick Mathewson2025-01-271-6/+2
| |/ | | | | | | They used to be deduplicated, but they haven't been for a while.
* | rpcbase: Enforce validity on error datum keywords.Nick Mathewson2025-01-271-3/+10
| |
* | rpcbase: Make recognized namespace list optional.Nick Mathewson2025-01-272-8/+11
| |
* | rpcbase: Move is_valid_rpc_identifier to crate root.Nick Mathewson2025-01-272-91/+89
| |
* | rpc: Rename InvalidMethodName to InvalidRpcIdentifier.Nick Mathewson2025-01-272-14/+16
| | | | | | | | We're about to use this error type for other things too.
* | Remove RPC TODO about bypass_method_dispatch method.Nick Mathewson2025-01-271-6/+1
|/ | | | | | There was formally a redundant method of this name, which could get out-of-sync with invoke_without_dispatch. But now that method is gone, and this TODO is wrong.
* rpc: Make cancel requests uncancellable.Nick Mathewson2025-01-221-1/+18
| | | | | | | | | The current cancel code is prone to deadlock, so the easiest way to solve it appears to be making cancel requests themselves uncancellable. I've included a test to verify the behavior; previously, this test caused a deadlock.
* clippy: deny `mod_module_files`Steven Engler2025-01-061-0/+1
| | | | | | Denies 'mod.rs' files for consistency. https://rust-lang.github.io/rust-clippy/master/index.html#mod_module_files
* add_warnings, *: Allow clippy::needless_lifetimesNick Mathewson2024-12-031-0/+1
| | | | | | | | In 1.83, this warning triggers on many of our crates. We're thinking of fixing them all, but for now, we're going to disable the warning. This is part of #1765.
* rpc: Simplify method-dispatch-bypass logic a bitNick Mathewson2024-10-233-25/+39
| | | | | | | | | | | | | | | This commit removes the separate function for asking whether to bypass the dispatch code. Instead, it gives the "invoke with bypass" function an error to return when no dispatch is warranted, and moves the whole responsibility for method dispatch or non-dispatch back into tor-rpcbase. I had to add an ObjectId argument to `invoke_rpc_method` to make this work, but that's probably a good thing. Additionally, this commit tweaks the derive-deftly macro to prevent you from asking for dispatch bypass on special methods, where it isn't implemented (and doesn't really make sense).
* rpc: do not attempt to dispatch methods with bypassed dispatch.Nick Mathewson2024-10-231-0/+12
|
* rpc: Add a mechanism for method that bypass regular dispatchNick Mathewson2024-10-231-2/+34
| | | | | | | I'm about to use this for rpc:release, which is special because it doesn't actually look at the type of the object that it's invoked on. Later it might be useful for manipulating weakrefs, cloning referenes, detecting reference equality, etc.
* rpc: Include "data" field in error.Nick Mathewson2024-10-171-3/+43
| | | | | | | | In older versions of the rpc spec, this field held a serialized version of the Arti error object. That's no longer the design: now it provides a way for specific errors to include extra, specified, machine-readable data. For more information see the section "Errors" in rpc-meta-draft.md
* Remove Rpc* variants from tor_error::ErrorKindNick Mathewson2024-10-173-31/+29
| | | | | | | | | | | | | These are not regular ErrorKinds, since they can never occur in an error that's meant to be returned from a Rust API like `arti-client`. Instead, they only exist for errors returned from RpcError. (I can't find the place where we discussed this previously, but the rationale is that if an ErrorKind never makes sense in response to something that the user does from Rust, we should never have that be an ErrorKind. The fact that the removed kinds do not actually appear outside the RPC system suggests that this is reasonable.)
* Tweak some RpcErrorKind member names.Nick Mathewson2024-10-171-4/+4
| | | | In some cases, the tor_error::ErrorKind names were nicer.
* rpc: Create a constructor for RpcError.Nick Mathewson2024-10-171-0/+14
| | | | | | | We'll use this to make RpcErrors directly, without having to go through an error that implements HasKind. Later, we'll add the ability to set the `data` fields on an RpcError.
* rpc: Allow the "RpcError.kinds" to be an RpcErrorKind.Nick Mathewson2024-10-171-10/+33
| | | | | This change will let us start removing the not-entirely-logical `Rpc.*` variants from tor_error::ErrorKind.
* rpc: Make RpcErrorKind public.Nick Mathewson2024-10-172-2/+3
|
* rpc: Rename RpcCode to RpcErrorKind.Nick Mathewson2024-10-171-6/+13
| | | | This is about to be a public competitor with tor_error::ErrorKind.
* rpc: Use an alias for RpcCode.Nick Mathewson2024-10-171-9/+10
|
* rpc: Remove prefix from RpcCode members.Nick Mathewson2024-10-171-20/+19
|
* tor-{error,rpcbase}: Add new RPC error codes from spec.Nick Mathewson2024-10-071-0/+6
| | | | | | These, like the other RPC-only error kinds, probably don't belong in `tor-error`. But for now, that's where they all are, and moving them is out of scope for this branch. See #1668.
* Merge branch 'rename_singleton_id' into 'main'Jim Newsome2024-09-251-1/+1
|\ | | | | | | | | | | | | rpc: Rename SingletonId to SingleIdResponse Closes #1585 See merge request tpo/core/arti!2448
| * rpc: Rename SingletonId to SingleIdResponseNick Mathewson2024-09-241-1/+1
| | | | | | | | | | | | | | | | | | | | Calling it "singleton" might have suggested that it was using the [singleton pattern](https://en.wikipedia.org/wiki/Singleton_pattern), which it isn't. (Renaming done with rust-analyzer and double-checked with `git grep`.) Closes #1585.
* | rpc: Expose a delegation table in arti:x_list_all_rpc_methodsNick Mathewson2024-09-244-1/+69
| | | | | | | | Closes #1624.
* | rpc: add mandatory delegate-type attribute to Object templateNick Mathewson2024-09-242-3/+12
|/ | | | | | | When specifying a delegation, the template user must also say what type they're delegating to. We're going to use this to document and expose delegations.
* Fix typosDimitris Apostolou2024-09-031-2/+2
|
* rpcbase: Implement RPC method delegation support.Nick Mathewson2024-08-143-32/+138
| | | | | | | | (Couldn't use Deref here, since we needed to get an Arc.) Only one delegation target per object is permitted for now. This will help with #1523.
* Add a missing incantation to fix doc(cfg=...).Nick Mathewson2024-08-131-0/+1
| | | | Without this, we get a warning when we run `cargo doc`.