]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #76138 - camelid:rc-fully-qualified-syntax, r=steveklabnik
Jonas Schievink [Thu, 29 Oct 2020 16:05:08 +0000 (17:05 +0100)]
Rollup merge of #76138 - camelid:rc-fully-qualified-syntax, r=steveklabnik

Explain fully qualified syntax for `Rc` and `Arc`

Also cleaned up some other small things.

@rustbot modify labels: T-doc

3 years agoRollup merge of #75078 - ijackson:slice-strip, r=steveklabnik
Jonas Schievink [Thu, 29 Oct 2020 16:05:00 +0000 (17:05 +0100)]
Rollup merge of #75078 - ijackson:slice-strip, r=steveklabnik

Improve documentation for slice strip_* functions

Prompted by the stabilisation tracking issue #73413 I looked at the docs for `strip_prefix` and `strip_suffix` for both `str` and `slice`, and I felt they could be slightly improved.

Thanks for your attention.

3 years agoAuto merge of #78446 - RalfJung:box, r=Amanieu
bors [Thu, 29 Oct 2020 12:08:16 +0000 (12:08 +0000)]
Auto merge of #78446 - RalfJung:box, r=Amanieu

fix Box::into_unique

https://github.com/rust-lang/rust/pull/77187/ broke Stacked Borrows pointer tagging around `Box::into_unique` (this is caused by `Box` being a special case in the type system, which box-internal code needs to account for). This PR fixes that.

r? `@Amanieu` Cc `@TimDiekmann`

Fixes https://github.com/rust-lang/rust/issues/78419.

3 years agoAuto merge of #78506 - cuviper:ubuntu-lts, r=pietroalbini
bors [Thu, 29 Oct 2020 09:27:08 +0000 (09:27 +0000)]
Auto merge of #78506 - cuviper:ubuntu-lts, r=pietroalbini

ci: update x86_64-gnu and x86_64-gnu-debug to ubuntu:20.04

The former `ubuntu:19.10` reached EOL in July, 2020, whereas
`ubuntu:20.04` is an LTS release supported until 2025.

These are non-dist CI images, so the impact should be low.

3 years agoAuto merge of #78486 - pietroalbini:manifest-artifacts, r=Mark-Simulacrum
bors [Thu, 29 Oct 2020 06:18:12 +0000 (06:18 +0000)]
Auto merge of #78486 - pietroalbini:manifest-artifacts, r=Mark-Simulacrum

Include non-rustup artifacts in the manifest

This PR fixes https://github.com/rust-lang/promote-release/issues/22 by including all the files we ship in the generated manifests, even the ones that are not installable through rustup. In practice this adds the following "artifacts":

* `source-code`: the tarball containing the full source code used to build the release (`rustc-{channel}-src.tar.xz`)
* `installer-msi`: the MSI installer for Windows systems (`rust-{channel}-{target}.msi`)
* `installer-pkg`: the PKG installer for macOS systems (`rust-{channel}-{target}.pkg`)

These files are included in a new `artifacts` table of the manifest, like so:

```toml
[[artifacts.installer-msi.target.aarch64-pc-windows-msvc]]
url = "https://example.com/2020-10-28/rust-nightly-aarch64-pc-windows-msvc.msi"
hash-sha256 = "6b41d5b829d20834c5d93628d008ec618f8914ee79303363bd13a86fd5f305dd"

[[artifacts.installer-msi.target.i686-pc-windows-gnu]]
url = "https://example.com/2020-10-28/rust-nightly-i686-pc-windows-gnu.msi"
hash-sha256 = "83f020de6e180c155add9fce1cea2ac6e5f744edbd6dc1581e24de8f56b2ca7a"

[[artifacts.installer-msi.target.i686-pc-windows-msvc]]
url = "https://example.com/2020-10-28/rust-nightly-i686-pc-windows-msvc.msi"
hash-sha256 = "dbc80c24e9d5df01616c6f216114b4351f51a94218e2368b5cebe4165b270702"

[[artifacts.installer-msi.target.x86_64-pc-windows-gnu]]
url = "https://example.com/2020-10-28/rust-nightly-x86_64-pc-windows-gnu.msi"
hash-sha256 = "8196eca3f02d72d4c8776ad4fcc72897125e2cf6404ae933e31c07e197e3c9fa"

[[artifacts.installer-msi.target.x86_64-pc-windows-msvc]]
url = "https://example.com/2020-10-28/rust-nightly-x86_64-pc-windows-msvc.msi"
hash-sha256 = "b2e7fd6463790732fcf9c726b9448068712341943199cb40fc11d1138b8a207b"

[[artifacts.installer-pkg.target.aarch64-apple-darwin]]
url = "https://example.com/2020-10-28/rust-nightly-aarch64-apple-darwin.pkg"
hash-sha256 = "70421c191752fb33886f8033b029e634bcc993b72308cef52a38405840e91f5c"

[[artifacts.installer-pkg.target.x86_64-apple-darwin]]
url = "https://example.com/2020-10-28/rust-nightly-x86_64-apple-darwin.pkg"
hash-sha256 = "ebd7a5acb61e82d85e855146cc9bd856f32228ee7f40dd94c659b00614ed4f1f"

[[artifacts.source-code.target."*"]]
url = "https://example.com/2020-10-28/rustc-nightly-src.tar.gz"
hash-sha256 = "5fcc487ee4c15c689de8ddf7daac7ff6a65c80498197b9aea58622dc2b3bca10"

[[artifacts.source-code.target."*"]]
url = "https://example.com/2020-10-28/rustc-nightly-src.tar.xz"
hash-sha256 = "0c618ef0ec5f64da1801e9d0df6c755f6ed1a8780ec5c8ee75e55614be51d42c"

```

Each artifact can be available for multiple targets, and each target can have multiple versions of the same file (for example, a `gz`-compressed one and a `xz`-compressed one). In the future rustup might add functionality to let users retrieve the artifacts, but that's not needed to land this PR, and whether to do the implementation is up to the rustup maintainers.

r? `@kinnison`
cc `@Mark-Simulacrum`

3 years agoAuto merge of #78512 - JohnTitor:rollup-a7qwjah, r=JohnTitor
bors [Thu, 29 Oct 2020 03:57:54 +0000 (03:57 +0000)]
Auto merge of #78512 - JohnTitor:rollup-a7qwjah, r=JohnTitor

Rollup of 11 pull requests

Successful merges:

 - #77213 (rustdoc options to set default theme (and other settings))
 - #78224 (min_const_generics: allow ty param in repeat expr)
 - #78428 (MinConstGenerics UI test for invalid values for bool & char)
 - #78460 (Adjust turbofish help message for const generics)
 - #78470 (Clean up intra-doc links in `std::path`)
 - #78475 (fix a comment in validity check)
 - #78478 (Add const generics tests for supertraits + dyn traits.)
 - #78487 (Fix typo "compiltest")
 - #78491 (Inline NonZeroN::from(n))
 - #78492 (Update books)
 - #78494 (Fix typos)

Failed merges:

r? `@ghost`

3 years agoRollup merge of #78494 - bugadani:typo2, r=jonas-schievink
Yuki Okushi [Thu, 29 Oct 2020 03:09:03 +0000 (12:09 +0900)]
Rollup merge of #78494 - bugadani:typo2, r=jonas-schievink

Fix typos

3 years agoRollup merge of #78492 - ehuss:update-books, r=ehuss
Yuki Okushi [Thu, 29 Oct 2020 03:09:01 +0000 (12:09 +0900)]
Rollup merge of #78492 - ehuss:update-books, r=ehuss

Update books

## nomicon

7 commits in 6e57e64501f61873ab80cb78a07180a22751a5d6..69333eddb1de92fd17e272ce4677cc983d3bd71d
2020-09-14 11:40:23 -0400 to 2020-10-17 15:44:12 -0700
- Tweak GHA config (rust-lang-nursery/nomicon#240)
- Fix link for `[T]` (rust-lang-nursery/nomicon#239)
- Update casts.md (rust-lang-nursery/nomicon#232)
- [WIP] Add more links (rust-lang-nursery/nomicon#180)
- Data Race definition should be more precise (rust-lang-nursery/nomicon#219)
- Update the diagnostic of `error[E0597]` in dropck.md (rust-lang-nursery/nomicon#157)
- fix typo in Lifetimes mutable reference aliasing section (rust-lang-nursery/nomicon#225)

## reference

3 commits in 1b78182e71709169dc0f1c3acdc4541b6860e1c4..10c16caebe475d0d11bec0531b95d7697856c13c
2020-10-11 13:53:47 -0700 to 2020-10-25 20:51:26 -0700
- Add `unsafe` for `mod` and `extern`. (rust-lang-nursery/reference#898)
- mention how unions interact with dropping (rust-lang-nursery/reference#897)
- Add `move_ref_pattern` docs (rust-lang-nursery/reference#881)

## book

2 commits in 451a1e30f2dd137aa04e142414eafb8d05f87f84..13e1c05420bca86ecc79e4ba5b6d02de9bd53c62
2020-10-05 09:11:18 -0500 to 2020-10-20 14:57:32 -0500
- Referencing to Appendix B (rust-lang/book#2481)
- Use GITHUB_PATH instead of add-path (rust-lang/book#2477)

## rust-by-example

2 commits in 152475937a8d8a1f508d8eeb57db79139bc803d9..99eafee0cb14e6ec641bf02a69d7b30f6058349a
2020-10-09 09:29:50 -0300 to 2020-10-21 14:21:55 -0300
- Formatting footer items. (rust-lang/rust-by-example#1385)
- Add partial moves example for `move_ref_pattern` stabilization (rust-lang/rust-by-example#1377)

## edition-guide

3 commits in 81f16863014de60b53de401d71ff904d163ee030..7bc9b7a5e800f79df62947cb7d566fd2fbaf19fe
2020-08-27 13:56:31 -0700 to 2020-10-23 18:31:23 -0500
- A few small updates. (rust-lang/edition-guide#221)
- Clarify the limitation of ? in main and tests (rust-lang/edition-guide#219)
- Update deprecated GitHub Actions commands. (rust-lang/edition-guide#220)

3 years agoRollup merge of #78491 - petertodd:2020-inline-from-nonzero, r=sfackler
Yuki Okushi [Thu, 29 Oct 2020 03:08:59 +0000 (12:08 +0900)]
Rollup merge of #78491 - petertodd:2020-inline-from-nonzero, r=sfackler

Inline NonZeroN::from(n)

Currently this results in the generated assembly having a function call for this trivial conversion.

3 years agoRollup merge of #78487 - rust-lang:GuillaumeGomez-patch-1, r=steveklabnik
Yuki Okushi [Thu, 29 Oct 2020 03:08:58 +0000 (12:08 +0900)]
Rollup merge of #78487 - rust-lang:GuillaumeGomez-patch-1, r=steveklabnik

Fix typo "compiltest"

Part of #70898.

3 years agoRollup merge of #78478 - hameerabbasi:const-generics-supertraits, r=lcnr
Yuki Okushi [Thu, 29 Oct 2020 03:08:56 +0000 (12:08 +0900)]
Rollup merge of #78478 - hameerabbasi:const-generics-supertraits, r=lcnr

Add const generics tests for supertraits + dyn traits.

Partially addresses #78433

3 years agoRollup merge of #78475 - RalfJung:validity-comment, r=oli-obk
Yuki Okushi [Thu, 29 Oct 2020 03:08:55 +0000 (12:08 +0900)]
Rollup merge of #78475 - RalfJung:validity-comment, r=oli-obk

fix a comment in validity check

A few things changed since that comment was written; update it to the current reality.

r? @oli-obk

3 years agoRollup merge of #78470 - camelid:fixup-std-path-intra-doc, r=jyn514
Yuki Okushi [Thu, 29 Oct 2020 03:08:53 +0000 (12:08 +0900)]
Rollup merge of #78470 - camelid:fixup-std-path-intra-doc, r=jyn514

Clean up intra-doc links in `std::path`

3 years agoRollup merge of #78460 - varkor:turbofish-string-generic, r=lcnr
Yuki Okushi [Thu, 29 Oct 2020 03:08:50 +0000 (12:08 +0900)]
Rollup merge of #78460 - varkor:turbofish-string-generic, r=lcnr

Adjust turbofish help message for const generics

Types are no longer special. (This message arguably only makes sense with `min_const_generics` or more, but we'll be there soon.)

r? @lcnr

3 years agoRollup merge of #78428 - JulianKnodt:invalid_patterns, r=lcnr
Yuki Okushi [Thu, 29 Oct 2020 03:08:48 +0000 (12:08 +0900)]
Rollup merge of #78428 - JulianKnodt:invalid_patterns, r=lcnr

MinConstGenerics UI test for invalid values for bool & char

This adds a test for `feature(min_const_generics)` with some invalid values for bools and chars and ensures that they do not ICE and error with understandable messages.

r? @lcnr

3 years agoRollup merge of #78224 - lcnr:repeat-expr, r=varkor
Yuki Okushi [Thu, 29 Oct 2020 03:08:40 +0000 (12:08 +0900)]
Rollup merge of #78224 - lcnr:repeat-expr, r=varkor

min_const_generics: allow ty param in repeat expr

implements https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/repeat.20expressions

Even with `min_const_generics` active, now keeps resulting in future compat warnings instead of hard errors.
Const parameters, for example `[0; N + 1]`, still result in hard errors during resolve.
```rust
#![allow(dead_code)]

fn foo<T>() {
    [0; std::mem::size_of::<*mut T>()];
}

struct Foo<T>(T);

impl<T> Foo<T> {
    const ASSOC: usize = 4;

    fn test() {
        [0; Self::ASSOC];
    }
}
```

r? @varkor cc @petrochenkov

3 years agoRollup merge of #77213 - ijackson:wip-rustdoc-settings, r=jyn514,GuillaumeGomez
Yuki Okushi [Thu, 29 Oct 2020 03:08:38 +0000 (12:08 +0900)]
Rollup merge of #77213 - ijackson:wip-rustdoc-settings, r=jyn514,GuillaumeGomez

rustdoc options to set default theme (and other settings)

Hi.  This is the MR I promised in #77024

It is a little more general than I envisaged there.  Once I had found the settings-handling machinery it seemed foolish to add this feature just for the theme.

Closes #77024

3 years agoAuto merge of #78430 - Nadrieril:taking-constructors-seriously2, r=varkor
bors [Thu, 29 Oct 2020 01:37:49 +0000 (01:37 +0000)]
Auto merge of #78430 - Nadrieril:taking-constructors-seriously2, r=varkor

Clarify main code paths in exhaustiveness checking

This PR massively clarifies the main code paths of exhaustiveness checking, by using the `Constructor` enum to a fuller extent. I've been itching to write it for more than a year, but the complexity of matching consts had prevented me. Behold a massive simplification :D.
This in particular removes a fair amount of duplication between various parts, localizes code into methods of relevant types when applicable, makes some implicit assumptions explicit, and overall improves legibility a lot (or so I hope). Additionally, after my changes undoing #76918 turned out to be a noticeable perf gain.

As usual I tried my best to make the commits self-contained and easy to follow. I've also tried to keep the code well-commented, but I tend to forget how complex this file is; I'm happy to clarify things as needed.
My measurements show good perf improvements on the two match-heavy benchmarks (-18.0% on `unicode_normalization-check`! :D); I'd like a perf run to check the overall impact.

r? `@varkor`
`@rustbot` modify labels: +A-exhaustiveness-checking

3 years agoci: update x86_64-gnu and x86_64-gnu-debug to ubuntu:20.04
Josh Stone [Thu, 29 Oct 2020 00:26:03 +0000 (17:26 -0700)]
ci: update x86_64-gnu and x86_64-gnu-debug to ubuntu:20.04

The former `ubuntu:19.10` reached EOL in July, 2020, whereas
`ubuntu:20.04` is an LTS release supported until 2025.

These are non-dist CI images, so the impact should be low.

3 years agoDon't say you "should" use fully qualified syntax
Camelid [Wed, 28 Oct 2020 23:47:05 +0000 (16:47 -0700)]
Don't say you "should" use fully qualified syntax

That recommendation was removed last year; there isn't a particular
style that is officially recommended anymore.

3 years agoFix broken intra-doc link
Camelid [Mon, 31 Aug 2020 04:22:10 +0000 (21:22 -0700)]
Fix broken intra-doc link

3 years agoExplain fully qualified syntax for `Rc` and `Arc`
Camelid [Mon, 31 Aug 2020 01:40:56 +0000 (18:40 -0700)]
Explain fully qualified syntax for `Rc` and `Arc`

3 years agorustdoc: Use Vec::into_iter() rather than drain()
Ian Jackson [Wed, 28 Oct 2020 21:29:21 +0000 (21:29 +0000)]
rustdoc: Use Vec::into_iter() rather than drain()

This allows removing a `mut` which is nicer.

Suggested-by: @jyn514
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoAdd a comment about non-panicking of splitn().next().unwrap()
Ian Jackson [Wed, 28 Oct 2020 21:25:47 +0000 (21:25 +0000)]
Add a comment about non-panicking of splitn().next().unwrap()

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agorustdoc: Fix some nits
Ian Jackson [Wed, 28 Oct 2020 20:12:15 +0000 (20:12 +0000)]
rustdoc: Fix some nits

* Remove a needless comma in the Rust code
* Replace double spaces after full stops with single spaces

Requested-by: @GuillaumeGomez
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoAuto merge of #78415 - tgnottingham:expn_id_tag_hash, r=Aaron1011
bors [Wed, 28 Oct 2020 20:03:55 +0000 (20:03 +0000)]
Auto merge of #78415 - tgnottingham:expn_id_tag_hash, r=Aaron1011

rustc_span: avoid hashing ExpnId tag when using cached hash

3 years agoApply suggestions from code review
Nadrieril [Wed, 28 Oct 2020 19:03:49 +0000 (19:03 +0000)]
Apply suggestions from code review

Co-authored-by: Who? Me?! <mark-i-m@users.noreply.github.com>
Co-authored-by: varkor <github@varkor.com>
3 years agoFix typos
Dániel Buga [Wed, 28 Oct 2020 18:31:16 +0000 (19:31 +0100)]
Fix typos

3 years agorustdoc: Provide a --default-theme THEME option
Ian Jackson [Wed, 28 Oct 2020 17:53:12 +0000 (17:53 +0000)]
rustdoc: Provide a --default-theme THEME option

This is a fairly simple special case of --default-eetting.  We must
set both "theme" and "use-system-theme".

Providing it separately enables us to document a way to set the theme
without expoosing the individual settings keywords, which are quite
complex.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agorustdoc: Provide a general --default-setting SETTING[=VALUE] option
Ian Jackson [Tue, 13 Oct 2020 17:52:43 +0000 (18:52 +0100)]
rustdoc: Provide a general --default-setting SETTING[=VALUE] option

We just plumb through what the user tells us.

This is flagged as unstable, mostly because I don't understand the
compatibility rules that rustdoc obeys for local storage data, and how
error handling of invalid data works.

We collect() the needed HashMap from Vec of Vecs of (key, value)
pairs, so that there is a nice place to add new more-specific options.
It would have been possible to use Extend::extend but doing it this
way ensures that all the used inputs are (and will stay) right next to
each other.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agorustdoc: Provide a way to set the default settings from Rust code
Ian Jackson [Wed, 23 Sep 2020 21:44:54 +0000 (22:44 +0100)]
rustdoc: Provide a way to set the default settings from Rust code

rustdoc has various user-configurable preferences.  These are recorded
in web Local Storage (where available).  But we want to provide a way
to configure the default default, including for when web storage is
not available.

getSettingValue is the function responsible for looking up these
settings.  Here we make it fall back some in-DOM data, which
ultimately comes from RenderOptions.default_settings.

Using HTML data atrtributes is fairly convenient here, dsspite the
need to transform between snake and kebab case to avoid the DOM
converting kebab case to camel case (!)

We cache the element and dataset lookup in a global variable, to
ensure that getSettingValue remains fast.

The DOM representation has to be in an element which precedes the
inclusion of storage.js.  That means it has to be in the <head> and we
should not use an empty <div> as the container (although most browsers
will accept that).  An empty <script> element provides a convenient
and harmless container object.  <meta> would be another possibility
but runs a greater risk of having unwanted behaviours on weird
browsers.

We trust the RenderOptions not to contain unhelpful setting names,
which don't fit nicely into an HTML attribute.  It's awkward to quote
dataset keys.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoUpdate books
Eric Huss [Wed, 28 Oct 2020 17:53:15 +0000 (10:53 -0700)]
Update books

3 years agoAuto merge of #78414 - nox:function-sections, r=nagisa,bjorn3
bors [Wed, 28 Oct 2020 17:47:36 +0000 (17:47 +0000)]
Auto merge of #78414 - nox:function-sections, r=nagisa,bjorn3

Implement -Z function-sections=yes|no

This lets rustc users tweak whether all functions should be put in their own TEXT section, using whatever default value the target defines if the flag is missing.

I'm having fun experimenting with musl libc and trying to implement the start symbol in Rust, that means avoiding code that requires relocations, and AFAIK putting everything in its own section makes the toolchain generate `GOTPCREL` relocations for symbols that could use plain old PC-relative addressing (at least on `x86_64`) if they were all in the same section.

3 years agoInline NonZeroN::from(n)
Peter Todd [Wed, 28 Oct 2020 17:26:44 +0000 (13:26 -0400)]
Inline NonZeroN::from(n)

3 years agorustdoc: js: Use getSettingValue for all rustdoc-* values
Ian Jackson [Wed, 23 Sep 2020 21:14:43 +0000 (22:14 +0100)]
rustdoc: js: Use getSettingValue for all rustdoc-* values

Currently, storage.js and main.js have many open-coded calls to
getCurrentValue for "rustdoc-" values, but these are settings and
should be handled by getSettingValue.

So make getSettingValue part of storage.js (where everyone can call
it) and use it everywhere.

No functional change yet.  We are going to make getSettingValue do
something more sophisticated in a moment.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoAuto merge of #78409 - pietroalbini:build-manifest-checksum-cache, r=Mark-Simulacrum
bors [Wed, 28 Oct 2020 14:52:20 +0000 (14:52 +0000)]
Auto merge of #78409 - pietroalbini:build-manifest-checksum-cache, r=Mark-Simulacrum

Add checksums cache to build-manifest

During the release process we're currently calculating the SHA256 of each file three times:

1. In `build-manifest`, to fill the `hash = "f00"` keys of the manifests.
2. In `promote-release`, to generate the `.sha256` files.
3. In `promote-release`, to generate the `.asc` GPG signatures.

Calculations 1. and 2. could be merged into a single one if there was a way for `build-manifest` to pass the checksums it generated over to `promote-release`. Unfortunately calculation 3. can't be merged as GPG requires extra metadata to be hashed.

This PR adds support for merging 1. and 2. by creating the `BUILD_MANIFEST_CHECKSUM_CACHE` environment variable, which points to a JSON file storing a cache of all the calculated checksums. `build-manifest` will load it at startup and avoid generating existing checksums, and it will dump its internal checksums cache into it when it exits successfully.

This PR also allows to run `build-manifest` multiple times without the need to wait for checksums to be calculated in the following invocations. The speedup will allow to work torwards a fix for https://github.com/rust-lang/promote-release/issues/15 without impacting the release process duration nor our storage costs.

This PR can be reviewed commit-by-commit.
r? `@Mark-Simulacrum`

3 years agoFix typo "compiltest"
Guillaume Gomez [Wed, 28 Oct 2020 14:51:26 +0000 (15:51 +0100)]
Fix typo "compiltest"

3 years agobuild-manifest: include artifacts in a new table
Pietro Albini [Wed, 28 Oct 2020 13:41:02 +0000 (14:41 +0100)]
build-manifest: include artifacts in a new table

This commit adds to the generated manifest all files we ship that are
not rustup components, namely:

* Source code tarballs (rustc-{channel}-src.tar.xz)
* Windows installers (rust-{channel}-{target}.msi)
* macOS installers (rust-{channel}-{target}.pkg)

Those files are included in a new "artifacts" table of the manifest, to
avoid interfering with existing rustup installations.

3 years agoAssert in every case.
Hameer Abbasi [Wed, 28 Oct 2020 12:51:15 +0000 (12:51 +0000)]
Assert in every case.

3 years agoExtend test to cover dyn methods/functions.
Hameer Abbasi [Wed, 28 Oct 2020 12:29:13 +0000 (12:29 +0000)]
Extend test to cover dyn methods/functions.

3 years agoRemove irrelevant FIXME
varkor [Wed, 28 Oct 2020 00:46:53 +0000 (00:46 +0000)]
Remove irrelevant FIXME

3 years agoAdjust turbofish help message for const generics
varkor [Wed, 28 Oct 2020 00:41:40 +0000 (00:41 +0000)]
Adjust turbofish help message for const generics

3 years agoAdd const generics tests for supertraits + dyn traits.
Hameer Abbasi [Wed, 28 Oct 2020 10:36:19 +0000 (10:36 +0000)]
Add const generics tests for supertraits + dyn traits.

3 years agofix a comment in validity check
Ralf Jung [Wed, 28 Oct 2020 09:39:21 +0000 (10:39 +0100)]
fix a comment in validity check

3 years agoAuto merge of #78323 - est31:smaller_list_overlap, r=varkor
bors [Wed, 28 Oct 2020 03:58:32 +0000 (03:58 +0000)]
Auto merge of #78323 - est31:smaller_list_overlap, r=varkor

Iterate over the smaller list

If there are two lists of different sizes,
iterating over the smaller list and then
looking up in the larger list is cheaper
than vice versa, because lookups scale
sublinearly.

3 years agoClean up intra-doc links in `std::path`
Camelid [Wed, 28 Oct 2020 03:54:30 +0000 (20:54 -0700)]
Clean up intra-doc links in `std::path`

3 years agoAuto merge of #78458 - Dylan-DPC:rollup-tan044s, r=Dylan-DPC
bors [Wed, 28 Oct 2020 01:40:06 +0000 (01:40 +0000)]
Auto merge of #78458 - Dylan-DPC:rollup-tan044s, r=Dylan-DPC

Rollup of 10 pull requests

Successful merges:

 - #78152 (Separate unsized locals)
 - #78297 (Suggest calling await on method call and field access)
 - #78351 (Move "mutable thing in const" check from interning to validity)
 - #78365 (check object safety of generic constants)
 - #78379 (Tweak invalid `fn` header and body parsing)
 - #78391 (Add const_fn in generics test)
 - #78401 (resolve: private fields in tuple struct ctor diag)
 - #78408 (Remove tokens from foreign items in `TokenStripper`)
 - #78447 (Fix typo in  comment)
 - #78453 (Fix typo in comments)

Failed merges:

r? `@ghost`

3 years agoRollup merge of #78453 - Storyyeller:patch-1, r=jonas-schievink
Dylan DPC [Wed, 28 Oct 2020 00:21:39 +0000 (01:21 +0100)]
Rollup merge of #78453 - Storyyeller:patch-1, r=jonas-schievink

Fix typo in comments

3 years agoRollup merge of #78447 - bugadani:typo, r=matthewjasper
Dylan DPC [Wed, 28 Oct 2020 00:21:37 +0000 (01:21 +0100)]
Rollup merge of #78447 - bugadani:typo, r=matthewjasper

Fix typo in  comment

I hope I got all the typos in that word. :)

3 years agoRollup merge of #78408 - Aaron1011:fix/remove-foreign-tokens, r=oli-obk
Dylan DPC [Wed, 28 Oct 2020 00:21:34 +0000 (01:21 +0100)]
Rollup merge of #78408 - Aaron1011:fix/remove-foreign-tokens, r=oli-obk

Remove tokens from foreign items in `TokenStripper`

Fixes #78398

I forgot to handle this case in #77255

3 years agoRollup merge of #78401 - davidtwco:issue-75906-tuple-construct-private-field, r=estebank
Dylan DPC [Wed, 28 Oct 2020 00:21:31 +0000 (01:21 +0100)]
Rollup merge of #78401 - davidtwco:issue-75906-tuple-construct-private-field, r=estebank

resolve: private fields in tuple struct ctor diag

Fixes #75906.

This PR improves the diagnostic emitted when a tuple struct is being constructed which has private fields so that private fields are labelled and the message is improved.

r? @estebank

3 years agoRollup merge of #78391 - JulianKnodt:mc_test, r=lcnr
Dylan DPC [Wed, 28 Oct 2020 00:21:27 +0000 (01:21 +0100)]
Rollup merge of #78391 - JulianKnodt:mc_test, r=lcnr

Add const_fn in generics test

Adds a test that constant functions in generic parameters work properly. I was surprised this works, but I also to turbofish the constant in main, otherwise it didn't infer properly:
```
let v: ConstU32<3> = ...
```
Did not work as I expected, which I can highlight in the test if that's the intended behaviour.

r? @lcnr

3 years agoRollup merge of #78379 - estebank:fn-signature-parse, r=varkor
Dylan DPC [Wed, 28 Oct 2020 00:21:24 +0000 (01:21 +0100)]
Rollup merge of #78379 - estebank:fn-signature-parse, r=varkor

Tweak invalid `fn` header and body parsing

* Rely on regular "expected"/"found" parser error for `fn`, fix #77115
* Recover empty `fn` bodies when encountering `}`
* Recover trailing `>` in return types
* Recover from non-type in array type `[<BAD TOKEN>; LEN]`

3 years agoRollup merge of #78365 - lcnr:const-eval-obj-safety, r=oli-obk
Dylan DPC [Wed, 28 Oct 2020 00:21:21 +0000 (01:21 +0100)]
Rollup merge of #78365 - lcnr:const-eval-obj-safety, r=oli-obk

check object safety of generic constants

As `Self` can only be effectively used in constants with `const_evaluatable_checked` this should not matter outside of it.

Implements the first item of #72219

> Object safety interactions with constants

r? @oli-obk for now cc @nikomatsakis

3 years agoRollup merge of #78351 - RalfJung:validity-unsafe-cell, r=oli-obk
Dylan DPC [Wed, 28 Oct 2020 00:21:18 +0000 (01:21 +0100)]
Rollup merge of #78351 - RalfJung:validity-unsafe-cell, r=oli-obk

Move "mutable thing in const" check from interning to validity

This moves the check for mutable things (such as `UnsafeCell` or `&mut`) in a`const` from interning to validity. That means we can give more targeted error messages (pointing out *where* the problem lies), and we can simplify interning a bit.

Also fix the interning mode used for promoteds in statics.

r? @oli-obk

3 years agoRollup merge of #78297 - estebank:match-semicolon-2, r=oli-obk
Dylan DPC [Wed, 28 Oct 2020 00:21:10 +0000 (01:21 +0100)]
Rollup merge of #78297 - estebank:match-semicolon-2, r=oli-obk

Suggest calling await on method call and field access

When encountering a failing method or field resolution on a `Future`,
look at the `Output` and try the same operation on it. If successful,
suggest calling `.await` on the `Future`.

This had already been introduced in #72784, but at some point they
stopped working.

Built on top of #78214, only last commit is relevant.

r? @oli-obk

3 years agoRollup merge of #78152 - spastorino:separate-unsized-locals, r=oli-obk
Dylan DPC [Wed, 28 Oct 2020 00:21:08 +0000 (01:21 +0100)]
Rollup merge of #78152 - spastorino:separate-unsized-locals, r=oli-obk

Separate unsized locals

Closes #71694

Takes over again #72029 and #74971

cc @RalfJung @oli-obk @pnkfelix @eddyb as they've participated in previous reviews of this PR.

3 years agoAuto merge of #75671 - nathanwhit:cstring-temp-lint, r=oli-obk
bors [Tue, 27 Oct 2020 22:59:13 +0000 (22:59 +0000)]
Auto merge of #75671 - nathanwhit:cstring-temp-lint, r=oli-obk

Uplift `temporary-cstring-as-ptr` lint from `clippy` into rustc

The general consensus seems to be that this lint covers a common enough mistake to warrant inclusion in rustc.
The diagnostic message might need some tweaking, as I'm not sure the use of second-person perspective matches the rest of rustc, but I'd like to hear others' thoughts on that.

(cc #53224).

r? `@oli-obk`

3 years agoAdd UI test for invalid values for bool & char
kadmin [Mon, 26 Oct 2020 23:25:12 +0000 (23:25 +0000)]
Add UI test for invalid values for bool & char

3 years agoFix typo in comments
Robert Grosse [Tue, 27 Oct 2020 21:23:58 +0000 (14:23 -0700)]
Fix typo in comments

3 years agoAdd const_fn in generics test
kadmin [Mon, 26 Oct 2020 08:19:05 +0000 (08:19 +0000)]
Add const_fn in generics test

3 years agoMerge unsized locals pat tests
Santiago Pastorino [Wed, 21 Oct 2020 11:23:40 +0000 (08:23 -0300)]
Merge unsized locals pat tests

3 years agoUse unsized_feature_enabled helper function
Santiago Pastorino [Wed, 21 Oct 2020 10:50:15 +0000 (07:50 -0300)]
Use unsized_feature_enabled helper function

3 years agois -> are both
Santiago Pastorino [Wed, 21 Oct 2020 10:36:29 +0000 (07:36 -0300)]
is -> are both

3 years agoBless tests again
Santiago Pastorino [Wed, 21 Oct 2020 10:35:19 +0000 (07:35 -0300)]
Bless tests again

3 years agoHide outermost_fn_param_pat, it's an internal detail
Santiago Pastorino [Wed, 21 Oct 2020 00:56:29 +0000 (21:56 -0300)]
Hide outermost_fn_param_pat, it's an internal detail

3 years agoor -> and
Santiago Pastorino [Wed, 21 Oct 2020 00:53:54 +0000 (21:53 -0300)]
or -> and

3 years agoAdd comment explaining why in these tests unsized locals are not accepted
Santiago Pastorino [Wed, 21 Oct 2020 00:52:49 +0000 (21:52 -0300)]
Add comment explaining why in these tests unsized locals are not accepted

3 years agoparam -> parameter, pat -> pattern
Santiago Pastorino [Tue, 20 Oct 2020 20:45:36 +0000 (17:45 -0300)]
param -> parameter, pat -> pattern

3 years agoRename within_fn_param to outermost_fn_param_pat
Santiago Pastorino [Tue, 20 Oct 2020 16:40:18 +0000 (13:40 -0300)]
Rename within_fn_param to outermost_fn_param_pat

3 years agoDo not use unsized_fn_params in patterns
Santiago Pastorino [Tue, 20 Oct 2020 16:30:47 +0000 (13:30 -0300)]
Do not use unsized_fn_params in patterns

3 years agoProperly restore within_fn_param value to the previous state
Santiago Pastorino [Tue, 20 Oct 2020 16:23:58 +0000 (13:23 -0300)]
Properly restore within_fn_param value to the previous state

3 years agoTest that unsized locals fail when turning unsized_fn_params feature flag on
Santiago Pastorino [Tue, 20 Oct 2020 16:08:40 +0000 (13:08 -0300)]
Test that unsized locals fail when turning unsized_fn_params feature flag on

3 years agoBetter test unsized_fn_params
Santiago Pastorino [Tue, 20 Oct 2020 15:40:02 +0000 (12:40 -0300)]
Better test unsized_fn_params

3 years agoBless issue-53448 test
Santiago Pastorino [Tue, 20 Oct 2020 15:39:32 +0000 (12:39 -0300)]
Bless issue-53448 test

3 years agounsized_locals feature is not needed in this test
Santiago Pastorino [Sat, 17 Oct 2020 02:19:58 +0000 (23:19 -0300)]
unsized_locals feature is not needed in this test

3 years agoDo not depend on except for bootstrap
Santiago Pastorino [Sat, 17 Oct 2020 02:19:26 +0000 (23:19 -0300)]
Do not depend on  except for bootstrap

3 years agoFix unstable-book doc tests
Santiago Pastorino [Sun, 24 May 2020 20:22:41 +0000 (17:22 -0300)]
Fix unstable-book doc tests

3 years agoUsing unsized_local feature is not needed in these tests
Santiago Pastorino [Sat, 23 May 2020 19:26:20 +0000 (16:26 -0300)]
Using unsized_local feature is not needed in these tests

3 years agoMake tidy happy
Santiago Pastorino [Sat, 23 May 2020 12:35:22 +0000 (09:35 -0300)]
Make tidy happy

3 years agoThis flag is not really needed in the test
Santiago Pastorino [Fri, 16 Oct 2020 22:38:46 +0000 (19:38 -0300)]
This flag is not really needed in the test

3 years agoAdd unsized_locals to INCOMPLETE_FEATURES list
Santiago Pastorino [Fri, 16 Oct 2020 22:37:54 +0000 (19:37 -0300)]
Add unsized_locals to INCOMPLETE_FEATURES list

3 years agoAdd unsized_fn_params feature
Santiago Pastorino [Fri, 16 Oct 2020 20:46:59 +0000 (17:46 -0300)]
Add unsized_fn_params feature

3 years agoFix typo in vec_graph
Dániel Buga [Tue, 27 Oct 2020 17:37:43 +0000 (18:37 +0100)]
Fix typo in vec_graph

3 years agoFix typos in arena comments
Dániel Buga [Tue, 27 Oct 2020 17:14:21 +0000 (18:14 +0100)]
Fix typos in arena comments

3 years agoAuto merge of #76269 - ayrtonm:function-reference-lint, r=oli-obk
bors [Tue, 27 Oct 2020 16:32:23 +0000 (16:32 +0000)]
Auto merge of #76269 - ayrtonm:function-reference-lint, r=oli-obk

added a lint against function references

this lint suggests casting function references to `*const ()`
closes #75239
r? `@RalfJung`

3 years agoFix typo in comment
Dániel Buga [Tue, 27 Oct 2020 15:55:20 +0000 (16:55 +0100)]
Fix typo in  comment

3 years agofix Box::into_unique
Ralf Jung [Tue, 27 Oct 2020 16:02:42 +0000 (17:02 +0100)]
fix Box::into_unique

3 years agoAdded suggestion to `function_item_references` lint and fixed warning message
Ayrton [Tue, 27 Oct 2020 13:00:19 +0000 (09:00 -0400)]
Added suggestion to `function_item_references` lint and fixed warning message

Also updated tests accordingly and tweaked some wording in the lint declaration.

3 years agoAdded documentation for `function_item_references` lint
Ayrton [Wed, 21 Oct 2020 21:19:21 +0000 (17:19 -0400)]
Added documentation for `function_item_references` lint

Added documentation for `function_item_references` lint to the rustc book and
fixed comments in the lint checker itself.

3 years agoFixed compiler error in lint checker triggered by associated types
Ayrton [Tue, 6 Oct 2020 21:55:46 +0000 (17:55 -0400)]
Fixed compiler error in lint checker triggered by associated types

When a function argument bound by `Pointer` is an associated type, we only
perform substitutions using the parameters from the callsite but don't attempt
to normalize since it may not succeed. A simplified version of the scenario that
triggered this error was added as a test case. Also fixed `Pointer::fmt` which
was being double-counted when called outside of macros and added a test case for
this.

3 years agoRemoved test for unhandled case in function_item_references lint
Ayrton [Tue, 6 Oct 2020 15:59:14 +0000 (11:59 -0400)]
Removed test for unhandled case in function_item_references lint

Removed test for the unhandled case of calls to `fn f<T>(x: &T)` where `x` is a
function reference and is formatted as a pointer in `f`. This compiles since
`&T` implements `Pointer`, but is unlikely to occur in practice. Also tweaked
the lint's wording and modified tests accordingly.

3 years agoChanged lint to check for `std::fmt::Pointer` and `transmute`
Ayrton [Tue, 6 Oct 2020 13:51:10 +0000 (09:51 -0400)]
Changed lint to check for `std::fmt::Pointer` and `transmute`

The lint checks arguments in calls to `transmute` or functions that have
`Pointer` as a trait bound and displays a warning if the argument is a function
reference. Also checks for `std::fmt::Pointer::fmt` to handle formatting macros
although it doesn't depend on the exact expansion of the macro or formatting
internals. `std::fmt::Pointer` and `std::fmt::Pointer::fmt` were also added as
diagnostic items and symbols.

3 years agomodified lint to work with MIR
Ayrton [Fri, 11 Sep 2020 02:53:14 +0000 (22:53 -0400)]
modified lint to work with MIR

Working with MIR let's us exclude expressions like `&fn_name as &dyn Something`
and `(&fn_name)()`. Also added ABI, unsafety and whether a function is variadic
in the lint suggestion, included the `&` in the span of the lint and updated the
test.

3 years agochanged lint to suggest casting to the proper function type and added a test
Ayrton [Fri, 4 Sep 2020 13:45:09 +0000 (09:45 -0400)]
changed lint to suggest casting to the proper function type and added a test

3 years agoadded a lint against function references
Ayrton [Wed, 19 Aug 2020 04:30:49 +0000 (00:30 -0400)]
added a lint against function references

this lint suggests casting function references to `*const ()`

3 years agoFix test
Nathan Whitaker [Tue, 27 Oct 2020 14:10:30 +0000 (10:10 -0400)]
Fix test

3 years agoAuto merge of #78434 - jonas-schievink:disable-miropt, r=wesleywiser
bors [Tue, 27 Oct 2020 13:57:54 +0000 (13:57 +0000)]
Auto merge of #78434 - jonas-schievink:disable-miropt, r=wesleywiser

Disable "optimization to avoid load of address" in InstCombine

Same as #78195, fixes https://github.com/rust-lang/rust/issues/78192 (again).

3 years agoAuto merge of #78227 - SergioBenitez:test-stdout-threading, r=m-ou-se
bors [Tue, 27 Oct 2020 11:43:18 +0000 (11:43 +0000)]
Auto merge of #78227 - SergioBenitez:test-stdout-threading, r=m-ou-se

Capture output from threads spawned in tests

This is revival of #75172.

Original text:
> Fixes #42474.
>
> r? `@​dtolnay` since you expressed interest in this, but feel free to redirect if you aren't the right person anymore.

---

Closes #75172.

3 years agoDisable "optimization to avoid load of address" in InstCombine
Jonas Schievink [Tue, 27 Oct 2020 09:59:28 +0000 (10:59 +0100)]
Disable "optimization to avoid load of address" in InstCombine