Commit graph

136111 commits

Author SHA1 Message Date
Camelid
2750e36209 rustdoc: Resolve &str as str
People almost always are referring to `&str`, not `str`, so this will
save a manual link resolve in many cases.

Note that we already accept `&` (resolves to `reference`) in intra-doc
links, so this shouldn't cause breakage.
2021-01-10 12:51:48 -08:00
bors
f30733adb9 Auto merge of #80441 - petrochenkov:kwtok, r=Aaron1011
ast: Remove some indirection layers from values in key-value attributes

Trying to address some perf regressions from https://github.com/rust-lang/rust/pull/78837#issuecomment-745380762.
2021-01-09 22:19:46 +00:00
bors
6184f23950 Auto merge of #80830 - Aaron1011:capture-token-empty-stack, r=petrochenkov
Use an empty `TokenCursorFrame` stack when capturing tokens

We will never need to pop  past our starting frame during token
capturing. Using an empty stack allows us to avoid pointless heap
allocations/deallocations.
2021-01-09 19:33:23 +00:00
Vadim Petrochenkov
71cd6f42a6 ast: Remove some indirection layers from values in key-value attributes 2021-01-09 21:50:39 +03:00
bors
d0beb70a65 Auto merge of #80563 - petrochenkov:expattronmac, r=Aaron1011
resolve/expand: Improve attribute expansion on macro definitions and calls

- Do not forget to visit attributes on macro definitions and calls in couple of places.
- Remove some weird special treatment of macro definition items, which is probably left from old times when macro definitions were treated more like macro calls.

Fixes https://github.com/rust-lang/rust/issues/80540
2021-01-09 16:46:54 +00:00
Vadim Petrochenkov
d81c1946c6 resolve/expand: Improve attribute expansion on macro definitions and calls 2021-01-09 18:43:01 +03:00
bors
ef589490a7 Auto merge of #80808 - CAD97:patch-3, r=nagisa
Fix typo in Step trait

... I don't know how this major typo happened, whoops 🙃

`@bors` rollup=always
(comment only change)
2021-01-09 13:56:15 +00:00
bors
46c35c76fe Auto merge of #80797 - pietroalbini:fix-relative-install, r=Mark-Simulacrum
Fix x.py install not working with relative prefix

The code powering `./x.py install` did not handle relative paths well: the installation script is executed inside a temporary directory, so all the relative paths specified in `config.toml` and in the `DESTDIR` environment variable were relative to that temporary directory. The original code fixed the problem for `config.toml` paths by canonicalizing the prefix, but breaking `DESTDIR`. https://github.com/rust-lang/rust/pull/80240 fixed the `DESTDIR` problem, but also regressed `config.toml` paths (#80683).

This PR refactors the installation code to generate paths that *in my understanding* are correct, adding comments in the meantime to explain what each step does. There was no documentation on why choices were made before, so my understanding could actually be wrong.

Regardless, executed `./x.py install` with various combinations of `config.toml` and `DESTDIR` paths, and everything seems to work according to my understanding. Still, I'd love if `@vext01` and `@yshui` could test these changes.

r? `@Mark-Simulacrum`
`@rustbot` modify labels: beta-nominated T-infra
2021-01-09 11:06:46 +00:00
bors
1f9dc9a182 Auto merge of #80755 - sunfishcode:path-cleanup/copy, r=nagisa
Optimize away some path lookups in the generic `fs::copy` implementation

This also eliminates a use of a `Path` convenience function, in support
of #80741, refactoring `std::path` to focus on pure data structures and
algorithms.
2021-01-09 07:48:53 +00:00
bors
c87ef0a2fc Auto merge of #80749 - as-com:target-cpu-actually-native, r=nagisa
Make target-cpu=native detect individual features

This PR makes target-cpu=native check for and enable/disable individual features instead of detecting and targeting a CPU by name. This brings the flag's behavior more in line with clang and gcc and ensures that the host actually supports each feature that we are compiling for.

This should resolve issues with miscompilations on e.g. "Haswell" Pentiums and Celerons that lack support for AVX, and also enable support for `aes` on Broadwell processors that support it. It should also resolve issues with failing to detect feature support in newer CPUs that aren't yet known by LLVM (see: #80633).

Fixes #54688
Fixes #48464
Fixes #38218
2021-01-09 04:36:24 +00:00
Aaron Hill
7b36408b5f
Use an empty TokenCursorFrame stack when capturing tokens
We will never need to pop  past our starting frame during token
capturing. Using an empty stack allows us to avoid pointless heap
allocations/deallocations.
2021-01-08 18:16:20 -05:00
bors
26438b4738 Auto merge of #78452 - cjgillot:ddk-struct, r=Mark-Simulacrum
Access query (DepKind) metadata through fields

This refactors the access to query definition metadata (attributes such as eval always, anon, has_params) and loading/forcing functions to generate a number of structs, instead of matching on the DepKind enum. This makes access to the fields cheaper to compile. Using a struct means that finding the metadata for a given query is just an offset away; previously the match may have been compiled to a jump table but likely not completely inlined as we expect here.

A previous attempt explored a similar strategy, but using trait objects in #78314 that proved less effective, likely due to higher overheads due to forcing dynamic calls and poorer cache utilization (all metadata is fairly densely packed with this PR).
2021-01-08 18:16:00 +00:00
Camille GILLOT
0f334c3642 Check is_anon outside of can_reconstruct_query_key. 2021-01-08 18:03:27 +01:00
Camille GILLOT
5fcc537d18 Make DepConstructor a module. 2021-01-08 18:02:04 +01:00
Camille GILLOT
921b284167 Make force_from_dep_node a function pointer. 2021-01-08 18:01:50 +01:00
Camille GILLOT
bee1fbb67e Make try_load_from_on_disk_cache a function pointer. 2021-01-08 17:59:27 +01:00
Camille GILLOT
438c430c76 Make can_reconstruct_query_key a function pointer. 2021-01-08 17:57:25 +01:00
Camille GILLOT
5027f1c6ea Use a field for has_params. 2021-01-08 17:55:46 +01:00
Camille GILLOT
d8c87ac080 Use a field for is_eval_always. 2021-01-08 17:53:38 +01:00
Camille GILLOT
24f0b957e7 Use a field for is_anon. 2021-01-08 17:51:53 +01:00
Andrew Sun
80ca198212 Check if the pointer is null/string is not utf8 2021-01-08 11:50:21 -05:00
Camille GILLOT
016ea6b319 Use a side-table of consts instead of matching on the DepKind enum. 2021-01-08 17:48:02 +01:00
Camille GILLOT
d1220fdedf Simplify DepNodeParams. 2021-01-08 17:29:49 +01:00
Camille GILLOT
79a57625f5 Move DepNodeExt outside of the macro. 2021-01-08 17:29:48 +01:00
bors
ddf2cc7f8e Auto merge of #76896 - spastorino:codegen-inline-fns2, r=davidtwco,wesleywiser
Do not make local copies of inline fns in debug mode

r? `@wesleywiser`

cc `@rust-lang/wg-incr-comp`

If this is correct it supersedes https://github.com/rust-lang/rust/pull/76889

Related to #54089
2021-01-08 15:21:45 +00:00
bors
937f629535 Auto merge of #80653 - jryans:doc-deref-recursive, r=jyn514,GuillaumeGomez
Recursively document methods via `Deref` traits

This changes `rustdoc` to recursively follow `Deref` targets so that methods from all levels are added to the rendered output. This implementation displays the methods from all levels in the expanded state with separate sections for each level.

![image](https://user-images.githubusercontent.com/279572/103482863-46723b00-4ddb-11eb-972b-c463351a425c.png)

Fixes https://github.com/rust-lang/rust/issues/26207
Fixes https://github.com/rust-lang/rust/issues/53038
Fixes https://github.com/rust-lang/rust/issues/71640

r? `@jyn514`
2021-01-08 12:34:20 +00:00
bors
3d8608a863 Auto merge of #80535 - JohnTitor:improve-use-diag, r=estebank
Add a note for `*` and `{}` usage on `use`

Closes #80333
2021-01-08 09:51:26 +00:00
Yuki Okushi
d063745023 Add a note for * and {} usage on use 2021-01-08 17:36:14 +09:00
J. Ryan Stinnett
ea946071dd Combine several push_str calls 2021-01-08 07:15:03 +00:00
J. Ryan Stinnett
8eaf68f92c Preserve non-local recursive Deref impls
This adjusts the `rustdoc` trait impl collection path to preserve `Deref` impls
from other crates. This adds a first pass to map all of the `Deref` type to
target edges and then recursively preserves all targets.
2021-01-08 07:15:03 +00:00
J. Ryan Stinnett
06ce97c3c9 Use target in Deref method section IDs
There can now be multiple `Deref` method sections, so this adds the target type
to the section ID to ensure they are unique.
2021-01-08 07:15:03 +00:00
J. Ryan Stinnett
fd0ad03902 Recursively document methods via Deref traits 2021-01-08 07:15:03 +00:00
bors
569e542f9f Auto merge of #80756 - sunfishcode:path-cleanup/rustc-incremental, r=nagisa
Optimize away some `fs::metadata` calls.

This also eliminates a use of a `Path` convenience function, in support
of #80741, refactoring `std::path` to focus on pure data structures and
algorithms.
2021-01-08 07:01:30 +00:00
Andrew Sun
bc4c5bac40 Use LLVMGetHostCPUFeatures instead of stdsimd 2021-01-07 23:25:19 -05:00
bors
9155a9dae5 Auto merge of #80806 - JohnTitor:rollup-y64z7ph, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #79675 (Make sure rust-call errors occur correctly for traits)
 - #80372 (Don't panic when an external crate can't be resolved)
 - #80761 (handle generic trait methods in coverage-report tests)
 - #80785 (rustc_ast_pretty: Remove `PrintState::insert_extra_parens`)
 - #80791 (Fix type name in doc example for Iter and IterMut)
 - #80794 (Use Option::map_or instead of `.map(..).unwrap_or(..)`)
 - #80799 (Get rid of custom pretty-printing in rustdoc)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-01-08 03:09:03 +00:00
Christopher Durham
02850d3f30
Fix typo in Step trait 2021-01-07 21:29:17 -05:00
Yuki Okushi
dec3dbd36a
Rollup merge of #80799 - jyn514:pretty-print, r=CraftSpider
Get rid of custom pretty-printing in rustdoc

and use rustc_hir_pretty directly instead.

Closes https://github.com/rust-lang/rust/issues/79497.

r? `@CraftSpider`
2021-01-08 11:11:50 +09:00
Yuki Okushi
faf5412cd1
Rollup merge of #80794 - LingMan:map_or, r=jyn514
Use Option::map_or instead of `.map(..).unwrap_or(..)`

r? `@jyn514`
`@rustbot` modify labels +C-cleanup +T-rustdoc
2021-01-08 11:11:48 +09:00
Yuki Okushi
1ed90e4f06
Rollup merge of #80791 - mrcz:master, r=jyn514
Fix type name in doc example for Iter and IterMut
2021-01-08 11:11:47 +09:00
Yuki Okushi
f6c58afe15
Rollup merge of #80785 - petrochenkov:prettyparen, r=Aaron1011
rustc_ast_pretty: Remove `PrintState::insert_extra_parens`

It's no longer necessary after #79472.

r? `@Aaron1011`
2021-01-08 11:11:45 +09:00
Yuki Okushi
c851ae9d26
Rollup merge of #80761 - andjo403:generic_coverage, r=spastorino
handle generic trait methods in coverage-report tests

also make the generic function pattern more specific and remove the extra $ that fails the matching.

r? `@wesleywiser`
as this was failing the test of #76896
2021-01-08 11:11:43 +09:00
Yuki Okushi
901b9a2d7b
Rollup merge of #80372 - jyn514:fix-panics, r=Manishearth
Don't panic when an external crate can't be resolved

This isn't actually a bug, it can occur when rustdoc tries to resolve a
crate that isn't used in the main code.

Fixes #72381.

r? `@kinnison` if you have time, otherwise `@Manishearth`
2021-01-08 11:11:41 +09:00
Yuki Okushi
0afd72e313
Rollup merge of #79675 - CraftSpider:79669, r=estebank
Make sure rust-call errors occur correctly for traits

Fixes #79669

Adds trait method resolution to the error, and adds UI tests to ensure it doesn't happen again. Opening as draft because I'm getting weird link errors from unrelated code on my machine, and want to see what CI thinks.
2021-01-08 11:11:34 +09:00
bors
92c625d0f7 Auto merge of #80746 - ehuss:update-cargo, r=ehuss
Update cargo

12 commits in 75d5d8cffe3464631f82dcd3c470b78dc1dda8bb..329895f5b52a358e5d9ecb26215708b5cb31d906
2020-12-22 18:10:56 +0000 to 2021-01-06 00:01:52 +0000
- metadata: Supply local path for path dependencies (rust-lang/cargo#8994)
- Add support for Rust edition 2021. (rust-lang/cargo#8922)
- Stabilize -Zfeatures and -Zpackage-features. (rust-lang/cargo#8997)
- Small refactor, adding a list of all kinds to BuildContext (rust-lang/cargo#9046)
- Fix git http.proxy config setting. (rust-lang/cargo#8986)
- Clarify the help text of `--aggressive` and `--precise` of `update` (rust-lang/cargo#9031)
- Assert that tests are run in the crate directory (rust-lang/cargo#9037)
- Update mdbook (rust-lang/cargo#9044)
- Bump to 0.52.0, update changelog (rust-lang/cargo#9042)
- Fix redundant semicolon. (rust-lang/cargo#9033)
- Clarify fingerprint log messages (rust-lang/cargo#9026)
- Update credential docs for gnome-secret. (rust-lang/cargo#9013)
2021-01-08 00:20:06 +00:00
Joshua Nelson
31375d2074 Get rid of custom pretty-printing in rustdoc
and use rustc_hir_pretty directly instead
2021-01-07 17:44:59 -05:00
Vadim Petrochenkov
f915e3e5cf rustc_ast_pretty: Remove PrintState::insert_extra_parens
It's no longer necessary after #79472
2021-01-08 00:43:38 +03:00
bors
e02b0f4a55 Auto merge of #80709 - lzutao:target-enumerate, r=petrochenkov
Limit target endian to an enum instead of free string

This is #77604 revived.
2021-01-07 21:33:57 +00:00
Pietro Albini
2caf9bcb33
bootstrap: fix x.py install not working with relative prefix 2021-01-07 20:40:42 +01:00
LingMan
961f9ee6df Use Option::map_or instead of .map(..).unwrap_or(..) 2021-01-07 20:03:59 +01:00
Andreas Jonson
4f6305bc37 handle generic trait methods in coverage tests
make the generic function pattern more specific
2021-01-07 19:40:19 +01:00