Commit Graph

136102 Commits

Author SHA1 Message Date
Mara Bos 0aad91b990 Formatting. 2021-01-09 19:50:12 +01:00
Mara Bos d651fa78ce Allow #[rustc_builtin_macro = "name"].
This makes it possible to have both std::panic and core::panic as a
builtin macro, by using different builtin macro names for each.

Also removes SyntaxExtension::is_derive_copy, as the macro name (e.g.
sym::Copy) is now tracked and provides that information directly.
2021-01-09 19:50:06 +01: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
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
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
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
bors c8915eebea Auto merge of #80790 - JohnTitor:rollup-js1noez, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #80012 (Add pointing const identifier when emitting E0435)
 - #80521 (MIR Inline is incompatible with coverage)
 - #80659 (Edit rustc_ast::tokenstream docs)
 - #80660 (Properly handle primitive disambiguators in rustdoc)
 - #80738 (Remove bottom margin from crate version when the docs sidebar is collapsed)
 - #80744 (rustdoc: Turn `next_def_id` comments into docs)
 - #80750 (Don't use to_string on Symbol in rustc_passes/check_attr.rs)
 - #80769 (Improve wording of parse doc)
 - #80780 (Return EOF_CHAR constant instead of magic char.)
 - #80784 (rustc_parse: Better spans for synthesized token streams)

Failed merges:

 - #80785 (rustc_ast_pretty: Remove `PrintState::insert_extra_parens`)

r? `@ghost`
`@rustbot` modify labels: rollup
2021-01-07 18:20:12 +00:00
Marcus Svensson 358ef56216 Enclose types in comments in backticks 2021-01-07 18:36:25 +01:00
Marcus Svensson 10180b4c53 Fix type name in doc example for Iter and IterMut 2021-01-07 18:22:37 +01:00
Yuki Okushi 695f878332
Rollup merge of #80784 - petrochenkov:nontspan, r=Aaron1011
rustc_parse: Better spans for synthesized token streams

I think using the nonterminal span for synthesizing its tokens is a better approximation than using `DUMMY_SP` or the attribute span like #79472 did in `expand.rs`.

r? `@Aaron1011`
2021-01-08 02:06:20 +09:00
Yuki Okushi 695f18ebab
Rollup merge of #80780 - lianghanzhen:master, r=petrochenkov
Return EOF_CHAR constant instead of magic char.
2021-01-08 02:06:18 +09:00
Yuki Okushi a97dc5f103
Rollup merge of #80769 - ejez:patch-1, r=jonas-schievink
Improve wording of parse doc

Change:
```
`parse` can parse any type that...
```
to:
```
`parse` can parse into any type that...
```
Word `into` added to be more precise and in coherence with other parts of the doc.
2021-01-08 02:06:16 +09:00
Yuki Okushi fd7f2443f1
Rollup merge of #80750 - GuillaumeGomez:cleanup-to_string, r=lzutao
Don't use to_string on Symbol in rustc_passes/check_attr.rs

Improve code from #80686.

r? ``@lzutao``
2021-01-08 02:06:14 +09:00
Yuki Okushi 6fb79245e8
Rollup merge of #80744 - camelid:next_def_id-docs, r=jyn514
rustdoc: Turn `next_def_id` comments into docs

Split out from #80740.

r? ``@jyn514``
2021-01-08 02:06:13 +09:00
Yuki Okushi 94a27f2617
Rollup merge of #80738 - arusahni:master, r=GuillaumeGomez
Remove bottom margin from crate version when the docs sidebar is collapsed

This fixes a mobile UI bug where a vertical scrollbar would always be
rendered on the sidebar nav when the menu was closed.  When opened, the overflow would be handled by the opened sidebar, causing the scrollbar to disappear, and the contents to shift to the right.

## Firefox
**Before**
![before-ff](https://user-images.githubusercontent.com/139487/103713599-c2f74c00-4f8a-11eb-88c0-d5c6c088f8a0.png)
![before](https://user-images.githubusercontent.com/139487/103713793-2bdec400-4f8b-11eb-8223-94b77cc05f71.gif)

**After**
![after-ff](https://user-images.githubusercontent.com/139487/103713605-c8ed2d00-4f8a-11eb-9ee8-f86cafaa8775.png)
![after](https://user-images.githubusercontent.com/139487/103713805-31d4a500-4f8b-11eb-9e5b-4156402ca43e.gif)

## Chrome
**Before**
![localhost_8000_unicode_xid_ (1)](https://user-images.githubusercontent.com/139487/103713626-d60a1c00-4f8a-11eb-8605-cc98e04e9ad0.png)

**After**
![localhost_8000_unicode_xid_](https://user-images.githubusercontent.com/139487/103713622-d1456800-4f8a-11eb-8c66-7d19f81614ca.png)
2021-01-08 02:06:11 +09:00