Commit Graph

124584 Commits

Author SHA1 Message Date
bors
cfdf9d3355 Auto merge of #74993 - sunfishcode:update-wasi-libc, r=alexcrichton
Update the bundled wasi-libc with libstd

This just updates WASI libc, in preparation for WASI reactor support in
a separate change.

r? @alexcrichton
2020-08-01 11:25:31 +00:00
bors
dfe1e3b641 Auto merge of #74582 - Lezzz:rename-hair, r=nikomatsakis
Rename HAIR to THIR (Typed HIR).

r? @nikomatsakis

Originally suggested by @eddyb
2020-08-01 09:25:03 +00:00
bors
b5eae9c44d Auto merge of #74373 - lcnr:array_chunks, r=withoutboats
add `slice::array_chunks` to std

Now that #74113 has landed, these methods are suddenly usable. A rebirth of #72334

Tests are directly copied from `chunks_exact` and some additional tests for type inference.

r? @withoutboats as you are both part of t-libs and working on const generics. closes #60735
2020-08-01 06:54:14 +00:00
Bastian Kauschke
d51b71a35a add tracking issue 2020-08-01 07:49:24 +02:00
Oliver Scherer
aba0251c78 Replace a recursive algorithm with an iterative one and a stack. 2020-08-01 07:20:43 +02:00
bors
18e2a89199 Auto merge of #74945 - dingxiangfei2009:promote-static-ref-deref, r=oli-obk
[mir] Special treatment for dereferencing a borrow to a static definition

Fix #70584.

As suggested by @oli-obk in this [comment](https://github.com/rust-lang/rust/issues/70584#issuecomment-626009260), one can chase the definition of the local variable being de-referenced and check if it is a true static variable. If that is the case, `validate_place` will admit the promotion.

This is my first time to contribute to `rustc`, and I have two questions.
1. A generalization to some extent is applied to decide if the promotion is possible in the static context. In case that there are more projection operations preceding the de-referencing, `validate_place` recursively decent into inner projection operations. I have put thoughts into its correctness but I am not totally sure about it.
2. I have a hard time to find a good place for the test case. This patch has to do with MIR, but this test case would look out of place compared to other tests in `src/test/ui/mir` or `src/test/ui/borrowck` because it does not generate errors while others do. It is tentatively placed in `src/test/ui/statics` for now.

Thank you for any comments and suggestions!
2020-08-01 04:34:05 +00:00
bors
22e6099330 Auto merge of #74717 - davidtwco:issue-74636-polymorphized-closures-inherited-params, r=oli-obk
mir: add `used_generic_parameters_needs_subst`

Fixes #74636.

This PR adds a `used_generic_parameters_needs_subst` helper function which checks whether a type needs substitution, but only for parameters that the `unused_generic_params` query considers used. This is used in the MIR interpreter to make the check for some pointer casts and for reflection intrinsics more precise.

I've opened this as a draft PR because this might not be the approach we want to fix this issue and we have to decide what to do about the reflection case.

r? @eddyb
cc @lcnr @wesleywiser
2020-08-01 02:48:34 +00:00
bors
b544b43b10 Auto merge of #74994 - JohnTitor:rollup-eknaekv, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #74644 (Remove `linked_list_extras` methods.)
 - #74968 (Run all tests if have no specified tests)
 - #74982 (1.45.2 release notes)
 - #74984 (Miri: fix ICE when unwinding past topmost stack frame)
 - #74986 (fix part of comparison that would always evaluate to "true", probably an oversight)
 - #74991 (Fix Const-Generic Cycle ICE #74199)

Failed merges:

r? @ghost
2020-07-31 23:52:46 +00:00
Matthias Krüger
21cab87f08 submodules: update cargo from 974eb438d to 2d5c2381e
Changes:
````
Use the same index location on nightly as beta
relax deprecated diagnostic message check
Don't print to raw stderr in test
Emit the `test` field in cargo metadata
````
2020-08-01 01:41:36 +02:00
Dan Gohman
9ade8366c0 Update the WASI libc build to LLVM 10.
Among other things, this brings in [the `__main_argc_argv`] patch,
which simplifies the interaction between the compiler and WASI libc's
startup code, which will help work on reactor support.

[the `__main_argc_argv` patch]: 00072c08c7
2020-07-31 16:07:08 -07:00
Yuki Okushi
3ad6feda56
Rollup merge of #74991 - JulianKnodt:74199, r=lcnr
Fix Const-Generic Cycle ICE #74199

This PR intends to fix the bug in Issue #74199 by following the suggestion provided of ignoring the error that causes the ICE.

This does not fix the underlying cycle detection issue, but fixes the ICE.
Also adds a test to check that it doesn't causes an ICE but returns a valid error for now.

r? @lcnr

Edit: Also it's funny how this PR number is an anagram of the issue number
2020-08-01 08:02:12 +09:00
Yuki Okushi
ff5ccc82eb
Rollup merge of #74986 - matthiaskrgr:cmp_true, r=oli-obk
fix part of comparison that would always evaluate to "true", probably an oversight

cc  @jumbatm
2020-08-01 08:02:11 +09:00
Yuki Okushi
bb397c465c
Rollup merge of #74984 - RalfJung:miri-unwind-top, r=oli-obk
Miri: fix ICE when unwinding past topmost stack frame

Fixes https://github.com/rust-lang/miri/issues/1389
2020-08-01 08:02:09 +09:00
Yuki Okushi
5434142318
Rollup merge of #74982 - jonas-schievink:relnotes-1.45.2, r=Mark-Simulacrum
1.45.2 release notes

(for master)

cc https://github.com/rust-lang/rust/pull/74958
2020-08-01 08:02:07 +09:00
Yuki Okushi
ad8230f57d
Rollup merge of #74968 - lzutao:no-args, r=Mark-Simulacrum
Run all tests if have no specified tests

The behaviour was changed in https://github.com/rust-lang/rust/pull/74905#discussion_r463259562
cc @alex if you could check it again, thank you.
2020-08-01 08:02:06 +09:00
Yuki Okushi
ab4570eaf0
Rollup merge of #74644 - crlf0710:drop_old_stuff, r=Amanieu
Remove `linked_list_extras` methods.

Removing these in favor of the `Cursor` API in https://github.com/rust-lang/rust/issues/58533 .
Closes #27794.

r? @Amanieu
2020-08-01 08:02:04 +09:00
Valentin Lazureanu
40e6dccfb4 Rename HAIR to THIR (Typed HIR). 2020-07-31 22:15:12 +00:00
Bastian Kauschke
b90bc8d70b fix rustdoc generic param order 2020-07-31 23:51:19 +02:00
Dan Gohman
aaffb06c04 Update the bundled wasi-libc with libstd
This just updates WASI libc, in preparation for WASI reactor support in
a separate change.
2020-07-31 14:47:19 -07:00
kadmin
96b5dee9ab Added in explicit check for the type being matched 2020-07-31 21:33:55 +00:00
kadmin
011e0ef636 Removed error check in order to prevent ICE 2020-07-31 21:18:39 +00:00
Oliver Scherer
401033c684 Don't register a tracing dispatcher if no tracing env var was set. 2020-07-31 22:42:16 +02:00
Oliver Scherer
358e21ee78 Disable log support 2020-07-31 22:42:09 +02:00
Oliver Scherer
720832c644 Update error index generator to tracing 2020-07-31 22:38:27 +02:00
Oliver Scherer
208f973d1f Make rustdoc share the logger initialization routine with rustc. 2020-07-31 22:38:27 +02:00
Oliver Scherer
64296ec698 Add tracing libs to list of permitted dependencies 2020-07-31 22:38:27 +02:00
Oliver Scherer
ec7230fea2 Move from log to tracing 2020-07-31 22:38:20 +02:00
Matthias Krüger
8a5654f53c fix part of comparison that would always evaluate to "true", probably an oversight 2020-07-31 21:23:39 +02:00
Ralf Jung
73ba4e7abe Miri: fix ICE when unwinding past topmost stack frame 2020-07-31 20:46:05 +02:00
Esteban Küber
6ed06b2ba9 Reduce verbosity of some type ascription errors
* Deduplicate type ascription LHS errors
* Remove duplicated `:` -> `::` suggestion from parse error
* Tweak wording to be more accurate
* Modify `current_type_ascription` to reduce span wrangling
* remove now unnecessary match arm
* Add run-rustfix to appropriate tests
2020-07-31 11:29:15 -07:00
bors
6e87bacd37 Auto merge of #65989 - Aaron1011:fix/normalize-param-env, r=nikomatsakis
Normalize all opaque types when converting ParamEnv to Reveal::All

When we normalize a type using a ParamEnv with a reveal mode of
RevealMode::All, we will normalize opaque types to their underlying
types (e.g. `type MyOpaque = impl Foo` -> `StructThatImplsFoo`).
However, the ParamEnv may still have predicates referring to the
un-normalized opaque type (e.g. `<T as MyTrait<MyOpaque>>`). This can
cause trait projection to fail, since a type containing normalized
opaque types will not match up with the un-normalized type in the
`ParamEnv`.

To fix this, we now explicitly normalize all opaque types in
caller_bounds of a `ParamEnv` when changing its mode to
`RevealMode::All`. This ensures that all predicatse will refer to the
underlying types of any opaque types involved, allowing them to be
matched up properly during projection. To reflect the fact that
normalization is occuring, `ParamEnv::with_reveal_all` is renamed to
`ParamEnv::with_reveal_all_normalized`

Fixes #65918
2020-07-31 18:14:59 +00:00
Charles Lew
dc21178830 Remove linked_list_extras methods. 2020-08-01 00:54:22 +08:00
Mark Rousskov
f173a4b8ec 1.45.2 release notes 2020-07-31 17:47:33 +02:00
David Wood
59e621c196
interp: needs_subst -> ensure_monomorphic_enough
This commit adds a `ensure_monomorphic_enough` utility function which
checks whether a type needs substitution, but only for parameters
that the `unused_generic_params` query considers used.

`ensure_monomorphic_enough` is then used throughout interpret where
`needs_subst` checks previously existed (in particular, for some
pointer casts and for reflection intrinsics more precise).

Signed-off-by: David Wood <david@davidtw.co>
2020-07-31 16:36:42 +01:00
Takayuki Nakata
3e48848538 Some fixes for plugin.md in unstable-book
- sample codes not working
- broken link
2020-07-31 23:56:18 +09:00
bors
62f9aa94c0 Auto merge of #74844 - asomers:freebsd-profiler, r=pietroalbini
Enable the profiler on FreeBSD

FreeBSD has been doing this in our own package builds for two months
now.

https://svnweb.freebsd.org/ports?view=revision&revision=535771
2020-07-31 12:27:13 +00:00
Ralf Jung
ff0c3a9209 expand comments 2020-07-31 14:03:42 +02:00
Guillaume Gomez
1a6730e31c Clean up E0741 error explanation 2020-07-31 13:15:47 +02:00
bors
e614f66800 Auto merge of #74965 - JohnTitor:sort-params, r=estebank
Presort restrictions to make output consistent

The const test part is already adjusted so this should fix #74886.
r? @estebank
2020-07-31 10:16:57 +00:00
Ding Xiang Fei
c5114549d7
Add the proper tests 2020-07-31 18:04:13 +08:00
Ralf Jung
7468f632ff also reduce some libcore test iteration counts 2020-07-31 11:56:08 +02:00
Ralf Jung
7e168a696f reduce slice::panic_safe test size further in Miri 2020-07-31 11:56:08 +02:00
Ralf Jung
0a62b7dc92 make some vec_deque tests less exhaustive in Miri 2020-07-31 11:56:08 +02:00
Shen-Ta Hsieh
4c851792ac
Fix std::fs::File::metadata permission on WASI target
Previously `std::fs::File::metadata` on wasm32-wasi would call `fd_filestat_get`
to get metadata associated with fd, but that fd is opened without
RIGHTS_FD_FILESTAT_GET right, so it will failed on correctly implemented WASI
environment.

This change instead to add the missing rights when opening an fd.
2020-07-31 09:01:16 +00:00
bors
3a92b9987a Auto merge of #74956 - ecstatic-morse:const-option-unwrap, r=oli-obk
Make `Option::unwrap` unstably const

This is lumped into the `const_option` feature gate (#67441), which enables a potpourri of `Option` methods.

cc @rust-lang/wg-const-eval

r? @oli-obk
2020-07-31 08:26:33 +00:00
bors
ac91673d89 Auto merge of #74959 - richkadel:llvm-coverage-map-gen-5.1, r=tmandry
Rust function-level coverage now works on external crates

Follow-up to a known issue discussed (post-merge) in #74733:

Resolves a known issue in the coverage map where some regions had nonsensical source code locations.

External crate functions are already included in their own coverage maps, per library, and don't need to also
be added to the importing crate's coverage map. (In fact, their source start and end byte positions are not relevant to the importing crate's SourceMap.)

The fix was to simply skip trying to add imported coverage info to the coverage map if the instrumented function is not "local".

The injected counters are still relevant, however, and the LLVM `instrprof.increment` intrinsic call parameters will map those counters to the external crates' coverage maps, when generating runtime coverage data.

Now Rust Coverage can cleanly instrument and analyze coverage on an entire crate and its dependencies.

Example (instrumenting https://github.com/google/json5format):

```bash
$ ./x.py build rust-demangler  # make sure the demangler is built
$ cd ~/json5format
$ RUSTC=$HOME/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc \
   RUSTFLAGS="-Zinstrument-coverage" \
   cargo build --example formatjson5
$ LLVM_PROFILE_FILE="formatjson5.profraw" \
   ./target/debug/examples/formatjson5 session_manager.cml
$ ~/rust/build/x86_64-unknown-linux-gnu/llvm/bin/llvm-profdata merge \
   -sparse formatjson5.profraw -o formatjson5.profdata
$ ~/rust/build/x86_64-unknown-linux-gnu/llvm/bin/llvm-cov show --use-color \
   --instr-profile=formatjson5.profdata target/debug/examples/formatjson5 \
   --show-line-counts-or-regions  \
   --Xdemangler=$HOME/rust/build/x86_64-unknown-linux-gnu/stage0-tools-bin/rust-demangler \
   --show-instantiations \
   2>&1 | less -R
```

(Scan forward for some of the non-zero coverage results, with `/^....[0-9]\|  *[^ |0]`.)

<img width="1071" alt="Screen Shot 2020-07-30 at 1 21 01 PM" src="https://user-images.githubusercontent.com/3827298/88970627-97e43000-d267-11ea-8e4d-fe40a091f756.png">
2020-07-31 06:35:19 +00:00
Bastian Kauschke
e75ffb0f1c use Iter<'_, [T; N]> in array_chunks 2020-07-31 08:25:23 +02:00
Bastian Kauschke
a410ebc5ea add note to array_chunks 2020-07-31 08:24:57 +02:00
bors
66b97dca3c Auto merge of #74955 - P1n3appl3:rustdoc-formats, r=GuillaumeGomez
Add `--output-format json` for Rustdoc on nightly

This enables the previously deprecated `--output-format` flag so it can be used on nightly to host the experimental implementation of [rfc/2963](https://github.com/rust-lang/rfcs/pull/2963). The actual implementation will come in later PRs so for now there's just a stub that gives you an ICE.

I'm _pretty_ sure that the logic I added makes it inaccessible from stable, but someone should double check that. @tmandry @jyn514
2020-07-31 04:37:14 +00:00
Lzu Tao
a4757225d7 Run all tests if have no specified tests 2020-07-31 04:20:27 +00:00