]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 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 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 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 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 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

3 years agoRollup merge of #75596 - nixphix:docs/windows-ext, r=jyn514
Tyler Mandry [Sun, 16 Aug 2020 21:59:36 +0000 (14:59 -0700)]
Rollup merge of #75596 - nixphix:docs/windows-ext, r=jyn514

Switch to intra-doc links in /sys/windows/ext/{ffi,fs,process}.rs

Partial fix for #75080

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

r? @jyn514

3 years agoRollup merge of #75569 - tmiasko:emscripten, r=tlively
Tyler Mandry [Sun, 16 Aug 2020 21:59:34 +0000 (14:59 -0700)]
Rollup merge of #75569 - tmiasko:emscripten, r=tlively

Bump minor version of emsdk to 1.38.47

Release Notes:

```
v1.38.47: 10/02/2019
--------------------
 - Add support for FETCH API in WASM backend. This doesn't support FETCH in the
   main thread (`USE_FETCH_WORKER=0` is enforced). #9490
 - Redefine errno values to be consistent with wasi. This will let us avoid
   needing to convert the values back and forth as we use more wasi APIs.
   This is an ABI change, which should not be noticeable from user code
   unless you use errno defines (like EAGAIN) *and* keep around binaries
   compiled with an older version that you link against. In that case, you
   should rebuild them. See #9545.
 - Removed build option `-s ONLY_MY_CODE` as we now have much better solutions
   for that, like building to a wasm object file or using `STANDALONE_WASM`
   etc. (see
   https://github.com/emscripten-core/emscripten/wiki/WebAssembly-Standalone).
 - Emscripten now supports the config file (.emscripten) being placed in the
   emscripten directory rather that the current user's home directory.
   See #9543
```

Motivated by changes to errno values which are currently out of sync with those
in libc crate which uses wasi values already. Helps with #72808 and #75532.

3 years agoRollup merge of #75485 - RalfJung:pin, r=nagisa
Tyler Mandry [Sun, 16 Aug 2020 21:59:32 +0000 (14:59 -0700)]
Rollup merge of #75485 - RalfJung:pin, r=nagisa

pin docs: add some forward references

@nagisa had some questions about pinning that were answered in the docs, which they did not realize because that discussion is below the examples. I still think it makes sense to introduce the examples before that discussion, since it give the discussion something concrete to refer to, but this PR adds some forward references so people don't think the examples conclude the docs.

@nagisa do you think this would have helped?

3 years agoRollup merge of #75423 - denisvasilik:intra-doc-links-core-hint, r=dtolnay
Tyler Mandry [Sun, 16 Aug 2020 21:59:30 +0000 (14:59 -0700)]
Rollup merge of #75423 - denisvasilik:intra-doc-links-core-hint, r=dtolnay

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

Helps with #75080.

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

3 years agoRollup merge of #75223 - Aaron1011:feature/session-track-caller, r=eddyb
Tyler Mandry [Sun, 16 Aug 2020 21:59:29 +0000 (14:59 -0700)]
Rollup merge of #75223 - Aaron1011:feature/session-track-caller, r=eddyb

Add #[track_caller] to `Session::delay_span_bug`

This forwards the caller span to `Handler::delay_span_bug`

3 years agoRollup merge of #75177 - JohnTitor:broken-mir-test, r=eddyb
Tyler Mandry [Sun, 16 Aug 2020 21:59:27 +0000 (14:59 -0700)]
Rollup merge of #75177 - JohnTitor:broken-mir-test, r=eddyb

Add regression test for issue-66768

Fixes #66768

This is fixed by #70452 (in particular, https://github.com/rust-lang/rust/pull/70452/files#diff-53aef089a36a8e2ed07627fc8915fe63R1763) and I'm not sure it's worth to add this test (i.e. the tests in #70452 are enough), so r? @eddyb to confirm it.

3 years agoRollup merge of #74399 - mark-i-m:ty-err-4, r=eddyb
Tyler Mandry [Sun, 16 Aug 2020 21:59:25 +0000 (14:59 -0700)]
Rollup merge of #74399 - mark-i-m:ty-err-4, r=eddyb

Move DelaySpanBugEmitted to ty::context

This makes it even hard to abuse.

r? @eddyb

cc @LeSeulArtichaut as this will probably conflict with your PR :/

3 years agoRollup merge of #74346 - eddyb:reachable-defs, r=nikomatsakis
Tyler Mandry [Sun, 16 Aug 2020 21:59:23 +0000 (14:59 -0700)]
Rollup merge of #74346 - eddyb:reachable-defs, r=nikomatsakis

Use LocalDefId instead of HirId for reachable_set elements.

The only `HirId`s being tracked there that don't have matching `DefId`s are local variables, and that's an accident from #44316 (where I preserved the old behavior, even if nothing relied on reachability tracking local variables).

3 years agoRollup merge of #74314 - eddyb:closure-substs-direct, r=nikomatsakis
Tyler Mandry [Sun, 16 Aug 2020 21:59:21 +0000 (14:59 -0700)]
Rollup merge of #74314 - eddyb:closure-substs-direct, r=nikomatsakis

rustc_typeck: construct {Closure,Generator}Substs more directly.

We've previously not had a way to create `{Closure,Generator}Substs` other than instantiating all generics as inference variables and unifying the inference types (extracted using the regular `{Closure,Generator}Substs` accessors), with the actual types.

With this PR, those hacks, and assumptions about the order of closure/generator-specific components, are replaced with a simple API where the base `Substs` are combined with the additional information into a `{Closure,Generator}Substs`.
This might also be faster than relying inference, although probably not by much.

r? @nikomatsakis cc #53488 @blitzerr

3 years agoRollup merge of #74204 - ayazhafiz:i/74120, r=eddyb
Tyler Mandry [Sun, 16 Aug 2020 21:59:20 +0000 (14:59 -0700)]
Rollup merge of #74204 - ayazhafiz:i/74120, r=eddyb

Don't visit foreign function bodies when lowering ast to hir

Previously the existence of bodies inside a foreign function block would
cause a panic in the hir `NodeCollector` during its collection of crate
bodies to compute a crate hash:

https://github.com/rust-lang/rust/blob/e59b08e62ea691916d2f063cac5aab4634128022/src/librustc_middle/hir/map/collector.rs#L154-L158

The collector walks the hir tree and creates a map of hir nodes, then
attaching bodies in the crate to their owner in the map. For a code like

```rust
extern "C" {
    fn f() {
        fn g() {}
    }
}
```

The crate bodies include the body of the function `g`. But foreign
functions cannot have bodies, and while the parser AST permits a foreign
function to have a body, the hir doesn't. This means that the body of
`f` is not present in the hir, and so neither is `g`. So when the
`NodeCollector` finishes the walking the hir, it has no record of `g`,
cannot find an owner for the body of `g` it sees in the crate bodies,
and blows up.

Why do the crate bodies include the body of `g`? The AST walker has a
need a for walking function bodies, and FFIs share the same AST node as
functions in other contexts.

There are at least two options to fix this:

- Don't unwrap the map entry for an hir node in the `NodeCollector`
- Modifier the ast->hir lowering visitor to ignore foreign function
  blocks

I don't think the first is preferrable, since we want to know when we
can't find a body for an hir node that we thought had one (dropping this
information may lead to an invalid hash). So this commit implements the
second option.

Closes #74120

3 years agoFix fortanix build
Mark Rousskov [Sun, 16 Aug 2020 20:34:39 +0000 (16:34 -0400)]
Fix fortanix build

3 years agoImplement 'considered equal' for statements, so that for example `_0 = _1` and `discr...
Simon Vandel Sillesen [Sat, 25 Jul 2020 15:46:11 +0000 (17:46 +0200)]
Implement 'considered equal' for statements, so that for example `_0 = _1` and `discriminant(_0) = discriminant(0)` are considered equal if 0 is a fieldless variant of an enum

3 years agoUse more compatible out-implib style
Mateusz Mikuła [Sun, 16 Aug 2020 19:54:37 +0000 (21:54 +0200)]
Use more compatible out-implib style

3 years agomove DelaySpanBugEmitted to ty::context
mark [Thu, 16 Jul 2020 15:21:10 +0000 (10:21 -0500)]
move DelaySpanBugEmitted to ty::context

3 years agoAuto merge of #73176 - LeSeulArtichaut:tyctxtat-err, r=eddyb
bors [Sun, 16 Aug 2020 18:48:26 +0000 (18:48 +0000)]
Auto merge of #73176 - LeSeulArtichaut:tyctxtat-err, r=eddyb

Add `TyCtxtAt::{ty_error, ty_error_with_message}`

~~Only e2d957d was added, the rest comes from #70551.~~
I was unsure where to put the implementation for those methods, please tell me if there is a better place for it.

Closes #72619, ~~blocked on #70551~~.

r? @eddyb cc @mark-i-m, maybe this should be part of #70551? If so feel free to cherry-pick or ask me to file a PR against your fork.

3 years agorustc_typeck: construct {Closure,Generator}Substs more directly.
Eduard-Mihai Burtescu [Mon, 13 Jul 2020 14:12:07 +0000 (17:12 +0300)]
rustc_typeck: construct {Closure,Generator}Substs more directly.

3 years agoUse LocalDefId instead of HirId for reachable_set elements.
Eduard-Mihai Burtescu [Tue, 14 Jul 2020 23:51:46 +0000 (02:51 +0300)]
Use LocalDefId instead of HirId for reachable_set elements.

3 years agoSwitch to intra-doc links in /sys/windows/ext/{ffi,fs,process}.rs
Prabakaran Kumaresshan [Sun, 16 Aug 2020 16:58:45 +0000 (22:28 +0530)]
Switch to intra-doc links in /sys/windows/ext/{ffi,fs,process}.rs

3 years agoAuto merge of #75472 - Mark-Simulacrum:mangling-config, r=eddyb
bors [Sun, 16 Aug 2020 16:58:13 +0000 (16:58 +0000)]
Auto merge of #75472 - Mark-Simulacrum:mangling-config, r=eddyb

Add option to use the new symbol mangling in rustc/std

I don't know if this causes problems in some cases -- maybe it should be on by default for at least rustc. I've never encountered problems with it other than tools not supporting it, though.

cc @nnethercote
r? @eddyb

3 years agomiri engine: add option to use force_int for alignment check
Ralf Jung [Sun, 16 Aug 2020 15:36:46 +0000 (17:36 +0200)]
miri engine: add option to use force_int for alignment check

3 years agorustdoc: clean `QPath::LangItem`
David Wood [Tue, 4 Aug 2020 13:22:16 +0000 (14:22 +0100)]
rustdoc: clean `QPath::LangItem`

This commit adds support for cleaning `QPath::LangItem` and
`hir::GenericBound::LangItemTrait` in rustdoc. `QPath::LangItem`
does not require lowering, and `hir::GenericBound::LangItemTrait`
is lowered to a `GenericBound::TraitBound`.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoresolve: support `GenericBound::LangItemTrait`
David Wood [Tue, 4 Aug 2020 13:19:28 +0000 (14:19 +0100)]
resolve: support `GenericBound::LangItemTrait`

This commit modifies name resolution to ensure that new scopes are
introduced from lang-item generic bounds.

Co-authored-by: Matthew Jasper <mjjasper1@gmail.com>
Signed-off-by: David Wood <david@davidtw.co>
3 years agohir: simplify `is_range_literal`
David Wood [Tue, 4 Aug 2020 13:18:11 +0000 (14:18 +0100)]
hir: simplify `is_range_literal`

This commit simplifies `is_range_literal` by checking for
`QPath::LangItem` containing range-related lang items, rather than using
a heuristic.

Co-authored-by: Matthew Jasper <mjjasper1@gmail.com>
Signed-off-by: David Wood <david@davidtw.co>
3 years agosave_analysis: support `QPath::LangItem`
David Wood [Tue, 4 Aug 2020 13:36:09 +0000 (14:36 +0100)]
save_analysis: support `QPath::LangItem`

This commit implements support for `QPath::LangItem` and
`GenericBound::LangItemTrait` in save analysis.

Signed-off-by: David Wood <david@davidtw.co>
3 years agohir: introduce `QPath::LangItem`
David Wood [Tue, 4 Aug 2020 13:34:24 +0000 (14:34 +0100)]
hir: introduce `QPath::LangItem`

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

This might be better for performance, but is also much cleaner as the
previous approach is fragile. In addition, it resolves a bug (#61019)
where an extern crate imported as "std" would result in the paths
created during AST lowering being resolved incorrectly (or not at all).

Co-authored-by: Matthew Jasper <mjjasper1@gmail.com>
Signed-off-by: David Wood <david@davidtw.co>
3 years agohir: introduce lang items for AST lowering
David Wood [Tue, 4 Aug 2020 13:04:25 +0000 (14:04 +0100)]
hir: introduce lang items for AST lowering

This commit adds new lang items which will be used in AST lowering once
`QPath::LangItem` is introduced.

Co-authored-by: Matthew Jasper <mjjasper1@gmail.com>
Signed-off-by: David Wood <david@davidtw.co>
3 years agotests: add test for #61019's current behaviour
David Wood [Tue, 4 Aug 2020 09:47:07 +0000 (10:47 +0100)]
tests: add test for #61019's current behaviour

This commit adds a test for #61019 where a extern crate is imported as
`std` which results in name resolution to fail due to the uses of `std`
types introduced from lowering.

Signed-off-by: David Wood <david@davidtw.co>
3 years agolang_items: add support for lang items on variants
David Wood [Tue, 4 Aug 2020 09:27:35 +0000 (10:27 +0100)]
lang_items: add support for lang items on variants

This commit adds support for lang items (`#[lang = "..."]` attributes)
on enum variants.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoAuto merge of #75567 - poliorcetics:intra-links-std-net, r=jyn514
bors [Sun, 16 Aug 2020 13:15:52 +0000 (13:15 +0000)]
Auto merge of #75567 - poliorcetics:intra-links-std-net, r=jyn514

Move to intra doc links in std::net

Helps with #75080.

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

The links for `true` and `false` had to stay else `rustdoc` complained, it is intended ?