]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #65989 - Aaron1011:fix/normalize-param-env, r=nikomatsakis
bors [Fri, 31 Jul 2020 18:14:59 +0000 (18:14 +0000)]
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

3 years agoAuto merge of #74844 - asomers:freebsd-profiler, r=pietroalbini
bors [Fri, 31 Jul 2020 12:27:13 +0000 (12:27 +0000)]
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

3 years agoAuto merge of #74965 - JohnTitor:sort-params, r=estebank
bors [Fri, 31 Jul 2020 10:16:57 +0000 (10:16 +0000)]
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

3 years agoAuto merge of #74956 - ecstatic-morse:const-option-unwrap, r=oli-obk
bors [Fri, 31 Jul 2020 08:26:33 +0000 (08:26 +0000)]
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

3 years agoAuto merge of #74959 - richkadel:llvm-coverage-map-gen-5.1, r=tmandry
bors [Fri, 31 Jul 2020 06:35:19 +0000 (06:35 +0000)]
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">

3 years agoAuto merge of #74955 - P1n3appl3:rustdoc-formats, r=GuillaumeGomez
bors [Fri, 31 Jul 2020 04:37:14 +0000 (04:37 +0000)]
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

3 years agoAuto merge of #74926 - Manishearth:rename-lint, r=jyn514
bors [Fri, 31 Jul 2020 02:20:47 +0000 (02:20 +0000)]
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

3 years agoPresort restrictions to make output consistent
Yuki Okushi [Fri, 31 Jul 2020 00:03:14 +0000 (09:03 +0900)]
Presort restrictions to make output consistent

3 years agoAuto merge of #74682 - alexcrichton:backtrace-gimli-round-2, r=Mark-Simulacrum
bors [Thu, 30 Jul 2020 23:22:09 +0000 (23:22 +0000)]
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

3 years agoAuto merge of #74957 - Manishearth:rollup-3wudwlg, r=Manishearth
bors [Thu, 30 Jul 2020 20:57:54 +0000 (20:57 +0000)]
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

3 years agoTest `Option::unwrap` in a const context
Dylan MacKenzie [Thu, 30 Jul 2020 19:32:20 +0000 (12:32 -0700)]
Test `Option::unwrap` in a const context

3 years agoRollup merge of #74951 - cuviper:relnotes-1.45.1, r=jonas-schievink
Manish Goregaokar [Thu, 30 Jul 2020 20:04:43 +0000 (13:04 -0700)]
Rollup merge of #74951 - cuviper:relnotes-1.45.1, r=jonas-schievink

Cherry-pick the release notes for 1.45.1

3 years agoRollup merge of #74934 - nbdd0121:issue-73976, r=ecstatic-morse
Manish Goregaokar [Thu, 30 Jul 2020 20:04:42 +0000 (13:04 -0700)]
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`.

3 years agoRollup merge of #74915 - alexcrichton:allow-failing-canonicalize, r=Mark-Simulacrum
Manish Goregaokar [Thu, 30 Jul 2020 20:04:40 +0000 (13:04 -0700)]
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!

3 years agoRollup merge of #74907 - GuillaumeGomez:cleanup-e0740, r=pickfire
Manish Goregaokar [Thu, 30 Jul 2020 20:04:38 +0000 (13:04 -0700)]
Rollup merge of #74907 - GuillaumeGomez:cleanup-e0740, r=pickfire

Clean up E0740 explanation

r? @Dylan-DPC

3 years agoRollup merge of #74905 - lzutao:listed, r=jyn514
Manish Goregaokar [Thu, 30 Jul 2020 20:04:36 +0000 (13:04 -0700)]
Rollup merge of #74905 - lzutao:listed, r=jyn514

Avoid bool-like naming

Lost in https://github.com/rust-lang/rust/pull/74127#discussion_r453143504

3 years agoRollup merge of #74871 - etherealist:musl_doc, r=Mark-Simulacrum
Manish Goregaokar [Thu, 30 Jul 2020 20:04:34 +0000 (13:04 -0700)]
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.

3 years agoRollup merge of #74835 - GuillaumeGomez:cleanup-e0734, r=jyn514
Manish Goregaokar [Thu, 30 Jul 2020 20:04:32 +0000 (13:04 -0700)]
Rollup merge of #74835 - GuillaumeGomez:cleanup-e0734, r=jyn514

Clean up E0734 explanation

r? @Dylan-DPC

3 years agoRollup merge of #74782 - vorner:weak-into-raw-cnt-doc, r=dtolnay
Manish Goregaokar [Thu, 30 Jul 2020 20:04:29 +0000 (13:04 -0700)]
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.

3 years agoRollup merge of #74751 - GuillaumeGomez:cleanup-e0730, r=jyn514
Manish Goregaokar [Thu, 30 Jul 2020 20:04:23 +0000 (13:04 -0700)]
Rollup merge of #74751 - GuillaumeGomez:cleanup-e0730, r=jyn514

Clean up E0730 explanation

r? @Dylan-DPC

3 years agoMake `Option::unwrap` unstably const
Dylan MacKenzie [Thu, 30 Jul 2020 19:30:56 +0000 (12:30 -0700)]
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.

3 years agoRust function-level coverage now works on external crates
Rich Kadel [Thu, 30 Jul 2020 19:25:39 +0000 (12:25 -0700)]
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.

3 years agoUpdate driver to add json backend
Joseph Ryan [Thu, 30 Jul 2020 18:54:26 +0000 (13:54 -0500)]
Update driver to add json backend

3 years agoUpdate release notes
Mark Rousskov [Sat, 25 Jul 2020 15:01:44 +0000 (11:01 -0400)]
Update release notes

(cherry picked from commit 32166ab1ebec2e5e5454221f0d3238c21382de9f)

3 years ago1.45.1 release
Mark Rousskov [Mon, 20 Jul 2020 12:58:10 +0000 (08:58 -0400)]
1.45.1 release

(cherry picked from commit 9e5fb40807f97fe47d2eaca99daeb1f1f6ff07a7)

3 years agoAuto merge of #74908 - RalfJung:miri, r=RalfJung
bors [Thu, 30 Jul 2020 18:29:08 +0000 (18:29 +0000)]
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

3 years agoFix uitests
Manish Goregaokar [Thu, 30 Jul 2020 17:40:17 +0000 (10:40 -0700)]
Fix uitests

3 years agoRename the lint again
Manish Goregaokar [Thu, 30 Jul 2020 17:39:16 +0000 (10:39 -0700)]
Rename the lint again

3 years agointra_doc_resolution_failures -> broken_intra_doc_links
Manish Goregaokar [Thu, 30 Jul 2020 17:38:55 +0000 (10:38 -0700)]
intra_doc_resolution_failures -> broken_intra_doc_links

3 years agoUpdate uitest expectations
Manish Goregaokar [Thu, 30 Jul 2020 17:22:57 +0000 (10:22 -0700)]
Update uitest expectations

3 years agoupdate Miri
Ralf Jung [Thu, 30 Jul 2020 17:05:21 +0000 (19:05 +0200)]
update Miri

3 years agorustc: Ignore fs::canonicalize errors in metadata
Alex Crichton [Wed, 29 Jul 2020 16:10:07 +0000 (09:10 -0700)]
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!

3 years agoRemove deny for intra doc link failures from library code, it's no longer necessary
Manish Goregaokar [Thu, 30 Jul 2020 06:19:12 +0000 (23:19 -0700)]
Remove deny for intra doc link failures from library code, it's no longer necessary

3 years agoRename in library
Manish Goregaokar [Thu, 30 Jul 2020 00:06:44 +0000 (17:06 -0700)]
Rename in library

3 years agoRename to intra_doc_resolution_failures
Manish Goregaokar [Wed, 29 Jul 2020 23:26:32 +0000 (16:26 -0700)]
Rename to intra_doc_resolution_failures

3 years agoAuto merge of #73990 - jumbatm:clashing-extern-decl, r=nagisa
bors [Thu, 30 Jul 2020 14:36:41 +0000 (14:36 +0000)]
Auto merge of #73990 - jumbatm:clashing-extern-decl, r=nagisa

Fix incorrect clashing_extern_declarations warnings.

Fixes #73735, fixes #73872.

Fix clashing_extern_declarations warning for `#[repr(transparent)]` structs and safely-FFI-convertible enums, and not warning for clashes of struct members of different types, but the same size.

r? @nagisa

3 years agoAuto merge of #74930 - ecstatic-morse:const-size-align-of-val, r=oli-obk
bors [Thu, 30 Jul 2020 12:52:41 +0000 (12:52 +0000)]
Auto merge of #74930 - ecstatic-morse:const-size-align-of-val, r=oli-obk

Make `mem::size_of_val` and `mem::align_of_val` unstably const

Implements #46571 but does not stabilize it. I wanted this while working on something today.

The only reason not to immediately stabilize are concerns around [custom DSTs](https://github.com/rust-lang/rust/issues/46571#issuecomment-387669352). That proposal has made zero progress in the last two years and const eval is rich enough to support pretty much any user-defined `len` function as long as nightly features are allowed (`raw_ptr_deref`).

Currently, this raises a `const_err` lint when passed an `extern type`.

r? @oli-obk

cc @rust-lang/wg-const-eval

3 years agoFix missed same-sized member clash in ClashingExternDeclarations.
jumbatm [Tue, 7 Jul 2020 11:08:14 +0000 (21:08 +1000)]
Fix missed same-sized member clash in ClashingExternDeclarations.

3 years agoHandle structs with zst members.
jumbatm [Wed, 15 Jul 2020 07:03:53 +0000 (17:03 +1000)]
Handle structs with zst members.

3 years agoAddress code review comments.
jumbatm [Mon, 13 Jul 2020 13:06:35 +0000 (23:06 +1000)]
Address code review comments.

- Make `is_repr_nullable_ptr` freestanding again to avoid usage of
ImproperCTypesVisitor in ClashingExternDeclarations (and don't
accidentally revert the ParamEnv::reveal_all() fix from a week earlier)
- Revise match condition for 1 Adt, 1 primitive
- Generalise check for non-null type so that it would also work for
ranges which exclude any single value (all bits set, for example)
- Make is_repr_nullable_ptr return the representable type instead of
just a boolean, to avoid adding an additional, independent "source of
truth" about the FFI-compatibility of Option-like enums. Also, rename to
`repr_nullable_ptr`.

3 years agoApply suggested wording changes from code review.
jumbatm [Sat, 4 Jul 2020 02:07:43 +0000 (12:07 +1000)]
Apply suggested wording changes from code review.

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
3 years agoDon't emit clashing decl lint for FFI-safe enums.
jumbatm [Fri, 3 Jul 2020 10:14:05 +0000 (20:14 +1000)]
Don't emit clashing decl lint for FFI-safe enums.

An example of an FFI-safe enum conversion is when converting
Option<NonZeroUsize> to usize. Because the Some value must be non-zero,
rustc can use 0 to represent the None variant, making this conversion is
safe. Furthermore, it can be relied on (and removing this optimisation
already would be a breaking change).

3 years agoAdd additional clashing_extern_decl cases.
jumbatm [Sun, 28 Jun 2020 21:33:15 +0000 (07:33 +1000)]
Add additional clashing_extern_decl cases.

3 years agoImprove E0730 explanation
Guillaume Gomez [Thu, 30 Jul 2020 11:51:22 +0000 (13:51 +0200)]
Improve E0730 explanation

3 years agoAuto merge of #74105 - npmccallum:naked, r=matthewjasper
bors [Thu, 30 Jul 2020 10:58:59 +0000 (10:58 +0000)]
Auto merge of #74105 - npmccallum:naked, r=matthewjasper

Suppress debuginfo on naked function arguments

A function that has no prologue cannot be reasonably expected to support
debuginfo. In fact, the existing code (before this patch) would generate
invalid instructions that caused crashes. We can solve this easily by
just not emitting the debuginfo in this case.

Fixes https://github.com/rust-lang/rust/issues/42779
cc https://github.com/rust-lang/rust/issues/32408

3 years agoFix ui tests
Gary Guo [Thu, 30 Jul 2020 05:34:16 +0000 (06:34 +0100)]
Fix ui tests

3 years agoImprove diagnostics when constant pattern is too generic
Gary Guo [Thu, 30 Jul 2020 05:17:18 +0000 (06:17 +0100)]
Improve diagnostics when constant pattern is too generic

3 years agoAuto merge of #74876 - oli-obk:lumberjack_disable, r=RalfJung
bors [Thu, 30 Jul 2020 03:54:05 +0000 (03:54 +0000)]
Auto merge of #74876 - oli-obk:lumberjack_disable, r=RalfJung

Replace all uses of `log::log_enabled` with `Debug` printers

cc @RalfJung this touches a bunch of logging in the miri engine. There are some visual changes, mainly that in several cases we stop prepending lines with the module path and just have a newline.

3 years agoTest `{align,size}_of_val` in a const context
Dylan MacKenzie [Wed, 29 Jul 2020 21:58:06 +0000 (14:58 -0700)]
Test `{align,size}_of_val` in a const context

3 years agoAuto merge of #74923 - ehuss:update-cargo, r=Mark-Simulacrum
bors [Thu, 30 Jul 2020 02:05:48 +0000 (02:05 +0000)]
Auto merge of #74923 - ehuss:update-cargo, r=Mark-Simulacrum

Update cargo

14 commits in aa6872140ab0fa10f641ab0b981d5330d419e927..974eb438da8ced6e3becda2bbf63d9b643eacdeb
2020-07-23 13:46:27 +0000 to 2020-07-29 16:15:05 +0000
- Fix O0 build scripts by default without `[profile.release]` (rust-lang/cargo#8560)
- Emphasize git dependency version locking behavior. (rust-lang/cargo#8561)
- Update lock file encodings on changes (rust-lang/cargo#8554)
- Fix sporadic lto test failures. (rust-lang/cargo#8559)
- build-std: Fix libraries paths following upstream (rust-lang/cargo#8558)
- Flag git http errors as maybe spurious (rust-lang/cargo#8553)
- Display builtin aliases with `cargo --list` (rust-lang/cargo#8542)
- Check manifest for requiring nonexistent features (rust-lang/cargo#7950)
- Clarify test name filter usage (rust-lang/cargo#8552)
- Revert Cargo Book changes for default edition (rust-lang/cargo#8551)
- Prepare for not defaulting to master branch for git deps (rust-lang/cargo#8522)
- Include `+` for crates.io feature requirements in the Cargo Book section on features (rust-lang/cargo#8547)
- Update termcolor and fwdansi versions (rust-lang/cargo#8540)
- Cargo book nitpick in Manifest section (rust-lang/cargo#8543)

3 years agoAuto merge of #74929 - Manishearth:rollup-z2vflrp, r=Manishearth
bors [Thu, 30 Jul 2020 00:17:51 +0000 (00:17 +0000)]
Auto merge of #74929 - Manishearth:rollup-z2vflrp, r=Manishearth

Rollup of 10 pull requests

Successful merges:

 - #74742 (Remove links to rejected errata 4406 for RFC 4291)
 - #74819 (Point towards `format_spec`; it is in other direction)
 - #74852 (Explain why inlining default ToString impl)
 - #74869 (Make closures and generators a must use types)
 - #74873 (symbol mangling: use ty::print::Print for consts)
 - #74902 (Remove deprecated unstable `{Box,Rc,Arc}::into_raw_non_null` functions)
 - #74904 (Fix some typos in src/librustdoc/clean/auto_trait.rs)
 - #74910 (fence docs: fix example Mutex)
 - #74912 (Fix broken link in unstable book `plugin`)
 - #74927 (Change the target data layout to specify more values)

Failed merges:

r? @ghost

3 years agoMake `{align,size}_of_val` `const`
Dylan MacKenzie [Wed, 29 Jul 2020 21:56:58 +0000 (14:56 -0700)]
Make `{align,size}_of_val` `const`

3 years agoRollup merge of #74927 - Lokathor:Lokathor-patch-1, r=jonas-schievink
Manish Goregaokar [Wed, 29 Jul 2020 23:38:34 +0000 (16:38 -0700)]
Rollup merge of #74927 - Lokathor:Lokathor-patch-1, r=jonas-schievink

Change the target data layout to specify more values

This does not actually alter the previously specified important parts, but apparently `rustc` cares about more layout components than `cargo-xbuild` ever did. This extends the data layout to be a fully specified layout, as given in the error from issue #74767

* Closes https://github.com/rust-lang/rust/issues/74767

3 years agoRollup merge of #74912 - giraffate:fix_broken_link_in_unstable_plugin_book, r=jonas...
Manish Goregaokar [Wed, 29 Jul 2020 23:38:33 +0000 (16:38 -0700)]
Rollup merge of #74912 - giraffate:fix_broken_link_in_unstable_plugin_book, r=jonas-schievink

Fix broken link in unstable book `plugin`

There is broken link in https://doc.rust-lang.org/unstable-book/language-features/plugin.html#lint-plugins.

3 years agoRollup merge of #74910 - RalfJung:fence, r=Mark-Simulacrum
Manish Goregaokar [Wed, 29 Jul 2020 23:38:31 +0000 (16:38 -0700)]
Rollup merge of #74910 - RalfJung:fence, r=Mark-Simulacrum

fence docs: fix example Mutex

Fixes https://github.com/rust-lang/rust/issues/74808

Cc @pca006132

3 years agoRollup merge of #74904 - joshtriplett:typo-fix, r=jonas-schievink
Manish Goregaokar [Wed, 29 Jul 2020 23:38:29 +0000 (16:38 -0700)]
Rollup merge of #74904 - joshtriplett:typo-fix, r=jonas-schievink

Fix some typos in src/librustdoc/clean/auto_trait.rs

3 years agoRollup merge of #74902 - rust-lang:into_raw_non_null, r=dtolnay
Manish Goregaokar [Wed, 29 Jul 2020 23:38:28 +0000 (16:38 -0700)]
Rollup merge of #74902 - rust-lang:into_raw_non_null, r=dtolnay

Remove deprecated unstable `{Box,Rc,Arc}::into_raw_non_null` functions

FCP: https://github.com/rust-lang/rust/issues/47336#issuecomment-619369613

3 years agoRollup merge of #74873 - lcnr:const-print, r=eddyb
Manish Goregaokar [Wed, 29 Jul 2020 23:38:26 +0000 (16:38 -0700)]
Rollup merge of #74873 - lcnr:const-print, r=eddyb

symbol mangling: use ty::print::Print for consts

r? @eddyb

3 years agoRollup merge of #74869 - tmiasko:must-use-closures, r=ecstatic-morse
Manish Goregaokar [Wed, 29 Jul 2020 23:38:24 +0000 (16:38 -0700)]
Rollup merge of #74869 - tmiasko:must-use-closures, r=ecstatic-morse

Make closures and generators a must use types

Warn about unused expressions with closure or generator type. This follows
existing precedence of must use annotations present on `FnOnce`, `FnMut`, `Fn`
traits, which already indirectly apply to closures in some cases, e.g.,:

```rust
fn f() -> impl FnOnce() {
    || {}
}

fn main() {
    // an existing warning: unused implementer of `std::ops::FnOnce` that must be used:
    f();

    // a new warning: unused closure that must be used:
    || {};
}
```

Closes #74691.

3 years agoRollup merge of #74852 - lzutao:inline-rm-tostring, r=nnethercote
Manish Goregaokar [Wed, 29 Jul 2020 23:38:22 +0000 (16:38 -0700)]
Rollup merge of #74852 - lzutao:inline-rm-tostring, r=nnethercote

Explain why inlining default ToString impl

Trying to remove inline attribute from default ToString impl causes regression.
Perf result at <https://github.com/rust-lang/rust/pull/74852#issuecomment-664812994>.

3 years agoRollup merge of #74819 - tmiasko:format-spec, r=joshtriplett
Manish Goregaokar [Wed, 29 Jul 2020 23:38:20 +0000 (16:38 -0700)]
Rollup merge of #74819 - tmiasko:format-spec, r=joshtriplett

Point towards `format_spec`; it is in other direction

3 years agoRollup merge of #74742 - poliorcetics:ip-addr-remove-rejected-errata, r=nikomatsakis
Manish Goregaokar [Wed, 29 Jul 2020 23:38:19 +0000 (16:38 -0700)]
Rollup merge of #74742 - poliorcetics:ip-addr-remove-rejected-errata, r=nikomatsakis

Remove links to rejected errata 4406 for RFC 4291

Fixes #74198.

For now I simply removed the links, the docs seems clear enough to me but I'm no expert in the domain so don't hesitate to correct me if more is needed.

cc @ghanan94.

@rustbot modify labels: T-doc, T-libs

3 years agoChange the target data layout to specify more values
Lokathor [Wed, 29 Jul 2020 22:26:09 +0000 (16:26 -0600)]
Change the target data layout to specify more values

This does not actually alter the previously specified important parts, but apparently `rustc` cares about more layout components than `cargo-xbuild` ever did. This extends the data layout to be fully specified layout, as given in the error from issue #74767

3 years agoAuto merge of #73767 - P1n3appl3:rustdoc-formats, r=tmandry
bors [Wed, 29 Jul 2020 22:24:46 +0000 (22:24 +0000)]
Auto merge of #73767 - P1n3appl3:rustdoc-formats, r=tmandry

Refactor librustdoc html backend

This PR moves several types out of the librustdoc::html module so that they can be used by a future json backend. These changes are a re-implementation of [some work done 6 months ago](https://github.com/rust-lang/rust/compare/master...GuillaumeGomez:multiple-output-formats) by @GuillaumeGomez. I'm currently working on said json backend and will put up an RFC soon with the proposed implementation.

There are a couple of changes that are more substantial than relocating structs to a different module:
1. The `Cache` is no longer part of the `html::render::Context` type and therefor it needs to be explicitly passed to any functions that access it.
2. The driving function `html::render::run` has been rewritten to use the `FormatRenderer` trait which should allow different backends to re-use the driving code.

r? @GuillaumeGomez

cc @tmandry @betamos

3 years agoRegister renamed lint
Manish Goregaokar [Wed, 29 Jul 2020 22:23:07 +0000 (15:23 -0700)]
Register renamed lint

3 years agoRename usage of intra_doc_link_resolution_failure
Manish Goregaokar [Wed, 29 Jul 2020 22:21:26 +0000 (15:21 -0700)]
Rename usage of intra_doc_link_resolution_failure

3 years agoRename intra_doc_link_resolution_failure -> intra_doc_link_resolution_failures
Manish Goregaokar [Wed, 29 Jul 2020 22:22:13 +0000 (15:22 -0700)]
Rename intra_doc_link_resolution_failure -> intra_doc_link_resolution_failures

3 years agoPass by value
Joseph Ryan [Wed, 29 Jul 2020 21:48:22 +0000 (16:48 -0500)]
Pass by value

3 years agoRefactor DocFS to fix error handling bugs
Joseph Ryan [Wed, 29 Jul 2020 21:15:31 +0000 (16:15 -0500)]
Refactor DocFS to fix error handling bugs

3 years agoAuto merge of #74733 - richkadel:llvm-coverage-map-gen-5, r=tmandry
bors [Wed, 29 Jul 2020 20:35:52 +0000 (20:35 +0000)]
Auto merge of #74733 - richkadel:llvm-coverage-map-gen-5, r=tmandry

Fixed coverage map issues; better aligned with LLVM APIs

Found some problems with the coverage map encoding when testing with more than one counter per function.

While debugging, I realized some better ways to structure the Rust implementation of the coverage mapping generator. I refactored somewhat, resulting in less code overall, expanded coverage of LLVM Coverage Map capabilities, and much closer alignment with LLVM data structures, APIs, and naming.

This should be easier to follow and easier to maintain.

r? @tmandry

Rust compiler MCP rust-lang/compiler-team#278
Relevant issue: #34701 - Implement support for LLVMs code coverage instrumentation

3 years agoUpdate cargo
Eric Huss [Wed, 29 Jul 2020 18:02:05 +0000 (11:02 -0700)]
Update cargo

3 years agoAuto merge of #74837 - xldenis:mir-dump-crate-file, r=oli-obk
bors [Wed, 29 Jul 2020 17:50:30 +0000 (17:50 +0000)]
Auto merge of #74837 - xldenis:mir-dump-crate-file, r=oli-obk

Fix #70767

This PR changes the format of MIR dump filenames to include the crate name rather than `rustc` at the start.

As a result, we can now place mir-opt tests in the same directory as the source files, like with UI tests. I had to make sure that `compiletest` added a bit_width suffix to the expected files when appropriate but otherwise the change is only moving the files to the correct location and ensuring that the `EMIT_MIR` lines are correct.

Fixes #70767
cc @oli-obk

3 years agoAuto merge of #72488 - KodrAus:stabilize/const_type_id, r=nikomatsakis
bors [Wed, 29 Jul 2020 15:58:32 +0000 (15:58 +0000)]
Auto merge of #72488 - KodrAus:stabilize/const_type_id, r=nikomatsakis

Stabilize const_type_id feature

The tracking issue for `const_type_id` points to the ill-fated #41875. So I'm re-energizing `TypeId` shenanigans by opening this one up to see if there's anything blocking us from stabilizing the constification of type ids.

Will wait for CI before pinging teams/groups.

-----

This PR stabilizes the `const_type_id` feature, which allows `TypeId::of` (and the underlying unstable intrinsic) to be called in constant contexts.

There are some [sanity tests](https://github.com/rust-lang/rust/blob/master/src/test/ui/consts/const-typeid-of-rpass.rs) that demonstrate its usage, but I’ve included some more below.

As a simple example, you could create a constant item that contains some type ids:

```rust
use std::any::TypeId;

const TYPE_IDS: [TypeId; 2] = [
    TypeId::of::<u32>(),
    TypeId::of::<i32>(),
];

assert_eq!(TypeId::of::<u32>(), TYPE_IDS[0]);
```

Type ids can also now appear in associated constants. You could create a trait that associates each type with its constant type id:

```rust
trait Any where Self: 'static {
    const TYPE_ID: TypeId = TypeId::of::<Self>();
}

impl<T: 'static> Any for T { }

assert_eq!(TypeId::of::<usize>(), usize::TYPE_ID);
```

`TypeId::of` is generic, which we saw above in the way the generic `Self` argument was used. This has some implications for const evaluation. It means we can make trait impls evaluate differently depending on information that wasn't directly passed through the trait system. This violates the _parametricity_ property, which requires all instances of a generic function to behave the same way with respect to its generic parameters. That's not unique to `TypeId::of`, other generic const functions based on compiler intrinsics like `mem::align_of` can also violate parametricity. In practice Rust doesn't really have type parametricity anyway since it monomorphizes generics into concrete functions, so violating it using type ids isn’t new.

As an example of how impls can behave differently, you could combine constant type ids with the `const_if_match` feature to dispatch calls based on the type id of the generic `Self`, rather than based on information about `Self` that was threaded through trait bounds. It's like a rough-and-ready form of specialization:

```rust
#![feature(const_if_match)]

trait Specialized where Self: 'static {
    // An associated constant that determines the function to call
    // at compile-time based on `TypeId::of::<Self>`.
    const CALL: fn(&Self) = {
        const USIZE: TypeId = TypeId::of::<usize>();

        match TypeId::of::<Self>() {
            // Use a closure for `usize` that transmutes the generic `Self` to
            // a concrete `usize` and dispatches to `Self::usize`.
            USIZE => |x| Self::usize(unsafe { &*(x as *const Self as *const usize) }),
            // For other types, dispatch to the generic `Self::default`.
            _ => Self::default,
        }
    };

    fn call(&self) {
        // Call the function we determined at compile-time
        (Self::CALL)(self)
    }

    fn default(x: &Self);
    fn usize(x: &usize);
}

// Implement our `Specialized` trait for any `Debug` type.
impl<T: fmt::Debug + 'static> Specialized for T {
    fn default(x: &Self) {
        println!("default: {:?}", x);
    }

    fn usize(x: &usize) {
        println!("usize: {:?}", x);
    }
}

// Will print "usize: 42"
Specialized::call(&42usize);

// Will print "default: ()"
Specialized::call(&());
```

Type ids have some edges that this stabilization exposes to more contexts. It's possible for type ids to collide (but this is a bug). Since they can change between compiler versions, it's never valid to cast a type id to its underlying value.

3 years agoMove mir-opt tests to toplevel
Xavier Denis [Tue, 28 Jul 2020 13:22:21 +0000 (15:22 +0200)]
Move mir-opt tests to toplevel

3 years agoMoved structs/enums with repr(C) to LLVM types into ffi.rs crates
Rich Kadel [Wed, 29 Jul 2020 06:09:16 +0000 (23:09 -0700)]
Moved structs/enums with repr(C) to LLVM types into ffi.rs crates

Some were in librustc_codegen_llvm, but others are not tied to LLVM, so
I put them in a new crate: librustc_codegen_ssa/coverageinfo/ffi.rs

3 years agoFix broken link in unstable book `plugin`
Takayuki Nakata [Wed, 29 Jul 2020 14:21:56 +0000 (23:21 +0900)]
Fix broken link in unstable book `plugin`

3 years agoAuto merge of #72049 - mati865:mingw-lld, r=petrochenkov
bors [Wed, 29 Jul 2020 13:58:19 +0000 (13:58 +0000)]
Auto merge of #72049 - mati865:mingw-lld, r=petrochenkov

MinGW: enable dllexport/dllimport

Fixes (only when using LLD) https://github.com/rust-lang/rust/issues/50176
Fixes https://github.com/rust-lang/rust/issues/72319

This makes `windows-gnu` on pair with `windows-msvc` when it comes to symbol exporting.
For MinGW it means both good things like correctly working dllimport/dllexport, ability to link with LLD and bad things like https://github.com/rust-lang/rust/issues/27438.

Not sure but maybe this should land behind unstable compiler option (`-Z`) or environment variable?

3 years agofence docs: fix example Mutex
Ralf Jung [Wed, 29 Jul 2020 13:44:19 +0000 (15:44 +0200)]
fence docs: fix example Mutex

3 years agoAdd test for #50176
Mateusz Mikuła [Fri, 3 Jul 2020 19:00:14 +0000 (21:00 +0200)]
Add test for #50176

3 years agoMinGW: emit dllexport/dllimport by rustc
Mateusz Mikuła [Thu, 7 May 2020 09:52:21 +0000 (11:52 +0200)]
MinGW: emit dllexport/dllimport by rustc

This fixes various cases where LD could not guess dllexport correctly and greatly improves compatibility with LLD which is not going to support linker scripts anytime soon

3 years agoClean up E0740 explanation
Guillaume Gomez [Wed, 29 Jul 2020 12:06:29 +0000 (14:06 +0200)]
Clean up E0740 explanation

3 years agoadd crate name to mir dumps
Xavier Denis [Mon, 27 Jul 2020 19:22:43 +0000 (21:22 +0200)]
add crate name to mir dumps

3 years agoAuto merge of #74900 - tmiasko:doc-open, r=Mark-Simulacrum
bors [Wed, 29 Jul 2020 11:19:36 +0000 (11:19 +0000)]
Auto merge of #74900 - tmiasko:doc-open, r=Mark-Simulacrum

Fix opening docs for std crates with ./x.py doc --open library/*

The directories for core, alloc, std, proc_macro, and test crates now
correspond directly to the crate name, and stripping the "lib" prefix is
no longer necessary.

3 years agoAvoid bool-like naming
Lzu Tao [Wed, 29 Jul 2020 10:48:00 +0000 (10:48 +0000)]
Avoid bool-like naming

3 years agoFix opening docs for std crates with ./x.py doc --open library/*
Tomasz Miąsko [Wed, 29 Jul 2020 00:00:00 +0000 (00:00 +0000)]
Fix opening docs for std crates with ./x.py doc --open library/*

The directories for core, alloc, std, proc_macro, and test crates now
correspond directly to the crate name and stripping the "lib" prefix is
no longer necessary.

3 years agoFix some typos in src/librustdoc/clean/auto_trait.rs
Josh Triplett [Wed, 29 Jul 2020 10:25:38 +0000 (03:25 -0700)]
Fix some typos in src/librustdoc/clean/auto_trait.rs

3 years agoAddress review comments
Oliver Scherer [Wed, 29 Jul 2020 09:37:33 +0000 (11:37 +0200)]
Address review comments

3 years agoRemove deprecated unstable `{Box,Rc,Arc}::into_raw_non_null` functions
Simon Sapin [Wed, 29 Jul 2020 08:57:16 +0000 (10:57 +0200)]
Remove deprecated unstable `{Box,Rc,Arc}::into_raw_non_null` functions

FCP: https://github.com/rust-lang/rust/issues/47336#issuecomment-619369613

3 years agoAuto merge of #74896 - imbolc:patch-1, r=kennytm
bors [Wed, 29 Jul 2020 08:52:01 +0000 (08:52 +0000)]
Auto merge of #74896 - imbolc:patch-1, r=kennytm

Update `fs::remove_file` docs

Mention that absence of file causes an error

3 years agoLink to syntax section when referencing it
Tomasz Miąsko [Mon, 27 Jul 2020 00:00:00 +0000 (00:00 +0000)]
Link to syntax section when referencing it

3 years agoExplain why inline default ToString impl
Lzu Tao [Wed, 29 Jul 2020 07:38:06 +0000 (07:38 +0000)]
Explain why inline default ToString impl

3 years agoUpdate `fs::remove_file` docs
Imbolc [Wed, 29 Jul 2020 05:18:01 +0000 (08:18 +0300)]
Update `fs::remove_file` docs

Mention that absence of file causes an error

3 years agoAuto merge of #74887 - Mark-Simulacrum:cache-non-exhaustive, r=petrochenkov
bors [Wed, 29 Jul 2020 04:59:37 +0000 (04:59 +0000)]
Auto merge of #74887 - Mark-Simulacrum:cache-non-exhaustive, r=petrochenkov

Cache non-exhaustive separately from attributes

This prevents cross-crate attribute loading from metadata just for non_exhaustive checking; cross-crate attribute loading implies disk reading and is relatively slow.

3 years agoAuto merge of #74894 - JohnTitor:rollup-4ine62a, r=JohnTitor
bors [Wed, 29 Jul 2020 01:38:00 +0000 (01:38 +0000)]
Auto merge of #74894 - JohnTitor:rollup-4ine62a, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #74266 (Clean up E0720 explanation)
 - #74671 (add const generics array coercion test)
 - #74707 (Add str::[r]split_once)
 - #74814 (Fix RefUnwindSafe & UnwinsSafe impls for lazy::SyncLazy)
 - #74859 (Update outdated readme)
 - #74864 (ayu theme: Change doccomment color to `#a1ac88`)
 - #74872 (Enable to ping RISC-V group via triagebot)
 - #74891 (handle ConstEquate in rustdoc)

Failed merges:

r? @ghost

3 years agoFunctionCoverage: improve type checking with newtype_index types
Rich Kadel [Wed, 29 Jul 2020 00:45:58 +0000 (17:45 -0700)]
FunctionCoverage: improve type checking with newtype_index types

3 years agoRollup merge of #74891 - lcnr:auto-trait-finder, r=varkor
Yuki Okushi [Wed, 29 Jul 2020 00:24:25 +0000 (09:24 +0900)]
Rollup merge of #74891 - lcnr:auto-trait-finder, r=varkor

handle ConstEquate in rustdoc

fixes #74882

r? @varkor cc @eddyb

3 years agoRollup merge of #74872 - JohnTitor:ping-risc-v, r=Mark-Simulacrum
Yuki Okushi [Wed, 29 Jul 2020 00:24:24 +0000 (09:24 +0900)]
Rollup merge of #74872 - JohnTitor:ping-risc-v, r=Mark-Simulacrum

Enable to ping RISC-V group via triagebot

We have the RISC-V group (https://github.com/rust-lang/team/blob/master/teams/risc-v.toml) but don't enable to ping on this repository (https://github.com/rust-lang/rust/pull/74813#issuecomment-664841177).
We don't have the instructions on the rustc-dev-guide yet but I'll create it soonish.

3 years agoRollup merge of #74864 - lzutao:ayu-doccolor, r=GuillaumeGomez
Yuki Okushi [Wed, 29 Jul 2020 00:24:22 +0000 (09:24 +0900)]
Rollup merge of #74864 - lzutao:ayu-doccolor, r=GuillaumeGomez

ayu theme: Change doccomment color to `#a1ac88`

Before:
![image](https://user-images.githubusercontent.com/15225902/88621499-d1cbff80-d0ca-11ea-99c3-5e2632709274.png)

After:
![image](https://user-images.githubusercontent.com/15225902/88621471-bf51c600-d0ca-11ea-9455-9c297f50f15f.png)

Close #74788

3 years agoRollup merge of #74859 - mark-i-m:patch-1, r=JohnTitor
Yuki Okushi [Wed, 29 Jul 2020 00:24:20 +0000 (09:24 +0900)]
Rollup merge of #74859 - mark-i-m:patch-1, r=JohnTitor

Update outdated readme

3 years agoRollup merge of #74814 - matklad:unwind-safe, r=KodrAus
Yuki Okushi [Wed, 29 Jul 2020 00:24:19 +0000 (09:24 +0900)]
Rollup merge of #74814 - matklad:unwind-safe, r=KodrAus

Fix RefUnwindSafe & UnwinsSafe impls for lazy::SyncLazy

I *think* we should implement those unconditionally with respect to `F`.

The user code can't observe the closure in any way, and we poison lazy if the closure itself panics.

But I've never fully wrapped my head around `UnwindSafe` traits, so :man_shrugging: