]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #79502 - Julian-Wollersberger:from_char_for_u64, r=withoutboats
Yuki Okushi [Sun, 10 Jan 2021 07:55:53 +0000 (16:55 +0900)]
Rollup merge of #79502 - Julian-Wollersberger:from_char_for_u64, r=withoutboats

Implement From<char> for u64 and u128.

With this PR you can write
```
let u = u64::from('👤');
let u = u128::from('👤');
```

Previously, you could already write `as` conversions ([Playground link](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=cee18febe28e69024357d099f07ca081)):
```
// Lossless conversions
dbg!('👤' as u32);    // Prints 128100
dbg!('👤' as u64);    // Prints 128100
dbg!('👤' as u128);   // Prints 128100

// truncates, thus no `From` impls.
dbg!('👤' as u8);     // Prints 100
dbg!('👤' as u16);    // Prints 62564

// These `From` impls already exist.
dbg!(u32::from('👤'));               // Prints 128100
dbg!(u64::from(u32::from('👤')));    // Prints 128100
```

The idea is from ``@gendx`` who opened [this Internals thread](https://internals.rust-lang.org/t/implement-from-char-for-u64/13454), and ``@withoutboats`` responded that someone should open a PR for it.
Some people mentioned `From<char>` impls for `f32` and `f64`, but that doesn't seem correct to me, so I didn't include them here.

I don't know what the feature should be named. Must it be registered somewhere, like unstable features?

r? ``@withoutboats``

3 years agoAuto merge of #80831 - jyn514:no-inline, r=Mark-Simulacrum
bors [Sun, 10 Jan 2021 01:08:41 +0000 (01:08 +0000)]
Auto merge of #80831 - jyn514:no-inline, r=Mark-Simulacrum

Don't mark `force_query_with_job` as `inline(always)`

It's rather large, and using `inline(always)` forces it to be recompiled
in each calling crate. Hopefully this change will help with #65031. I intentionally only removed inline from `force_query_with_job` because the other functions are tiny and I wanted to measure this change on its own.

This may conflict with https://github.com/rust-lang/rust/issues/78780. I am not sure if it will hurt or help.

cc `@cjgillot`

3 years agoAuto merge of #80441 - petrochenkov:kwtok, r=Aaron1011
bors [Sat, 9 Jan 2021 22:19:46 +0000 (22:19 +0000)]
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.

3 years agoAuto merge of #80830 - Aaron1011:capture-token-empty-stack, r=petrochenkov
bors [Sat, 9 Jan 2021 19:33:23 +0000 (19:33 +0000)]
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.

3 years agoast: Remove some indirection layers from values in key-value attributes
Vadim Petrochenkov [Sat, 19 Dec 2020 20:38:22 +0000 (23:38 +0300)]
ast: Remove some indirection layers from values in key-value attributes

3 years agoAuto merge of #80563 - petrochenkov:expattronmac, r=Aaron1011
bors [Sat, 9 Jan 2021 16:46:54 +0000 (16:46 +0000)]
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

3 years agoresolve/expand: Improve attribute expansion on macro definitions and calls
Vadim Petrochenkov [Thu, 31 Dec 2020 14:59:09 +0000 (17:59 +0300)]
resolve/expand: Improve attribute expansion on macro definitions and calls

3 years agoAuto merge of #80808 - CAD97:patch-3, r=nagisa
bors [Sat, 9 Jan 2021 13:56:15 +0000 (13:56 +0000)]
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)

3 years agoUpdate the stabilisation version.
Julian Wollersberger [Sat, 9 Jan 2021 11:31:30 +0000 (12:31 +0100)]
Update the stabilisation version.

3 years agoAuto merge of #80797 - pietroalbini:fix-relative-install, r=Mark-Simulacrum
bors [Sat, 9 Jan 2021 11:06:46 +0000 (11:06 +0000)]
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

3 years agoAuto merge of #80755 - sunfishcode:path-cleanup/copy, r=nagisa
bors [Sat, 9 Jan 2021 07:48:53 +0000 (07:48 +0000)]
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.

3 years agoAuto merge of #80749 - as-com:target-cpu-actually-native, r=nagisa
bors [Sat, 9 Jan 2021 04:36:24 +0000 (04:36 +0000)]
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

3 years agoDon't mark `force_query_with_job` as `inline(always)`
Joshua Nelson [Fri, 8 Jan 2021 23:38:33 +0000 (18:38 -0500)]
Don't mark `force_query_with_job` as `inline(always)`

It's rather large, and using `inline(always)` forces it to be recompiled
in each calling crate.

3 years agoUse an empty `TokenCursorFrame` stack when capturing tokens
Aaron Hill [Fri, 8 Jan 2021 23:16:20 +0000 (18:16 -0500)]
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.

3 years agoAuto merge of #78452 - cjgillot:ddk-struct, r=Mark-Simulacrum
bors [Fri, 8 Jan 2021 18:16:00 +0000 (18:16 +0000)]
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).

3 years agoCheck is_anon outside of can_reconstruct_query_key.
Camille GILLOT [Wed, 6 Jan 2021 17:54:27 +0000 (18:54 +0100)]
Check is_anon outside of can_reconstruct_query_key.

3 years agoMake DepConstructor a module.
Camille GILLOT [Fri, 25 Dec 2020 18:07:28 +0000 (19:07 +0100)]
Make DepConstructor a module.

3 years agoMake force_from_dep_node a function pointer.
Camille GILLOT [Tue, 27 Oct 2020 18:33:03 +0000 (19:33 +0100)]
Make force_from_dep_node a function pointer.

3 years agoMake try_load_from_on_disk_cache a function pointer.
Camille GILLOT [Tue, 27 Oct 2020 18:22:58 +0000 (19:22 +0100)]
Make try_load_from_on_disk_cache a function pointer.

3 years agoMake can_reconstruct_query_key a function pointer.
Camille GILLOT [Tue, 27 Oct 2020 18:49:10 +0000 (19:49 +0100)]
Make can_reconstruct_query_key a function pointer.

3 years agoUse a field for has_params.
Camille GILLOT [Tue, 27 Oct 2020 17:46:43 +0000 (18:46 +0100)]
Use a field for has_params.

3 years agoUse a field for is_eval_always.
Camille GILLOT [Tue, 27 Oct 2020 17:43:49 +0000 (18:43 +0100)]
Use a field for is_eval_always.

3 years agoUse a field for is_anon.
Camille GILLOT [Fri, 20 Nov 2020 18:35:17 +0000 (19:35 +0100)]
Use a field for is_anon.

3 years agoCheck if the pointer is null/string is not utf8
Andrew Sun [Fri, 8 Jan 2021 16:50:21 +0000 (11:50 -0500)]
Check if the pointer is null/string is not utf8

3 years agoUse a side-table of consts instead of matching on the DepKind enum.
Camille GILLOT [Tue, 27 Oct 2020 17:36:11 +0000 (18:36 +0100)]
Use a side-table of consts instead of matching on the DepKind enum.

3 years agoSimplify DepNodeParams.
Camille GILLOT [Tue, 27 Oct 2020 18:54:28 +0000 (19:54 +0100)]
Simplify DepNodeParams.

3 years agoMove DepNodeExt outside of the macro.
Camille GILLOT [Sat, 24 Oct 2020 15:37:26 +0000 (17:37 +0200)]
Move DepNodeExt outside of the macro.

3 years agoAuto merge of #76896 - spastorino:codegen-inline-fns2, r=davidtwco,wesleywiser
bors [Fri, 8 Jan 2021 15:21:45 +0000 (15:21 +0000)]
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

3 years agoAuto merge of #80653 - jryans:doc-deref-recursive, r=jyn514,GuillaumeGomez
bors [Fri, 8 Jan 2021 12:34:20 +0000 (12:34 +0000)]
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`

3 years agoAuto merge of #80535 - JohnTitor:improve-use-diag, r=estebank
bors [Fri, 8 Jan 2021 09:51:26 +0000 (09:51 +0000)]
Auto merge of #80535 - JohnTitor:improve-use-diag, r=estebank

Add a note for `*` and `{}` usage on `use`

Closes #80333

3 years agoAdd a note for `*` and `{}` usage on `use`
Yuki Okushi [Wed, 30 Dec 2020 22:40:54 +0000 (07:40 +0900)]
Add a note for `*` and `{}` usage on `use`

3 years agoCombine several `push_str` calls
J. Ryan Stinnett [Sun, 3 Jan 2021 17:32:48 +0000 (17:32 +0000)]
Combine several `push_str` calls

3 years agoPreserve non-local recursive `Deref` impls
J. Ryan Stinnett [Sun, 3 Jan 2021 13:13:30 +0000 (13:13 +0000)]
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.

3 years agoUse target in `Deref` method section IDs
J. Ryan Stinnett [Thu, 31 Dec 2020 02:45:15 +0000 (02:45 +0000)]
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.

3 years agoRecursively document methods via `Deref` traits
J. Ryan Stinnett [Thu, 31 Dec 2020 02:23:19 +0000 (02:23 +0000)]
Recursively document methods via `Deref` traits

3 years agoAuto merge of #80756 - sunfishcode:path-cleanup/rustc-incremental, r=nagisa
bors [Fri, 8 Jan 2021 07:01:30 +0000 (07:01 +0000)]
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.

3 years agoUse LLVMGetHostCPUFeatures instead of stdsimd
Andrew Sun [Fri, 8 Jan 2021 04:25:19 +0000 (23:25 -0500)]
Use LLVMGetHostCPUFeatures instead of stdsimd

3 years agoAuto merge of #80806 - JohnTitor:rollup-y64z7ph, r=JohnTitor
bors [Fri, 8 Jan 2021 03:09:03 +0000 (03:09 +0000)]
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

3 years agoFix typo in Step trait
Christopher Durham [Fri, 8 Jan 2021 02:29:17 +0000 (21:29 -0500)]
Fix typo in Step trait

3 years agoRollup merge of #80799 - jyn514:pretty-print, r=CraftSpider
Yuki Okushi [Fri, 8 Jan 2021 02:11:50 +0000 (11:11 +0900)]
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`

3 years agoRollup merge of #80794 - LingMan:map_or, r=jyn514
Yuki Okushi [Fri, 8 Jan 2021 02:11:48 +0000 (11:11 +0900)]
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

3 years agoRollup merge of #80791 - mrcz:master, r=jyn514
Yuki Okushi [Fri, 8 Jan 2021 02:11:47 +0000 (11:11 +0900)]
Rollup merge of #80791 - mrcz:master, r=jyn514

Fix type name in doc example for Iter and IterMut

3 years agoRollup merge of #80785 - petrochenkov:prettyparen, r=Aaron1011
Yuki Okushi [Fri, 8 Jan 2021 02:11:45 +0000 (11:11 +0900)]
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`

3 years agoRollup merge of #80761 - andjo403:generic_coverage, r=spastorino
Yuki Okushi [Fri, 8 Jan 2021 02:11:43 +0000 (11:11 +0900)]
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

3 years agoRollup merge of #80372 - jyn514:fix-panics, r=Manishearth
Yuki Okushi [Fri, 8 Jan 2021 02:11:41 +0000 (11:11 +0900)]
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`

3 years agoRollup merge of #79675 - CraftSpider:79669, r=estebank
Yuki Okushi [Fri, 8 Jan 2021 02:11:34 +0000 (11:11 +0900)]
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.

3 years agoAuto merge of #80746 - ehuss:update-cargo, r=ehuss
bors [Fri, 8 Jan 2021 00:20:06 +0000 (00:20 +0000)]
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)

3 years agoGet rid of custom pretty-printing in rustdoc
Joshua Nelson [Thu, 7 Jan 2021 22:40:07 +0000 (17:40 -0500)]
Get rid of custom pretty-printing in rustdoc

and use rustc_hir_pretty directly instead

3 years agorustc_ast_pretty: Remove `PrintState::insert_extra_parens`
Vadim Petrochenkov [Thu, 7 Jan 2021 14:58:05 +0000 (17:58 +0300)]
rustc_ast_pretty: Remove `PrintState::insert_extra_parens`

It's no longer necessary after #79472

3 years agoAuto merge of #80709 - lzutao:target-enumerate, r=petrochenkov
bors [Thu, 7 Jan 2021 21:33:57 +0000 (21:33 +0000)]
Auto merge of #80709 - lzutao:target-enumerate, r=petrochenkov

Limit target endian to an enum instead of free string

This is #77604 revived.

3 years agobootstrap: fix x.py install not working with relative prefix
Pietro Albini [Thu, 7 Jan 2021 18:59:24 +0000 (19:59 +0100)]
bootstrap: fix x.py install not working with relative prefix

3 years agoUse Option::map_or instead of `.map(..).unwrap_or(..)`
LingMan [Thu, 7 Jan 2021 19:03:59 +0000 (20:03 +0100)]
Use Option::map_or instead of `.map(..).unwrap_or(..)`

3 years agohandle generic trait methods in coverage tests
Andreas Jonson [Thu, 7 Jan 2021 18:40:19 +0000 (19:40 +0100)]
handle generic trait methods in coverage tests

make the generic function pattern more specific

3 years agoAuto merge of #80790 - JohnTitor:rollup-js1noez, r=JohnTitor
bors [Thu, 7 Jan 2021 18:20:12 +0000 (18:20 +0000)]
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

3 years agoEnclose types in comments in backticks
Marcus Svensson [Thu, 7 Jan 2021 17:36:25 +0000 (18:36 +0100)]
Enclose types in comments in backticks

3 years agoFix type name in doc example for Iter and IterMut
Marcus Svensson [Thu, 7 Jan 2021 17:22:37 +0000 (18:22 +0100)]
Fix type name in doc example for Iter and IterMut

3 years agoRollup merge of #80784 - petrochenkov:nontspan, r=Aaron1011
Yuki Okushi [Thu, 7 Jan 2021 17:06:20 +0000 (02:06 +0900)]
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`

3 years agoRollup merge of #80780 - lianghanzhen:master, r=petrochenkov
Yuki Okushi [Thu, 7 Jan 2021 17:06:18 +0000 (02:06 +0900)]
Rollup merge of #80780 - lianghanzhen:master, r=petrochenkov

Return EOF_CHAR constant instead of magic char.

3 years agoRollup merge of #80769 - ejez:patch-1, r=jonas-schievink
Yuki Okushi [Thu, 7 Jan 2021 17:06:16 +0000 (02:06 +0900)]
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.

3 years agoRollup merge of #80750 - GuillaumeGomez:cleanup-to_string, r=lzutao
Yuki Okushi [Thu, 7 Jan 2021 17:06:14 +0000 (02:06 +0900)]
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``

3 years agoRollup merge of #80744 - camelid:next_def_id-docs, r=jyn514
Yuki Okushi [Thu, 7 Jan 2021 17:06:13 +0000 (02:06 +0900)]
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``

3 years agoRollup merge of #80738 - arusahni:master, r=GuillaumeGomez
Yuki Okushi [Thu, 7 Jan 2021 17:06:11 +0000 (02:06 +0900)]
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)

3 years agoRollup merge of #80660 - max-heller:issue-80559-fix, r=jyn514
Yuki Okushi [Thu, 7 Jan 2021 17:06:09 +0000 (02:06 +0900)]
Rollup merge of #80660 - max-heller:issue-80559-fix, r=jyn514

Properly handle primitive disambiguators in rustdoc

Fixes #80559

r? ``@jyn514``

Is there a way to test that the generated intra-doc link is what I expect?

3 years agoRollup merge of #80659 - pierwill:edit-tokenstream, r=davidtwco
Yuki Okushi [Thu, 7 Jan 2021 17:06:07 +0000 (02:06 +0900)]
Rollup merge of #80659 - pierwill:edit-tokenstream, r=davidtwco

Edit rustc_ast::tokenstream docs

Fix some punctuation and wording, and add intra-documentation links.

3 years agoRollup merge of #80521 - richkadel:llvm-coverage-counters-2.4.0, r=wesleywiser
Yuki Okushi [Thu, 7 Jan 2021 17:06:03 +0000 (02:06 +0900)]
Rollup merge of #80521 - richkadel:llvm-coverage-counters-2.4.0, r=wesleywiser

MIR Inline is incompatible with coverage

Fixes: #80060
Fixed by disabling inlining if `-Zinstrument-coverage` is set.

The PR also adds additional use cases to the coverage test for doctests.

r? `@wesleywiser`
cc: `@tmandry`

3 years agoRollup merge of #80012 - sasurau4:feature/point-constant-identifier-E0435, r=petrochenkov
Yuki Okushi [Thu, 7 Jan 2021 17:05:58 +0000 (02:05 +0900)]
Rollup merge of #80012 - sasurau4:feature/point-constant-identifier-E0435, r=petrochenkov

Add pointing const identifier when emitting E0435

Fix #79919

3 years agoAuto merge of #77853 - ijackson:slice-strip-stab, r=Amanieu
bors [Thu, 7 Jan 2021 15:21:30 +0000 (15:21 +0000)]
Auto merge of #77853 - ijackson:slice-strip-stab, r=Amanieu

Stabilize slice::strip_prefix and slice::strip_suffix

These two methods are useful.  The corresponding methods on `str` are already stable.

I believe that stablising these now would not get in the way of, in the future, extending these to take a richer pattern API a la `str`'s patterns.

Tracking PR: #73413.  I also have an outstanding PR to improve the docs for these two functions and the corresponding ones on `str`: #75078

I have tried to follow the [instructions in the dev guide](https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#stabilization-pr).  The part to do with `compiler/rustc_feature` did not seem applicable.  I assume that's because these are just library features, so there is no corresponding machinery in rustc.

3 years agorustc_parse: Better spans for synthesized token streams
Vadim Petrochenkov [Thu, 7 Jan 2021 13:43:22 +0000 (16:43 +0300)]
rustc_parse: Better spans for synthesized token streams

3 years agoReturn EOF_CHAR constant instead of magic char.
Hanzhen Liang [Thu, 7 Jan 2021 12:20:04 +0000 (13:20 +0100)]
Return EOF_CHAR constant instead of magic char.

3 years agoAuto merge of #79863 - JohnTitor:compiler-builtins, r=bjorn3
bors [Thu, 7 Jan 2021 11:22:42 +0000 (11:22 +0000)]
Auto merge of #79863 - JohnTitor:compiler-builtins, r=bjorn3

Update `compiler_builtins` to 0.1.39

This version contains the fixes of https://github.com/rust-lang/compiler-builtins/issues/390 and https://github.com/rust-lang/compiler-builtins/issues/391.
Also, rename features following https://github.com/rust-lang/compiler-builtins/pull/386.

3 years agoRefine E0435 description
Daiki Ihara [Sat, 26 Dec 2020 12:15:51 +0000 (21:15 +0900)]
Refine E0435 description

3 years agobless tests
Daiki Ihara [Sun, 13 Dec 2020 15:40:59 +0000 (00:40 +0900)]
bless tests

3 years agoAdd pointing const identifier when emitting E0435
Daiki Ihara [Sun, 13 Dec 2020 15:32:59 +0000 (00:32 +0900)]
Add pointing const identifier when emitting E0435

3 years agoAuto merge of #80648 - Aaron1011:expn-data-private, r=petrochenkov
bors [Thu, 7 Jan 2021 08:25:39 +0000 (08:25 +0000)]
Auto merge of #80648 - Aaron1011:expn-data-private, r=petrochenkov

Make `ExpnData` fields `krate` and `orig_id` private

These fields are only used by hygiene serialized, and should not be
accessed by anything outside of `rustc_span`.

3 years agoUpdate `compiler_builtins` to 0.1.39
Yuki Okushi [Wed, 9 Dec 2020 19:48:08 +0000 (04:48 +0900)]
Update `compiler_builtins` to 0.1.39

3 years agoImprove wording of parse doc
Ejez [Thu, 7 Jan 2021 04:47:03 +0000 (07:47 +0300)]
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.

3 years agoAuto merge of #80200 - mahkoh:dst-offset, r=nagisa
bors [Thu, 7 Jan 2021 03:13:21 +0000 (03:13 +0000)]
Auto merge of #80200 - mahkoh:dst-offset, r=nagisa

Optimize DST field access

For

    struct X<T: ?Sized>(T)
    struct Y<T: ?Sized>(u8, T)

the offset of the unsized field is

    0
    mem::align_of_val(&self.1)

respectively. This patch changes the expression used to compute these
offsets so that the optimizer can perform this optimization.

Consider

```rust
fn f(x: &X<dyn Any>) -> &dyn Any {
    &x.0
}
```

Before:

```asm
test:
movq %rsi, %rdx
movq 16(%rsi), %rax
leaq -1(%rax), %rcx
negq %rax
andq %rcx, %rax
addq %rdi, %rax
retq
```

After:

```asm
test:
movq %rsi, %rdx
movq %rdi, %rax
retq
```

3 years agoAuto merge of #80425 - camelid:resolve-moduledata-docs, r=petrochenkov
bors [Thu, 7 Jan 2021 00:31:09 +0000 (00:31 +0000)]
Auto merge of #80425 - camelid:resolve-moduledata-docs, r=petrochenkov

Document `ModuleData` and improve names

- Document `ModuleData`
- Rename `ModuleData.normal_ancestor_id` to `nearest_parent_mod`
- Rename `Resolver::nearest_mod_parent` to `nearest_parent_mod`

cc https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/mentoring/near/221029702

r? `@petrochenkov`

3 years agoAuto merge of #80754 - sunfishcode:path-cleanup/rustc-fs-util, r=davidtwco
bors [Wed, 6 Jan 2021 21:48:06 +0000 (21:48 +0000)]
Auto merge of #80754 - sunfishcode:path-cleanup/rustc-fs-util, r=davidtwco

Optimize away a `fs::metadata` call.

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.

3 years agoRename to `nearest_parent_mod`
Camelid [Mon, 28 Dec 2020 00:54:47 +0000 (16:54 -0800)]
Rename to `nearest_parent_mod`

* Rename `ModuleData.normal_ancestor_id` to `nearest_parent_mod`

`normal_ancestor_id` is a very confusing name if you don't already
understand what it means. Adding docs helps, but using a clearer and
more obvious name is also important.

* Rename `Resolver::nearest_mod_parent` to `nearest_parent_mod`

* Add more docs

3 years agoDocument `ModuleData`
Camelid [Mon, 28 Dec 2020 00:53:57 +0000 (16:53 -0800)]
Document `ModuleData`

* Convert comments on fields to doc comments so they're visible in API
  docs
* Add new documentation
* Get rid of "normal module" terminology

3 years agoAuto merge of #80758 - RalfJung:miri, r=RalfJung
bors [Wed, 6 Jan 2021 18:56:48 +0000 (18:56 +0000)]
Auto merge of #80758 - RalfJung:miri, r=RalfJung

update Miri

update Miri to include fix for https://github.com/rust-lang/miri/issues/1643
Cc `@rust-lang/miri` r? `@ghost`

3 years agoupdate Miri
Ralf Jung [Wed, 6 Jan 2021 17:29:04 +0000 (18:29 +0100)]
update Miri

3 years agoOptimize away some path lookups in the generic `fs::copy` implementation.
Dan Gohman [Wed, 6 Jan 2021 02:00:38 +0000 (18:00 -0800)]
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.

3 years agoOptimize away a `fs::metadata` call.
Dan Gohman [Wed, 6 Jan 2021 16:20:58 +0000 (08:20 -0800)]
Optimize away a `fs::metadata` call.

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.

3 years agoOptimize away some `fs::metadata` calls.
Dan Gohman [Wed, 6 Jan 2021 16:31:25 +0000 (08:31 -0800)]
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.

3 years agoChange related spec files to use the new enum
Lzu Tao [Tue, 5 Jan 2021 01:13:27 +0000 (01:13 +0000)]
Change related spec files to use the new enum

3 years agoPrefer enum Endian in rustc_target::Target
Lzu Tao [Tue, 5 Jan 2021 01:01:29 +0000 (01:01 +0000)]
Prefer enum Endian in rustc_target::Target

3 years agoAuto merge of #80714 - jakevossen5:master, r=lcnr
bors [Wed, 6 Jan 2021 10:25:18 +0000 (10:25 +0000)]
Auto merge of #80714 - jakevossen5:master, r=lcnr

fixed const_generics error help

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

3 years agoDon't use to_string on Symbol
Guillaume Gomez [Wed, 6 Jan 2021 09:59:50 +0000 (10:59 +0100)]
Don't use to_string on Symbol

3 years agoMake target-cpu=native detect individual features
Andrew Sun [Wed, 6 Jan 2021 08:23:54 +0000 (03:23 -0500)]
Make target-cpu=native detect individual features

3 years agoAuto merge of #80724 - GuillaumeGomez:remove-useless-doc_alias-feature, r=jyn514
bors [Wed, 6 Jan 2021 05:41:42 +0000 (05:41 +0000)]
Auto merge of #80724 - GuillaumeGomez:remove-useless-doc_alias-feature, r=jyn514

Remove useless doc_alias feature gate

As `@jyn514`  rightfully noted in https://github.com/rust-lang/rust/pull/80686 , this feature is no more. Therefore, cleanup time!

r? `@jyn514`

3 years agoApply suggestions from code review
Camelid [Wed, 6 Jan 2021 03:46:51 +0000 (19:46 -0800)]
Apply suggestions from code review

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoUpdate cargo
Eric Huss [Wed, 6 Jan 2021 03:36:00 +0000 (19:36 -0800)]
Update cargo

3 years agorustdoc: Turn `next_def_id` comments into docs
Camelid [Wed, 6 Jan 2021 00:32:50 +0000 (16:32 -0800)]
rustdoc: Turn `next_def_id` comments into docs

3 years agoAuto merge of #80415 - cjgillot:issue-77828, r=petrochenkov
bors [Wed, 6 Jan 2021 00:36:14 +0000 (00:36 +0000)]
Auto merge of #80415 - cjgillot:issue-77828, r=petrochenkov

Compute parent module when collecting hir::MacroDef.

Fixes #77828.

r? `@jyn514`

3 years agoRemove bottom margin from crate version when the sidebar is collapsed.
Aru Sahni [Tue, 5 Jan 2021 23:53:23 +0000 (18:53 -0500)]
Remove bottom margin from crate version when the 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.

3 years agoDocument hackiness around primitive associated item disambiguators
max-heller [Tue, 5 Jan 2021 20:15:25 +0000 (15:15 -0500)]
Document hackiness around primitive associated item disambiguators

3 years agoDo not swallow parent for MacroDef.
Camille GILLOT [Tue, 29 Dec 2020 20:43:17 +0000 (21:43 +0100)]
Do not swallow parent for MacroDef.

3 years agoAdd rustdoc test.
Camille GILLOT [Mon, 28 Dec 2020 21:01:05 +0000 (22:01 +0100)]
Add rustdoc test.