about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2022-06-05reduce code duplicationRalf Jung-13/+12
2022-06-05interpret: better control over whether we read data with provenance, and ↵Ralf Jung-404/+495
implicit provenance stripping where possible
2022-06-02Auto merge of #96737 - ChrisDenton:win-manifest, r=wesleywiserbors-0/+52
Add Windows application manifest to rustc-main Windows allows setting some runtime options using a manifest file. The format of the XML file is documented here: https://docs.microsoft.com/en-us/windows/win32/sbscs/application-manifests The manifest file in this PR does three things: * Declares which Windows versions we support. This may help avoid unnecessary compatibility shims. * Uses the UTF-8 code page. While Rust itself uses UTF-16 APIs, other code may rely on the code page. * Makes the application long path aware (if also enabled by the user). This allows for the current directory to be longer than `PATH_MAX`. These changes only affect the `rustc` process and not any other DLLs or compiled programs.
2022-06-02Auto merge of #97414 - LYF1999:yf/cachealign, r=Mark-Simulacrumbors-1/+2
use 128 cache align for aarch64 the cache line size of m1 mac is 128. so use `align(128)` for m1 mac here is `sysctl -a hw machdep.cpu` output on m1 mac ``` hw.ncpu: 10 hw.byteorder: 1234 hw.memsize: 68719476736 hw.activecpu: 10 hw.perflevel0.physicalcpu: 8 hw.perflevel0.physicalcpu_max: 8 hw.perflevel0.logicalcpu: 8 hw.perflevel0.logicalcpu_max: 8 hw.perflevel0.l1icachesize: 196608 hw.perflevel0.l1dcachesize: 131072 hw.perflevel0.l2cachesize: 12582912 hw.perflevel0.cpusperl2: 4 hw.perflevel1.physicalcpu: 2 hw.perflevel1.physicalcpu_max: 2 hw.perflevel1.logicalcpu: 2 hw.perflevel1.logicalcpu_max: 2 hw.perflevel1.l1icachesize: 131072 hw.perflevel1.l1dcachesize: 65536 hw.perflevel1.l2cachesize: 4194304 hw.perflevel1.cpusperl2: 2 hw.optional.arm.FEAT_FlagM: 1 hw.optional.arm.FEAT_FlagM2: 1 hw.optional.arm.FEAT_FHM: 1 hw.optional.arm.FEAT_DotProd: 1 hw.optional.arm.FEAT_SHA3: 1 hw.optional.arm.FEAT_RDM: 1 hw.optional.arm.FEAT_LSE: 1 hw.optional.arm.FEAT_SHA256: 1 hw.optional.arm.FEAT_SHA512: 1 hw.optional.arm.FEAT_SHA1: 1 hw.optional.arm.FEAT_AES: 1 hw.optional.arm.FEAT_PMULL: 1 hw.optional.arm.FEAT_SPECRES: 0 hw.optional.arm.FEAT_SB: 1 hw.optional.arm.FEAT_FRINTTS: 1 hw.optional.arm.FEAT_LRCPC: 1 hw.optional.arm.FEAT_LRCPC2: 1 hw.optional.arm.FEAT_FCMA: 1 hw.optional.arm.FEAT_JSCVT: 1 hw.optional.arm.FEAT_PAuth: 1 hw.optional.arm.FEAT_PAuth2: 0 hw.optional.arm.FEAT_FPAC: 0 hw.optional.arm.FEAT_DPB: 1 hw.optional.arm.FEAT_DPB2: 1 hw.optional.arm.FEAT_BF16: 0 hw.optional.arm.FEAT_I8MM: 0 hw.optional.arm.FEAT_ECV: 1 hw.optional.arm.FEAT_LSE2: 1 hw.optional.arm.FEAT_CSV2: 1 hw.optional.arm.FEAT_CSV3: 1 hw.optional.arm.FEAT_FP16: 1 hw.optional.arm.FEAT_SSBS: 1 hw.optional.arm.FEAT_BTI: 0 hw.optional.floatingpoint: 1 hw.optional.neon: 1 hw.optional.neon_hpfp: 1 hw.optional.neon_fp16: 1 hw.optional.armv8_1_atomics: 1 hw.optional.armv8_2_fhm: 1 hw.optional.armv8_2_sha512: 1 hw.optional.armv8_2_sha3: 1 hw.optional.armv8_3_compnum: 1 hw.optional.watchpoint: 4 hw.optional.breakpoint: 6 hw.optional.armv8_crc32: 1 hw.optional.armv8_gpi: 1 hw.optional.AdvSIMD: 1 hw.optional.AdvSIMD_HPFPCvt: 1 hw.optional.ucnormal_mem: 1 hw.optional.arm64: 1 hw.features.allows_security_research: 0 hw.physicalcpu: 10 hw.physicalcpu_max: 10 hw.logicalcpu: 10 hw.logicalcpu_max: 10 hw.cputype: 16777228 hw.cpusubtype: 2 hw.cpu64bit_capable: 1 hw.cpufamily: 458787763 hw.cpusubfamily: 5 hw.cacheconfig: 10 1 2 0 0 0 0 0 0 0 hw.cachesize: 3373957120 65536 4194304 0 0 0 0 0 0 0 hw.pagesize: 16384 hw.pagesize32: 16384 hw.cachelinesize: 128 hw.l1icachesize: 131072 hw.l1dcachesize: 65536 hw.l2cachesize: 4194304 hw.tbfrequency: 24000000 hw.packages: 1 hw.osenvironment: hw.ephemeral_storage: 0 hw.use_recovery_securityd: 0 hw.use_kernelmanagerd: 1 hw.serialdebugmode: 0 hw.nperflevels: 2 hw.targettype: J316c machdep.cpu.cores_per_package: 10 machdep.cpu.core_count: 10 machdep.cpu.logical_per_package: 10 machdep.cpu.thread_count: 10 machdep.cpu.brand_string: Apple M1 Max ```
2022-06-01Auto merge of #97632 - JohnTitor:rollup-d2ucrjw, r=JohnTitorbors-82/+293
Rollup of 6 pull requests Successful merges: - #95594 (Additional `*mut [T]` methods) - #97130 (rustdoc: avoid including impl blocks with filled-in generics) - #97166 (Move conditions out of recover/report functions.) - #97605 (Mention filename in suggestion when it differs from primary span) - #97613 (rustdoc: Improve calculation of "Impls on Foreign Types") - #97626 (rename PointerAddress → PointerExposeAddress) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-02Rollup merge of #97626 - RalfJung:expose, r=tmiaskoYuki Okushi-18/+23
rename PointerAddress → PointerExposeAddress `PointerAddress` sounds a bit too much like `ptr.addr()`, but this corresponds to `ptr.expose_addr()`. r? `@tmiasko`
2022-06-02Rollup merge of #97613 - jsha:implementation-is-on-local-type, r=GuillaumeGomezYuki Okushi-7/+29
rustdoc: Improve calculation of "Impls on Foreign Types" The existing code to calculate whether an implementation was on a "Foreign Type" was duplicated across the sidebar generation and the page generation. It also came to the wrong conclusion for some cases where both the trait and the "for" type were re-exports. This PR extracts the logic into a method of `Impl`, breaks it into a multi-line method so it can be commented, and adds a case for when the trait and the "for" type came from the same crate. This fixes some cases - like the platform-specific integer types (`__m256`, `__m128`, etc). But it doesn't fix all cases. See the screenshots below. [Before](https://doc.rust-lang.org/nightly/std/clone/trait.Clone.html#foreign-impls): <img src="https://user-images.githubusercontent.com/220205/171338226-59ce6daf-3d76-4bad-bc8d-72a8259a8f43.png" width=200> [After](https://rustdoc.crud.net/jsha/implementation-is-on-local-type/std/clone/trait.Clone.html): <img src="https://user-images.githubusercontent.com/220205/171338147-28308a65-1597-4223-be47-9550062404dd.png" width=200> The remaining types (`CString`, `NulError`, etc) are all from the `alloc` crate, while the `Clone` trait is from the `core` crate. Since `CString` and `Clone` are both re-exported by `std`, they are logically local to each other, but I couldn't figure out a good way to detect that in this code. I figure this is still a good step forward. Related: #97610 r? `@camelid`
2022-06-02Rollup merge of #97605 - estebank:suggestion-filename, r=oli-obkYuki Okushi-4/+39
Mention filename in suggestion when it differs from primary span
2022-06-02Rollup merge of #97166 - nnethercote:move-conditions-out, r=estebankYuki Okushi-50/+41
Move conditions out of recover/report functions. `Parser` has six recover/report functions that are passed a boolean, and nothing is done if the boolean has a particular value. This PR moves the tests outside the functions. This has the following effects. - The number of lines of code goes down. - Some `use` items become shorter. - Avoids the strangeness whereby 11 out of 12 calls to `maybe_recover_from_bad_qpath` pass `true` as the second argument. - Makes it clear at the call site that only one of `maybe_recover_from_bad_type_plus` and `maybe_report_ambiguous_plus` will be run. r? `@estebank`
2022-06-02Rollup merge of #97130 - notriddle:notriddle/collect-trait-impls-dup, ↵Yuki Okushi-2/+43
r=GuillaumeGomez rustdoc: avoid including impl blocks with filled-in generics Fixes #94937 # Before ![image](https://user-images.githubusercontent.com/1593513/168933282-02ccc4ae-9c89-4836-ba34-e2bd83946105.png) # After ![image](https://user-images.githubusercontent.com/1593513/168933255-4c17407d-d8d1-406e-87f5-9ea809437173.png)
2022-06-02Rollup merge of #95594 - the8472:raw_slice_methods, r=yaahcYuki Okushi-1/+118
Additional `*mut [T]` methods Split out from #94247 This adds the following methods to raw slices that already exist on regular slices * `*mut [T]::is_empty` * `*mut [T]::split_at_mut` * `*mut [T]::split_at_mut_unchecked` These methods reduce the amount of unsafe code needed to migrate `ChunksMut` and related iterators to raw slices (#94247) r? `@m-ou-se`
2022-06-01Auto merge of #97612 - ehuss:update-cargo, r=ehussbors-0/+0
Update cargo 5 commits in 39ad1039d9e3e1746177bf5d134af4c164f95528..38472bc19f2f76e245eba54a6e97ee6821b3c1db 2022-05-25 00:50:02 +0000 to 2022-05-31 02:03:24 +0000 - Emit warning upon encountering multiple packages with the same name (rust-lang/cargo#10701) - Guide new users to add use `super::*;` to `mod test` (rust-lang/cargo#10706) - Document how to debug change detection events (rust-lang/cargo#10708) - fix(publish): add more check when use `publish -p &lt;SPEC&gt;` (rust-lang/cargo#10677) - fix key formatting when switching to a dotted `WorkspaceSource` (rust-lang/cargo#10705)
2022-06-01rename PointerAddress → PointerExposeAddressRalf Jung-18/+23
2022-06-01rustdoc: add test case for auto traits on slice primitiveMichael Howell-0/+14
2022-06-01Auto merge of #97624 - matthiaskrgr:rollup-rtcqjx9, r=matthiaskrgrbors-78/+655
Rollup of 4 pull requests Successful merges: - #96271 (suggest `?` when method is missing on `Result<T, _>` but found on `T`) - #97264 (Suggest `extern crate foo` when failing to resolve `use foo`) - #97592 (rustdoc: also index impl trait and raw pointers) - #97621 (update Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-01Update src/librustdoc/passes/collect_trait_impls.rsMichael Howell-3/+5
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2022-06-01Mention filename in suggestion when it differs from primary spanEsteban Küber-4/+39
2022-06-01Improve calculation of "Impls on Foreign Types"Jacob Hoffman-Andrews-7/+29
2022-06-01Rollup merge of #97621 - RalfJung:miri, r=RalfJungMatthias Krüger-10/+11
update Miri Fixes https://github.com/rust-lang/rust/issues/97563 Cc ``@rust-lang/miri`` r? ``@ghost``
2022-06-01Rollup merge of #97592 - notriddle:notriddle/impl-trait, r=GuillaumeGomezMatthias Krüger-8/+182
rustdoc: also index impl trait and raw pointers Revives #92339
2022-06-01Rollup merge of #97264 - ↵Matthias Krüger-8/+94
TaKO8Ki:suggest-extern-crate-when-failing-to-resolve-use-crate, r=estebank Suggest `extern crate foo` when failing to resolve `use foo` closes #97095 r? ``@estebank``
2022-06-01Rollup merge of #96271 - compiler-errors:suggest-question-mark, r=estebankMatthias Krüger-52/+368
suggest `?` when method is missing on `Result<T, _>` but found on `T` The wording needs help, I think. Fixes #95729
2022-06-01Auto merge of #97622 - JohnTitor:rollup-4qoxrjn, r=JohnTitorbors-59/+257
Rollup of 9 pull requests Successful merges: - #94647 (Expose `get_many_mut` and `get_many_unchecked_mut` to HashMap) - #97216 (Ensure we never consider the null pointer dereferencable) - #97399 (simplify code of finding arg index in `opt_const_param_of`) - #97470 (rustdoc: add more test coverage) - #97498 (Corrected EBNF grammar for from_str) - #97562 (Fix comment in `poly_project_and_unify_type`) - #97580 (Add regression test for #71546) - #97611 (Tweak insert docs) - #97616 (Remove an unnecessary `Option`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-01Rollup merge of #97616 - TaKO8Ki:remove-unnecessary-option, r=Dylan-DPCYuki Okushi-4/+11
Remove an unnecessary `Option`
2022-06-01Rollup merge of #97611 - azdavis:master, r=Dylan-DPCYuki Okushi-7/+13
Tweak insert docs For `{Hash, BTree}Map::insert`, I always have to take a few extra seconds to think about the slight weirdness about the fact that if we "did not" insert (which "sounds" false), we return true, and if we "did" insert, (which "sounds" true), we return false. This tweaks the doc comments for the `insert` methods of those types (as well as what looks like a rustc internal data structure that I found just by searching the codebase for "If the set did") to first use the "Returns whether _something_" pattern used in e.g. `remove`, where we say that `remove` "returns whether the value was present".
2022-06-01Rollup merge of #97580 - JohnTitor:issue-71546, r=compiler-errorsYuki Okushi-0/+39
Add regression test for #71546 Closes #71546 r? `@compiler-errors`
2022-06-01Rollup merge of #97562 - ↵Yuki Okushi-14/+14
compiler-errors:comment-poly_project_and_unify_type, r=lcnr Fix comment in `poly_project_and_unify_type` Renamed some variants to match `ProjectAndUnifyResult`
2022-06-01Rollup merge of #97498 - ijchen:master, r=Mark-SimulacrumYuki Okushi-1/+0
Corrected EBNF grammar for from_str Hello! This is my first time contributing to an open-source project. I'm excited to have the chance to contribute to the rust community 🥳 I noticed an issue with the documentation for `from_str` in `f32` and `f64`. It states that "All strings that adhere to the following [EBNF](https://www.w3.org/TR/REC-xml/#sec-notation) grammar when lowercased will result in an `Ok` being returned. I believe this is incorrect for the string `"."`, which is valid for the given EBNF grammar, but does not result in an `Ok` being returned ([playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=09f891aa87963a56d3b0d715d8cbc2b4)). I have simplified the grammar in a way which fixes that, but is otherwise identical. Previously, the `Number` part of the EBNF grammar had an option for `'.' Digit*`, which would include the string `"."`. This is not valid, and does not return an Ok as stated. The corrected version removes this, and still allows for the `'.' Digit+` case with the already existing `Digit* '.' Digit+` case.
2022-06-01Rollup merge of #97470 - notriddle:notriddle/test-cases, r=GuillaumeGomezYuki Okushi-2/+47
rustdoc: add more test coverage https://github.com/rust-lang/rust/issues/91113
2022-06-01Rollup merge of #97399 - SparrowLii:arg_index, r=oli-obkYuki Okushi-31/+16
simplify code of finding arg index in `opt_const_param_of` From the FIXME in the impl of `opt_const_param_of`. Part of the code is simplified by blending two iterator statements and using `let...else` statement.
2022-06-01Rollup merge of #97216 - RalfJung:null-ptr-check, r=oli-obkYuki Okushi-0/+4
Ensure we never consider the null pointer dereferencable This replaces the checks that are being removed in https://github.com/rust-lang/rust/pull/97188. Those checks were too early and hence incorrect.
2022-06-01Rollup merge of #94647 - Urgau:hash-map-many-mut, r=AmanieuYuki Okushi-0/+113
Expose `get_many_mut` and `get_many_unchecked_mut` to HashMap This pull-request expose the function [`get_many_mut`](https://docs.rs/hashbrown/0.12.0/hashbrown/struct.HashMap.html#method.get_many_mut) and [`get_many_unchecked_mut`](https://docs.rs/hashbrown/0.12.0/hashbrown/struct.HashMap.html#method.get_many_unchecked_mut) from `hashbrown` to the standard library `HashMap` type. They obviously keep the same API and are added under the (new) `map_many_mut` feature. - `get_many_mut`: Attempts to get mutable references to `N` values in the map at once. - `get_many_unchecked_mut`: Attempts to get mutable references to `N` values in the map at once, without validating that the values are unique.
2022-06-01update MiriRalf Jung-10/+11
2022-06-01Add regression test for #71546Yuki Okushi-0/+39
2022-06-01remove an unnecessary `Option`Takayuki Maeda-4/+11
2022-05-31Update cargoEric Huss-0/+0
2022-05-31Tweak insert docsAriel Davis-7/+13
2022-06-01Auto merge of #97553 - nbdd0121:lib, r=Mark-Simulacrumbors-0/+2
Add `#[inline]` to `Vec`'s `Deref/DerefMut` This should help #97552 (although I haven't verified).
2022-06-01use 128 cache align for m1 macyifei-1/+2
2022-06-01Auto merge of #97435 - Patryk27:bump-compiler-builtins, r=Dylan-DPCbors-3/+3
library/std: Bump compiler_builtins Some neat changes include faster float conversions & fixes for AVR 🙂 (note that's it's my first time upgrading `compiler_builtins`, so I'm not 100% sure if bumping `library/std/Cargo.toml` is enough; certainly seems to be so, though.)
2022-05-31Auto merge of #97600 - matthiaskrgr:rollup-yivyeu5, r=matthiaskrgrbors-26/+46
Rollup of 4 pull requests Successful merges: - #97316 (Put a bound on collection misbehavior) - #97578 (alloc: remove repeated word in comment) - #97593 (:arrow_up: rust-analyzer) - #97596 (Fixup feature name to be more consistent with others) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-01Expose get_many_mut and get_many_unchecked_mut to HashMapLoïc BRANSTETT-0/+113
2022-05-31Rollup merge of #97596 - WaffleLapkin:fixup_feature_name, r=compiler-errorsMatthias Krüger-1/+1
Fixup feature name to be more consistent with others `slice_from_mut_ptr_range_const` -> `const_slice_from_mut_ptr_range`, we usually have `const` in the front. I've made a typo in #97419
2022-05-31Rollup merge of #97593 - lnicola:rust-analyzer-2022-05-31, r=lnicolaMatthias Krüger-7/+24
:arrow_up: rust-analyzer r? `@ghost`
2022-05-31Rollup merge of #97578 - ojeda:checkpatch, r=JohnTitorMatthias Krüger-1/+1
alloc: remove repeated word in comment Linux's `checkpatch.pl` reports: ```txt #42544: FILE: rust/alloc/vec/mod.rs:2692: WARNING: Possible repeated word: 'to' + // - Elements are :Copy so it's OK to to copy them, without doing ``` Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2022-05-31Rollup merge of #97316 - CAD97:bound-misbehavior, r=dtolnayMatthias Krüger-17/+20
Put a bound on collection misbehavior As currently written, when a logic error occurs in a collection's trait parameters, this allows *completely arbitrary* misbehavior, so long as it does not cause undefined behavior in std. However, because the extent of misbehavior is not specified, it is allowed for *any* code in std to start misbehaving in arbitrary ways which are not formally UB; consider the theoretical example of a global which gets set on an observed logic error. Because the misbehavior is only bound by not resulting in UB from safe APIs and the crate-level encapsulation boundary of all of std, this makes writing user unsafe code that utilizes std theoretically impossible, as it now relies on undocumented QOI (quality of implementation) that unrelated parts of std cannot be caused to misbehave by a misuse of std::collections APIs. In practice, this is a nonconcern, because std has reasonable QOI and an implementation that takes advantage of this freedom is essentially a malicious implementation and only compliant by the most langauage-lawyer reading of the documentation. To close this hole, we just add a small clause to the existing logic error paragraph that ensures that any misbehavior is limited to the collection which observed the logic error, making it more plausible to prove the soundness of user unsafe code. This is not meant to be formal; a formal refinement would likely need to mention that values derived from the collection can also misbehave after a logic error is observed, as well as define what it means to "observe" a logic error in the first place. This fix errs on the side of informality in order to close the hole without complicating a normal reading which can assume a reasonable nonmalicious QOI. See also [discussion on IRLO][1]. [1]: https://internals.rust-lang.org/t/using-std-collections-and-unsafe-anything-can-happen/16640 r? rust-lang/libs-api ```@rustbot``` label +T-libs-api -T-libs This technically adds a new guarantee to the documentation, though I argue as written it's one already implicitly provided.
2022-05-31Auto merge of #97582 - tmiasko:pointer-address-cast, r=oli-obkbors-94/+96
Add a pointer to address cast kind A pointer to address cast are often special-cased. Introduce a dedicated cast kind to make them easy distinguishable.
2022-05-31Fixup feature name to be more consistent with othersMaybe Waffle-1/+1
`slice_from_mut_ptr_range_const` -> `const_slice_from_mut_ptr_range`, we usually have `const` in the front.
2022-05-31:arrow_up: rust-analyzerLaurențiu Nicola-7/+24
2022-05-31rustdoc: also index raw pointersMichael Howell-2/+82
Co-authored-by: Noah Lev <camelidcamel@gmail.com>