]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #75685 - nixphix:docs/unix-ext, r=jyn514
Yuki Okushi [Wed, 19 Aug 2020 06:54:39 +0000 (15:54 +0900)]
Rollup merge of #75685 - nixphix:docs/unix-ext, r=jyn514

Switch to intra-doc links in /src/sys/unix/ext/*.rs

Partial fix for #75080

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

r? @jyn514

These two links are not resolving to either `crate::fs::File...` or `fs::File...`
```
# unix/ext/fs.rs
   27:    /// [`File::read`]: ../../../../std/fs/struct.File.html#method.read

  130:   /// [`File::write`]: ../../../../std/fs/struct.File.html#method.write
```

3 years agoRollup merge of #75665 - GuillaumeGomez:doc-examples-coverage, r=jyn514
Yuki Okushi [Wed, 19 Aug 2020 06:54:37 +0000 (15:54 +0900)]
Rollup merge of #75665 - GuillaumeGomez:doc-examples-coverage, r=jyn514

Add doc examples coverage

r? @jyn514

3 years agoRollup merge of #75658 - tgnottingham:issue-75599, r=estebank
Yuki Okushi [Wed, 19 Aug 2020 06:54:35 +0000 (15:54 +0900)]
Rollup merge of #75658 - tgnottingham:issue-75599, r=estebank

Don't emit "is not a logical operator" error outside of associative expressions

Avoid showing this error where it doesn't make sense by not assuming
"and" and "or" were intended to mean "&&" and "||" until after we decide
to continue parsing input as an associative expression.

Note that the decision of whether or not to continue parsing input as an
associative expression doesn't actually depend on this assumption.

Fixes #75599

---

First time contributor! Let me know if there are any conventions or policies I should be following that I missed here. Thanks :)

3 years agoRollup merge of #75652 - jyn514:true-false-2, r=GuillaumeGomez
Yuki Okushi [Wed, 19 Aug 2020 06:54:34 +0000 (15:54 +0900)]
Rollup merge of #75652 - jyn514:true-false-2, r=GuillaumeGomez

Resolve true and false as booleans

Successor to https://github.com/rust-lang/rust/pull/75101.

r? @Manishearth
cc @rust-lang/rustdoc

3 years agoRollup merge of #75646 - poliorcetics:intra-links-keywords, r=jyn514
Yuki Okushi [Wed, 19 Aug 2020 06:54:32 +0000 (15:54 +0900)]
Rollup merge of #75646 - poliorcetics:intra-links-keywords, r=jyn514

Move to intra doc links for keyword documentation

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

3 years agoRollup merge of #75554 - jumbatm:fix-clashing-extern-decl-overflow, r=lcnr
Yuki Okushi [Wed, 19 Aug 2020 06:54:30 +0000 (15:54 +0900)]
Rollup merge of #75554 - jumbatm:fix-clashing-extern-decl-overflow, r=lcnr

Fix clashing_extern_declarations stack overflow for recursive types.

Fixes #75512.

Adds a seen set to `structurally_same_type` to avoid recursing indefinitely for types which contain values of the same type through a pointer or reference.

3 years agoRollup merge of #75499 - jack-champagne:jack-champagne/issue-75412, r=Dylan-DPC
Yuki Okushi [Wed, 19 Aug 2020 06:54:28 +0000 (15:54 +0900)]
Rollup merge of #75499 - jack-champagne:jack-champagne/issue-75412, r=Dylan-DPC

Fix documentation error

This should fix #75412. Just a quick >= to > sign replacement.

3 years agoRollup merge of #75049 - janriemer:patch-1, r=poliorcetics
Yuki Okushi [Wed, 19 Aug 2020 06:54:26 +0000 (15:54 +0900)]
Rollup merge of #75049 - janriemer:patch-1, r=poliorcetics

docs(marker/copy): provide example for `&T` being `Copy`

### Edited 2020-08-16 (most recent)
In the current documentation about the `Copy` marker trait, there is a section
with examples of structs that can implement `Copy`. Currently there is no example for
showing that shared references (`&T`) are also `Copy`.
It is worth to have a dedicated example for `&T` being `Copy`, because shared
references are an integral part of the language and it being `Copy` is not as
intuitive as other types that share this behaviour like `i32` or `bool`.

The example picks up on the previous non-`Copy` struct and shows that
structs can be `Copy`, even when they hold a shared reference to a non-`Copy` type.

-----------------------------------------
### Edited 2020-08-02, 3:28 p.m.
I've just realized that it says "in addition to the **implementors listed below**", which makes this PR kind of "wrong", because `&T` is indeed in the "implementors listed below".
Maybe we can instead show an example with `&T` in the [When can my type be Copy](https://doc.rust-lang.org/std/marker/trait.Copy.html#when-can-my-type-be-copy) section.

What I really want to achieve is that it becomes more obvious that `&T` is also `Copy`, because, I think, it is very valuable to know and it wasn't obvious for me, until I read something about it in a forum post.

What do you think? I would create another PR for that.
**Please feel free to close this PR.**

-----------------------------------
### Original post
In the current documentation about the `Copy` marker trait, there is a section
about "additional implementors", which list additional implementors of the `Copy` trait.
The fact that shared references are also `Copy` is mixed with another point,
which makes it hard to recognize and make it seem not as important.

This clarifies the fact that shared references are also `Copy`, by mentioning it as a
separate item in the list of "additional implementors".

3 years agoRollup merge of #75038 - rust-lang:Havvy-patch-1, r=steveklabnik
Yuki Okushi [Wed, 19 Aug 2020 06:54:24 +0000 (15:54 +0900)]
Rollup merge of #75038 - rust-lang:Havvy-patch-1, r=steveklabnik

See also X-Link mem::{swap, take, replace}

Since it's easy to end up at one of these functions when you really wanted the other one, cross link them with descriptions of why you'd want to use them.

3 years agoAuto merge of #75677 - cuviper:shrink-towel, r=Mark-Simulacrum
bors [Wed, 19 Aug 2020 02:56:59 +0000 (02:56 +0000)]
Auto merge of #75677 - cuviper:shrink-towel, r=Mark-Simulacrum

Don't panic in Vec::shrink_to_fit

We can help the compiler see that `Vec::shrink_to_fit` will never reach the panic case in `RawVec::shrink_to_fit`, just by guarding the call only for cases where the capacity is strictly greater. A capacity less than the length is only possible through an unsafe call to `set_len`, which would break the `Vec` invariants, so `shrink_to_fit` can just ignore that.

This removes the panicking code from the examples in both #71861 and #75636.

3 years agoAuto merge of #75555 - workingjubilee:update-everything, r=Mark-Simulacrum
bors [Wed, 19 Aug 2020 01:02:19 +0000 (01:02 +0000)]
Auto merge of #75555 - workingjubilee:update-everything, r=Mark-Simulacrum

Cargo update (almost) all the things!

This runs `cargo update` on our dependency tree, bumping numerous crates. See details in the first commit of this PR.

Several updates were held back intentionally; version_check in particular landed a change in behavior in 0.9.2 (arguably a bug fix, but still will be split into a separate PR).

3 years agoresolve comments
Prabakaran Kumaresshan [Wed, 19 Aug 2020 00:49:35 +0000 (06:19 +0530)]
resolve comments

3 years agoSwitch to intra-doc links in /src/sys/unix/ext/*.rs
Prabakaran Kumaresshan [Tue, 18 Aug 2020 16:41:20 +0000 (22:11 +0530)]
Switch to intra-doc links in /src/sys/unix/ext/*.rs

3 years agoAuto merge of #75516 - matklad:remove-deprecation, r=petrochenkov
bors [Tue, 18 Aug 2020 20:51:22 +0000 (20:51 +0000)]
Auto merge of #75516 - matklad:remove-deprecation, r=petrochenkov

Promote missing_fragment_specifier to hard error

It has been deny_by_default since 2017 (and warned for some time
before that), so it seems reasonable to promote it.

The specific technical motivation to do this now is to remove a field
from `ParseSess` -- it is a global state, and global state makes
extracting libraries annoying.

Closes #40107

3 years agoFix asm compiler flags change from cmake 0.1.44
Tomasz Miąsko [Tue, 18 Aug 2020 19:55:54 +0000 (12:55 -0700)]
Fix asm compiler flags change from cmake 0.1.44

cmake-rs@8141f0e changed the logic for handling asm compiler flags.
This change was pulled in with the cmake 0.1.42 -> 0.1.44 update.

This introduced two new flags to the LLVM build, breaking it:
"-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64"
"-DCMAKE_ASM_COMPILER=/usr/bin/cc"

This patch should resolve the breakage by handling it in bootstrap.

3 years agoDon't emit "is not a logical operator" error outside of associative expressions
Tyson Nottingham [Tue, 18 Aug 2020 02:15:51 +0000 (19:15 -0700)]
Don't emit "is not a logical operator" error outside of associative expressions

Avoid showing this error where it doesn't make sense by not assuming
"and" and "or" were intended to mean "&&" and "||" until after we decide
to continue parsing input as an associative expression.

Note that the decision of whether or not to continue parsing input as an
associative expression doesn't actually depend on this assumption.

Fixes #75599

3 years agoDon't panic in Vec::shrink_to_fit
Josh Stone [Tue, 18 Aug 2020 18:45:40 +0000 (11:45 -0700)]
Don't panic in Vec::shrink_to_fit

3 years agoAuto merge of #75657 - TimDiekmann:allocref-cleanup, r=Amanieu
bors [Tue, 18 Aug 2020 18:43:50 +0000 (18:43 +0000)]
Auto merge of #75657 - TimDiekmann:allocref-cleanup, r=Amanieu

Clean up AllocRef implementation and documentation

r? @Amanieu

3 years agodocs: add another `derive` for `Copy`able struct
Jan Riemer [Tue, 18 Aug 2020 16:40:19 +0000 (18:40 +0200)]
docs: add another `derive` for `Copy`able struct

This adds another `derive` for a `Copy`able struct, so that we are
consistent with `derive` annotations.

3 years agoAuto merge of #75635 - Aaron1011:fix/incr-fn-param-names, r=eddyb
bors [Tue, 18 Aug 2020 16:18:07 +0000 (16:18 +0000)]
Auto merge of #75635 - Aaron1011:fix/incr-fn-param-names, r=eddyb

Don't use `dep_graph.with_ignore` when encoding fn param names

The call to `with_ignore` was added years ago, and should no longer be
necessary with the modern incremental query infrastructure.

I also removed a related FIXME comment for issue #38501, which was
closed months ago.

3 years agoDowngrade version_check 0.9.2 -> 0.9.1
Jubilee Young [Tue, 18 Aug 2020 00:09:36 +0000 (17:09 -0700)]
Downgrade version_check 0.9.2 -> 0.9.1

0.9.2 is a breaking change to the #[cfg(version)] test in
src/test/ui/feature-gates/feature-gate-config-version.*
Let's downgrade for now.

3 years agoResolve licensing by updating tinyvec 0.3.3 -> 0.3.4
Jubilee Young [Mon, 17 Aug 2020 23:07:09 +0000 (16:07 -0700)]
Resolve licensing by updating tinyvec 0.3.3 -> 0.3.4

Per https://github.com/rust-lang/rust/pull/75555#issuecomment-675090858
Zlib license might be OK. "OR Apache-2.0 OR MIT" definitely is.
unicode-normalization depends on this and rustc_parse, clippy,
and many other things depend on unicode-normalization.

3 years agoUpdate license check post-cargo update
Mark Rousskov [Mon, 17 Aug 2020 19:13:04 +0000 (15:13 -0400)]
Update license check post-cargo update

3 years agoUpdate dependencies
Mark Rousskov [Mon, 17 Aug 2020 15:21:44 +0000 (11:21 -0400)]
Update dependencies

This runs cargo update, applying the following changes:
      Adding arrayref v0.3.6
      Adding base64 v0.11.0
      Adding blake2b_simd v0.5.10
      Adding cloudabi v0.1.0
      Adding crossbeam-queue v0.2.3
      Adding instant v0.1.6
      Adding lock_api v0.4.1
      Adding maybe-uninit v2.0.0
      Adding parking_lot_core v0.7.2
      Adding parking_lot_core v0.8.0
      Adding parking_lot v0.11.0
      Adding proc-macro-error-attr v1.0.4
      Adding quick-error v2.0.0
      Adding rust-argon2 v0.7.0
      Adding signal-hook-registry v1.2.1
      Adding smallvec v0.6.13
      Adding smallvec v1.4.2
      Adding tinyvec v0.3.3
    Removing argon2rs v0.2.5
    Removing arrayvec v0.4.7
    Removing blake2-rfc v0.2.18
    Removing fuchsia-cprng v0.1.1
    Removing nodrop v0.1.12
    Removing parking_lot_core v0.7.1
    Removing rand_core v0.3.0
    Removing rand_core v0.4.0
    Removing rand_os v0.1.3
    Removing rdrand v0.4.0
    Removing scoped_threadpool v0.1.9
    Removing signal-hook v0.1.7
    Removing smallvec v0.6.10
    Removing smallvec v1.4.0
    Updating aho-corasick v0.7.10 -> v0.7.13
    Updating anyhow v1.0.31 -> v1.0.32
    Updating arc-swap v0.3.7 -> v0.4.7
    Updating bitmaps v2.0.0 -> v2.1.0
    Updating bstr v0.1.3 -> v0.2.13
    Updating byteorder v1.3.2 -> v1.3.4
    Updating bytesize v1.0.0 -> v1.0.1
    Updating bytes v0.4.11 -> v0.4.12
    Updating cargo_metadata v0.8.0 -> v0.8.2
    Updating chrono v0.4.6 -> v0.4.15
    Updating clap v2.33.0 -> v2.33.3
    Updating cmake v0.1.42 -> v0.1.44
    Updating constant_time_eq v0.1.3 -> v0.1.5
    Updating crossbeam-channel v0.4.0 -> v0.4.3
    Updating crossbeam-deque v0.7.1 -> v0.7.3
    Updating crossbeam-epoch v0.7.2 -> v0.8.2
    Updating crossbeam-utils v0.6.5 -> v0.6.6
    Updating crypto-hash v0.3.1 -> v0.3.4
    Updating ctor v0.1.13 -> v0.1.15
    Updating curl-sys v0.4.25 -> v0.4.34+curl-7.71.1
    Updating curl v0.4.25 -> v0.4.31
    Updating derive_more v0.99.2 -> v0.99.9
    Updating diff v0.1.11 -> v0.1.12
    Updating directories v2.0.1 -> v2.0.2
    Updating dirs-sys v0.3.3 -> v0.3.5
    Updating dirs v2.0.1 -> v2.0.2
    Updating either v1.5.0 -> v1.6.0
    Updating failure v0.1.5 -> v0.1.8
    Updating filetime v0.2.9 -> v0.2.12
    Updating fnv v1.0.6 -> v1.0.7
    Updating fortanix-sgx-abi v0.3.2 -> v0.3.3
    Updating fst v0.3.0 -> v0.3.5
    Updating futures v0.1.28 -> v0.1.29
    Updating git2 v0.13.5 -> v0.13.8
    Updating globset v0.4.3 -> v0.4.5
    Updating handlebars v3.0.1 -> v3.4.0
    Updating heck v0.3.0 -> v0.3.1
    Updating hex v0.4.0 -> v0.4.2
    Updating home v0.5.1 -> v0.5.3
    Updating humantime v2.0.0 -> v2.0.1
    Updating ignore v0.4.11 -> v0.4.16
    Updating itertools v0.8.0 -> v0.8.2
    Updating itoa v0.4.4 -> v0.4.6
    Updating jemalloc-sys v0.3.0 -> v0.3.2
    Updating jsonrpc-client-transports v14.0.5 -> v14.2.1
    Updating jsonrpc-core-client v14.0.5 -> v14.2.0
    Updating jsonrpc-core v14.0.5 -> v14.2.0
    Updating jsonrpc-derive v14.0.5 -> v14.2.1
    Updating jsonrpc-pubsub v14.0.6 -> v14.2.0
    Updating jsonrpc-server-utils v14.0.5 -> v14.2.0
    Updating json v0.11.13 -> v0.11.15
    Updating lazycell v1.2.1 -> v1.3.0
    Updating libgit2-sys v0.12.7+1.0.0 -> v0.12.9+1.0.1
    Updating libnghttp2-sys v0.1.2 -> v0.1.4+1.41.0
    Updating libssh2-sys v0.2.14 -> v0.2.18
    Updating libz-sys v1.0.25 -> v1.0.27
    Updating linked-hash-map v0.5.2 -> v0.5.3
    Updating log v0.4.8 -> v0.4.11
    Updating lzma-sys v0.1.14 -> v0.1.16
    Updating macro-utils v0.1.2 -> v0.1.3
    Updating maplit v1.0.1 -> v1.0.2
    Updating mdbook v0.4.0 -> v0.4.2
    Updating memoffset v0.5.1 -> v0.5.5
    Updating mio-named-pipes v0.1.6 -> v0.1.7
    Updating mio-uds v0.6.7 -> v0.6.8
    Updating mio v0.6.16 -> v0.6.22
    Updating miow v0.3.3 -> v0.3.5
    Updating net2 v0.2.33 -> v0.2.34
    Updating new_debug_unreachable v1.0.3 -> v1.0.4
    Updating num_cpus v1.10.1 -> v1.13.0
    Updating num-integer v0.1.39 -> v0.1.43
    Updating num-traits v0.2.6 -> v0.2.12
    Updating once_cell v1.1.0 -> v1.4.0
    Updating opener v0.4.0 -> v0.4.1
    Updating openssl-src v111.9.0+1.1.1g -> v111.10.2+1.1.1g
    Updating openssl-sys v0.9.54 -> v0.9.58
    Updating openssl v0.10.25 -> v0.10.30
    Updating open v1.2.1 -> v1.4.0
    Updating packed_simd v0.3.1 -> v0.3.3
    Updating pest v2.1.0 -> v2.1.3
    Updating pkg-config v0.3.17 -> v0.3.18
    Updating proc-macro2 v1.0.3 -> v1.0.19
    Updating proc-macro-crate v0.1.4 -> v0.1.5
    Updating proc-macro-error v0.2.6 -> v1.0.4
    Updating psm v0.1.10 -> v0.1.11
    Updating pulldown-cmark v0.7.1 -> v0.7.2
    Updating punycode v0.4.0 -> v0.4.1
    Updating quote v1.0.2 -> v1.0.7
    Updating rayon-core v1.6.0 -> v1.7.1
    Updating rayon v1.2.0 -> v1.3.1
    Updating redox_syscall v0.1.56 -> v0.1.57
    Updating redox_users v0.3.0 -> v0.3.4
    Updating regex-syntax v0.6.17 -> v0.6.18
    Updating regex v1.3.7 -> v1.3.9
    Updating remove_dir_all v0.5.2 -> v0.5.3
    Updating rustfix v0.5.0 -> v0.5.1
    Updating ryu v1.0.0 -> v1.0.5
    Updating same-file v1.0.4 -> v1.0.6
    Updating schannel v0.1.16 -> v0.1.19
    Updating scopeguard v1.0.0 -> v1.1.0
    Updating serde_derive v1.0.106 -> v1.0.115
    Updating serde_ignored v0.1.0 -> v0.1.2
    Updating serde_json v1.0.40 -> v1.0.57
    Updating serde_repr v0.1.5 -> v0.1.6
    Updating serde v1.0.99 -> v1.0.115
    Updating shell-escape v0.1.4 -> v0.1.5
    Updating stable_deref_trait v1.1.0 -> v1.2.0
    Updating stacker v0.1.9 -> v0.1.11
    Updating structopt-derive v0.3.1 -> v0.4.9
    Updating structopt v0.3.1 -> v0.3.16
    Updating synstructure v0.12.1 -> v0.12.4
    Updating syn v1.0.11 -> v1.0.38
    Updating tar v0.4.26 -> v0.4.29
    Updating tendril v0.4.0 -> v0.4.1
    Updating term v0.6.0 -> v0.6.1
    Updating thiserror-impl v1.0.5 -> v1.0.20
    Updating thiserror v1.0.5 -> v1.0.20
    Updating time v0.1.42 -> v0.1.43
    Updating tokio-codec v0.1.1 -> v0.1.2
    Updating tokio-current-thread v0.1.6 -> v0.1.7
    Updating tokio-executor v0.1.9 -> v0.1.10
    Updating tokio-fs v0.1.6 -> v0.1.7
    Updating tokio-io v0.1.12 -> v0.1.13
    Updating tokio-process v0.2.4 -> v0.2.5
    Updating tokio-reactor v0.1.11 -> v0.1.12
    Updating tokio-signal v0.2.7 -> v0.2.9
    Updating tokio-sync v0.1.7 -> v0.1.8
    Updating tokio-tcp v0.1.3 -> v0.1.4
    Updating tokio-threadpool v0.1.17 -> v0.1.18
    Updating tokio-timer v0.2.12 -> v0.2.13
    Updating tokio-udp v0.1.5 -> v0.1.6
    Updating tokio-uds v0.2.5 -> v0.2.7
    Updating toml v0.5.3 -> v0.5.6
    Updating tracing-attributes v0.1.9 -> v0.1.10
    Updating tracing-core v0.1.12 -> v0.1.14
    Updating tracing-subscriber v0.2.10 -> v0.2.11
    Updating tracing v0.1.18 -> v0.1.19
    Updating ucd-parse v0.1.4 -> v0.1.8
    Updating ucd-trie v0.1.1 -> v0.1.3
    Updating unicode-normalization v0.1.12 -> v0.1.13
    Updating unicode-script v0.5.1 -> v0.5.2
    Updating unicode-width v0.1.6 -> v0.1.8
    Updating unicode-xid v0.2.0 -> v0.2.1
    Updating url v2.1.0 -> v2.1.1
    Updating utf-8 v0.7.2 -> v0.7.5
    Updating vcpkg v0.2.8 -> v0.2.10
    Updating vec_map v0.8.1 -> v0.8.2
    Updating version_check v0.9.1 -> v0.9.2
    Updating walkdir v2.2.7 -> v2.3.1
    Updating winapi v0.3.8 -> v0.3.9
    Updating xz2 v0.1.5 -> v0.1.6
    Updating yaml-merge-keys v0.4.0 -> v0.4.1
    Updating yaml-rust v0.4.3 -> v0.4.4

3 years agoAuto merge of #75639 - RalfJung:miri, r=RalfJung
bors [Tue, 18 Aug 2020 14:23:22 +0000 (14:23 +0000)]
Auto merge of #75639 - RalfJung:miri, r=RalfJung

update miri

Fixes https://github.com/rust-lang/rust/issues/75630
Cc @rust-lang/miri r? @ghost

3 years agoMake `grow_impl` unsafe
Tim Diekmann [Tue, 18 Aug 2020 13:22:10 +0000 (15:22 +0200)]
Make `grow_impl` unsafe

3 years agoUpdate rustdoc-ui tests
Guillaume Gomez [Tue, 18 Aug 2020 11:31:40 +0000 (13:31 +0200)]
Update rustdoc-ui tests

3 years agoAuto merge of #75663 - Xanewok:update-rls, r=Mark-Simulacrum
bors [Tue, 18 Aug 2020 12:29:50 +0000 (12:29 +0000)]
Auto merge of #75663 - Xanewok:update-rls, r=Mark-Simulacrum

Use git for Rustfmt dependency of RLS

Closes #75442

r? @Mark-Simulacrum

cc @calebcartwright for changed rustfmt dep kind

3 years agoAdd doc examples count for --show-coverage
Guillaume Gomez [Tue, 18 Aug 2020 11:31:23 +0000 (13:31 +0200)]
Add doc examples count for --show-coverage

3 years agoRemove broken clap versions from cargotest
Aleksey Kladov [Sat, 15 Aug 2020 12:12:51 +0000 (14:12 +0200)]
Remove broken clap versions from cargotest

treeify depends on an outdated version of clap, which will fail to compile
when we promote missing_fragment_specifier future compat lint to
error (ie, old clap contains code that shouldn't have compiled in the
first place).

Additionally, this crate seem tiny relative to other crates we are
testing here, so it seems like it doesn't provide that much additional
confidence.

The same happens with tokei project, but it is an actively maintained
one, so we can just upgrade it to a version from 2018, where clap was
upgraded.

3 years agoBump RLS
Igor Matuszewski [Tue, 18 Aug 2020 10:45:20 +0000 (12:45 +0200)]
Bump RLS

3 years agoAuto merge of #75631 - matklad:rust-analyzer-2020-08-17, r=matklad
bors [Tue, 18 Aug 2020 10:23:28 +0000 (10:23 +0000)]
Auto merge of #75631 - matklad:rust-analyzer-2020-08-17, r=matklad

:arrow_up: rust-analyzer

r? @ghost

3 years agoupdate miri
Ralf Jung [Tue, 18 Aug 2020 09:04:01 +0000 (11:04 +0200)]
update miri

3 years agoAdd comment, which was removed by accident (again)
Tim Diekmann [Tue, 18 Aug 2020 08:00:31 +0000 (10:00 +0200)]
Add comment, which was removed by accident (again)

3 years agoClean up AllocRef implementation and documentation
Tim Diekmann [Tue, 18 Aug 2020 05:41:06 +0000 (07:41 +0200)]
Clean up AllocRef implementation and documentation

3 years agoAuto merge of #75566 - alasher:master, r=oli-obk
bors [Tue, 18 Aug 2020 07:39:48 +0000 (07:39 +0000)]
Auto merge of #75566 - alasher:master, r=oli-obk

Suppress verbose MIR comments for trivial types

Addresses #74508

This is my first contribution to the Rust project! Please let me know if anything needs revising, I'm happy to make changes.

3 years agoRemove missing_fragment_specifier lint
Aleksey Kladov [Fri, 14 Aug 2020 09:29:22 +0000 (11:29 +0200)]
Remove missing_fragment_specifier lint

3 years agoPromote missing_fragment_specifier to hard error
Aleksey Kladov [Fri, 14 Aug 2020 09:24:01 +0000 (11:24 +0200)]
Promote missing_fragment_specifier to hard error

It has been deny_by_default since 2017 (and warned for some time
before that), so it seems reasonable to promote it.

The specific technical motivation to do this now is to remove a field
from `ParseSess` -- it is a global state, and global state makes
extracting libraries annoying.

Closes #40107

3 years agoMove macro test to ui/macros
Aleksey Kladov [Fri, 14 Aug 2020 08:46:39 +0000 (10:46 +0200)]
Move macro test to ui/macros

3 years agoAuto merge of #75621 - TimDiekmann:no-fast-realloc, r=Amanieu
bors [Tue, 18 Aug 2020 05:42:05 +0000 (05:42 +0000)]
Auto merge of #75621 - TimDiekmann:no-fast-realloc, r=Amanieu

Remove fast path in reallocation for same layout sizes

r? @Amanieu

Before merging a perf-run should be done.

Closes https://github.com/rust-lang/wg-allocators/issues/70

3 years agoAuto merge of #75654 - tmandry:rollup-ej0oezi, r=tmandry
bors [Tue, 18 Aug 2020 03:21:22 +0000 (03:21 +0000)]
Auto merge of #75654 - tmandry:rollup-ej0oezi, r=tmandry

Rollup of 3 pull requests

Successful merges:

 - #75548 (librustc_metadata::locator: Properly detect file type.)
 - #75603 (Use more compatible out-implib style)
 - #75637 (update stacker to 0.1.11 to unbreak build for wasm32-unknown-unknown)

Failed merges:

r? @ghost

3 years agoRollup merge of #75637 - ctaggart:wasm32build, r=Mark-Simulacrum
Tyler Mandry [Tue, 18 Aug 2020 03:20:29 +0000 (20:20 -0700)]
Rollup merge of #75637 - ctaggart:wasm32build, r=Mark-Simulacrum

update stacker to 0.1.11 to unbreak build for wasm32-unknown-unknown

Like #72079, this updates stacker. The related problem is stacker is here https://github.com/rust-lang/stacker/issues/42. It was fixed by switching from `libc::c_void` to `std::ffi::c_void` https://github.com/rust-lang/stacker/pull/43/files.

3 years agoRollup merge of #75603 - mati865:mingw-out-implib-compat, r=oli-obk
Tyler Mandry [Tue, 18 Aug 2020 03:20:27 +0000 (20:20 -0700)]
Rollup merge of #75603 - mati865:mingw-out-implib-compat, r=oli-obk

Use more compatible out-implib style

When calling `rust-lld` directly it accepts only `--out-implib {}` or `--out-implib={}` not `--out-implib,{}`.

3 years agoRollup merge of #75548 - dancrossnyc:master, r=tmandry
Tyler Mandry [Tue, 18 Aug 2020 03:20:25 +0000 (20:20 -0700)]
Rollup merge of #75548 - dancrossnyc:master, r=tmandry

librustc_metadata::locator: Properly detect file type.

Make sure to test file types against the non-canonicalized name to
avoid detecting the wrong type.  Some systems save build artifacts
into associate file stores that do not preserve extensions, and
then link to those using conventionally-named symbolic links, that
are the arguments to `rustc` et al.  If we canonicalize before
testing the type, we resolve the symlink, the extension is
lost and we might treat rlibs and rmetas as dylibs.

The fix is to tntroduce a temporary to hold the canonicalized name,
compare against the non-canonical name, and add a comment
explaining what's going on for the would-be mainter who sees a
potential cleanup.

Signed-off-by: Dan Cross <dcross@google.com>
3 years agoAuto merge of #75653 - JohnTitor:rollup-0ejtdfo, r=JohnTitor
bors [Tue, 18 Aug 2020 01:11:43 +0000 (01:11 +0000)]
Auto merge of #75653 - JohnTitor:rollup-0ejtdfo, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #75389 (attempt to improve span_label docs)
 - #75392 (Add `as_uninit`-like methods to pointer types and unify documentation of `as_ref` methods)
 - #75464 (Move to intra doc links for ascii.rs and panic.rs)
 - #75578 (Allowing raw ptr dereference in const fn)
 - #75613 (Add explanation for `&mut self` method call when expecting `-> Self`)
 - #75626 (Clean up E0754 explanation)
 - #75629 (Use intra-doc links in `std::env`, `std::alloc` and `std::error`)
 - #75634 (Mark x86_64-linux-kernel as *)

Failed merges:

r? @ghost

3 years agoRollup merge of #75634 - scileo:fix-75581, r=ehuss
Yuki Okushi [Tue, 18 Aug 2020 00:27:53 +0000 (09:27 +0900)]
Rollup merge of #75634 - scileo:fix-75581, r=ehuss

Mark x86_64-linux-kernel as *

This should fix #75581.

This is my first contribution to the Rust organization. Please, feel free to tell me if I did anything wrong :)

3 years agoRollup merge of #75629 - EllenNyan:ellen-intra-doc-links, r=jyn514
Yuki Okushi [Tue, 18 Aug 2020 00:27:51 +0000 (09:27 +0900)]
Rollup merge of #75629 - EllenNyan:ellen-intra-doc-links, r=jyn514

Use intra-doc links in `std::env`, `std::alloc` and `std::error`

This is partial fixes for #75080.

3 years agoRollup merge of #75626 - GuillaumeGomez:cleanup-e0754, r=pickfire
Yuki Okushi [Tue, 18 Aug 2020 00:27:49 +0000 (09:27 +0900)]
Rollup merge of #75626 - GuillaumeGomez:cleanup-e0754, r=pickfire

Clean up E0754 explanation

r? @Dylan-DPC

cc @pickfire

3 years agoRollup merge of #75613 - estebank:explain-mut-method, r=petrochenkov
Yuki Okushi [Tue, 18 Aug 2020 00:27:47 +0000 (09:27 +0900)]
Rollup merge of #75613 - estebank:explain-mut-method, r=petrochenkov

Add explanation for `&mut self` method call when expecting `-> Self`

When a user tries to use a method as if it returned a new value of the
same type as its receiver, we will emit a type error. Try to detect this
and provide extra explanation that the method modifies the receiver
in-place.

This has confused people in the wild, like in
https://users.rust-lang.org/t/newbie-why-the-commented-line-stops-the-snippet-from-compiling/47322

3 years agoRollup merge of #75578 - 5M1Sec:master, r=oli-obk
Yuki Okushi [Tue, 18 Aug 2020 00:27:45 +0000 (09:27 +0900)]
Rollup merge of #75578 - 5M1Sec:master, r=oli-obk

Allowing raw ptr dereference in const fn

Reflect on issue #75340
Discussion in previous PR  #75425

## Updates
Change `UnsafetyViolationKind::General` to `UnsafetyViolationKind::GeneralAndConstFn` in check_unsafety.rs

Remove `unsafe` in min_const_fn_unsafe_bad.rs

Bless min_const_fn

Add the test case from issue 75340
***
Sorry for the chaos. I messed up and ended up deleting the repo in the last PR. I have to create a new PR for the new repo. I will make a feature branch next time. I will edit the old PR once I receive the commends.

@RalfJung Thank you all for your replies. They are helpful!

r? @oli-obk

3 years agoRollup merge of #75464 - poliorcetics:intra-links-panic-and-ascii, r=jyn514
Yuki Okushi [Tue, 18 Aug 2020 00:27:43 +0000 (09:27 +0900)]
Rollup merge of #75464 - poliorcetics:intra-links-panic-and-ascii, r=jyn514

Move to intra doc links for ascii.rs and panic.rs

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

I also updated the doc to fix the wording in `AsciiExt` since it is now deprecated.
The two file are small changes so I bundled them together.

Some links could not be changed to make them work, I believe those are known issues with primitive types.

3 years agoRollup merge of #75392 - TimDiekmann:non-null-uninit-slice, r=RalfJung
Yuki Okushi [Tue, 18 Aug 2020 00:27:42 +0000 (09:27 +0900)]
Rollup merge of #75392 - TimDiekmann:non-null-uninit-slice, r=RalfJung

Add `as_uninit`-like methods to pointer types and unify documentation of `as_ref` methods

This adds a convenient method to retrieve a `&(mut) [MaybeUninit<T>]` from slice pointers (`*const [T]`, `*mut [T]`, `NonNull<[T]>`). See also https://github.com/rust-lang/wg-allocators/issues/66#issuecomment-671789105.

~I'll add a tracking issue as soon as it's reviewed and CI passed.~
Tracking Issue: #75402

r? @RalfJung

3 years agoRollup merge of #75389 - RalfJung:span_label, r=davidtwco
Yuki Okushi [Tue, 18 Aug 2020 00:27:39 +0000 (09:27 +0900)]
Rollup merge of #75389 - RalfJung:span_label, r=davidtwco

attempt to improve span_label docs

I was still confused by the `span_label` docs, so I did some more digging. However, this needs careful checking as I have no idea if any of this is correct.

3 years agoResolve true and false as booleans
Joshua Nelson [Mon, 17 Aug 2020 23:51:09 +0000 (19:51 -0400)]
Resolve true and false as booleans

3 years agoAuto merge of #75120 - JulianKnodt:rm_reps, r=oli-obk
bors [Mon, 17 Aug 2020 23:16:08 +0000 (23:16 +0000)]
Auto merge of #75120 - JulianKnodt:rm_reps, r=oli-obk

rust_ast::ast => rustc_ast

Rework of #71199 which is a rework #70621

Still working on this but just made the PR to track progress

r? @Dylan-DPC

3 years agoUpdate MIR tests with comment verbosity fix
Austin Lasher [Sat, 15 Aug 2020 17:04:37 +0000 (13:04 -0400)]
Update MIR tests with comment verbosity fix

3 years agoSuppress verbose MIR comments for trivial types
Austin Lasher [Sat, 15 Aug 2020 17:04:18 +0000 (13:04 -0400)]
Suppress verbose MIR comments for trivial types

3 years agoAuto merge of #75145 - davidtwco:issue-60607-preallocate-defid-for-lang-items, r...
bors [Mon, 17 Aug 2020 20:51:59 +0000 (20:51 +0000)]
Auto merge of #75145 - davidtwco:issue-60607-preallocate-defid-for-lang-items, r=petrochenkov

Reference lang items during AST lowering

Fixes #60607 and fixes #61019.

This PR introduces `QPath::LangItem` to the HIR and uses it in AST lowering instead of constructing a `hir::Path` from a slice of symbols:

- Credit for much of this work goes to @matthewjasper, I basically just [rebased their earlier work](https://github.com/matthewjasper/rust/commit/a227c706b7809ff07021baf3856b7540d5b57f8a#diff-c0f791ead38d2d02916faaad0f56f41d).
- ~~Changes to Clippy might not be correct, they compile but attempting to run tests through `./x.py` produced failures which appeared spurious, so I didn't run any clippy tests.~~
- Changes to save analysis might not be correct - tests pass but I don't have a lot of confidence in those changes being correct.
- I've used `GenericBounds::LangItemTrait` rather than changing `PolyTraitRef`, as suggested by @matthewjasper [in this comment](https://github.com/matthewjasper/rust/commit/a227c706b7809ff07021baf3856b7540d5b57f8a#r40107992) but I'd prefer that be left for a follow-up.
- I've split things into smaller commits fairly arbitrarily to make the diff easier to review, each commit should compile but might not pass tests until the final commit.

r? @oli-obk
cc @matthewjasper

3 years agorust_ast::ast => rustc_ast
Ujjwal Sharma [Mon, 27 Apr 2020 17:56:11 +0000 (23:26 +0530)]
rust_ast::ast => rustc_ast

3 years agoMove to intra doc links for keyword documentation
Alexis Bourget [Mon, 17 Aug 2020 20:17:14 +0000 (22:17 +0200)]
Move to intra doc links for keyword documentation

3 years agoAuto merge of #74748 - simonvandel:simplify-discriminant-arm, r=wesleywiser
bors [Mon, 17 Aug 2020 18:33:24 +0000 (18:33 +0000)]
Auto merge of #74748 - simonvandel:simplify-discriminant-arm, r=wesleywiser

MIR-OPT: Make SimplifyBranchSame able to remove identity match with fieldless variant

Modifies SimplifyBranchSame so that it can see that the statements can be considered equal in the following example
`_0 = _1` and `discriminant(_0) = discriminant(0)` are considered equal if 0 is a fieldless variant of an enum.

3 years agolibrustc_metadata::locator: Properly detect file type.
Dan Cross [Sat, 15 Aug 2020 00:29:04 +0000 (20:29 -0400)]
librustc_metadata::locator: Properly detect file type.

Make sure to test for file types against the non-canonicalized name
to avoid detecting the wrong type.  Some systems save build artifacts
into associative file stores that do not preserve extensions, and
then link to those using conventionally-named symbolic links that
are the arguments to `rustc` et al.  If we canonicalize before
testing the type, we resolve the symlink, the extension is lost and
we might treat rlibs and rmetas as dylibs.

The fix is to introduce a temporary to hold the canonicalized name,
compare against the non-canonical name, and add a comment
explaining what's going on for the would-be maintainer who sees a
potential cleanup.

Signed-off-by: Dan Cross <dcross@google.com>
3 years agoupdate stacker to 0.1.11 to unbreak build for wasm32-unknown-unknown
Cameron Taggart [Mon, 17 Aug 2020 16:57:53 +0000 (10:57 -0600)]
update stacker to 0.1.11 to unbreak build for wasm32-unknown-unknown

3 years agoAuto merge of #75187 - pawanbisht62:feature/incorporate-tracing, r=oli-obk
bors [Mon, 17 Aug 2020 16:40:10 +0000 (16:40 +0000)]
Auto merge of #75187 - pawanbisht62:feature/incorporate-tracing, r=oli-obk

Incorporated Tracing Crate in some libraries

Issue #74747

3 years agoWrap recursion in `ensure_sufficient_stack`.
jumbatm [Mon, 17 Aug 2020 16:00:35 +0000 (02:00 +1000)]
Wrap recursion in `ensure_sufficient_stack`.

3 years agoAlso accept Refs for is_primitive_or_pointer
jumbatm [Sun, 16 Aug 2020 08:04:14 +0000 (18:04 +1000)]
Also accept Refs for is_primitive_or_pointer

3 years agoAvoid double hashset lookup.
jumbatm [Sun, 16 Aug 2020 07:14:09 +0000 (17:14 +1000)]
Avoid double hashset lookup.

Co-authored-by: Bastian Kauschke <bastian_kauschke@hotmail.de>
3 years agoDon't memoize seen types.
jumbatm [Sun, 16 Aug 2020 01:01:14 +0000 (11:01 +1000)]
Don't memoize seen types.

That cache is unlikely to be particularly useful within a single
invocation of structurally_same_type, especially compared to memoizing
results across _all_ invocations of that function.

3 years agoReduce indentation by replacing match arm w/ early return.
jumbatm [Sun, 16 Aug 2020 00:50:20 +0000 (10:50 +1000)]
Reduce indentation by replacing match arm w/ early return.

3 years agoRemove structural equiv check for Array const.
jumbatm [Sun, 16 Aug 2020 00:47:35 +0000 (10:47 +1000)]
Remove structural equiv check for Array const.

3 years agoRemove unnecessary rebinding of def ids.
jumbatm [Sun, 16 Aug 2020 00:41:59 +0000 (10:41 +1000)]
Remove unnecessary rebinding of def ids.

3 years agoActually introduce a cycle in Reffy test.
jumbatm [Sun, 16 Aug 2020 00:26:45 +0000 (10:26 +1000)]
Actually introduce a cycle in Reffy test.

3 years agoFix stack overflow for recursive types.
jumbatm [Sat, 15 Aug 2020 05:05:18 +0000 (15:05 +1000)]
Fix stack overflow for recursive types.

Adds a seen set to structurally_same_type to avoid recursing
indefinitely when a reference or pointer member introduces a cycle in
the visited types.

3 years agoAdd test demonstrating the issue.
jumbatm [Sat, 15 Aug 2020 03:18:54 +0000 (13:18 +1000)]
Add test demonstrating the issue.

3 years agoImprove display
Guillaume Gomez [Mon, 17 Aug 2020 15:22:53 +0000 (17:22 +0200)]
Improve display

3 years agoRemove unnecessary links in env.rs
Ellen [Mon, 17 Aug 2020 14:16:00 +0000 (15:16 +0100)]
Remove unnecessary links in env.rs

3 years ago:arrow_up: rust-analyzer
Aleksey Kladov [Mon, 17 Aug 2020 14:15:20 +0000 (16:15 +0200)]
:arrow_up: rust-analyzer

3 years agoAuto merge of #74940 - oli-obk:const_is_null, r=RalfJung
bors [Mon, 17 Aug 2020 14:13:13 +0000 (14:13 +0000)]
Auto merge of #74940 - oli-obk:const_is_null, r=RalfJung

Make `<*const T>::is_null` const fn

r? @RalfJung

cc @rust-lang/wg-const-eval

tracking issue: #74939

3 years agoSwitch to intra-doc links for std/src/alloc.rs
Ellen [Mon, 17 Aug 2020 13:42:40 +0000 (14:42 +0100)]
Switch to intra-doc links for std/src/alloc.rs

3 years agoSwitch to intra-doc links for std/src/env.rs
Ellen [Mon, 17 Aug 2020 13:42:23 +0000 (14:42 +0100)]
Switch to intra-doc links for std/src/env.rs

3 years agoSwitch to intra-doc links for std/src/error.rs
Ellen [Mon, 17 Aug 2020 13:41:57 +0000 (14:41 +0100)]
Switch to intra-doc links for std/src/error.rs

3 years agoMake a test platform independent
Oliver Scherer [Mon, 17 Aug 2020 13:31:48 +0000 (15:31 +0200)]
Make a test platform independent

3 years agoClean up E0754 explanation
Guillaume Gomez [Mon, 17 Aug 2020 13:14:53 +0000 (15:14 +0200)]
Clean up E0754 explanation

3 years agoFix typo in comment
Tim Diekmann [Mon, 17 Aug 2020 13:05:19 +0000 (15:05 +0200)]
Fix typo in comment

3 years agoclippy: support `QPath::LangItem`
David Wood [Tue, 4 Aug 2020 13:24:13 +0000 (14:24 +0100)]
clippy: support `QPath::LangItem`

This commit updates clippy with the introduction of `QPath::LangItem` so
that it still compiles.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoAdd `as_uninit`-like methods to pointer types and unify documentation of `as_ref...
Tim Diekmann [Mon, 17 Aug 2020 12:22:59 +0000 (14:22 +0200)]
Add `as_uninit`-like methods to pointer types and unify documentation of `as_ref` methods

Fix example in `NonNull::as_uninit_slice`

Rename feature gate to "ptr_as_uninit"

Make methods more consistent with already stable methods

Make `pointer::as_uninit_slice` return an `Option`

Fix placement for `// SAFETY` section

Add `as_uninit_ref` and `as_uninit_mut` to pointers

Fix doctest

Update tracking issue

Fix doc links

Apply suggestions from review

Make wording about counterparts consistent

Fix doc links

Improve documentation

Fix doc-tests

Fix doc links ... again

Apply suggestions from review

Apply suggestions from Review

Apply suggestion from review to all affected files

Add missing words in safety sections in `as_uninit_slice_mut`

Fix safety-comment in `NonNull::as_uninit_slice_mut`

3 years agoattempt to improve span_label docs
Ralf Jung [Tue, 11 Aug 2020 07:42:25 +0000 (09:42 +0200)]
attempt to improve span_label docs

3 years agoAuto merge of #75592 - RalfJung:miri-int-align, r=oli-obk
bors [Mon, 17 Aug 2020 12:11:41 +0000 (12:11 +0000)]
Auto merge of #75592 - RalfJung:miri-int-align, r=oli-obk

miri engine: add option to use force_int for alignment check

This is needed for https://github.com/rust-lang/miri/issues/1074. The Miri-side patch is at https://github.com/rust-lang/miri/pull/1513.

r? @oli-obk

3 years agofix typo
Ralf Jung [Mon, 17 Aug 2020 12:11:03 +0000 (14:11 +0200)]
fix typo

Co-authored-by: Oliver Scherer <github35764891676564198441@oli-obk.de>
3 years agoRemove fast path in reallocation for same layout sizes
Tim Diekmann [Mon, 17 Aug 2020 11:23:38 +0000 (13:23 +0200)]
Remove fast path in reallocation for same layout sizes

3 years agoMark x86_64-linux-kernel as *
Sasha [Mon, 17 Aug 2020 10:44:18 +0000 (12:44 +0200)]
Mark x86_64-linux-kernel as *

3 years agoAuto merge of #75535 - denisvasilik:intra-doc-links-any, r=jyn514
bors [Mon, 17 Aug 2020 08:00:45 +0000 (08:00 +0000)]
Auto merge of #75535 - denisvasilik:intra-doc-links-any, r=jyn514

Move to intra-doc links for /library/core/src/any.rs

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

Known issues:

* Links from `core` to `std` (#74481):
    * `[Box]: ../../std/boxed/struct.Box.html`

3 years agoAuto merge of #75468 - poliorcetics:intra-links-fs, r=jyn514
bors [Mon, 17 Aug 2020 06:02:16 +0000 (06:02 +0000)]
Auto merge of #75468 - poliorcetics:intra-links-fs, r=jyn514

Move to intra doc links in std/src/fs.rs

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

3 years agoAuto merge of #75568 - ehuss:cloudabi-tier3, r=Mark-Simulacrum
bors [Mon, 17 Aug 2020 03:52:46 +0000 (03:52 +0000)]
Auto merge of #75568 - ehuss:cloudabi-tier3, r=Mark-Simulacrum

Move CloudABI to tier 3.

The CloudABI target hasn't had much work done on it in a while, and it doesn't appear to be in active use. It has a fairly substantial amount of code, particularly in the [sys module](https://github.com/rust-lang/rust/tree/5addb135edc2653b07670482a430aac9b655a86b/library/std/src/sys/cloudabi) that requires actively supporting. I contacted @EdSchouten who indicated that many of the CloudABI concepts are now in WASI, and that they are OK with the target being moved to tier 3.

3 years agoAllowing raw ptr dereference in const fn
5M1Sec [Sun, 16 Aug 2020 03:39:09 +0000 (23:39 -0400)]
Allowing raw ptr dereference in const fn

Change `UnsafetyViolationKind::General` to `UnsafetyViolationKind::GeneralAndConstFn` in check_unsafety.rs

Remove unsafe in min_const_fn_unsafe_bad.rs

Bless min_const_fn

Add the test case from issue 75340

Co-authored-by: lzutao <taolzu@gmail.com>
3 years agoAuto merge of #75014 - Amanieu:fix_asm_reg, r=nagisa
bors [Mon, 17 Aug 2020 01:57:50 +0000 (01:57 +0000)]
Auto merge of #75014 - Amanieu:fix_asm_reg, r=nagisa

Work around LLVM issues with explicit register in inline asm

Fixes #74658

3 years agoAdd explanation for `&mut self` method call when expecting `-> Self`
Esteban Küber [Mon, 17 Aug 2020 01:33:30 +0000 (18:33 -0700)]
Add explanation for `&mut self` method call when expecting `-> Self`

When a user tries to use a method as if it returned a new value of the
same type as its receiver, we will emit a type error. Try to detect this
and provide extra explanation that the method modifies the receiver
in-place.

This has confused people in the wild, like in
https://users.rust-lang.org/t/newbie-why-the-commented-line-stops-the-snippet-from-compiling/47322

3 years agoAuto merge of #74562 - pickfire:is_ascii_branchless, r=nagisa
bors [Sun, 16 Aug 2020 23:52:32 +0000 (23:52 +0000)]
Auto merge of #74562 - pickfire:is_ascii_branchless, r=nagisa

Remove branch in optimized is_ascii

Performs slightly better in short or medium bytes by eliminating
the last branch check on `byte_pos == len` and always check the
last byte as it is always at most one `usize`.

Benchmark, before `libcore`, after `libcore_new`. It improves
medium and short by 1ns but regresses unaligned_tail by 2ns,
either way we can get unaligned_tail have a tiny chance of 1/8
on a 64 bit machine. I don't think we should bet on that, the
probability is worse than dice.

```
test long::case00_libcore                     ... bench:          38 ns/iter (+/- 1) = 183947 MB/s
test long::case00_libcore_new                 ... bench:          38 ns/iter (+/- 1) = 183947 MB/s
test long::case01_iter_all                    ... bench:         227 ns/iter (+/- 6) = 30792 MB/s
test long::case02_align_to                    ... bench:          40 ns/iter (+/- 1) = 174750 MB/s
test long::case03_align_to_unrolled           ... bench:          19 ns/iter (+/- 1) = 367894 MB/s
test medium::case00_libcore                   ... bench:           5 ns/iter (+/- 0) = 6400 MB/s
test medium::case00_libcore_new               ... bench:           4 ns/iter (+/- 0) = 8000 MB/s
test medium::case01_iter_all                  ... bench:          20 ns/iter (+/- 1) = 1600 MB/s
test medium::case02_align_to                  ... bench:           6 ns/iter (+/- 0) = 5333 MB/s
test medium::case03_align_to_unrolled         ... bench:           5 ns/iter (+/- 0) = 6400 MB/s
test short::case00_libcore                    ... bench:           7 ns/iter (+/- 0) = 1000 MB/s
test short::case00_libcore_new                ... bench:           6 ns/iter (+/- 0) = 1166 MB/s
test short::case01_iter_all                   ... bench:           5 ns/iter (+/- 0) = 1400 MB/s
test short::case02_align_to                   ... bench:           5 ns/iter (+/- 0) = 1400 MB/s
test short::case03_align_to_unrolled          ... bench:           5 ns/iter (+/- 1) = 1400 MB/s
test unaligned_both::case00_libcore           ... bench:           4 ns/iter (+/- 0) = 7500 MB/s
test unaligned_both::case00_libcore_new       ... bench:           4 ns/iter (+/- 0) = 7500 MB/s
test unaligned_both::case01_iter_all          ... bench:          26 ns/iter (+/- 0) = 1153 MB/s
test unaligned_both::case02_align_to          ... bench:          13 ns/iter (+/- 2) = 2307 MB/s
test unaligned_both::case03_align_to_unrolled ... bench:          11 ns/iter (+/- 0) = 2727 MB/s
test unaligned_head::case00_libcore           ... bench:           5 ns/iter (+/- 0) = 6200 MB/s
test unaligned_head::case00_libcore_new       ... bench:           5 ns/iter (+/- 0) = 6200 MB/s
test unaligned_head::case01_iter_all          ... bench:          19 ns/iter (+/- 1) = 1631 MB/s
test unaligned_head::case02_align_to          ... bench:          10 ns/iter (+/- 0) = 3100 MB/s
test unaligned_head::case03_align_to_unrolled ... bench:          14 ns/iter (+/- 0) = 2214 MB/s
test unaligned_tail::case00_libcore           ... bench:           3 ns/iter (+/- 0) = 10333 MB/s
test unaligned_tail::case00_libcore_new       ... bench:           5 ns/iter (+/- 0) = 6200 MB/s
test unaligned_tail::case01_iter_all          ... bench:          19 ns/iter (+/- 0) = 1631 MB/s
test unaligned_tail::case02_align_to          ... bench:          10 ns/iter (+/- 0) = 3100 MB/s
test unaligned_tail::case03_align_to_unrolled ... bench:          13 ns/iter (+/- 0) = 2384 MB/s
```

Rough (unfair) maths on improvements for fun: 1ns * 7/8 - 2ns * 1/8 = 0.625ns

Inspired by fish and zsh clever trick to highlight missing linefeeds (⏎)
and branchless implementation of binary_search in rust.

cc @thomcc https://github.com/rust-lang/rust/pull/74066
r? @nagisa

3 years agoDon't use `dep_graph.with_ignore` when encoding fn param names
Aaron Hill [Sun, 16 Aug 2020 23:08:35 +0000 (19:08 -0400)]
Don't use `dep_graph.with_ignore` when encoding fn param names

The call to `with_ignore` was added years ago, and should no longer be
necessary with the modern incremental query infrastructure.

I also removed a related FIXME comment for issue #38501, which was
closed months ago.

3 years agoAuto merge of #75609 - tmandry:rollup-yrcmgke, r=tmandry
bors [Sun, 16 Aug 2020 22:00:29 +0000 (22:00 +0000)]
Auto merge of #75609 - tmandry:rollup-yrcmgke, r=tmandry

Rollup of 10 pull requests

Successful merges:

 - #74204 (Don't visit foreign function bodies when lowering ast to hir)
 - #74314 (rustc_typeck: construct {Closure,Generator}Substs more directly.)
 - #74346 (Use LocalDefId instead of HirId for reachable_set elements.)
 - #74399 (Move DelaySpanBugEmitted to ty::context)
 - #75177 (Add regression test for issue-66768)
 - #75223 (Add #[track_caller] to `Session::delay_span_bug`)
 - #75423 (Move to intra-doc links for /library/core/src/hint.rs)
 - #75485 (pin docs: add some forward references)
 - #75569 (Bump minor version of emsdk to 1.38.47)
 - #75596 (Switch to intra-doc links in /sys/windows/ext/{ffi,fs,process}.rs)

Failed merges:

r? @ghost