-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
net: add track_caller to public APIs #4805
Commits on Jul 4, 2022
-
net: add track_caller to public APIs
Functions that may panic can be annotated with #[track_caller] so that in the event of a panic, the function where the user called the panicking function is shown instead of the file and line within Tokio source. This change adds #[track_caller] to all the non-unstable public net APIs in the main tokio crate where the documentation describes how the function may panic due to incorrect context or inputs. Not all panic cases can have #[track_caller] applied fully as the callstack passes through a closure which isn't yet supported by the annotation (e.g. net functions called from outside a tokio runtime). Additionally, the documentation was updated to indicate additional cases in which the public net functions may panic (the same as the io functions). Tests are included to cover each potentially panicking function. Refs: tokio-rs#4413
Configuration menu - View commit details
-
Copy full SHA for 3eb71f2 - Browse repository at this point
Copy the full SHA 3eb71f2View commit details -
Added track_caller to max_instances
Without a windows machine to test on, I had to add the test before adding track_caller to ensure that it failed first. This commit adds the change that should make the test pass (and also fixes the test name).
Configuration menu - View commit details
-
Copy full SHA for 62a7455 - Browse repository at this point
Copy the full SHA 62a7455View commit details
Commits on Jul 5, 2022
-
sync: add track_caller to public APIs
Functions that may panic can be annotated with `#[track_caller]` so that in the event of a panic, the function where the user called the panicking function is shown instead of the file and line within Tokio source. This change adds `#[track_caller]` to all the public APIs in the sync module of the tokio crate where the documentation describes how the function may panic due to incorrect context or inputs. In cases where `#[track_caller]` does not work, it has been left out. For example, it currently does not work on async functions, blocks, or closures. So any call stack that passes through one of these before reaching the actual panic is not able to show the calling site outside of tokio as the panic location. The following functions have call stacks that pass through closures: * `sync::watch::Sender::send_modify` * `sync::watch::Sender::send_if_modified` Additionally, in the above functions it is a panic inside the supplied closure which causes the function to panic, and so showing the location of the panic itself is desirable. The following functions are async: * `sync::mpsc::bounded::Sender::send_timeout` Tests are included to cover each potentially panicking function. Refs: tokio-rs#4413
Configuration menu - View commit details
-
Copy full SHA for 0918514 - Browse repository at this point
Copy the full SHA 0918514View commit details
Commits on Jul 6, 2022
-
Modified changes to some panic descriptions
Modified the description of situations in which some functions can panic to align with reviewer suggestions (at least that's the intent).
Configuration menu - View commit details
-
Copy full SHA for dedc60e - Browse repository at this point
Copy the full SHA dedc60eView commit details
Commits on Jul 18, 2022
-
Changed to remove duplicate cause statements based on suggestions during the PR review.
Configuration menu - View commit details
-
Copy full SHA for 990fb3a - Browse repository at this point
Copy the full SHA 990fb3aView commit details -
Only test udp_socket_from_std_panic_caller when not on easi
Co-authored-by: Alice Ryhl <aliceryhl@google.com>
Configuration menu - View commit details
-
Copy full SHA for 73c5aea - Browse repository at this point
Copy the full SHA 73c5aeaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9ff7e4d - Browse repository at this point
Copy the full SHA 9ff7e4dView commit details -
Ignore all net_panic tests when target is wasi
Catch unwind isn't supported, so these tests won't work.
Configuration menu - View commit details
-
Copy full SHA for 373c17a - Browse repository at this point
Copy the full SHA 373c17aView commit details