{"push_id":3078721943,"size":4,"distinct_size":0,"ref":"refs/heads/master","head":"6acbb5b65c06d82c867a94c54ce51dab4707ac61","before":"5bd451b26580de465d59ed5389209ed191b7dbdd","commits":[{"sha":"6d40b7232eaa00ab5c060582011f350725703a1e","author":{"name":"Sebastian Geisler","email":"db043b2055cb3a47b2eb0b5aebf4e114a8c24a5a@blockstream.io"},"message":"Implement checked_add_duration for SystemTime\n\nSince SystemTime is opaque there is no way to check if the result\nof an addition will be in bounds. That makes the Add<Duration>\ntrait completely unusable with untrusted data. This is a big problem\nbecause adding a Duration to UNIX_EPOCH is the standard way of\nconstructing a SystemTime from a unix timestamp.\n\nThis commit implements checked_add_duration(&self, &Duration) -> Option<SystemTime>\nfor std::time::SystemTime and as a prerequisite also for all platform\nspecific time structs. This also led to the refactoring of many\nadd_duration(&self, &Duration) -> SystemTime functions to avoid\nredundancy (they now unwrap the result of checked_add_duration).\n\nSome basic unit tests for the newly introduced function were added\ntoo.","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/6d40b7232eaa00ab5c060582011f350725703a1e"},{"sha":"86ef38b3b7a24959ca11a29c79cf921ed5986bc9","author":{"name":"Sebastian Geisler","email":"db043b2055cb3a47b2eb0b5aebf4e114a8c24a5a@blockstream.io"},"message":"Rename checked_add_duration to checked_add and make it take the duration by value","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/86ef38b3b7a24959ca11a29c79cf921ed5986bc9"},{"sha":"f2106d0746cdbd04ddad44c35b4e13eeced2a546","author":{"name":"Sebastian Geisler","email":"db043b2055cb3a47b2eb0b5aebf4e114a8c24a5a@blockstream.io"},"message":"use ? operator instead of match","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/f2106d0746cdbd04ddad44c35b4e13eeced2a546"},{"sha":"6acbb5b65c06d82c867a94c54ce51dab4707ac61","author":{"name":"bors","email":"3a2c29237f73c7cf88424b80e427b1884f346b35@rust-lang.org"},"message":"Auto merge of #55527 - sgeisler:time-checked-add, r=sfackler\n\nImplement checked_add_duration for SystemTime\n\n[Original discussion on the rust user forum](https://users.rust-lang.org/t/std-systemtime-misses-a-checked-add-function/21785)\n\nSince `SystemTime` is opaque there is no way to check if the result of an addition will be in bounds. That makes the `Add<Duration>` trait completely unusable with untrusted data. This is a big problem because adding a `Duration` to `UNIX_EPOCH` is the standard way of constructing a `SystemTime` from a unix timestamp.\n\nThis PR implements `checked_add_duration(&self, &Duration) -> Option<SystemTime>` for `std::time::SystemTime` and as a prerequisite also for all platform specific time structs. This also led to the refactoring of many `add_duration(&self, &Duration) -> SystemTime` functions to avoid redundancy (they now unwrap the result of `checked_add_duration`).\n\nSome basic unit tests for the newly introduced function were added too.\n\nI wasn't sure which stabilization attribute to add to the newly introduced function, so I just chose `#[stable(feature = \"time_checked_add\", since = \"1.32.0\")]` for now to make it compile. Please let me know how I should change it or if I violated any other conventions.\n\nP.S.: I could only test on Linux so far, so I don't necessarily expect it to compile for all platforms.","distinct":false,"url":"https://api.github.com/repos/rust-lang/rust/commits/6acbb5b65c06d82c867a94c54ce51dab4707ac61"}]}
{"actor":{"display_login":"bors"}}