about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2020-06-21Auto merge of #70946 - jumbatm:clashing-extern-decl, r=nagisabors-0/+2
Add a lint to catch clashing `extern` fn declarations. Closes #69390. Adds lint `clashing_extern_decl` to detect when, within a single crate, an extern function of the same name is declared with different types. Because two symbols of the same name cannot be resolved to two different functions at link time, and one function cannot possibly have two types, a clashing extern declaration is almost certainly a mistake. This lint does not run between crates because a project may have dependencies which both rely on the same extern function, but declare it in a different (but valid) way. For example, they may both declare an opaque type for one or more of the arguments (which would end up distinct types), or use types that are valid conversions in the language the extern fn is defined in. In these cases, we can't say that the clashing declaration is incorrect. r? @eddyb
2020-06-20Rollup merge of #73471 - raoulstrackx:raoul/fpu_tag_word, r=jethrogbRalf Jung-12/+8
Prevent attacker from manipulating FPU tag word used in SGX enclave Insufficient sanitization of the x87 FPU tag word in the trusted enclave runtime allowed unprivileged adversaries in the containing host application to induce incoherent or unexpected results for ABI-compliant compiled enclave application code that uses the x87 FPU. Vulnerability was disclosed to us by Fritz Alder, Jo Van Bulck, David Oswald and Frank Piessens cc: @jethrogb
2020-06-20Rollup merge of #73171 - tblah:riscv-qemu-test, r=pietroalbiniRalf Jung-2/+3
RISC-V Emulated Testing Adds a disabled docker image on which to run RISC-V tests. Based on the armhf image. Test using ``` ./src/ci/docker/run.sh riscv64gc-linux ``` cc: @msizanoen1
2020-06-20Add ClashingExternDecl lint.jumbatm-0/+2
This lint checks that all declarations for extern fns of the same name are declared with the same types.
2020-06-19Rollup merge of #73484 - poliorcetics:use-prelude-doc, r=sfacklerManish Goregaokar-16/+0
Update the doc for std::prelude to the correct behavior Fixes #64686. One line change to ensure the docs are correct about the behavior of the compiler when inserting`std::prelude::v1`. I don't think examples are necessary but I can add some (especially those from the original issue) if needed.
2020-06-19Update the doc for std::prelude, removing the "technical part" sectionAlexis Bourget-16/+0
2020-06-19Using xsave restore to restore complete FPU stateRaoul Strackx-12/+1
2020-06-19Rollup merge of #73464 - qy3u:fs-document-format-correction, r=jonas-schievinkRalf Jung-2/+4
Document format correction Minor amendments to the document. r? @steveklabnik
2020-06-19Rollup merge of #73142 - ehuss:std-benches, r=dtolnayRalf Jung-0/+5
Ensure std benchmarks get tested. This ensures that the std benchmarks don't break in the future. Currently they aren't compiled or tested on CI, so they can easily bitrot. Testing a benchmark runs it with one iteration. Adding these should only add a few seconds to CI. Closes #54176 Closes #61913
2020-06-19Rollup merge of #72486 - Ralith:asinh-fix, r=dtolnayRalf Jung-10/+6
Fix asinh of negative values Rust's current implementation of asinh has [large errors](https://www.wolframalpha.com/input/?i=arcsinh%28x%29%2C+ln%28x%2B%28x%5E2%2B1%29%5E0.5%29%2C+x+from+-67452095.07139316+to+0) in its negative range. ~These are (mostly) not numerical, but rather seem due to an incorrect implementation.~ This appears to be due to avoidable catastrophic cancellation. [Playground before/after](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=bd04ae6d86d06612e4e389a8b95d19ab). [glibc uses](https://github.com/bminor/glibc/blob/81dca813cc35f91414731fdd0ff6b756d5e1827f/sysdeps/ieee754/dbl-64/s_asinh.c#L56) abs here. Many thanks to @danieldeankon for finding this weird behavior, @jebrosen for diagnosing it, and @toasteater for identifying the probable implementation error!
2020-06-18Remove now-redundant branchBenjamin Saunders-10/+2
2020-06-18Rollup merge of #72836 - poliorcetics:std-time-os-specificities, r=shepmasterManish Goregaokar-0/+15
Complete the std::time documentation to warn about the inconsistencies between OS Fixes #48980. I put the new documentation in `src/libstd/time.rs` at the module-level because it affects all types, even the one that are not directly system dependents if they are used with affected types, but there may be a better place for it.
2020-06-18Rollup merge of #72279 - RalfJung:raw-ref-macros, r=nikomatsakisManish Goregaokar-0/+1
add raw_ref macros In https://github.com/rust-lang/rust/issues/64490, various people were in favor of exposing `&raw` as a macro first before making the actual syntax stable. So this PR (unstably) introduces those macros. I'll create the tracking issue if we're okay moving forward with this.
2020-06-18Ensure std benchmarks get tested.Eric Huss-0/+5
2020-06-18Prevent attacker from manipulating FPU tag word used in SGX enclaveRaoul Strackx-0/+7
Insufficient sanitization of the x87 FPU tag word in the trusted enclave runtime allowed unprivileged adversaries in the containing host application to induce incoherent or unexpected results for ABI-compliant compiled enclave application code that uses the x87 FPU. Vulnerability was disclosed to us by Fritz Alder, Jo Van Bulck, David Oswald and Frank Piessens
2020-06-18Document format correctionqy3u-2/+4
2020-06-16Rollup merge of #73389 - lzutao:from, r=kennytmDylan DPC-8/+2
Use `Ipv4Addr::from<[u8; 4]>` when possible Resolve this comment: https://github.com/rust-lang/rust/pull/73331#discussion_r440098369
2020-06-16Rollup merge of #73373 - lzutao:bug-trackcaller, r=AmanieuDylan DPC-10/+3
Use track caller for bug! macro
2020-06-16Use `Ipv4Addr::from<[u8; 4]>` when possibleLzu Tao-8/+2
2020-06-15Complete the std::time documentation to warn about the inconsistencies ↵Alexis Bourget-0/+15
between OS
2020-06-15Join mutiple lines if it is more readableLzu Tao-10/+3
2020-06-15Rollup merge of #73331 - hermitcore:listen, r=kennytmRalf Jung-47/+86
extend network support for HermitCore - add basic support of TcpListerner for HermitCore - revise TcpStream to support peer_addr
2020-06-15Rollup merge of #73304 - dtolnay:socketeq, r=Mark-SimulacrumRalf Jung-40/+5
Revert heterogeneous SocketAddr PartialEq impls Originally added in #72239. These lead to inference regressions (mostly in tests) in code that looks like: ```rust let socket = SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 8080); assert_eq!(socket, "127.0.0.1:8080".parse().unwrap()); ``` That compiles as of stable 1.44.0 but fails in beta with: ```console error[E0284]: type annotations needed --> src/main.rs:3:41 | 3 | assert_eq!(socket, "127.0.0.1:8080".parse().unwrap()); | ^^^^^ cannot infer type for type parameter `F` declared on the associated function `parse` | = note: cannot satisfy `<_ as std::str::FromStr>::Err == _` help: consider specifying the type argument in the method call | 3 | assert_eq!(socket, "127.0.0.1:8080".parse::<F>().unwrap()); | ``` Closes #73242.
2020-06-15Rollup merge of #73139 - poliorcetics:cstring-from-vec-with-nul, r=dtolnayRalf Jung-6/+183
Add methods to go from a nul-terminated Vec<u8> to a CString Fixes #73100. Doc tests have been written and the documentation on the error type updated too. I used `#[stable(feature = "cstring_from_vec_with_nul", since = "1.46.0")]` but I don't know if the version is correct.
2020-06-15Rollup merge of #73104 - poliorcetics:explicit-mutex-drop-example, r=dtolnayRalf Jung-0/+54
Example about explicit mutex dropping Fixes #67457. Following the remarks made in #73074, I added an example on the main `Mutex` type, with a situation where there is mutable data and a computation result. In my testing it is effectively needed to explicitly drop the lock, else it deadlocks. r? @dtolnay because you were the one to review the previous PR.
2020-06-15remove obsolete , to pass the format checkStefan Lankes-2/+2
2020-06-15add comment about the usage of ArcStefan Lankes-0/+3
2020-06-15use Ipv6Addr::from to build the IPv6 addressStefan Lankes-24/+2
2020-06-15Revert "simplify conversion to IpAddr::V6"Stefan Lankes-2/+18
This reverts commit d221ffc68e543f4a38efcc2bd34f52145f89003b.
2020-06-15Revert "changes to pass the format check"Stefan Lankes-4/+10
This reverts commit 9d596b50f15dfff47fa2272ee63cdc9aeb9307fa.
2020-06-15remove obsolete lineStefan Lankes-1/+0
2020-06-15changes to pass the format checkStefan Lankes-10/+4
2020-06-14simplify conversion to IpAddr::V6Stefan Lankes-18/+2
2020-06-14Update to use the new error type and correctly compile the doc testsAlexis Bourget-16/+21
2020-06-14Add a new error type for the new methodAlexis Bourget-0/+98
2020-06-14Removing the TryFrom implAlexis Bourget-14/+0
2020-06-14use latest interface to HermitCoreStefan Lankes-1/+1
2020-06-14remove unused functionStefan Lankes-6/+0
2020-06-13add TcpListener support for HermitCoreStefan Lankes-46/+111
Add basic support of TcpListerner for HermitCore. In addition, revise TcpStream to support peer_addr.
2020-06-13Add test for comparing SocketAddr with inferred right-hand sideDavid Tolnay-0/+5
2020-06-13Rewrap comments in Mutex exampleDavid Tolnay-11/+11
2020-06-13Clarify the scope-related explanation Poliorcetics-3/+2
Based on the review made by dtolnay.
2020-06-13Apply suggestions from code reviewPoliorcetics-5/+5
Co-authored-by: David Tolnay <dtolnay@gmail.com>
2020-06-12Revert heterogeneous SocketAddr PartialEq implsDavid Tolnay-40/+0
These lead to inference regressions (mostly in tests) in code that looks like: let socket = std::net::SocketAddrV4::new(std::net::Ipv4Addr::new(127, 0, 0, 1), 8080); assert_eq!(socket, "127.0.0.1:8080".parse().unwrap()); That compiles as of stable 1.44.0 but fails in beta with: error[E0284]: type annotations needed --> src/main.rs:3:41 | 3 | assert_eq!(socket, "127.0.0.1:8080".parse().unwrap()); | ^^^^^ cannot infer type for type parameter `F` declared on the associated function `parse` | = note: cannot satisfy `<_ as std::str::FromStr>::Err == _` help: consider specifying the type argument in the method call | 3 | assert_eq!(socket, "127.0.0.1:8080".parse::<F>().unwrap()); |
2020-06-12add raw_ref macrosRalf Jung-0/+1
2020-06-11Fix the link in the TryFrom implAlexis Bourget-1/+1
2020-06-11Add a TryFrom<Vec<u8>> impl that mirror from_vec_with_nulAlexis Bourget-0/+14
2020-06-10Migrate to numeric associated constsLzu Tao-211/+185
2020-06-09Remove a lot of unecessary/duplicated commentsAlexis Bourget-11/+3
2020-06-09Move to unstable, linking the issueAlexis Bourget-2/+2