about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2021-10-31Combine drain_filter callsAaron Hill-4/+4
2021-10-30Use SsoHashSetAaron Hill-2/+2
2021-10-30Deduplicate projection sub-obligationsAaron Hill-0/+6
2021-10-30Auto merge of #90416 - matthiaskrgr:rollup-55lzqng, r=matthiaskrgrbors-146/+393
Rollup of 8 pull requests Successful merges: - #89876 (Make most std::ops traits const on numeric types) - #90371 (Fix incorrect doc link) - #90374 (Unify titles in rustdoc book doc attributes chapter) - #90377 (Make `core::slice::from_raw_parts[_mut]` const) - #90395 (Restrict liveness of mutable borrow of inner infcx in ConstInferUnifier::consts) - #90396 (Prevent type flags assertions being thrown in default_anon_const_substs if errors occurred) - #90402 (Add a few query descriptions) - #90412 (Remove unnecessary `macro_use`s in rustdoc) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-30Rollup merge of #90412 - jyn514:macro-use, r=camelidMatthias Krüger-7/+6
Remove unnecessary `macro_use`s in rustdoc
2021-10-30Rollup merge of #90402 - wesleywiser:query_descriptions, r=oli-obkMatthias Krüger-1/+8
Add a few query descriptions
2021-10-30Rollup merge of #90396 - b-naber:type_flags_ices_default_anon_consts, r=lcnrMatthias Krüger-1/+49
Prevent type flags assertions being thrown in default_anon_const_substs if errors occurred Fixes https://github.com/rust-lang/rust/issues/90364 Fixes https://github.com/rust-lang/rust/issues/88997 r? ``@lcnr``
2021-10-30Rollup merge of #90395 - b-naber:const-expr-type-relation, r=oli-obkMatthias Krüger-9/+40
Restrict liveness of mutable borrow of inner infcx in ConstInferUnifier::consts Fixes https://github.com/rust-lang/rust/issues/89304 r? ``@oli-obk``
2021-10-30Rollup merge of #90377 - WaffleLapkin:const_slice_from_raw_parts, r=oli-obkMatthias Krüger-14/+43
Make `core::slice::from_raw_parts[_mut]` const Responses to #90012 seem to allow ``@rust-lang/wg-const-eval`` to decide on use of `const_eval_select`, so we can make `core::slice::from_raw_parts[_mut]` const :) --- This PR marks the following APIs as const: ```rust // core::slice pub const unsafe fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T]; pub const unsafe fn from_raw_parts_mut<'a, T>(data: *mut T, len: usize) -> &'a mut [T]; ``` --- Resolves #90011 r? ``@oli-obk``
2021-10-30Rollup merge of #90374 - GuillaumeGomez:unify-rustdoc-book-titles, r=camelidMatthias Krüger-7/+11
Unify titles in rustdoc book doc attributes chapter As discussed in https://github.com/rust-lang/rust/pull/90339. I wasn't able to find out where the link to the titles was used so let's see if the CI fails. :) r? ``@camelid``
2021-10-30Rollup merge of #90371 - Veykril:patch-2, r=jyn514Matthias Krüger-1/+1
Fix incorrect doc link Looks like a copy paste mistake
2021-10-30Rollup merge of #89876 - AlexApps99:const_ops, r=oli-obkMatthias Krüger-106/+235
Make most std::ops traits const on numeric types This PR makes existing implementations of `std::ops` traits (`Add`, `Sub`, etc) [`impl const`](https://github.com/rust-lang/rust/issues/67792) where possible. This affects: - All numeric primitives (`u*`, `i*`, `f*`) - `NonZero*` - `Wrapping` This is under the `rustc_const_unstable` feature `const_ops`. I will write tests once I know what can and can't be kept for the final version of this PR. Since this is my first PR to rustc (and hopefully one of many), please give me feedback on how to better handle the PR process wherever possible. Thanks [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Const.20std.3A.3Aops.20traits.20PR)
2021-10-30Auto merge of #89174 - ChrisDenton:automatic-verbatim-paths, r=dtolnaybors-13/+203
Automatically convert paths to verbatim for filesystem operations that support it This allows using longer paths without the user needing to `canonicalize` or manually prefix paths. If the path is already verbatim then this has no effect. Fixes: #32689
2021-10-30Auto merge of #88268 - GuillaumeGomez:generics-search-index, ↵bors-93/+147
r=notriddle,camelid,jyn514 rustdoc: Fix generics generation in search index The generics were not added to the search index as they should, instead they were added as arguments. I used this opportunity to allow generics to have generics themselves (will come in very handy for my current rewrite of the search engine!). r? `@jyn514`
2021-10-30Remove unnecessary `macro_use`s in rustdocJoshua Nelson-7/+6
2021-10-30Auto merge of #90403 - michaelwoerister:odht-0.3.1, r=Mark-Simulacrumbors-4/+4
Update odht crate to 0.3.1 (big-endian bugfix) Update `odht` to 0.3.1 in order to get https://github.com/rust-lang/odht/pull/20 which fixes issue https://github.com/rust-lang/rust/issues/90123.
2021-10-29Auto merge of #90346 - ferrocene:pa-short-circuit, r=oli-obkbors-7/+5
Replace some operators in libcore with their short-circuiting equivalents In libcore there are a few occurrences of bitwise operators used in boolean expressions instead of their short-circuiting equivalents. This makes it harder to perform some kinds of source code analysis over libcore, for example [MC/DC] code coverage (a requirement in safety-critical environments). This PR aims to remove as many bitwise operators in boolean expressions from libcore as possible, without any performance regression and without other changes. This means not all bitwise operators are removed, only the ones that don't have any difference with their short-circuiting counterparts. This already simplifies achieving MC/DC coverage, and the other functions can be changed in future PRs. The PR is best reviewed commit-by-commit, and each commit has the resulting assembly in the message. ## Checked integer methods These methods recently switched to bitwise operators in PRs https://github.com/rust-lang/rust/pull/89459 and https://github.com/rust-lang/rust/pull/89351. I confirmed bitwise operators are needed in most of the functions, except these two: * `{integer}::checked_div` ([Godbolt link (nightly)](https://rust.godbolt.org/z/17efh5jPc)) * `{integer}::checked_rem` ([Godbolt link (nightly)](https://rust.godbolt.org/z/85qGWc94K)) `@tspiteri` already mentioned this was the case in https://github.com/rust-lang/rust/pull/89459#issuecomment-932728384, but opted to also switch those two to bitwise operators for consistency. As that makes MC/DC analysis harder this PR proposes switching those two back to short-circuiting operators. ## `{unsigned_ints}::carrying_add` [Godbolt link (1.56.0)](https://rust.godbolt.org/z/vG9vx8x48) In this instance replacing the `|` with `||` produces the exact same assembly when optimizations are enabled, so switching to the short-circuiting operator shouldn't have any impact. ## `{unsigned_ints}::borrowing_sub` [Godbolt link (1.56.0)](https://rust.godbolt.org/z/asEfKaGE4) In this instance replacing the `|` with `||` produces the exact same assembly when optimizations are enabled, so switching to the short-circuiting operator shouldn't have any impact. ## String UTF-8 validation [Godbolt link (1.56.0)](https://rust.godbolt.org/z/a4rEbTvvx) In this instance replacing the `|` with `||` produces practically the same assembly, with the two operands for the "or" swapped: ```asm ; Old mov rax, qword ptr [rdi + rdx + 8] or rax, qword ptr [rdi + rdx] test rax, r9 je .LBB0_7 ; New mov rax, qword ptr [rdi + rdx] or rax, qword ptr [rdi + rdx + 8] test rax, r8 je .LBB0_7 ``` [MC/DC]: https://en.wikipedia.org/wiki/Modified_condition/decision_coverage
2021-10-29Apply changes proposed in the reviewMaybe Waffle-8/+9
2021-10-29Use proper issue number for `feature(const_slice_from_raw_parts)`Maybe Waffle-4/+4
2021-10-29Unify titles in rustdoc book doc attributes chapterGuillaume Gomez-7/+11
2021-10-29Fix invalid handling of genericsGuillaume Gomez-93/+147
2021-10-29Auto merge of #90390 - umanwizard:update-miri, r=RalfJungbors-9/+7
Update miri Fixes https://github.com/rust-lang/rust/issues/90298
2021-10-29Update odht crate to 0.3.1 (big-endian bugfix)Michael Woerister-4/+4
2021-10-29Auto merge of #90389 - camelid:rustdoc-rayon, r=jyn514bors-12/+3
rustdoc: Switch to mainline rayon The rustc fork of rayon integrates with Cargo's jobserver to limit the amount of parallelism. However, rustdoc's use case is concurrent I/O, which is not CPU-heavy, so it should be able to use mainline rayon. See [this discussion][1] for more details. [1]: https://github.com/rust-lang/rust/issues/90227#issuecomment-952468618 Note: I chose rayon 1.3.1 so that the rayon version used elsewhere in the workspace does not change. r? `@Mark-Simulacrum` cc `@jyn514`
2021-10-29Add a few query descriptionsWesley Wiser-1/+8
2021-10-29Auto merge of #90373 - tmiasko:union-qualification, r=oli-obkbors-1/+103
Use type based qualification for unions Union field access is currently qualified based on the qualification of a value previously assigned to the union. At the same time, every union access transmutes the content of the union, which might result in a different qualification. For example, consider constants A and B as defined below, under the current rules neither contains interior mutability, since a value used in the initial assignment did not contain `UnsafeCell` constructor. ```rust #![feature(untagged_unions)] union U { i: u32, c: std::cell::Cell<u32> } const A: U = U { i: 0 }; const B: std::cell::Cell<u32> = unsafe { U { i: 0 }.c }; ``` To avoid the issue, the changes here propose to consider the content of a union as opaque and use type based qualification for union types. Fixes #90268. `@rust-lang/wg-const-eval`
2021-10-29ignore type flags insertion in default_anon_const_substs if error occurredb-naber-1/+49
2021-10-29add testb-naber-0/+20
2021-10-29don't mutably borrow inner infcx in all of ConstInferUnifier::constsb-naber-9/+20
2021-10-29Auto merge of #90214 - tmiasko:indirect-mutation-qualif, ↵bors-63/+250
r=ecstatic-morse,oli-obk Consider indirect mutation during const qualification dataflow Previously a local would be qualified if either one of two separate data flow computations indicated so. First determined if a local could contain the qualif, but ignored any forms of indirect mutation. Second determined if a local could be mutably borrowed (and so indirectly mutated), but which in turn ignored the qualif. The end result was incorrect because the effect of indirect mutation was effectivelly ignored in the all but the final stage of computation. In the new implementation the indirect mutation is directly incorporated into the qualif data flow. The local variable becomes immediately qualified once it is mutably borrowed and borrowed place type can contain the qualif. In general we will now reject additional programs, program that were prevously unintentionally accepted. There are also some cases which are now accepted but were previously rejected, because previous implementation didn't consider whether borrowed place could have the qualif under the consideration. Fixes #90124. r? `@ecstatic-morse`
2021-10-29Auto merge of #90380 - Mark-Simulacrum:revert-89558-query-stable-lint, r=lcnrbors-299/+68
Revert "Add rustc lint, warning when iterating over hashmaps" Fixes perf regressions introduced in https://github.com/rust-lang/rust/pull/90235 by temporarily reverting the relevant PR.
2021-10-29Auto merge of #90363 - camelid:build-impl-perf, r=jyn514bors-3/+3
Improve perf measurements of `build_extern_trait_impl` Before, it was only measuring one callsite of `build_impl`, and it incremented the call count even if `build_impl` returned early because the `did` was already inlined. Now, it measures all calls, minus calls that return early.
2021-10-28rustdoc: Remove a single-use macroNoah Lev-10/+1
I think the new code is simpler and easier to understand.
2021-10-28Update miriBrennan Vincent-9/+7
2021-10-28rustdoc: Switch to mainline rayonNoah Lev-2/+2
The rustc fork of rayon integrates with Cargo's jobserver to limit the amount of parallelism. However, rustdoc's use case is concurrent I/O, which is not CPU-heavy, so it should be able to use mainline rayon. See this discussion [1] for more details. [1]: https://github.com/rust-lang/rust/issues/90227#issuecomment-952468618 Note: I chose rayon 1.3.1 so that the rayon version used elsewhere in the workspace does not change.
2021-10-28Auto merge of #90387 - matthiaskrgr:rollup-b2x8v0x, r=matthiaskrgrbors-655/+599
Rollup of 3 pull requests Successful merges: - #90082 (Fix minor typos) - #90336 (Remove extra lines in examples for `Duration::try_from_secs_*`) - #90376 (Various cleanups around opaque types) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-29Rollup merge of #90376 - oli-obk:🧹, r=spastorinoMatthias Krüger-650/+597
Various cleanups around opaque types Best reviewed commit by commit. This PR has no functional changes. Mostly it's moving logic from an extension trait in rustc_trait_selection to inherent impls on rustc_infer.
2021-10-29Rollup merge of #90336 - mbartlett21:patch-4, r=Mark-SimulacrumMatthias Krüger-3/+0
Remove extra lines in examples for `Duration::try_from_secs_*` None of the other examples have extra lines below the `#![feature(...)]` statements, so I thought it appropriate that these examples shouldn't either.
2021-10-29Rollup merge of #90082 - noncombatant:patch-1, r=GuillaumeGomezMatthias Krüger-2/+2
Fix minor typos
2021-10-28Auto merge of #90281 - xldenis:public-borrow-set, r=nikomatsakisbors-14/+14
Add BorrowSet to public api This PR adds `BorrowSet` to the public api so that verification tools can obtain the activation and reservation points of two phase borrows without having to redo calculations themselves (and thus potentially differently from rustc). Turns out we already can obtain `MoveData` thanks to the public `HasMoveData` trait, so constructing a `BorrowSet` should not provide much of an issue. However, I can't speak to the soundness of this approach, is it safe to take an under-approximation of `MoveData`? r? `@nikomatsakis`
2021-10-28Auto merge of #90218 - JakobDegen:adt_significant_drop_fix, r=nikomatsakisbors-45/+93
Fixes incorrect handling of ADT's drop requirements Fixes #90024 and a bunch of duplicates. The main issue was just that the contract of `NeedsDropTypes::adt_components` was inconsistent; the list of types it might return were the generic parameters themselves or the fields of the ADT, depending on the nature of the drop impl. This meant that the caller could not determine whether a `.subst()` call was still needed on those types; it called `.subst()` in all cases, and this led to ICEs when the returned types were the generic params. First contribution of more than a few lines, so feedback definitely appreciated.
2021-10-28Revert "Add rustc lint, warning when iterating over hashmaps"Mark Rousskov-299/+68
2021-10-28Make `core::slice::from_raw_parts[_mut]` constMaybe Waffle-14/+42
2021-10-28Move instantiate_opaque_types to rustc_infer.Oli Scherer-294/+283
It does not depend on anything from rustc_trait_selection anymore.
2021-10-28Move some functions into `rustc_infer`.Oli Scherer-318/+316
They don't depend on trait selection anymore, so there is no need for an extension trait.
2021-10-28Manually inline a function that is only ever called at the end of another ↵Oli Scherer-33/+6
function
2021-10-28Remove dead code.Oli Scherer-14/+1
We don't do member constraint checks in regionck anymore. All member constraint checks are done in mir borrowck.
2021-10-28Auto merge of #90145 - cjgillot:sorted-map, r=michaelwoeristerbors-57/+55
Use SortedMap in HIR. Closes https://github.com/rust-lang/rust/issues/89788 r? `@ghost`
2021-10-28Fix incorrect doc linkLukas Wirth-1/+1
2021-10-28Auto merge of #90339 - GuillaumeGomez:doc-alias-doc, r=GuillaumeGomezbors-2/+49
Add missing documentation for doc alias