about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2022-01-10Improve documentation for File::options to give a more likely exampleJosh Triplett-4/+5
`File::options().read(true).open(...)` is equivalent to just `File::open`. Change the example to set the `append` flag instead, and then change the filename to something more likely to be written in append mode.
2022-01-10Auto merge of #92719 - matthiaskrgr:rollup-tc7oqys, r=matthiaskrgrbors-137/+224
Rollup of 7 pull requests Successful merges: - #92248 (Normalize struct tail type when checking Pointee trait) - #92357 (Fix invalid removal of newlines from doc comments) - #92602 (Make source links look cleaner) - #92636 (Normalize generator-local types with unevaluated constants) - #92693 (Release notes: add `Result::unwrap_{,err_}unchecked`) - #92702 (Clean up lang_items::extract) - #92717 (update miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-10Rollup merge of #92717 - RalfJung:miri, r=RalfJungMatthias Krüger-8/+10
update miri Fixes https://github.com/rust-lang/rust/issues/92691 r? `@ghost`
2022-01-10Rollup merge of #92702 - ehuss:clean-lang_items-extract, r=petrochenkovMatthias Krüger-27/+9
Clean up lang_items::extract Noted in https://github.com/rust-lang/rust/pull/87739#pullrequestreview-740497194, lang_items::extract no longer needs to take a closure.
2022-01-10Rollup merge of #92693 - ojeda:relnotes, r=pietroalbiniMatthias Krüger-0/+4
Release notes: add `Result::unwrap_{,err_}unchecked` They were stabilized together with `Option::unwrap_unchecked` in https://github.com/rust-lang/rust/issues/81383. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2022-01-10Rollup merge of #92636 - compiler-errors:normalize-generator-const-expr, ↵Matthias Krüger-4/+32
r=oli-obk Normalize generator-local types with unevaluated constants Normalize generator-interior types in addition to (i.e. instead of just) erasing regions, since sometimes we collect types with unevaluated const exprs. Fixes #84737 Fixes #88171 Fixes #92091 Fixes #92634 Probably also fixes #73114, but that one has no code I could test. It looks like it's the same issue, though.
2022-01-10Rollup merge of #92602 - jsha:source-link-2, r=GuillaumeGomezMatthias Krüger-79/+96
Make source links look cleaner Change from syntaxy-looking [src] to the plain word "source". Change the syntaxy-looking `[-]` at the top of the page to say "collapse". Reduce opacity of rightside content. Part of #59851 r? `@GuillaumeGomez` Demo: https://rustdoc.crud.net/jsha/source-link-2/std/string/struct.String.html [Discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/display.20of.20source.20link).
2022-01-10Rollup merge of #92357 - GuillaumeGomez:fix-doc-comment-backline-removal, ↵Matthias Krüger-9/+12
r=camelid Fix invalid removal of newlines from doc comments Fixes https://github.com/rust-lang/rust/issues/91201. Before: ![Screenshot from 2021-12-28 17-02-11](https://user-images.githubusercontent.com/3050060/147585187-c8e67531-c1b4-457d-9d30-d5b44bf91fea.png) After: ![Screenshot from 2021-12-28 17-02-25](https://user-images.githubusercontent.com/3050060/147585190-30aa0398-1fc7-4fe7-9e8b-5c475d4f9613.png) r? `@camelid`
2022-01-10Rollup merge of #92248 - compiler-errors:normalize-type-for-pointee, r=jackh726Matthias Krüger-10/+61
Normalize struct tail type when checking Pointee trait Let's go ahead and implement the FIXMEs by properly normalizing the struct-tail type when satisfying a Pointee obligation. This should fix the ICE when we try to calculate a layout depending on `<Ty as Pointee>::Metadata` later. Fixes #92128 Fixes #92577 Additionally, mark the obligation as ambiguous if there are any infer types in that struct-tail type. This has the effect of causing `<_ as Pointee>::Metadata` to be properly replaced with an infer variable ([here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_trait_selection/src/traits/project.rs#L813)) and registered as an obligation... this turns out to be very important in unifying function parameters with formals that are assoc types. Fixes #91446
2022-01-10miriRalf Jung-8/+10
2022-01-10Auto merge of #87487 - lambinoo:I-64762_unreachable_pub_lint, r=petrochenkovbors-218/+359
Fixes wrong unreachable_pub lints on nested and glob public reexport Linked issues: #64762 & #82064
2022-01-10Auto merge of #92278 - Aaron1011:fix-fingerprint-caching, r=michaelwoeristerbors-46/+118
Ensure that `Fingerprint` caching respects hashing configuration Fixes #92266 In some `HashStable` impls, we use a cache to avoid re-computing the same `Fingerprint` from the same structure (e.g. an `AdtDef`). However, the `StableHashingContext` used can be configured to perform hashing in different ways (e.g. skipping `Span`s). This configuration information is not included in the cache key, which will cause an incorrect `Fingerprint` to be used if we hash the same structure with different `StableHashingContext` settings. To fix this, the configuration settings of `StableHashingContext` are split out into a separate `HashingControls` struct. This struct is used as part of the cache key, ensuring that our caches always produce the correct result for the given settings. With this in place, we now turn off `Span` hashing during the entire process of computing the hash included in legacy symbols. This current has no effect, but will matter when a future PR starts hashing more `Span`s that we currently skip.
2022-01-09Clean up lang_items::extractEric Huss-27/+9
Noted in https://github.com/rust-lang/rust/pull/87739#pullrequestreview-740497194, lang_items::extract no longer needs to take a closure.
2022-01-09Compute most of Public/Exported access level in rustc_resolveLamb-218/+359
Mak DefId to AccessLevel map in resolve for export hir_id to accesslevel in resolve and applied in privacy using local def id removing tracing probes making function not recursive and adding comments Move most of Exported/Public res to rustc_resolve moving public/export res to resolve fix missing stability attributes in core, std and alloc move code to access_levels.rs return for some kinds instead of going through them Export correctness, macro changes, comments add comment for import binding add comment for import binding renmae to access level visitor, remove comments, move fn as closure, remove new_key fmt fix rebase fix rebase fmt fmt fix: move macro def to rustc_resolve fix: reachable AccessLevel for enum variants fmt fix: missing stability attributes for other architectures allow unreachable pub in rustfmt fix: missing impl access level + renaming export to reexport Missing impl access level was found thanks to a test in clippy
2022-01-09Release notes: add `Result::unwrap_{,err_}unchecked`Miguel Ojeda-0/+4
They were stabilized together with `Option::unwrap_unchecked` in https://github.com/rust-lang/rust/issues/81383. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2022-01-09Auto merge of #92534 - Aaron1011:hash-hir, r=petrochenkovbors-10/+2
Hash `Ident` spans in all HIR structures This PR removes all of the `#[stable_hasher(project(name))]` attributes used in HIR structs. While these attributes are not known to be causing any issues in practice, we need to hash these in order for the incremental system to work correctly - a query could be otherwise be incorrectly marked green when a change occures in one of the `Span`s that it uses.
2022-01-09Auto merge of #92690 - matthiaskrgr:rollup-rw0oz05, r=matthiaskrgrbors-856/+1339
Rollup of 8 pull requests Successful merges: - #92055 (Add release notes for 1.58) - #92490 (Move crate drop-down to search results page) - #92510 (Don't resolve blocks in foreign functions) - #92573 (expand: Refactor InvocationCollector visitor for better code reuse) - #92608 (rustdoc: Introduce a resolver cache for sharing data between early doc link resolution and later passes) - #92657 (Implemented const casts of raw pointers) - #92671 (Make `Atomic*::from_mut` return `&mut Atomic*`) - #92673 (Remove useless collapse toggle on "all items" page) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-09Rollup merge of #92673 - GuillaumeGomez:remove-all-items-toggle, r=jshaMatthias Krüger-8/+0
Remove useless collapse toggle on "all items" page When clicking on this toggle, nothing happens because there is nothing to collapse. Instead of keeping it around, let's just remove it. Before: ![Screenshot from 2022-01-08 16-02-38](https://user-images.githubusercontent.com/3050060/148649149-821a1e77-8c34-4975-b50a-984ca8865518.png) After: ![Screenshot from 2022-01-08 16-02-32](https://user-images.githubusercontent.com/3050060/148649154-b5912a97-9229-46bd-be3c-df3c3fa3ac8f.png) r? `@jsha`
2022-01-09Rollup merge of #92671 - WaffleLapkin:atomic_from_mut_unique_ref, r=m-ou-seMatthias Krüger-6/+6
Make `Atomic*::from_mut` return `&mut Atomic*` ```rust impl Atomic* { pub fn from_mut(v: &mut bool) -> &mut Self; // ^^^^---- previously was just a & } ``` This PR makes `from_mut` atomic methods tracked in #76314 return unique references to atomic types, instead of shared ones. This makes `from_mut` and `get_mut` inverses of each other, allowing to undo either of them by the other. r? `@RalfJung` (as Ralf was [concerned](https://github.com/rust-lang/rust/issues/76314#issuecomment-955062593) about this)
2022-01-09Rollup merge of #92657 - Kixunil:ptr_as_const_mut, r=m-ou-seMatthias Krüger-0/+24
Implemented const casts of raw pointers This adds `as_mut()` method for `*const T` and `as_const()` for `*mut T` which are intended to make casting of consts safer. This was discussed in the [internals discussion][discussion]. Given that this is a simple change and multiple people agreed to it including `@RalfJung` I decided to go ahead and open the PR. [discussion]: https://internals.rust-lang.org/t/casting-constness-can-be-risky-heres-a-simple-fix/15933
2022-01-09Rollup merge of #92608 - petrochenkov:doctrscope3, r=CraftSpiderMatthias Krüger-259/+290
rustdoc: Introduce a resolver cache for sharing data between early doc link resolution and later passes The refactoring parts of https://github.com/rust-lang/rust/pull/88679, shouldn't cause any slowdowns. r? `@jyn514`
2022-01-09Rollup merge of #92573 - petrochenkov:ltrattr3, r=Aaron1011Matthias Krüger-540/+761
expand: Refactor InvocationCollector visitor for better code reuse The refactoring part of https://github.com/rust-lang/rust/pull/92473. Invocation collector visitor logic now lives in two main functions: - `fn flat_map_node`, corresponding to "one to many" expansions - `fn visit_node`, corresponding to "one to one" expansions All specific mut visitor methods now use one of these functions. The new `InvocationCollectorNode` trait implemented for all `AstFragment` nodes provides the necessary small pieces of functionality required to implement the `(flat_map,visit)_node` functions. r? `@Aaron1011`
2022-01-09Rollup merge of #92510 - inquisitivecrystal:foreign-block, r=cjgillotMatthias Krüger-3/+43
Don't resolve blocks in foreign functions Although it is an error for a foreign function to have a block, it is still possible at the level of the AST. #74204 made AST lowering skip over blocks belonging to foreign functions, since they're invalid. However, resolve still treated these blocks normally, resulting in a mismatch between the HIR and resolve, which could cause an ICE under certain circumstances. This PR changes resolve to skip over blocks belonging to foreign functions, as AST lowering does. Fixes #91370. r? ``@cjgillot``
2022-01-09Rollup merge of #92490 - jsha:crates-in-results, r=GuillaumeGomezMatthias Krüger-40/+45
Move crate drop-down to search results page This reduces clutter on doc pages. Part of #59840 r? ```@GuillaumeGomez``` Demo: https://rustdoc.crud.net/jsha/crates-in-results/std/index.html?search=str
2022-01-09Rollup merge of #92055 - tmandry:relnotes-1.58, r=pietroalbiniMatthias Krüger-0/+170
Add release notes for 1.58 r? `@rust-lang/release`
2022-01-09Auto merge of #92086 - petrochenkov:modchild, r=jackh726bors-118/+137
rustc_metadata: Optimize and document module children decoding The first commit limits the item in the `item_children`/`each_child_of_item` query to modules (in name resolution sense) and adds a corresponding assertion. The `associated_item_def_ids` query collecting children of traits and impls specifically now uses a simplified implementation not decoding unnecessary data instead of `each_child_of_item`, this gives a nice performance improvement. The second commit does some renaming that clarifies the terminology used for all items in a module vs `use` items only.
2022-01-09Auto merge of #92497 - bjorn3:remove_lazy_meta_min_size, r=eddybbors-32/+13
Remove LazyMeta::min_size It is extremely conservative and as such barely reduces the size of encoded Lazy distances, but does increase complexity.
2022-01-09rustc_middle: Rename `Export` to `ModChild` and add some commentsVadim Petrochenkov-64/+66
Also rename `module_exports`/`export_map` to `module_reexports`/`reexport_map` for clarity.
2022-01-09rustc_metadata: Rename `item_children(_untracked)` to ↵Vadim Petrochenkov-22/+27
`module_children(_untracked)` And `each_child_of_item` to `for_each_module_child`
2022-01-09rustc_metadata: Optimize and document module children decodingVadim Petrochenkov-38/+50
2022-01-08Auto merge of #92068 - fee1-dead:libcore2021, r=m-ou-sebors-68/+22
Switch all libraries to the 2021 edition The fix for https://github.com/rust-lang/rust/issues/88638#issuecomment-996620107 is to simply add const-stability for these functions. r? `@m-ou-se` Closes #88638.
2022-01-08remove float methodsPietro Albini-10/+0
2022-01-08Auto merge of #91919 - Aaron1011:query-recursive-read, r=michaelwoeristerbors-2/+76
Don't perform any new queries while reading a query result on disk In addition to being very confusing, this can cause us to add dep node edges between two queries that would not otherwise have an edge. We now panic if any new dep node edges are created during the deserialization of a query result. This requires serializing the full `AdtDef` to disk, instead of just serializing the `DefId` and invoking the `adt_def` query during deserialization. I'll probably split this up into several smaller PRs for perf runs.
2022-01-08Implemented const casts of raw pointersMartin Habovstiak-0/+24
This adds `as_mut()` method for `*const T` and `as_const()` for `*mut T` which are intended to make casting of consts safer. This was discussed in the [internals discussion][discussion]. [discussion]: https://internals.rust-lang.org/t/casting-constness-can-be-risky-heres-a-simple-fix/15933
2022-01-08Auto merge of #90639 - matthewjasper:leaf-def-cache, r=cjgillotbors-448/+483
Add a query for resolving an impl item from the trait item This makes finding the item in an impl that implements a given trait item a query. This is for a few reasons: - To slightly improve performance - To avoid having to do name resolution during monomorphisation - To make it easier to implement potential future features that create anonymous associated items
2022-01-08Remove useless collapse toggle on "all items" pageGuillaume Gomez-8/+0
2022-01-08Make source links look cleanerJacob Hoffman-Andrews-79/+96
Change from syntaxy-looking [src] to the plain word "source".
2022-01-08Make `Atomic*::from_mut` return `&mut Atomic*`Maybe Waffle-6/+6
2022-01-08Remove LazyMeta::min_sizebjorn3-32/+13
It is extremely conservative and as such barely reduces the size of encoded Lazy distances, but does increase complexity.
2022-01-08Auto merge of #92639 - pietroalbini:bump-version, r=pietroalbinibors-1/+1
Bump version to 1.60.0 Part of the release process, cc `@rust-lang/release` r? `@ghost`
2022-01-08Auto merge of #91305 - camelid:rm-cond, r=GuillaumeGomezbors-3/+0
rustdoc: Remove apparently unnecessary conditional in `doc_value` I need to remove this conditional for #91072, but while it seems unnecessary, we are not certain. So, the plan is to first remove the conditional and see if any regressions pop up before doing the refactor. This way, it will be easier to revert if there are subtle regressions. r? `@jyn514`
2022-01-08Auto merge of #92664 - ehuss:rollup-t9yrvk5, r=ehussbors-95/+142
Rollup of 8 pull requests Successful merges: - #84640 (Implement `TryFrom<char>` for `u8`) - #92336 (Remove &self from PrintState::to_string) - #92375 (Consolidate checking for msvc when generating debuginfo) - #92568 (Add note about non_exhaustive to variant_count) - #92600 (Add some missing `#[must_use]` to some `f{32,64}` operations) - #92610 (Create CSS class instead of using inline style for search results) - #92632 (Implement stabilization of `#[feature(available_parallelism)]`) - #92650 (Fix typo in `StableCrateId` docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-07Rollup merge of #92650 - pierwill:patch-2, r=michaelwoeristerEric Huss-2/+2
Fix typo in `StableCrateId` docs
2022-01-07Rollup merge of #92632 - yoshuawuyts:stabilize-available-parallelism, ↵Eric Huss-3/+1
r=joshtriplett Implement stabilization of `#[feature(available_parallelism)]` Stabilized in https://github.com/rust-lang/rust/issues/74479#issuecomment-984379800. Closes https://github.com/rust-lang/rust/issues/74479. Thanks! cc/ ``@rust-lang/libs-api``
2022-01-07Rollup merge of #92610 - GuillaumeGomez:css-class-instead-of-inline-style, ↵Eric Huss-2/+6
r=jsha Create CSS class instead of using inline style for search results I saw this change in the update you proposed in https://github.com/rust-lang/rust/pull/92404. :) r? ``@jsha``
2022-01-07Rollup merge of #92600 - asquared31415:float-must-use, r=joshtriplettEric Huss-0/+10
Add some missing `#[must_use]` to some `f{32,64}` operations This PR adds `#[must_use]` to the following methods: - `f32::recip` - `f32::max` - `f32::min` - `f32::maximum` - `f32::minimum` and their equivalents in `f64`. These methods all produce a new value without modifying the original and so are pointless to call without using the result.
2022-01-07Rollup merge of #92568 - Mark-Simulacrum:non-exhaustive-variant-count, r=the8472Eric Huss-0/+4
Add note about non_exhaustive to variant_count Since `variant_count` isn't returning something opaque, I thought it makes sense to explicitly call out that its return value may change for some enums. cc #73662
2022-01-07Rollup merge of #92375 - wesleywiser:consolidate_debuginfo_msvc_check, ↵Eric Huss-64/+65
r=michaelwoerister Consolidate checking for msvc when generating debuginfo If the target we're generating code for is msvc, then we do two main things differently: we generate type names in a C++ style instead of a Rust style and we generate debuginfo for enums differently. I've refactored the code so that there is one function (`cpp_like_debuginfo`) which determines if we should use the C++ style of naming types and other debuginfo generation or the regular Rust one. r? ``@michaelwoerister`` This PR is not urgent so please don't let it interrupt your holidays! 🎄 🎁
2022-01-07Rollup merge of #92336 - dtolnay:printstateself, r=michaelwoeristerEric Huss-24/+24
Remove &self from PrintState::to_string The point of `PrintState::to_string` is to create a `State` and evaluate the caller's closure on it: https://github.com/rust-lang/rust/blob/e9fbe79292783972a222afd270db3f77c0b4f3c8/compiler/rustc_ast_pretty/src/pprust/state.rs#L868-L872 Making the caller *also* construct and pass in a `State`, which is then ignored, was confusing.
2022-01-07Rollup merge of #84640 - ids1024:u8_from_char, r=m-ou-seEric Huss-0/+30
Implement `TryFrom<char>` for `u8` Previously suggested in https://github.com/rust-lang/rfcs/issues/2854. It makes sense to have this since `char` implements `From<u8>`. Likewise `u32`, `u64`, and `u128` (since #79502) implement `From<char>`.