Commit Graph

160800 Commits

Author SHA1 Message Date
Matthias Krüger
51001b35bd
Rollup merge of #92608 - petrochenkov:doctrscope3, r=CraftSpider
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-09 13:38:32 +01:00
Matthias Krüger
b681dc2af4
Rollup merge of #92573 - petrochenkov:ltrattr3, r=Aaron1011
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-09 13:38:31 +01:00
Matthias Krüger
464a0813d1
Rollup merge of #92510 - inquisitivecrystal:foreign-block, r=cjgillot
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-09 13:38:30 +01:00
Matthias Krüger
598364c995
Rollup merge of #92490 - jsha:crates-in-results, r=GuillaumeGomez
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-09 13:38:29 +01:00
Matthias Krüger
8dc3bf7221
Rollup merge of #92055 - tmandry:relnotes-1.58, r=pietroalbini
Add release notes for 1.58

r? `@rust-lang/release`
2022-01-09 13:38:28 +01:00
bors
02fe61b381 Auto merge of #92497 - bjorn3:remove_lazy_meta_min_size, r=eddyb
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-09 01:29:22 +00:00
bors
23ce5fc465 Auto merge of #92068 - fee1-dead:libcore2021, r=m-ou-se
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-08 21:41:48 +00:00
Pietro Albini
0e13d0c20e
remove float methods 2022-01-08 21:34:01 +01:00
bors
a7e2e33960 Auto merge of #91919 - Aaron1011:query-recursive-read, r=michaelwoerister
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-08 18:32:31 +00:00
bors
488acf86a7 Auto merge of #90639 - matthewjasper:leaf-def-cache, r=cjgillot
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-08 15:20:33 +00:00
bjorn3
717d4b35f8 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-08 13:55:33 +01:00
bors
66f64a441a Auto merge of #92639 - pietroalbini:bump-version, r=pietroalbini
Bump version to 1.60.0

Part of the release process, cc `@rust-lang/release`

r? `@ghost`
2022-01-08 12:06:40 +00:00
bors
02822334e9 Auto merge of #91305 - camelid:rm-cond, r=GuillaumeGomez
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-08 08:55:46 +00:00
bors
84abaf3f7d Auto merge of #92664 - ehuss:rollup-t9yrvk5, r=ehuss
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-08 06:01:37 +00:00
Eric Huss
05cfc4f4a9
Rollup merge of #92650 - pierwill:patch-2, r=michaelwoerister
Fix typo in `StableCrateId` docs
2022-01-07 20:21:02 -08:00
Eric Huss
10010685a9
Rollup merge of #92632 - yoshuawuyts:stabilize-available-parallelism, 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-07 20:21:01 -08:00
Eric Huss
759b13eb6c
Rollup merge of #92610 - GuillaumeGomez:css-class-instead-of-inline-style, 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-07 20:21:01 -08:00
Eric Huss
d43c9ad5d3
Rollup merge of #92600 - asquared31415:float-must-use, r=joshtriplett
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-07 20:21:00 -08:00
Eric Huss
0bd7e2ff2e
Rollup merge of #92568 - Mark-Simulacrum:non-exhaustive-variant-count, r=the8472
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-07 20:20:59 -08:00
Eric Huss
5cddd24daa
Rollup merge of #92375 - wesleywiser:consolidate_debuginfo_msvc_check, 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-07 20:20:58 -08:00
Eric Huss
81c515bf77
Rollup merge of #92336 - dtolnay:printstateself, r=michaelwoerister
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:

e9fbe79292/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-07 20:20:56 -08:00
Eric Huss
83de77dd5e
Rollup merge of #84640 - ids1024:u8_from_char, r=m-ou-se
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>`.
2022-01-07 20:20:55 -08:00
Noah Lev
9d625bc972 Fix accidental undo of 5e1972eba7 2022-01-07 14:16:56 -08:00
Matthew Jasper
9e5f23e2a6 Update clippy for associated item changes 2022-01-07 13:31:46 -08:00
Matthew Jasper
3b7d496f72 Add query to avoid name comparison in leaf_def 2022-01-07 13:31:36 -08:00
Matthew Jasper
1b057a33bd Move associated_item* providers to their own module 2022-01-07 13:23:35 -08:00
Ian Douglas Scott
a02639dc09 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>`.
2022-01-07 12:28:47 -08:00
Matthew Jasper
d7595853a2 Add trait_item_def_id to AssocItem
This allows avoiding some lookups by name
2022-01-07 12:28:12 -08:00
Matthew Jasper
0b1ab91d66 Deserialization less in associated_item_def_ids 2022-01-07 11:50:42 -08:00
Wesley Wiser
836addcbc4 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.
2022-01-07 12:36:09 -05:00
Tyler Mandry
81963b12c5 Clarify that -C strip is only in rustc, not cargo, in 1.58 2022-01-07 16:49:14 +00:00
Tyler Mandry
dd9501f8d3 Fix broken link 2022-01-07 16:48:47 +00:00
pierwill
130ba4718e
Fix typo in StableCrateId docs 2022-01-07 10:26:26 -06:00
Pietro Albini
18d1551f3b
bump version to 1.60.0 2022-01-07 10:04:15 +01:00
Vadim Petrochenkov
5acd1f91a0 rustdoc: Introduce a resolver cache for sharing data between early doc link resolution and later passes 2022-01-07 16:21:53 +08:00
Vadim Petrochenkov
4523466770 expand: Import more AST enums 2022-01-07 14:54:16 +08:00
Vadim Petrochenkov
800ba8f8e8 expand: Refactor InvocationCollector visitor for better code reuse 2022-01-07 14:41:22 +08:00
Vadim Petrochenkov
4fd23350cd expand: Remove some unnecessary self mutability 2022-01-07 13:50:03 +08:00
Vadim Petrochenkov
dc7e771155 expand: Rename some AstFragments to match AST structures 2022-01-07 13:50:03 +08:00
Yoshua Wuyts
3632f41c78 Stabilize #[feature(available_parallelism)] 2022-01-07 01:07:10 +01:00
bors
e012a191d7 Auto merge of #92627 - matthiaskrgr:rollup-xmz0rib, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #91055 (return the correct type for closures in `type_of`)
 - #92207 (Delay remaining `span_bug`s in drop elaboration)
 - #92417 (Fix spacing and ordering of words in pretty printed Impl)
 - #92504 (Exit nonzero on rustc -Wall)
 - #92559 (RustWrapper: adapt to new AttributeMask API)
 - #92589 (Break the loop)
 - #92607 (rustc_metadata: Some minor cleanups and optimizations)
 - #92620 (Remove unused `ExtendDefault` struct)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-01-06 22:56:13 +00:00
Matthias Krüger
fcae1d64d9
Rollup merge of #92620 - steffahn:remove_unused_ExtendDefault_struct, r=Mark-Simulacrum
Remove unused `ExtendDefault` struct

As noted in https://github.com/rust-lang/rust/pull/77850#issuecomment-1002272054, this struct is no longer used.
2022-01-06 23:15:23 +01:00
Matthias Krüger
140b6cb1ba
Rollup merge of #92607 - petrochenkov:doctrscope2, r=cjgillot
rustc_metadata: Some minor cleanups and optimizations

Mostly extracted from https://github.com/rust-lang/rust/pull/88679 (which is otherwise a rustdoc PR).
r? ``@cjgillot``
2022-01-06 23:15:21 +01:00
Matthias Krüger
0c9cf9a9ea
Rollup merge of #92589 - ChrisDenton:break-loop, r=Mark-Simulacrum
Break the loop

A missing break statement lead to an infinite loop in bootstrap.py.

I also added a short sleep so it's not constantly running at 100%. But I can remove that if it's not wanted.

Fixes #76661
2022-01-06 23:15:20 +01:00
Matthias Krüger
1591dcb659
Rollup merge of #92559 - durin42:llvm-14-attributemask, r=nikic
RustWrapper: adapt to new AttributeMask API

Upstream LLVM change 9290ccc3c1a1 migrated attribute removal to use
AttributeMask instead of AttrBuilder, so we need to follow suit here.

r? ``@nagisa`` cc ``@nikic``
2022-01-06 23:15:18 +01:00
Matthias Krüger
844a657bb8
Rollup merge of #92504 - dtolnay:wall, r=jackh726
Exit nonzero on rustc -Wall

Previously `rustc -Wall /dev/null` would print a paragraph explaining that `-Wall` is not a thing in Rust, but would then exit 0. I believe exiting 0 is not the right behavior. For something like `rustc --version` or `rustc --help` or `rustc -C help` the user is requesting rustc to print some information; rustc prints that information and exits 0 because what the user requested has been accomplished. In the case of `rustc -Wall path/to/main.rs`, I don't find it correct to conceptualize this as "the user requested rustc to print information about the fact that Wall doesn't exist". The user requested a particular thing, and despite rustc knowing what they probably meant and informing them about that, the thing they requested has *not* been accomplished. Thus a nonzero exit code is needed.
2022-01-06 23:15:17 +01:00
Matthias Krüger
1a8f69826c
Rollup merge of #92417 - dtolnay:printimpl, r=jackh726
Fix spacing and ordering of words in pretty printed Impl

Follow-up to #92238 fixing one of the FIXMEs.

```rust
macro_rules! repro {
    ($item:item) => {
        stringify!($item)
    };
}

fn main() {
    println!("{}", repro!(impl<T> Struct<T> {}));
    println!("{}", repro!(impl<T> const Trait for T {}));
}
```

Before:&ensp;`impl <T> Struct<T> {}`
After:&ensp;`impl<T> Struct<T> {}`

Before:&ensp;`impl const <T> Trait for T {}` 😿
After:&ensp;`impl<T> const Trait for T {}`
2022-01-06 23:15:16 +01:00
Matthias Krüger
0604cf5fd8
Rollup merge of #92207 - tmiasko:delay-drop-elaboration-bug, r=jackh726
Delay remaining `span_bug`s in drop elaboration

This follows changes from #67967 and converts remaining `span_bug`s into
delayed bugs, since for const items drop elaboration might be executed
on a MIR which failed borrowck.

Fixes #81708.
Fixes #91816.
2022-01-06 23:15:14 +01:00
Matthias Krüger
cdc5c1381d
Rollup merge of #91055 - lcnr:type_of-closures, r=nikomatsakis
return the correct type for closures in `type_of`

A bit unhappy about the way `typeck::check_crate` works rn. Would have preferred to not change `CollectItemTypesVisitor` in this way.

r? ``@nikomatsakis``
2022-01-06 23:15:13 +01:00
David Tolnay
7174ec22cf
Exit nonzero on rustc -Wall 2022-01-06 13:30:57 -08:00