Commit Graph

124498 Commits

Author SHA1 Message Date
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
Ding Xiang Fei
4631579b00
rustfmt 2020-07-31 11:58:49 +08:00
Ding Xiang Fei
db07174632
Remove a trailing space 2020-07-31 11:46:05 +08:00
bors
ffa80f01d8 Auto merge of #74926 - Manishearth:rename-lint, r=jyn514
Rename intra_doc_link_resolution_failure

It should be plural to follow the conventions in https://github.com/rust-lang/rfcs/blob/master/text/0344-conventions-galore.md#lints
2020-07-31 02:20:47 +00:00
Yuki Okushi
1629fed4c0
Presort restrictions to make output consistent 2020-07-31 09:03:14 +09:00
bors
c058a8b8dc Auto merge of #74682 - alexcrichton:backtrace-gimli-round-2, r=Mark-Simulacrum
std: Switch from libbacktrace to gimli (take 2)

This is the second attempt to land https://github.com/rust-lang/rust/pull/73441 after being reverted in https://github.com/rust-lang/rust/pull/74613. Will be gathering precise perf numbers here in this take.

Closes #71060
2020-07-30 23:22:09 +00:00
Yuki Okushi
c2afce4058
Fix ICEs with @ .. binding 2020-07-31 07:50:29 +09:00
Yuki Okushi
8b778a5f8d
Revert "Fix an ICE on an invalid binding @ ... in a tuple struct pattern"
This reverts commit f5e5eb6f46.
2020-07-31 06:52:00 +09:00
bors
cfc572cae2 Auto merge of #74957 - Manishearth:rollup-3wudwlg, r=Manishearth
Rollup of 9 pull requests

Successful merges:

 - #74751 (Clean up E0730 explanation)
 - #74782 (Don't use "weak count" around Weak::from_raw_ptr)
 - #74835 (Clean up E0734 explanation)
 - #74871 (Enable docs on dist-x86_64-musl)
 - #74905 (Avoid bool-like naming)
 - #74907 (Clean up E0740 explanation)
 - #74915 (rustc: Ignore fs::canonicalize errors in metadata)
 - #74934 (Improve diagnostics when constant pattern is too generic)
 - #74951 (Cherry-pick the release notes for 1.45.1)

Failed merges:

r? @ghost
2020-07-30 20:57:54 +00:00
Dylan MacKenzie
96c84ac3cb Test Option::unwrap in a const context 2020-07-30 13:09:45 -07:00
Manish Goregaokar
9eb50260bd
Rollup merge of #74951 - cuviper:relnotes-1.45.1, r=jonas-schievink
Cherry-pick the release notes for 1.45.1
2020-07-30 13:04:43 -07:00
Manish Goregaokar
b0d426165f
Rollup merge of #74934 - nbdd0121:issue-73976, r=ecstatic-morse
Improve diagnostics when constant pattern is too generic

This PR is a follow-up to PR #74538 and issue #73976

When constants queries Layout, TypeId or type_name of a generic parameter, instead of emitting `could not evaluate constant pattern`, we will instead emit a more detailed message `constant pattern depends on a generic parameter`.
2020-07-30 13:04:42 -07:00
Manish Goregaokar
0a45b1303c
Rollup merge of #74915 - alexcrichton:allow-failing-canonicalize, r=Mark-Simulacrum
rustc: Ignore fs::canonicalize errors in metadata

This commit updates the metadata location logic to ignore errors when
calling `fs::canonicalize`. Canonicalization was added historically so
multiple `-L` paths to the same directory don't print errors about
multiple candidates (since rustc can deduplicate same-named paths), but
canonicalization doesn't work on all filesystems. Cargo, for example,
always uses this sort of fallback where it will opportunitistically try
to canonicalize but fall back to using the input path if it otherwise
doesn't work.

If rustc is run on a filesystem that doesn't support canonicalization
then the effect of this change will be that `-L` paths which logically
point to the same directory will cause errors, but that's a rare enough
occurrence it shouldn't cause much issue in practice. Otherwise rustc
doesn't work at all today on those sorts of filesystem where
canonicalization isn't supported!
2020-07-30 13:04:40 -07:00
Manish Goregaokar
2c6c764d9a
Rollup merge of #74907 - GuillaumeGomez:cleanup-e0740, r=pickfire
Clean up E0740 explanation

r? @Dylan-DPC
2020-07-30 13:04:38 -07:00
Manish Goregaokar
e823af6015
Rollup merge of #74905 - lzutao:listed, r=jyn514
Avoid bool-like naming

Lost in https://github.com/rust-lang/rust/pull/74127#discussion_r453143504
2020-07-30 13:04:36 -07:00
Manish Goregaokar
8892785c8e
Rollup merge of #74871 - etherealist:musl_doc, r=Mark-Simulacrum
Enable docs on dist-x86_64-musl

Add the `rust-docs` component to toolchain `x86_64-unknown-linux-musl`, which allows people using rustup on their musl-based linux distribution to download the rust-docs.

`--disable-docs` is based on the assumption that `x86_64-unknown-linux-musl` is only a cross-compile target.

I have tested that the docs are built. I assume the build-system will automatically detect the docs and create a `rust-docs` component. I will [monitor](https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-musl.html) the components and create a follow-up PR, if the docs aren't published.

See also #70619, where we enabled `rust-lld` to enable the wasm-workflow on musl-based linux distributions.
2020-07-30 13:04:34 -07:00
Manish Goregaokar
172b3a713a
Rollup merge of #74835 - GuillaumeGomez:cleanup-e0734, r=jyn514
Clean up E0734 explanation

r? @Dylan-DPC
2020-07-30 13:04:32 -07:00
Manish Goregaokar
46379687ac
Rollup merge of #74782 - vorner:weak-into-raw-cnt-doc, r=dtolnay
Don't use "weak count" around Weak::from_raw_ptr

As `Rc/Arc::weak_count` returns 0 when having no strong counts, this
could be confusing and it's better to avoid using that completely.

Closes #73840.
2020-07-30 13:04:29 -07:00
Manish Goregaokar
7e86c8eccb
Rollup merge of #74751 - GuillaumeGomez:cleanup-e0730, r=jyn514
Clean up E0730 explanation

r? @Dylan-DPC
2020-07-30 13:04:23 -07:00
Dylan MacKenzie
fc2c1f8ddc Make Option::unwrap unstably const
`Result::unwrap` is not eligible becuase it formats the contents of the
`Err` variant. `unwrap_or`, `unwrap_or_else` and friends are not
eligible because they drop things or invoke closures.
2020-07-30 12:30:58 -07:00
Rich Kadel
34b26d6a77 Rust function-level coverage now works on external crates
Fixed 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.
2020-07-30 12:25:39 -07:00
Joseph Ryan
48c6f05662
Update driver to add json backend 2020-07-30 14:13:51 -05:00
Mark Rousskov
19d191bb02 Update release notes
(cherry picked from commit 32166ab1eb)
2020-07-30 11:36:33 -07:00
Mark Rousskov
e1e01f72a5 1.45.1 release
(cherry picked from commit 9e5fb40807)
2020-07-30 11:36:14 -07:00
bors
438c59f010 Auto merge of #74908 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/74580
Cc @rust-lang/miri r? @ghost
2020-07-30 18:29:08 +00:00
Ding Xiang Fei
3b2642ffa7
Add comments to explain the test case and the special treatment 2020-07-31 02:16:42 +08:00
Manish Goregaokar
c17eb566c2 Fix uitests 2020-07-30 10:40:17 -07:00
Manish Goregaokar
e25a67fa6c Rename the lint again 2020-07-30 10:39:31 -07:00
Manish Goregaokar
8fe438e632 intra_doc_resolution_failures -> broken_intra_doc_links 2020-07-30 10:38:55 -07:00
Manish Goregaokar
bcb2813e01 Update uitest expectations 2020-07-30 10:22:57 -07:00
Ralf Jung
1a2208afc5 update Miri 2020-07-30 19:05:21 +02:00