Commit Graph

125615 Commits

Author SHA1 Message Date
Alexis Bourget
431a465a8f Move to intra doc links for keyword documentation 2020-08-17 22:17:14 +02:00
bors
33c96b4d97 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.
2020-08-17 18:33:24 +00:00
Dan Cross
6ad6d8c25c 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>
2020-08-17 13:23:29 -04:00
Cameron Taggart
2b1fc16153 update stacker to 0.1.11 to unbreak build for wasm32-unknown-unknown 2020-08-17 10:57:53 -06:00
bors
8d185cabbd Auto merge of #75187 - pawanbisht62:feature/incorporate-tracing, r=oli-obk
Incorporated Tracing Crate in some libraries

Issue #74747
2020-08-17 16:40:10 +00:00
jumbatm
bc15dd6dde Wrap recursion in ensure_sufficient_stack. 2020-08-18 02:01:05 +10:00
jumbatm
1321a2dce3 Also accept Refs for is_primitive_or_pointer 2020-08-18 02:01:05 +10:00
jumbatm
7708abbbef Avoid double hashset lookup.
Co-authored-by: Bastian Kauschke <bastian_kauschke@hotmail.de>
2020-08-18 02:01:04 +10:00
jumbatm
6c57de1166 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.
2020-08-18 02:01:04 +10:00
jumbatm
bca48ad7ac Reduce indentation by replacing match arm w/ early return. 2020-08-18 02:01:04 +10:00
jumbatm
80c2c80d52 Remove structural equiv check for Array const. 2020-08-18 02:01:04 +10:00
jumbatm
a1fa4e05ac Remove unnecessary rebinding of def ids. 2020-08-18 02:01:04 +10:00
jumbatm
154b74e8f9 Actually introduce a cycle in Reffy test. 2020-08-18 02:01:04 +10:00
jumbatm
db753137a1 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.
2020-08-18 02:01:04 +10:00
jumbatm
b0eb55a092 Add test demonstrating the issue. 2020-08-18 02:01:04 +10:00
Guillaume Gomez
4fa69cb3ce Improve display 2020-08-17 17:22:53 +02:00
Ellen
e7a7279750 Remove unnecessary links in env.rs 2020-08-17 15:16:09 +01:00
Aleksey Kladov
0c33df9c77 ⬆️ rust-analyzer 2020-08-17 16:15:20 +02:00
bors
e8df0b8932 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
2020-08-17 14:13:13 +00:00
Ellen
a2dfc3ec78 Switch to intra-doc links for std/src/alloc.rs 2020-08-17 14:42:40 +01:00
Ellen
b6d2868caa Switch to intra-doc links for std/src/env.rs 2020-08-17 14:42:23 +01:00
Ellen
509cad7f2f Switch to intra-doc links for std/src/error.rs 2020-08-17 14:42:16 +01:00
Oliver Scherer
daf7a37510 Make a test platform independent 2020-08-17 15:31:48 +02:00
Guillaume Gomez
cbc13c5eb7 Clean up E0754 explanation 2020-08-17 15:14:53 +02:00
David Wood
5703b2863e
polymorphize: ∃ used param ∈ predicate → all used
This commit modifies polymorphization's handling of predicates so that
if any generic parameter is used in a predicate then all parameters in
that predicate are used.

Signed-off-by: David Wood <david@davidtw.co>
2020-08-17 14:13:58 +01:00
Tim Diekmann
c48f784418 Fix typo in comment 2020-08-17 15:05:19 +02:00
David Wood
f1ce2948db
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>
2020-08-17 13:55:05 +01:00
Tim Diekmann
93e074bc8a 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`
2020-08-17 14:23:14 +02:00
Ralf Jung
edb39c0d20 attempt to improve span_label docs 2020-08-17 14:15:47 +02:00
bors
8cdc94e840 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
2020-08-17 12:11:41 +00:00
Ralf Jung
6da8503dff
fix typo
Co-authored-by: Oliver Scherer <github35764891676564198441@oli-obk.de>
2020-08-17 14:11:03 +02:00
Tim Diekmann
c619b36975 Remove fast path in reallocation for same layout sizes 2020-08-17 13:23:38 +02:00
Sasha
bdbb995df3 Mark x86_64-linux-kernel as * 2020-08-17 12:57:42 +02:00
bors
67e7b9b8cf 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`
2020-08-17 08:00:45 +00:00
bors
94d7660d59 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
2020-08-17 06:02:16 +00:00
bors
49d39e5591 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](5addb135ed/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.
2020-08-17 03:52:46 +00:00
5M1Sec
be1fc40b1d 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>
2020-08-16 23:26:51 -04:00
bors
5f88bea878 Auto merge of #75014 - Amanieu:fix_asm_reg, r=nagisa
Work around LLVM issues with explicit register in inline asm

Fixes #74658
2020-08-17 01:57:50 +00:00
Esteban Küber
ac73474c7d 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
2020-08-16 18:33:30 -07:00
bors
4bb4b96ee7 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
2020-08-16 23:52:32 +00:00
Aaron Hill
5d40e4515f
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.
2020-08-16 19:08:43 -04:00
bors
7e6d6e5f53 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
2020-08-16 22:00:29 +00:00
Tyler Mandry
e46b1efd39
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
2020-08-16 14:59:36 -07:00
Tyler Mandry
b32df4312e
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.
2020-08-16 14:59:34 -07:00
Tyler Mandry
8ba56afcc6
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?
2020-08-16 14:59:32 -07:00
Tyler Mandry
18e3799dc8
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
2020-08-16 14:59:30 -07:00
Tyler Mandry
8a33c98d52
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`
2020-08-16 14:59:29 -07:00
Tyler Mandry
76b2fce98b
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.
2020-08-16 14:59:27 -07:00
Tyler Mandry
54c74345b4
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 :/
2020-08-16 14:59:25 -07:00
Tyler Mandry
3ef2244b41
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).
2020-08-16 14:59:23 -07:00