]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #82191 - Soveu:dedup, r=nagisa
Dylan DPC [Wed, 17 Mar 2021 23:28:04 +0000 (00:28 +0100)]
Rollup merge of #82191 - Soveu:dedup, r=nagisa

Vec::dedup_by optimization

Now `Vec::dedup_by` drops items in-place as it goes through them.
From my benchmarks, it is around 10% faster when T is small, with no major regression when otherwise.

I used `ptr::copy` instead of conditional `ptr::copy_nonoverlapping`, because the latter had some weird performance issues on my ryzen laptop (it was 50% slower on it than on intel/sandybridge laptop)
It would be good if someone was able to reproduce these results.

3 years agoAuto merge of #82122 - bstrie:dep4real, r=dtolnay
bors [Wed, 17 Mar 2021 19:39:03 +0000 (19:39 +0000)]
Auto merge of #82122 - bstrie:dep4real, r=dtolnay

Deprecate `intrinsics::drop_in_place` and `collections::Bound`, which accidentally weren't deprecated

Fixes #82080.

I've taken the liberty of updating the `since` values to 1.52, since an unobservable deprecation isn't much of a deprecation (even the detailed release notes never bothered to mention these deprecations).

As mentioned in the issue I'm *pretty* sure that using a type alias for `Bound` is semantically equivalent to the re-export; [the reference implies](https://doc.rust-lang.org/reference/items/type-aliases.html) that type aliases only observably differ from types when used on unit structs or tuple structs, whereas `Bound` is an enum.

3 years agoAuto merge of #83188 - petrochenkov:field, r=lcnr
bors [Wed, 17 Mar 2021 16:49:46 +0000 (16:49 +0000)]
Auto merge of #83188 - petrochenkov:field, r=lcnr

ast/hir: Rename field-related structures

I always forget what `ast::Field` and `ast::StructField` mean despite working with AST for long time, so this PR changes the naming to less confusing and more consistent.

- `StructField` -> `FieldDef` ("field definition")
- `Field` -> `ExprField` ("expression field", not "field expression")
- `FieldPat` -> `PatField` ("pattern field", not "field pattern")

Various visiting and other methods working with the fields are renamed correspondingly too.

The second commit reduces the size of `ExprKind` by boxing fields of `ExprKind::Struct` in preparation for https://github.com/rust-lang/rust/pull/80080.

3 years agoAuto merge of #83090 - jackh726:bound_var_replacer_option, r=varkor
bors [Wed, 17 Mar 2021 14:01:48 +0000 (14:01 +0000)]
Auto merge of #83090 - jackh726:bound_var_replacer_option, r=varkor

Make functions passed to BoundVarReplacer be optional

This means we can reuse the bound vars when we don't care to change them

3 years agoAuto merge of #81358 - mcastorina:to-upper-lower-speed, r=joshtriplett
bors [Wed, 17 Mar 2021 11:17:18 +0000 (11:17 +0000)]
Auto merge of #81358 - mcastorina:to-upper-lower-speed, r=joshtriplett

Add a check for ASCII characters in to_upper and to_lower

This extra check has better performance. See discussion here:
https://internals.rust-lang.org/t/to-upper-speed/13896

Thanks to `@gilescope` for helping discover and test this.

3 years agoAuto merge of #83225 - JohnTitor:rollup-4hnuhb8, r=JohnTitor
bors [Wed, 17 Mar 2021 08:27:16 +0000 (08:27 +0000)]
Auto merge of #83225 - JohnTitor:rollup-4hnuhb8, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #82774 (Fix bad diagnostics for anon params with ref and/or qualified paths)
 - #82826 ((std::net::parser): Fix capitalization of IP version names)
 - #83092 (More precise spans for HIR paths)
 - #83124 (Do not insert impl_trait_in_bindings opaque definitions twice.)
 - #83202 (Show details in cfg version unstable book)
 - #83203 (Don't warn about old rustdoc lint names (temporarily))
 - #83206 (Update books)
 - #83219 (Update cargo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #83219 - ehuss:update-cargo, r=ehuss
Yuki Okushi [Wed, 17 Mar 2021 06:21:00 +0000 (15:21 +0900)]
Rollup merge of #83219 - ehuss:update-cargo, r=ehuss

Update cargo

8 commits in 32da9eaa5de5be241cf8096ca6b749a157194f77..90691f2bfe9a50291a98983b1ed2feab51d5ca55
2021-03-13 01:18:40 +0000 to 2021-03-16 21:36:55 +0000
- Add report if `cargo fix --edition` changes features. (rust-lang/cargo#9268)
- Fix --feature pkg/feat for V1 resolver for non-member. (rust-lang/cargo#9275)
- Fix doc duplicate removal of root units. (rust-lang/cargo#9276)
- Add CLI help text for patch-in-config (rust-lang/cargo#9271)
- Document `-Zpatch-in-config` (rust-lang/cargo#9270)
- Support [patch] in .cargo/config files (rust-lang/cargo#9204)
- Add `--future-incompat-report` support to `cargo test` (rust-lang/cargo#9264)
- 🍱 Crop favicon (rust-lang/cargo#9262)

3 years agoRollup merge of #83206 - ehuss:update-books, r=ehuss
Yuki Okushi [Wed, 17 Mar 2021 06:20:59 +0000 (15:20 +0900)]
Rollup merge of #83206 - ehuss:update-books, r=ehuss

Update books

## nomicon

1 commits in adca786547d08fe676b2fc7a6f08c2ed5280ca38..6fe476943afd53a9a6e91f38a6ea7bb48811d8ff
2021-02-16 16:34:20 +0900 to 2021-03-10 07:28:57 +0900
- Merge pull request rust-lang-nursery/nomicon#257 from skade/opaque-types-fix

## reference

3 commits in 3b6fe80c205d2a2b5dc8a276192bbce9eeb9e9cf..e32a2f928f8b78d534bca2b9e7736413314dc556
2021-02-22 22:09:17 -0800 to 2021-03-08 23:24:30 -0800
- Clarify that ::foo paths are not necessarily based off of the "crate root" (rust-lang-nursery/reference#974)
- Comment typo (rust-lang-nursery/reference#977)
- Fix misspelled word discrimnant (rust-lang-nursery/reference#976)

## book

2 commits in 0f87daf683ae3de3cb725faecb11b7e7e89f0e5a..fc2f690fc16592abbead2360cfc0a42f5df78052
2021-03-01 08:54:04 -0500 to 2021-03-05 14:03:22 -0500
- Fix wrapping
- fix: redundant double introduction of shadowing (rust-lang/book#2633)

## rust-by-example

1 commits in 3e0d98790c9126517fa1c604dc3678f396e92a27..eead22c6c030fa4f3a167d1798658c341199e2ae
2021-02-25 08:23:10 -0300 to 2021-03-04 16:26:43 -0300
- Fix grammar "terminates" -> "terminate" (rust-lang/rust-by-example#1423)

## rustc-dev-guide

15 commits in c431f8c29a41413dddcb3bfa0d71c9cabe366317..67ebd4b55dba44edfc351621cef6e5e758169c55
2021-02-28 16:35:20 -0500 to 2021-03-11 13:36:25 -0800
- Remove extra the (rust-lang/rustc-dev-guide#1088)
- Fix double-word typos (rust-lang/rustc-dev-guide#1084)
- I-nominated are nominated for discussion (rust-lang/rustc-dev-guide#1080)
- Complete unfinished statement
- Check `BASE_SHA` only if it's a PR (rust-lang/rustc-dev-guide#1083)
- Update lins
- Apply suggestions from code review
- Add stub about the THIR
- Switch from Travis to GHA (rust-lang/rustc-dev-guide#1073)
- Adjust a bit better P- label text
- Fix typos (rust-lang/rustc-dev-guide#1079)
- Update cmake version in prerequisites.md (rust-lang/rustc-dev-guide#1077)
- Fix typo: suceed -> succeed
- Add article on using WPA to profile rustc memory usage on Windows (rust-lang/rustc-dev-guide#1074)
- Use more accurate estimate of generated LLVM IR with llvm-lines

## embedded-book

1 commits in a96d096cffe5fa2c84af1b4b61e1492f839bb2e1..f61685755fad7d3b88b4645adfbf461d500563a2
2021-02-17 08:08:52 +0000 to 2021-03-08 01:06:44 +0000
- Swap to GHA  (rust-embedded/book#285)

3 years agoRollup merge of #83203 - jyn514:rustdoc-warnings, r=Manishearth
Yuki Okushi [Wed, 17 Mar 2021 06:20:58 +0000 (15:20 +0900)]
Rollup merge of #83203 - jyn514:rustdoc-warnings, r=Manishearth

Don't warn about old rustdoc lint names (temporarily)

Since https://github.com/rust-lang/rust/pull/80527, rustdoc users have an unpleasant situation: they can either use the new tool lint names (`rustdoc::non_autolinks`) or they can use the old names (`non_autolinks`). If they use the tool lints, they get a hard error on stable compilers, because rustc rejects all tool names it doesn't recognize (https://github.com/rust-lang/rust/issues/66079#issuecomment-788589193). If they use the old name, they get a warning to rename the lint to the new name. The only way to compile without warnings is to add `#[allow(renamed_removed_lints)]`, which defeats the whole point of the change: we *want* people to switch to the new name.

To avoid people silencing the lint and never migrating to the tool lint, this avoids warning about the old name, while still allowing you to use the new name. Once the new `rustdoc` tool name makes it to the stable channel, we can change these lints to warn again.

This adds the new lint functions `register_alias` and `register_ignored` - I didn't see an existing way to do this.

r? `@Manishearth` cc `@rust-lang/rustdoc`

3 years agoRollup merge of #83202 - pickfire:patch-6, r=JohnTitor
Yuki Okushi [Wed, 17 Mar 2021 06:20:56 +0000 (15:20 +0900)]
Rollup merge of #83202 - pickfire:patch-6, r=JohnTitor

Show details in cfg version unstable book

3 years agoRollup merge of #83124 - cjgillot:iiib, r=petrochenkov
Yuki Okushi [Wed, 17 Mar 2021 06:20:55 +0000 (15:20 +0900)]
Rollup merge of #83124 - cjgillot:iiib, r=petrochenkov

Do not insert impl_trait_in_bindings opaque definitions twice.

The reference to the item already appears inside the `OpaqueDef`. It does not need to be repeated as a statement.

3 years agoRollup merge of #83092 - petrochenkov:qspan, r=estebank
Yuki Okushi [Wed, 17 Mar 2021 06:20:54 +0000 (15:20 +0900)]
Rollup merge of #83092 - petrochenkov:qspan, r=estebank

More precise spans for HIR paths

`Ty::assoc_item` is lowered to `<Ty>::assoc_item` in HIR, but `Ty` got span from the whole path.
This PR fixes that, and adjusts some diagnostic code that relied on `Ty` having the whole path span.

This is a pre-requisite for https://github.com/rust-lang/rust/pull/82868 (we cannot report suggestions like `Tr::assoc` -> `<dyn Tr>::assoc` with the current imprecise spans).
r? ````@estebank````

3 years agoRollup merge of #82826 - pierwill:fix-IPv, r=JohnTitor
Yuki Okushi [Wed, 17 Mar 2021 06:20:49 +0000 (15:20 +0900)]
Rollup merge of #82826 - pierwill:fix-IPv, r=JohnTitor

(std::net::parser): Fix capitalization of IP version names

Also add some missing puctuation in doc and code comments.

3 years agoRollup merge of #82774 - JohnTitor:bad-diag-for-anon-params-with-ref, r=estebank
Yuki Okushi [Wed, 17 Mar 2021 06:20:48 +0000 (15:20 +0900)]
Rollup merge of #82774 - JohnTitor:bad-diag-for-anon-params-with-ref, r=estebank

Fix bad diagnostics for anon params with ref and/or qualified paths

Fixes #82729
It's easier to review with hiding whitespace changes.

3 years agoAuto merge of #83084 - nagisa:nagisa/features-native, r=petrochenkov
bors [Wed, 17 Mar 2021 05:46:08 +0000 (05:46 +0000)]
Auto merge of #83084 - nagisa:nagisa/features-native, r=petrochenkov

Adjust `-Ctarget-cpu=native` handling in cg_llvm

When cg_llvm encounters the `-Ctarget-cpu=native` it computes an
explciit set of features that applies to the target in order to
correctly compile code for the host CPU (because e.g. `skylake` alone is
not sufficient to tell if some of the instructions are available or
not).

However there were a couple of issues with how we did this. Firstly, the
order in which features were overriden wasn't quite right – conceptually
you'd expect `-Ctarget-cpu=native` option to override the features that
are implicitly set by the target definition. However due to how other
`-Ctarget-cpu` values are handled we must adopt the following order
of priority:

* Features from -Ctarget-cpu=*; are overriden by
* Features implied by --target; are overriden by
* Features from -Ctarget-feature; are overriden by
* function specific features.

Another problem was in that the function level `target-features`
attribute would overwrite the entire set of the globally enabled
features, rather than just the features the
`#[target_feature(enable/disable)]` specified. With something like
`-Ctarget-cpu=native` we'd end up in a situation wherein a function
without `#[target_feature(enable)]` annotation would have a broader
set of features compared to a function with one such attribute. This
turned out to be a cause of heavy run-time regressions in some code
using these function-level attributes in conjunction with
`-Ctarget-cpu=native`, for example.

With this PR rustc is more careful about specifying the entire set of
features for functions that use `#[target_feature(enable/disable)]` or
`#[instruction_set]` attributes.

Sadly testing the original reproducer for this behaviour is quite
impossible – we cannot rely on `-Ctarget-cpu=native` to be anything in
particular on developer or CI machines.

cc https://github.com/rust-lang/rust/issues/83027 `@BurntSushi`

3 years agoAdd more test case
Yuki Okushi [Wed, 17 Mar 2021 02:41:05 +0000 (11:41 +0900)]
Add more test case

3 years agoEmit more pretty diagnostics for qualified paths
Yuki Okushi [Wed, 17 Mar 2021 00:49:46 +0000 (09:49 +0900)]
Emit more pretty diagnostics for qualified paths

3 years agoFix bad diagnostics for anon params with qualified paths
Yuki Okushi [Fri, 5 Mar 2021 05:52:45 +0000 (14:52 +0900)]
Fix bad diagnostics for anon params with qualified paths

3 years agoFix bad diagnostics for anon params with ref
Yuki Okushi [Thu, 4 Mar 2021 19:19:15 +0000 (04:19 +0900)]
Fix bad diagnostics for anon params with ref

3 years agoAuto merge of #82936 - oli-obk:valtree, r=RalfJung,lcnr,matthewjasper
bors [Tue, 16 Mar 2021 22:42:56 +0000 (22:42 +0000)]
Auto merge of #82936 - oli-obk:valtree, r=RalfJung,lcnr,matthewjasper

Implement (but don't use) valtree and refactor in preparation of use

This PR does not cause any functional change. It refactors various things that are needed to make valtrees possible. This refactoring got big enough that I decided I'd want it reviewed as a PR instead of trying to make one huge PR with all the changes.

cc `@rust-lang/wg-const-eval` on the following commits:

2027184 implement valtree
eeecea9 fallible Scalar -> ScalarInt
042f663 ScalarInt convenience methods

cc `@eddyb` on ef04a6d

cc `@rust-lang/wg-mir-opt` for cf1700c (`mir::Constant` can now represent either a `ConstValue` or a `ty::Const`, and it is totally possible to have two different representations for the same value)

3 years agoUpdate cargo
Eric Huss [Tue, 16 Mar 2021 22:42:44 +0000 (15:42 -0700)]
Update cargo

3 years agoAdjust `-Ctarget-cpu=native` handling in cg_llvm
Simonas Kazlauskas [Sat, 13 Mar 2021 13:29:39 +0000 (15:29 +0200)]
Adjust `-Ctarget-cpu=native` handling in cg_llvm

When cg_llvm encounters the `-Ctarget-cpu=native` it computes an
explciit set of features that applies to the target in order to
correctly compile code for the host CPU (because e.g. `skylake` alone is
not sufficient to tell if some of the instructions are available or
not).

However there were a couple of issues with how we did this. Firstly, the
order in which features were overriden wasn't quite right – conceptually
you'd expect `-Ctarget-cpu=native` option to override the features that
are implicitly set by the target definition. However due to how other
`-Ctarget-cpu` values are handled we must adopt the following order
of priority:

* Features from -Ctarget-cpu=*; are overriden by
* Features implied by --target; are overriden by
* Features from -Ctarget-feature; are overriden by
* function specific features.

Another problem was in that the function level `target-features`
attribute would overwrite the entire set of the globally enabled
features, rather than just the features the
`#[target_feature(enable/disable)]` specified. With something like
`-Ctarget-cpu=native` we'd end up in a situation wherein a function
without `#[target_feature(enable)]` annotation would have a broader
set of features compared to a function with one such attribute. This
turned out to be a cause of heavy run-time regressions in some code
using these function-level attributes in conjunction with
`-Ctarget-cpu=native`, for example.

With this PR rustc is more careful about specifying the entire set of
features for functions that use `#[target_feature(enable/disable)]` or
`#[instruction_set]` attributes.

Sadly testing the original reproducer for this behaviour is quite
impossible – we cannot rely on `-Ctarget-cpu=native` to be anything in
particular on developer or CI machines.

3 years agoAuto merge of #82536 - sexxi-goose:handle-patterns-take-2, r=nikomatsakis
bors [Tue, 16 Mar 2021 19:19:06 +0000 (19:19 +0000)]
Auto merge of #82536 - sexxi-goose:handle-patterns-take-2, r=nikomatsakis

2229: Handle patterns within closures correctly when `capture_disjoint_fields` is enabled

This PR fixes several issues related to handling patterns within closures when `capture_disjoint_fields` is enabled.
1. Matching is always considered a use of the place, even with `_` patterns
2. Compiler ICE when capturing fields in closures through `let` assignments

To do so, we

- Introduced new Fake Reads
- Delayed use of `Place` in favor of `PlaceBuilder`
- Ensured that `PlaceBuilder` can be resolved before attempting to extract `Place` in any of the pattern matching code

Closes rust-lang/project-rfc-2229/issues/27
Closes rust-lang/project-rfc-2229/issues/24
r? `@nikomatsakis`

3 years agoUpdate compiler/rustc_middle/src/ty/consts/valtree.rs
Oli Scherer [Tue, 16 Mar 2021 17:31:33 +0000 (18:31 +0100)]
Update compiler/rustc_middle/src/ty/consts/valtree.rs

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agoUpdate compiler/rustc_middle/src/ty/consts/valtree.rs
Oli Scherer [Tue, 16 Mar 2021 17:31:25 +0000 (18:31 +0100)]
Update compiler/rustc_middle/src/ty/consts/valtree.rs

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agoUpdate compiler/rustc_mir/src/const_eval/mod.rs
Oli Scherer [Tue, 16 Mar 2021 17:26:09 +0000 (18:26 +0100)]
Update compiler/rustc_mir/src/const_eval/mod.rs

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agoDon't warn about old rustdoc lint names (temporarily)
Joshua Nelson [Tue, 16 Mar 2021 15:59:05 +0000 (11:59 -0400)]
Don't warn about old rustdoc lint names (temporarily)

Right now, rustdoc users have an unpleasant situation: they can either
use the new tool lint names (`rustdoc::non_autolinks`) or they can use
the old names (`non_autolinks`). If they use the tool lints, they get a
hard error on stable compilers, because rustc rejects all tool names it
doesn't recognize. If they use the old name, they get a warning to
rename the lint to the new name. The only way to compile without
warnings is to add `#[allow(renamed_removed_lints)]`, which defeats the
whole point of the change: we *want* people to switch to the new name.

To avoid people silencing the lint and never migrating to the tool lint,
this avoids warning about the old name, while still allowing you to use
the new name. Once the new `rustdoc` tool name makes it to the stable
channel, we can change these lints to warn again.

This adds the new lint functions `register_alias` and `register_ignored`
- I didn't see an existing way to do this.

3 years agoAuto merge of #83199 - JohnTitor:rollup-zrfk94a, r=JohnTitor
bors [Tue, 16 Mar 2021 16:37:43 +0000 (16:37 +0000)]
Auto merge of #83199 - JohnTitor:rollup-zrfk94a, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #81822 (Added `try_exists()` method to `std::path::Path`)
 - #83072 (Update `Vec` docs)
 - #83077 (rustdoc: reduce GC work during search)
 - #83091 (Constify `copy` related functions)
 - #83156 (Fall-back to sans-serif if Arial is not available)
 - #83157 (No background for code in portability snippets)
 - #83160 (Deprecate RustcEncodable and RustcDecodable.)
 - #83162 (Specify *.woff2 files as binary)
 - #83172 (More informative diagnotic from `x.py test` attempt atop beta checkout)
 - #83196 (Use delay_span_bug instead of panic in layout_scalar_valid_range)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoUpdate books
Eric Huss [Tue, 16 Mar 2021 16:23:11 +0000 (09:23 -0700)]
Update books

3 years agoShow details in cfg version unstable book
Ivan Tham [Tue, 16 Mar 2021 15:15:44 +0000 (23:15 +0800)]
Show details in cfg version unstable book

3 years agoRollup merge of #83196 - tmiasko:valid-range-delay-span-bug, r=oli-obk
Yuki Okushi [Tue, 16 Mar 2021 14:54:03 +0000 (23:54 +0900)]
Rollup merge of #83196 - tmiasko:valid-range-delay-span-bug, r=oli-obk

Use delay_span_bug instead of panic in layout_scalar_valid_range

#83054 introduced validation of scalar range attributes, but panicking
code that uses the attribute remained reachable. Use `delay_span_bug`
instead to avoid the ICE.

Fixes #83180.

3 years agoRollup merge of #83172 - pnkfelix:bootstrap-tell-me-what-to-do-about-tidy-on-beta...
Yuki Okushi [Tue, 16 Mar 2021 14:54:02 +0000 (23:54 +0900)]
Rollup merge of #83172 - pnkfelix:bootstrap-tell-me-what-to-do-about-tidy-on-beta, r=Mark-Simulacrum

More informative diagnotic from `x.py test` attempt atop beta checkout

Make bootstrap be more informative when one does `x.py test` on a beta checkout without other mods.

To be clear, by default running `x.py test` on a checkout of the beta branch
currently fails, and with this change will continue to fail, because `x.py
tests` runs `x.py test src/tools/tidy` which tries to run `rustfmt` and that
will fail because the `rustfmt` binary is pinned to the current nighlty and we
do not attempt to distribute one for the beta builds.

This change gives a better error message than the current message, which is just
"./x.py fmt is not supported on this channel" without providing any hint about
what one might do about that problem.

3 years agoRollup merge of #83162 - jfrimmel:woff2, r=Mark-Simulacrum
Yuki Okushi [Tue, 16 Mar 2021 14:54:01 +0000 (23:54 +0900)]
Rollup merge of #83162 - jfrimmel:woff2, r=Mark-Simulacrum

Specify *.woff2 files as binary

This prevents older git versions to change the "line endings".
Fixes #83159.

3 years agoRollup merge of #83160 - m-ou-se:deprecate-rustc-serialize-derives, r=petrochenkov
Yuki Okushi [Tue, 16 Mar 2021 14:54:00 +0000 (23:54 +0900)]
Rollup merge of #83160 - m-ou-se:deprecate-rustc-serialize-derives, r=petrochenkov

Deprecate RustcEncodable and RustcDecodable.

We can't remove the `RustcEncodable` and `RustcDecodable` derive macros from the prelude, but we can deprecate them.

3 years agoRollup merge of #83157 - nagisa:nagisa/portability-background, r=GuillaumeGomez
Yuki Okushi [Tue, 16 Mar 2021 14:53:59 +0000 (23:53 +0900)]
Rollup merge of #83157 - nagisa:nagisa/portability-background, r=GuillaumeGomez

No background for code in portability snippets

This better matches the appearance of this kind of snippet in the full
item view and is less jarring to read due to repeated
foreground-background changes.

![Listing of items in a module with some portability snippets attached to some of the items (light theme). The portability snippet has a light blue background and all of the text in it, monospace or not, is the same colour – black](https://user-images.githubusercontent.com/679122/111196363-1900f500-85b5-11eb-8f97-e283c59002a4.png)
![Listing of items in a module with some portability snippets attached to some of the items (dark theme). The portability snippet has a light blue background and all of the text in it, monospace or not, is the same colour – black](https://user-images.githubusercontent.com/679122/111196366-19998b80-85b5-11eb-9914-4d14d9d13ed3.png)

There should be no observable changes to the ayu theme.

3 years agoRollup merge of #83156 - nagisa:nagisa/sans-serif-please, r=GuillaumeGomez
Yuki Okushi [Tue, 16 Mar 2021 14:53:58 +0000 (23:53 +0900)]
Rollup merge of #83156 - nagisa:nagisa/sans-serif-please, r=GuillaumeGomez

Fall-back to sans-serif if Arial is not available

Otherwise on systems where Arial is not available the UA will
fallback to a serif font, rather than a sans-serif one.

This is especially relevant on acessibility-conscious setups (such as is
mine) that have web-fonts disabled and a limited set of fonts available
on the system.

r? ```@GuillaumeGomez``` cc ```@jsha```

3 years agoRollup merge of #83091 - usbalbin:const_copy, r=oli-obk
Yuki Okushi [Tue, 16 Mar 2021 14:53:56 +0000 (23:53 +0900)]
Rollup merge of #83091 - usbalbin:const_copy, r=oli-obk

Constify `copy` related functions

Constify

* `*const T::copy_to[_nonoverlapping]`
* `*mut T::copy_to[_nonoverlapping]`
* `*mut T::copy_from[_nonoverlapping]`
* `mem::transmute_copy`
* `mem::swap`
* `ptr::swap[_nonoverlapping]`
* `mem::replace`
* `ptr::replace`

3 years agoRollup merge of #83077 - notriddle:gc-cleanup-rustdoc-search, r=GuillaumeGomez
Yuki Okushi [Tue, 16 Mar 2021 14:53:55 +0000 (23:53 +0900)]
Rollup merge of #83077 - notriddle:gc-cleanup-rustdoc-search, r=GuillaumeGomez

rustdoc: reduce GC work during search

3 years agoRollup merge of #83072 - henryboisdequin:patch-1, r=Dylan-DPC
Yuki Okushi [Tue, 16 Mar 2021 14:53:54 +0000 (23:53 +0900)]
Rollup merge of #83072 - henryboisdequin:patch-1, r=Dylan-DPC

Update `Vec` docs

Fix typos/nits in `Vec` docs

3 years agoRollup merge of #81822 - Kixunil:path_try_exists, r=kennytm
Yuki Okushi [Tue, 16 Mar 2021 14:53:52 +0000 (23:53 +0900)]
Rollup merge of #81822 - Kixunil:path_try_exists, r=kennytm

Added `try_exists()` method to `std::path::Path`

This method is similar to the existing `exists()` method, except it
doesn't silently ignore the errors, leading to less error-prone code.

This change intentionally does NOT touch the documentation of `exists()`
nor recommend people to use this method while it's unstable.
Such changes are reserved for stabilization to prevent confusing people.

Apart from that it avoids conflicts with #80979.

`@joshtriplett` requested this PR in [internals discussion](https://internals.rust-lang.org/t/the-api-of-path-exists-encourages-broken-code/13817/25?u=kixunil)

3 years agoVec::dedup optimization - add benches
Soveu [Tue, 16 Mar 2021 13:41:26 +0000 (14:41 +0100)]
Vec::dedup optimization - add benches

3 years agoAuto merge of #82838 - Amanieu:rustdoc_asm, r=nagisa
bors [Tue, 16 Mar 2021 10:05:46 +0000 (10:05 +0000)]
Auto merge of #82838 - Amanieu:rustdoc_asm, r=nagisa

Allow rustdoc to handle asm! of foreign architectures

This allows rustdoc to process code containing `asm!` for architectures other than the current one. Since this never reaches codegen, we just replace target-specific registers and register classes with a dummy one.

Fixes #82869

3 years agoast: Reduce size of `ExprKind` by boxing fields of `ExprKind::Struct`
Vadim Petrochenkov [Tue, 16 Mar 2021 00:15:53 +0000 (03:15 +0300)]
ast: Reduce size of `ExprKind` by boxing fields of `ExprKind::Struct`

3 years agoast/hir: Rename field-related structures
Vadim Petrochenkov [Mon, 15 Mar 2021 21:36:07 +0000 (00:36 +0300)]
ast/hir: Rename field-related structures

StructField -> FieldDef ("field definition")
Field -> ExprField ("expression field", not "field expression")
FieldPat -> PatField ("pattern field", not "field pattern")

Also rename visiting and other methods working on them.

3 years agoFilled tracking issue for path_try_exists
Martin Habovstiak [Tue, 16 Mar 2021 07:41:14 +0000 (08:41 +0100)]
Filled tracking issue for path_try_exists

This adds the ID of the tracking issue to the feature.

3 years agoAuto merge of #82898 - oli-obk:tait_🧊, r=nikomatsakis
bors [Tue, 16 Mar 2021 04:24:48 +0000 (04:24 +0000)]
Auto merge of #82898 - oli-obk:tait_🧊, r=nikomatsakis

Add a `min_type_alias_impl_trait` feature gate

This new feature gate only permits type alias impl trait to be constrained by function and trait method return types. All other possible constraining sites like const/static types, closure return types and binding types are now forbidden and gated under the `type_alias_impl_trait` and `impl_trait_in_bindings` feature gates (which are both marked as incomplete, as they have various ways to ICE the compiler or cause query cycles where they shouldn't).

r? `@nikomatsakis`

This is best reviewed commit-by-commit

3 years agoMake bootstrap be more informative when one does `x.py test` on a beta checkout witho...
Felix S. Klock II [Mon, 15 Mar 2021 21:37:06 +0000 (17:37 -0400)]
Make bootstrap be more informative when one does `x.py test` on a beta checkout without other mods.

To be clear, by default running `x.py test` on a checkout of the beta branch
currently fails, and with this change will continue to fail, because `x.py
tests` runs `x.py test src/tools/tidy` which tries to run `rustfmt` and that
will fail because the `rustfmt` binary is pinned to the current nighlty and we
do not attempt to distribute one for the beta builds.

This change gives a better error message than the current message, which is just
"./x.py fmt is not supported on this channel" without providing any hint about
what one might do about that problem.

(update: placated tidy.)

3 years agoAuto merge of #83153 - Aaron1011:eval-always-extern_mod_stmt_cnum, r=michaelwoerister
bors [Tue, 16 Mar 2021 01:33:06 +0000 (01:33 +0000)]
Auto merge of #83153 - Aaron1011:eval-always-extern_mod_stmt_cnum, r=michaelwoerister

Mark `extern_mod_stmt_cnum` as `eval_always`

This query reads from global untracked state, so it always needs to be
evaluated.

3 years agoUse delay_span_bug instead of panic in layout_scalar_valid_range
Tomasz Miąsko [Tue, 16 Mar 2021 00:00:00 +0000 (00:00 +0000)]
Use delay_span_bug instead of panic in layout_scalar_valid_range

83054 introduced validation of scalar range attributes, but panicking
code that uses the attribute remained reachable. Use `delay_span_bug`
instead to avoid the ICE.

3 years agoMake functions passed to BoundVarReplacer be optional
Jack Huey [Sat, 13 Mar 2021 18:44:00 +0000 (13:44 -0500)]
Make functions passed to BoundVarReplacer be optional

3 years agoUpdate clippy tests
Vadim Petrochenkov [Mon, 15 Mar 2021 20:52:57 +0000 (23:52 +0300)]
Update clippy tests

3 years agoMerge branch 'master' into dedup
Soveu [Mon, 15 Mar 2021 20:51:38 +0000 (21:51 +0100)]
Merge branch 'master' into dedup

3 years agoVec::dedup optimization - add test for panic
Soveu [Mon, 15 Mar 2021 20:26:22 +0000 (21:26 +0100)]
Vec::dedup optimization - add test for panic

3 years agoConstify mem::transmute_copy
Albin Hedman [Sat, 13 Mar 2021 19:43:47 +0000 (20:43 +0100)]
Constify mem::transmute_copy

3 years agoConstify mem::replace and ptr::replace
Albin Hedman [Sat, 13 Mar 2021 19:38:43 +0000 (20:38 +0100)]
Constify mem::replace and ptr::replace

3 years agoConstify mem::swap and ptr::swap[_nonoverlapping]
Albin Hedman [Sat, 13 Mar 2021 19:33:27 +0000 (20:33 +0100)]
Constify mem::swap and ptr::swap[_nonoverlapping]

3 years agoConstify copy_to and copy_from
Albin Hedman [Sat, 13 Mar 2021 18:45:48 +0000 (19:45 +0100)]
Constify copy_to and copy_from

3 years agoVec::dedup optimization - finishing polishes
Soveu [Mon, 15 Mar 2021 19:36:29 +0000 (20:36 +0100)]
Vec::dedup optimization - finishing polishes

3 years agoVec::dedup optimization - add tests
Soveu [Mon, 15 Mar 2021 19:24:35 +0000 (20:24 +0100)]
Vec::dedup optimization - add tests

3 years agoDeprecate RustcEncodable and RustcDecodable.
Mara Bos [Mon, 15 Mar 2021 18:44:40 +0000 (19:44 +0100)]
Deprecate RustcEncodable and RustcDecodable.

3 years agoSpecify *.woff2 files as binary
Julian Frimmel [Mon, 15 Mar 2021 19:14:56 +0000 (20:14 +0100)]
Specify *.woff2 files as binary

This prevents older git versions to change the "line endings".

3 years agoMore precise spans for HIR paths
Vadim Petrochenkov [Sat, 13 Mar 2021 16:14:18 +0000 (19:14 +0300)]
More precise spans for HIR paths

3 years agoDeclare `word` outside the loop, as recommended by eslint
Michael Howell [Mon, 15 Mar 2021 18:58:34 +0000 (11:58 -0700)]
Declare `word` outside the loop, as recommended by eslint

3 years agoRun tests in nll mode
Oli Scherer [Mon, 15 Mar 2021 18:35:47 +0000 (18:35 +0000)]
Run tests in nll mode

3 years agoAuto merge of #83121 - the8472:env-rwlock-2, r=joshtriplett
bors [Mon, 15 Mar 2021 18:32:10 +0000 (18:32 +0000)]
Auto merge of #83121 - the8472:env-rwlock-2, r=joshtriplett

use RWlock when accessing os::env (take 2)

This reverts commit acdca316c3d42299d31c1b47eb792006ffdfc29c (#82877) i.e. redoes #81850 since the invalid unlock attempts in the child process have been fixed in #82949

r? `@joshtriplett`

3 years agoExplain each variant of TAIT usage with examples
Oli Scherer [Mon, 15 Mar 2021 11:02:35 +0000 (11:02 +0000)]
Explain each variant of TAIT usage with examples

3 years ago🍼 for tidy
Oli Scherer [Fri, 12 Mar 2021 12:51:53 +0000 (12:51 +0000)]
🍼 for tidy

3 years agoOnly allow tait defining uses in function and method return position
Oli Scherer [Fri, 12 Mar 2021 12:02:29 +0000 (12:02 +0000)]
Only allow tait defining uses in function and method return position

3 years agoNo background for code in portability snippets
Simonas Kazlauskas [Mon, 15 Mar 2021 17:34:21 +0000 (19:34 +0200)]
No background for code in portability snippets

This better matches the appearance of this kind of snippet in the full
item view and is less jarring to read due to repeated
foreground-background changes.

3 years agoSpecial case type aliases from impl trait in const/static types
Oli Scherer [Fri, 12 Mar 2021 11:27:08 +0000 (11:27 +0000)]
Special case type aliases from impl trait in const/static types

3 years agoAdd a test showing how `impl_trait_in_bindings` is a breaking change
Oli Scherer [Fri, 12 Mar 2021 10:54:12 +0000 (10:54 +0000)]
Add a test showing how `impl_trait_in_bindings` is a breaking change

3 years agoReplace `type_alias_impl_trait` by `min_type_alias_impl_trait` with no actual changes...
Oli Scherer [Fri, 12 Mar 2021 10:53:51 +0000 (10:53 +0000)]
Replace `type_alias_impl_trait` by `min_type_alias_impl_trait` with no actual changes in behaviour

This makes `type_alias_impl_trait` not actually do anything anymore

3 years agoFall-back to sans-serif if Arial is not available
Simonas Kazlauskas [Mon, 15 Mar 2021 17:20:15 +0000 (19:20 +0200)]
Fall-back to sans-serif if Arial is not available

Otherwise on systems where Arial is not available the system will
fallback to a serif font, rather than a sans-serif one.

This is especially relevant on acessibility-conscious setups (such as is
mine) that have web-fonts disabled and a limited set of fonts available
on the system.

3 years agoFix error after rebase
Roxane [Mon, 15 Mar 2021 03:53:43 +0000 (23:53 -0400)]
Fix error after rebase

3 years agoAdd comments with examples and tests
Roxane [Thu, 25 Feb 2021 23:03:41 +0000 (18:03 -0500)]
Add comments with examples and tests

3 years agoDelete non-revision ui test output file if revisions are used
Oli Scherer [Fri, 5 Mar 2021 11:26:06 +0000 (11:26 +0000)]
Delete non-revision ui test output file if revisions are used

3 years agoMake regression test succeed as long as it ICEs
Oli Scherer [Fri, 5 Mar 2021 11:16:37 +0000 (11:16 +0000)]
Make regression test succeed as long as it ICEs

3 years agoUse tracing instrumentation for better bug diagnosing
Oli Scherer [Fri, 5 Mar 2021 10:21:38 +0000 (10:21 +0000)]
Use tracing instrumentation for better bug diagnosing

3 years agoAdd reproduction test
Oli Scherer [Thu, 4 Mar 2021 16:22:00 +0000 (16:22 +0000)]
Add reproduction test

3 years agoMark `extern_mod_stmt_cnum` as `eval_always`
Aaron Hill [Mon, 15 Mar 2021 16:26:49 +0000 (12:26 -0400)]
Mark `extern_mod_stmt_cnum` as `eval_always`

This query reads from global untracked state, so it always needs to be
evaluated.

3 years agoAuto merge of #83149 - Dylan-DPC:rollup-ov70c5v, r=Dylan-DPC
bors [Mon, 15 Mar 2021 15:24:54 +0000 (15:24 +0000)]
Auto merge of #83149 - Dylan-DPC:rollup-ov70c5v, r=Dylan-DPC

Rollup of 10 pull requests

Successful merges:

 - #82989 (Custom error on literal names from other languages)
 - #83054 (Validate rustc_layout_scalar_valid_range_{start,end} attributes)
 - #83098 (Find more invalid doc attributes)
 - #83108 (Remove unused `opt_local_def_id_to_hir_id` function)
 - #83110 (Fix typos in `library/core/src/ptr/mod.rs` and `library/std/src/sys_common/thread_local_dtor.rs`)
 - #83113 (Minor refactoring in try_index_step)
 - #83127 (Introduce `proc_macro_back_compat` lint, and emit for `time-macros-impl`)
 - #83132 (Don't encode file information for span with a dummy location)
 - #83141 (:arrow_up: rust-analyzer)
 - #83144 (Introduce `rustc_interface::interface::Config::parse_sess_created` callback)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #83144 - hyd-dev:parse-sess-created, r=oli-obk
Dylan DPC [Mon, 15 Mar 2021 15:23:00 +0000 (16:23 +0100)]
Rollup merge of #83144 - hyd-dev:parse-sess-created, r=oli-obk

Introduce `rustc_interface::interface::Config::parse_sess_created` callback

Resolves #82900.

cc `@oli-obk`

3 years agoRollup merge of #83141 - lnicola:rust-analyzer-2021-03-15, r=jonas-schievink
Dylan DPC [Mon, 15 Mar 2021 15:22:59 +0000 (16:22 +0100)]
Rollup merge of #83141 - lnicola:rust-analyzer-2021-03-15, r=jonas-schievink

:arrow_up: rust-analyzer

3 years agoRollup merge of #83132 - Aaron1011:fix/incr-cache-dummy, r=estebank
Dylan DPC [Mon, 15 Mar 2021 15:22:58 +0000 (16:22 +0100)]
Rollup merge of #83132 - Aaron1011:fix/incr-cache-dummy, r=estebank

Don't encode file information for span with a dummy location

Fixes #83112

The location information for a dummy span isn't real, so don't encode
it. This brings the incr comp cache code into line with the Span
`StableHash` impl, which doesn't hash the location information for dummy
spans.

Previously, we would attempt to load the 'original' file from a dummy
span - if the file id changed (e.g. due to being moved on disk), we would get an
ICE, since the Span was still valid due to its hash being unchanged.

3 years agoRollup merge of #83127 - Aaron1011:time-macros-impl-warn, r=petrochenkov
Dylan DPC [Mon, 15 Mar 2021 15:22:57 +0000 (16:22 +0100)]
Rollup merge of #83127 - Aaron1011:time-macros-impl-warn, r=petrochenkov

Introduce `proc_macro_back_compat` lint, and emit for `time-macros-impl`

Now that future-incompat-report support has landed in nightly Cargo, we
can start to make progress towards removing the various proc-macro
back-compat hacks that have accumulated in the compiler.

This PR introduces a new lint `proc_macro_back_compat`, which results in
a future-incompat-report entry being generated. All proc-macro
back-compat warnings will be grouped under this lint. Note that this
lint will never actually become a hard error - instead, we will remove
the special cases for various macros, which will cause older versions of
those crates to emit some other error.

I've added code to fire this lint for the `time-macros-impl` case. This
is the easiest case out of all of our current back-compat hacks - the
crate was renamed to `time-macros`, so seeing a filename with
`time-macros-impl` guarantees that an older version of the parent `time`
crate is in use.

When Cargo's future-incompat-report feature gets stabilized, affected
users will start to see future-incompat warnings when they build their
crates.

3 years agoRollup merge of #83113 - osa1:refactor_try_index_step, r=jonas-schievink
Dylan DPC [Mon, 15 Mar 2021 15:22:56 +0000 (16:22 +0100)]
Rollup merge of #83113 - osa1:refactor_try_index_step, r=jonas-schievink

Minor refactoring in try_index_step

Merges `if-let` and `if x.is_some() { ... }` blocks

3 years agoRollup merge of #83110 - hyksm:fix-typo, r=jonas-schievink
Dylan DPC [Mon, 15 Mar 2021 15:22:55 +0000 (16:22 +0100)]
Rollup merge of #83110 - hyksm:fix-typo, r=jonas-schievink

Fix typos in `library/core/src/ptr/mod.rs` and `library/std/src/sys_common/thread_local_dtor.rs`

adress -> address

3 years agoRollup merge of #83108 - jyn514:remove-unused, r=estebank
Dylan DPC [Mon, 15 Mar 2021 15:22:53 +0000 (16:22 +0100)]
Rollup merge of #83108 - jyn514:remove-unused, r=estebank

Remove unused `opt_local_def_id_to_hir_id` function

Found while investigating #82933 - all LocalDefIds are expected to have
HirIds, there's no point in pretending otherwise.

3 years agoRollup merge of #83098 - camelid:more-doc-attr-check, r=davidtwco
Dylan DPC [Mon, 15 Mar 2021 15:22:52 +0000 (16:22 +0100)]
Rollup merge of #83098 - camelid:more-doc-attr-check, r=davidtwco

Find more invalid doc attributes

- Lint on `#[doc(123)]`, `#[doc("hello")]`, etc.
- Lint every attribute; e.g., will now report two warnings for `#[doc(foo, bar)]`
- Add hyphen to "crate level"
- Display paths like `#[doc(foo::bar)]` correctly instead of as an empty string

3 years agoRollup merge of #83054 - tmiasko:rustc_layout_scalar_valid_range, r=davidtwco
Dylan DPC [Mon, 15 Mar 2021 15:22:51 +0000 (16:22 +0100)]
Rollup merge of #83054 - tmiasko:rustc_layout_scalar_valid_range, r=davidtwco

Validate rustc_layout_scalar_valid_range_{start,end} attributes

Fixes #82251, fixes #82981.

3 years agoRollup merge of #82989 - Smittyvb:other-lang-literal-errors, r=varkor
Dylan DPC [Mon, 15 Mar 2021 15:22:50 +0000 (16:22 +0100)]
Rollup merge of #82989 - Smittyvb:other-lang-literal-errors, r=varkor

Custom error on literal names from other languages

This detects all Java literal types and all single word C data types, and suggests the corresponding Rust literal type.

3 years agoFix `src/test/run-make-fulldeps/issue-19371`
hyd-dev [Mon, 15 Mar 2021 13:16:39 +0000 (21:16 +0800)]
Fix `src/test/run-make-fulldeps/issue-19371`

3 years agoChange the `.unwrap` to `.expect` with a helpful message
hyd-dev [Mon, 15 Mar 2021 12:44:48 +0000 (20:44 +0800)]
Change the `.unwrap` to `.expect` with a helpful message

3 years agoPacify tidy
Oli Scherer [Mon, 15 Mar 2021 12:19:29 +0000 (12:19 +0000)]
Pacify tidy

3 years agoCustom error on literal names from other languages
Smitty [Mon, 15 Mar 2021 12:11:02 +0000 (08:11 -0400)]
Custom error on literal names from other languages

This detects all Java literal types and all single word C data types,
and suggests the corresponding Rust literal type.

3 years agoDo not expose fallible `to_int` operation on `Scalar`.
Oli Scherer [Mon, 15 Mar 2021 12:06:07 +0000 (12:06 +0000)]
Do not expose fallible `to_int` operation on `Scalar`.

Any use of it has been shown to be a bug in the past.

3 years agoExplain pointer and dyn Trait handling in const_to_valtree
Oli Scherer [Mon, 15 Mar 2021 11:53:37 +0000 (11:53 +0000)]
Explain pointer and dyn Trait handling in const_to_valtree

3 years agoExplain how we encode enums at the encoding site
Oli Scherer [Mon, 15 Mar 2021 11:52:26 +0000 (11:52 +0000)]
Explain how we encode enums at the encoding site

3 years agoExplain why we do not allow const_to_valtree to read from statics
Oli Scherer [Mon, 15 Mar 2021 11:52:00 +0000 (11:52 +0000)]
Explain why we do not allow const_to_valtree to read from statics

3 years agoDocument valtree
Oli Scherer [Mon, 15 Mar 2021 11:31:01 +0000 (11:31 +0000)]
Document valtree