]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #73304 - dtolnay:socketeq, r=Mark-Simulacrum
Ralf Jung [Mon, 15 Jun 2020 10:01:13 +0000 (12:01 +0200)]
Rollup merge of #73304 - dtolnay:socketeq, r=Mark-Simulacrum

Revert heterogeneous SocketAddr PartialEq impls

Originally added in #72239.

These lead to inference regressions (mostly in tests) in code that looks like:

```rust
let socket = SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 8080);
assert_eq!(socket, "127.0.0.1:8080".parse().unwrap());
```

That compiles as of stable 1.44.0 but fails in beta with:

```console
error[E0284]: type annotations needed
 --> src/main.rs:3:41
  |
3 |     assert_eq!(socket, "127.0.0.1:8080".parse().unwrap());
  |                                         ^^^^^ cannot infer type for type parameter `F` declared on the associated function `parse`
  |
  = note: cannot satisfy `<_ as std::str::FromStr>::Err == _`
help: consider specifying the type argument in the method call
  |
3 |     assert_eq!(socket, "127.0.0.1:8080".parse::<F>().unwrap());
  |
```

Closes #73242.

4 years agoRollup merge of #73296 - ehuss:remove-msvc-aux, r=Mark-Simulacrum
Ralf Jung [Mon, 15 Jun 2020 10:01:11 +0000 (12:01 +0200)]
Rollup merge of #73296 - ehuss:remove-msvc-aux, r=Mark-Simulacrum

Remove vestigial CI job msvc-aux.

This CI job isn't really doing anything, so it seems prudent to remove it.

For some history:
* This was introduced in #48809 when the msvc job was split in two to keep it under 2 hours (oh the good old days). At the time, this check-aux job did a bunch of things:
    * tidy
    * src/test/pretty
    * src/test/run-pass/pretty
    * src/test/run-fail/pretty
    * src/test/run-pass-valgrind/pretty
    * src/test/run-pass-fulldeps/pretty
    * src/test/run-fail-fulldeps/pretty
* Tidy was removed in #60777.
* run-pass and run-pass-fulldeps moved to UI in #63029
* src/test/pretty removed in #58140
* src/test/run-fail moved to UI in #71185
* run-fail-fulldeps removed in #51285

Over time through attrition, the job was left with one lonely thing: `src/test/run-pass-valgrind/pretty`. And of course, this wasn't actually running the "pretty" tests. The normal `run-pass-valgrind` tests ran, and then when it tried to run in "pretty" mode, all the tests were ignored because compiletest thought nothing had changed (apparently compiletest isn't fingerprinting the mode?  Needs more investigation…). `run-pass-valgrind` is already being run as part of `x86_64-msvc-1`, so there's no need to run it here.

I've taken the liberty of removing `src/test/run-pass-valgrind/pretty` as a distinct test. I'm guessing from the other PR's that the pretty tests should now live in `src/test/pretty`, and that the team has moved away from doing pretty tests on other parts of the `src/test` tree.

4 years agoRollup merge of #73139 - poliorcetics:cstring-from-vec-with-nul, r=dtolnay
Ralf Jung [Mon, 15 Jun 2020 10:01:09 +0000 (12:01 +0200)]
Rollup merge of #73139 - poliorcetics:cstring-from-vec-with-nul, r=dtolnay

Add methods to go from a nul-terminated Vec<u8> to a CString

Fixes #73100.

Doc tests have been written and the documentation on the error type
updated too.

I used `#[stable(feature = "cstring_from_vec_with_nul", since = "1.46.0")]` but I don't know if the version is correct.

4 years agoRollup merge of #73104 - poliorcetics:explicit-mutex-drop-example, r=dtolnay
Ralf Jung [Mon, 15 Jun 2020 10:01:07 +0000 (12:01 +0200)]
Rollup merge of #73104 - poliorcetics:explicit-mutex-drop-example, r=dtolnay

Example about explicit mutex dropping

Fixes #67457.

Following the remarks made in #73074, I added an example on the main `Mutex` type, with a situation where there is mutable data and a computation result.

In my testing it is effectively needed to explicitly drop the lock, else it deadlocks.

r? @dtolnay because you were the one to review the previous PR.

4 years agoRollup merge of #73086 - trevyn:apple-a7, r=nikic
Ralf Jung [Mon, 15 Jun 2020 10:01:05 +0000 (12:01 +0200)]
Rollup merge of #73086 - trevyn:apple-a7, r=nikic

Rename "cyclone" to "apple-a7" per changes in upstream LLVM

It looks like they intended to keep "cyclone" as a legacy option, but removed it from the list of subtarget features. This created a flood of warnings when targeting aarch64-apple-ios, and probably also created incorrectly optimized artifacts.

See:
https://reviews.llvm.org/D70779
https://reviews.llvm.org/D70779#C1703593NL568

LLVM 10 merged into master at:
https://github.com/rust-lang/rust/pull/67759

4 years agoRollup merge of #72938 - lzutao:stabilize_option_zip, r=dtolnay
Ralf Jung [Mon, 15 Jun 2020 10:01:03 +0000 (12:01 +0200)]
Rollup merge of #72938 - lzutao:stabilize_option_zip, r=dtolnay

Stabilize Option::zip

This PR stabilizes the following API:

```rust
impl<T> Option<T> {
    pub fn zip<U>(self, other: Option<U>) -> Option<(T, U)>;
}
```

This API has real world usage as seen in <https://grep.app/search?q=-%3E%20Option%3C%5C%28T%2C%5Cs%3FU%5C%29%3E&regexp=true&filter[lang][0]=Rust>.

The `zip_with` method is left unstably as this API is kinda niche
and it hasn't received much usage in Rust repositories on GitHub.

cc #70086

4 years agoRollup merge of #72879 - RalfJung:miri-tctx-at, r=oli-obk
Ralf Jung [Mon, 15 Jun 2020 10:01:01 +0000 (12:01 +0200)]
Rollup merge of #72879 - RalfJung:miri-tctx-at, r=oli-obk

Miri: avoid tracking current location three times

Miri tracks the current instruction to execute in the call stack, but it also additionally has two `TyCtxtAt` that carry a `Span` that also tracks the current instruction. That is quite silly, so this PR uses `TyCtxt` instead, and then uses a method for computing the current span when a `TyCtxtAt` is needed. Having less redundant (semi-)global state seems like a good improvement to me. :D

To keep the ConstProp errors the same, I had to add the option to `error_to_const_error` to overwrite the span. Also for some reason this changes cycle errors a bit -- not sure if we are now better or worse as giving those queries the right span. (It is unfortunately quite easy to accidentally use `DUMMY_SP` by calling the query on a `TyCtxt` instead of a `TyCtxtAt`.)

r? @oli-obk @eddyb

4 years agoRollup merge of #72740 - estebank:recursive-indirection, r=matthewjasper
Ralf Jung [Mon, 15 Jun 2020 10:00:59 +0000 (12:00 +0200)]
Rollup merge of #72740 - estebank:recursive-indirection, r=matthewjasper

On recursive ADT, provide indirection structured suggestion

4 years agoRollup merge of #72707 - matthewjasper:rustc_min_spec, r=oli-obk
Ralf Jung [Mon, 15 Jun 2020 10:00:58 +0000 (12:00 +0200)]
Rollup merge of #72707 - matthewjasper:rustc_min_spec, r=oli-obk

Use min_specialization in the remaining rustc crates

This adds a lot of `transmute` calls to replace the unsound uses of specialization.
It's ugly, but at least it's honest about what's going on.

cc #71420, @RalfJung

4 years agoAuto merge of #72080 - matthewjasper:uniform-impl-trait, r=nikomatsakis
bors [Mon, 15 Jun 2020 04:10:24 +0000 (04:10 +0000)]
Auto merge of #72080 - matthewjasper:uniform-impl-trait, r=nikomatsakis

Clean up type alias impl trait implementation

- Removes special case for top-level impl trait
- Removes associated opaque types
- Forbid lifetime elision in let position impl trait. This is consistent with the behavior for inferred types.
- Handle lifetimes in type alias impl trait more uniformly with other parameters

cc #69323
cc #63063
Closes #57188
Closes #62988
Closes #69136
Closes #73061

4 years agoUpdate to use the new error type and correctly compile the doc tests
Alexis Bourget [Sun, 14 Jun 2020 21:22:36 +0000 (23:22 +0200)]
Update to use the new error type and correctly compile the doc tests

4 years agoAdd a new error type for the new method
Alexis Bourget [Sun, 14 Jun 2020 21:21:40 +0000 (23:21 +0200)]
Add a new error type for the new method

4 years agoRemoving the TryFrom impl
Alexis Bourget [Sun, 14 Jun 2020 17:21:44 +0000 (19:21 +0200)]
Removing the TryFrom impl

4 years agokeep root_span and tcx together
Ralf Jung [Sun, 14 Jun 2020 13:02:51 +0000 (15:02 +0200)]
keep root_span and tcx together

4 years agoAuto merge of #73089 - tmiasko:musl-1.1.24, r=kennytm
bors [Sun, 14 Jun 2020 10:37:36 +0000 (10:37 +0000)]
Auto merge of #73089 - tmiasko:musl-1.1.24, r=kennytm

Update musl to 1.1.24

Release notes since previous version 1.1.22:

## 1.1.23 release notes

### new features:
- riscv64 port
- configure now allows customizing AR and RANLIB vars
- header-level support for new linux features in 5.1

### major internal changes:
- removed extern __syscall; syscall header code is now fully self-contained

### performance:
- new math library implementation for log/exp/pow
- aarch64 dynamic tlsdesc function is streamlined

### compatibility & conformance:
- O_TTY_INIT is now defined
- sys/types.h no longer pollutes namespace with sys/sysmacros.h in any profile
- powerpc asm is now compatible with clang internal assembler

### changes for new POSIX interpretations:
- fgetwc now sets stream error indicator on encoding errors
- fmemopen no longer rejects 0 size

### bugs fixed:
- static TLS for shared libraries was allocated wrong on "Variant I" archs
- crash in dladdr reading through uninitialized pointer on non-match
- sigaltstack wrongly errored out on invalid ss_size when doing SS_DISABLE
- getdents function misbehaved with buffer length larger than INT_MAX
- set*id could deadlock after fork from multithreaded process

### arch-specfic bugs fixed:
- s390x SO_PEERSEC definition was wrong
- passing of 64-bit syscall arguments was broken on microblaze
- posix_fadvise was broken on mips due to missing 7-arg syscall support
- vrregset_t layout and member naming was wrong on powerpc64

## 1.1.24 release notes

### new features:
- GLOB_TILDE extension to glob
- non-stub catgets localization API, using netbsd binary catalog format
- posix_spawn file actions for [f]chdir (extension, pending future standard)
- secure_getenv function (extension)
- copy_file_range syscall wrapper (Linux extension)
- header-level support for new linux features in 5.2

### performance:
- new fast path for lrint (generic C version) on 32-bit archs

### major internal changes:
- functions involving time are overhauled to be time64-ready in 32-bit archs
- x32 uses the new time64 code paths to replace nasty hacks in syscall glue

### compatibility & conformance:
- support for powerpc[64] unaligned relocation types
- powerpc[64] and sh sys/user.h no longer clash with kernel asm/ptrace.h
- select no longer modifies timeout on failure (or at all)
- mips64 stat results are no longer limited to 32-bit time range
- optreset (BSD extension) now has a public declaration
- support for clang inconsistencies in wchar_t type vs some 32-bit archs
- mips r6 syscall asm no longer has invalid lo/hi register clobbers
- vestigial asm declarations of __tls_get_new are removed (broke some tooling)
- riscv64 mcontext_t mismatch glibc's member naming is corrected

### bugs fixed:
- glob failed to match broken symlinks consistently
- invalid use of interposed calloc to allocate initial TLS
- various dlsym symbol resolution logic errors
- semctl with SEM_STAT_ANY didn't work
- pthread_create with explicit scheduling was subject to priority inversion
- pthread_create failure path had data race for thread count
- timer_create with SIGEV_THREAD notification had data race getting timer id
- wide printf family failed to support l modifier for float formats

### arch-specific bugs fixed:
- x87 floating point stack imbalance in math asm (i386-only CVE-2019-14697)
- x32 clock_adjtime, getrusage, wait3, wait4 produced junk (struct mismatches)
- lseek broken on x32 and mipsn32 with large file offsets
- riscv64 atomics weren't compiler barriers
- riscv64 atomics had broken asm constraints (missing earlyclobber flag)
- arm clone() was broken when compiled as thumb if start function returned
- mipsr6 setjmp/longjmp did not preserve fpu register state correctly

Fixes #71099.

4 years agoAuto merge of #73232 - RalfJung:miri-no-default, r=Mark-Simulacrum
bors [Sun, 14 Jun 2020 06:42:40 +0000 (06:42 +0000)]
Auto merge of #73232 - RalfJung:miri-no-default, r=Mark-Simulacrum

x.py: do not build Miri by default on stable/beta

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

Do I need to do anything to make sure Miri is still built by the tools CI builder? Are there other tools that should be off-by-default?

Also, unfortunately the `DEFAULT` associated const has no doc comment, so I have no idea what it does, or why there are semmingly two places where the default build of tools is controlled.

4 years agoAuto merge of #73188 - mati865:use-preinstalled-msys2, r=pietroalbini
bors [Sun, 14 Jun 2020 03:10:53 +0000 (03:10 +0000)]
Auto merge of #73188 - mati865:use-preinstalled-msys2, r=pietroalbini

Use preinstalled msys2

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

4 years agoAdd test for comparing SocketAddr with inferred right-hand side
David Tolnay [Sat, 13 Jun 2020 17:21:11 +0000 (10:21 -0700)]
Add test for comparing SocketAddr with inferred right-hand side

4 years agoRewrap comments in Mutex example
David Tolnay [Sat, 13 Jun 2020 17:11:02 +0000 (10:11 -0700)]
Rewrap comments in Mutex example

4 years agoClarify the scope-related explanation
Poliorcetics [Sat, 13 Jun 2020 16:43:37 +0000 (18:43 +0200)]
Clarify the scope-related explanation

Based on the review made by dtolnay.

4 years agoApply suggestions from code review
Poliorcetics [Sat, 13 Jun 2020 16:41:01 +0000 (18:41 +0200)]
Apply suggestions from code review

Co-authored-by: David Tolnay <dtolnay@gmail.com>
4 years agoAuto merge of #73316 - Dylan-DPC:rollup-zgouwou, r=Dylan-DPC
bors [Sat, 13 Jun 2020 15:50:56 +0000 (15:50 +0000)]
Auto merge of #73316 - Dylan-DPC:rollup-zgouwou, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #72932 (Clarify the behaviour of Pattern when used with methods like str::contains)
 - #73066 (Querify whether a type has structural equality (Take 2))
 - #73194 (Prefer the associated constants for pattern matching error)
 - #73241 (Add/update comments about MinGW late_link_args)
 - #73267 (Use the built cargo for cargotest.)
 - #73290 (Fix links when pinging notification groups)
 - #73302 (Adjusted some doctests in libcore to use `should_panic`.)
 - #73308 (pretty/asm.rs should only be tested for x86_64 and not AArch64)

Failed merges:

r? @ghost

4 years agoRollup merge of #73308 - yerke:fix-pretty-asm-rs-test-for-aarch64, r=Amanieu
Dylan DPC [Sat, 13 Jun 2020 14:47:56 +0000 (16:47 +0200)]
Rollup merge of #73308 - yerke:fix-pretty-asm-rs-test-for-aarch64, r=Amanieu

pretty/asm.rs should only be tested for x86_64 and not AArch64

pretty/asm.rs should only be tested for x86_64 and not AArch64
closes #73134
r?  @Amanieu

4 years agoRollup merge of #73302 - JakobDegen:should-panic-documentation, r=Mark-Simulacrum
Dylan DPC [Sat, 13 Jun 2020 14:47:54 +0000 (16:47 +0200)]
Rollup merge of #73302 - JakobDegen:should-panic-documentation, r=Mark-Simulacrum

Adjusted some doctests in libcore to use `should_panic`.

Fixes #73196 .

I grepped libstd and libcore for all the instances of this pattern that I could find, but its possible that I missed some of course. If anyone knows of any more, please let me know and I will add them to the PR.

4 years agoRollup merge of #73290 - LeSeulArtichaut:patch-1, r=Dylan-DPC
Dylan DPC [Sat, 13 Jun 2020 14:47:53 +0000 (16:47 +0200)]
Rollup merge of #73290 - LeSeulArtichaut:patch-1, r=Dylan-DPC

Fix links when pinging notification groups

I think a blank line is necessary for the link to be applied.
Not sure who to assign, r? @Dylan-DPC

4 years agoRollup merge of #73267 - ehuss:cargotest-this-cargo, r=Mark-Simulacrum
Dylan DPC [Sat, 13 Jun 2020 14:47:51 +0000 (16:47 +0200)]
Rollup merge of #73267 - ehuss:cargotest-this-cargo, r=Mark-Simulacrum

Use the built cargo for cargotest.

cargotest was using the beta (bootstrap) cargo. This changes it so that it will use the locally built cargo. This is intended to provide a sort of smoke test to ensure Cargo is functional. This *shouldn't* have any real impact on the CI build time.  The cargotest job also happens to run cargo's testsuite, so it should already be building cargo.

Note: This will fail until #73266 is merged.

4 years agoRollup merge of #73241 - mati865:mingw-libs-order-comment, r=petrochenkov
Dylan DPC [Sat, 13 Jun 2020 14:47:49 +0000 (16:47 +0200)]
Rollup merge of #73241 - mati865:mingw-libs-order-comment, r=petrochenkov

Add/update comments about MinGW late_link_args

4 years agoRollup merge of #73194 - lzutao:INT-patterns, r=dtolnay
Dylan DPC [Sat, 13 Jun 2020 14:47:47 +0000 (16:47 +0200)]
Rollup merge of #73194 - lzutao:INT-patterns, r=dtolnay

Prefer the associated constants for pattern matching error

Resolved this comment: https://github.com/rust-lang/rust/issues/68490#issuecomment-641614383

4 years agoRollup merge of #73066 - ecstatic-morse:query-structural-eq2, r=pnkfelix
Dylan DPC [Sat, 13 Jun 2020 14:47:45 +0000 (16:47 +0200)]
Rollup merge of #73066 - ecstatic-morse:query-structural-eq2, r=pnkfelix

Querify whether a type has structural equality (Take 2)

Alternative to #72177.

Unlike in #72177, this helper method works for all types, falling back to a query for `TyKind::Adt`s that determines whether the `{Partial,}StructuralEq` traits are implemented.

This is my preferred interface for this method. I think this is better than just documenting that the helper only works for ADTs. If others disagree, we can just merge #72177 with the fixes applied. This has already taken far too long.

4 years agoRollup merge of #72932 - poliorcetics:pattern-contains-behaviour, r=hanna-kruppe
Dylan DPC [Sat, 13 Jun 2020 14:47:40 +0000 (16:47 +0200)]
Rollup merge of #72932 - poliorcetics:pattern-contains-behaviour, r=hanna-kruppe

Clarify the behaviour of Pattern when used with methods like str::contains

Fixes #45507.

I used the previous work by @Emerentius (thanks !), added a paragraph and checked the links (they work for me but I'm not against someone else checking them too).

4 years agoAdd/update comments about MinGW late_link_args
Mateusz Mikuła [Thu, 11 Jun 2020 15:22:30 +0000 (17:22 +0200)]
Add/update comments about MinGW late_link_args

4 years agorun const_eval_raw with root_span
Ralf Jung [Sat, 13 Jun 2020 11:55:01 +0000 (13:55 +0200)]
run const_eval_raw with root_span

4 years agoavoid computing precise span for const_eval query
Ralf Jung [Sat, 13 Jun 2020 11:47:37 +0000 (13:47 +0200)]
avoid computing precise span for const_eval query

4 years agopretty/asm.rs should only be tested for x86_64 and not AArch64
Yerkebulan Tulibergenov [Sat, 13 Jun 2020 07:41:39 +0000 (00:41 -0700)]
pretty/asm.rs should only be tested for x86_64 and not AArch64

4 years agoRevert heterogeneous SocketAddr PartialEq impls
David Tolnay [Sat, 13 Jun 2020 05:12:45 +0000 (22:12 -0700)]
Revert heterogeneous SocketAddr PartialEq impls

These lead to inference regressions (mostly in tests) in code that looks
like:

    let socket = std::net::SocketAddrV4::new(std::net::Ipv4Addr::new(127, 0, 0, 1), 8080);
    assert_eq!(socket, "127.0.0.1:8080".parse().unwrap());

That compiles as of stable 1.44.0 but fails in beta with:

    error[E0284]: type annotations needed
     --> src/main.rs:3:41
      |
    3 |     assert_eq!(socket, "127.0.0.1:8080".parse().unwrap());
      |                                         ^^^^^ cannot infer type for type parameter `F` declared on the associated function `parse`
      |
      = note: cannot satisfy `<_ as std::str::FromStr>::Err == _`
    help: consider specifying the type argument in the method call
      |
    3 |     assert_eq!(socket, "127.0.0.1:8080".parse::<F>().unwrap());
      |

4 years agoAdjusted some doctests in libcore to use `should_panic`.
Jake Degen [Sat, 13 Jun 2020 04:06:09 +0000 (00:06 -0400)]
Adjusted some doctests in libcore to use `should_panic`.

Previously, some doctests were spawning new threads and joining them to
indicate that a particular call should panic; this hurt readability, so
the tests have been adjusted to simply call the method and use the
`should_panic` marker.

4 years agoStabilize Option::zip
Lzu Tao [Sat, 13 Jun 2020 01:27:14 +0000 (01:27 +0000)]
Stabilize Option::zip

4 years agoPrefer the associated consts for pattern matching error
Lzu Tao [Thu, 11 Jun 2020 03:03:59 +0000 (03:03 +0000)]
Prefer the associated consts for pattern matching error

4 years agoAuto merge of #73277 - RalfJung:miri-caller-location, r=oli-obk
bors [Sat, 13 Jun 2020 00:55:34 +0000 (00:55 +0000)]
Auto merge of #73277 - RalfJung:miri-caller-location, r=oli-obk

fix caller_location intrinsic for Miri

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

r? @oli-obk Cc @Aaron1011

4 years agoRemove vestigial CI job msvc-aux.
Eric Huss [Fri, 12 Jun 2020 21:17:42 +0000 (14:17 -0700)]
Remove vestigial CI job msvc-aux.

4 years agoAuto merge of #73262 - wesleywiser:simplifyarmidentity_beta_regression, r=oli-obk
bors [Fri, 12 Jun 2020 19:38:15 +0000 (19:38 +0000)]
Auto merge of #73262 - wesleywiser:simplifyarmidentity_beta_regression, r=oli-obk

Disable the `SimplifyArmIdentity` pass

This pass is buggy so I'm disabling it to fix a stable-to-beta
regression.

Related to #73223

4 years agoFix links when pinging notification groups
LeSeulArtichaut [Fri, 12 Jun 2020 18:33:18 +0000 (20:33 +0200)]
Fix links when pinging notification groups

4 years agoMake `type_marked_structural` private
Dylan MacKenzie [Fri, 12 Jun 2020 15:47:26 +0000 (08:47 -0700)]
Make `type_marked_structural` private

4 years agoUse "reflexive equality" in docs
Dylan MacKenzie [Fri, 12 Jun 2020 15:47:13 +0000 (08:47 -0700)]
Use "reflexive equality" in docs

4 years agoHelper method for whether type has structural equality
Dylan MacKenzie [Wed, 13 May 2020 20:40:22 +0000 (13:40 -0700)]
Helper method for whether type has structural equality

This helper method works for all types, falling back to a query for
`TyKind::Adt`s to determine whether the implement the
`{Partial,}StructuralEq` traits.

4 years agoAuto merge of #73276 - Dylan-DPC:rollup-hfd81qw, r=Dylan-DPC
bors [Fri, 12 Jun 2020 13:10:57 +0000 (13:10 +0000)]
Auto merge of #73276 - Dylan-DPC:rollup-hfd81qw, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #72906 (Migrate to numeric associated consts)
 - #73178 (expand: More precise locations for expansion-time lints)
 - #73225 (Allow inference regions when relating consts)
 - #73236 (Clean up E0666 explanation)
 - #73273 (Fix Zulip pings)

Failed merges:

r? @ghost

4 years agoDisable the `SimplifyArmIdentity` pass on beta
Wesley Wiser [Fri, 12 Jun 2020 00:46:55 +0000 (20:46 -0400)]
Disable the `SimplifyArmIdentity` pass on beta

This pass is buggy so I'm disabling it to fix a stable-to-beta
regression.

Related to #73223

4 years agofix caller_location intrinsic for Miri
Ralf Jung [Fri, 12 Jun 2020 10:35:37 +0000 (12:35 +0200)]
fix caller_location intrinsic for Miri

4 years agoRollup merge of #73273 - LeSeulArtichaut:patch-1, r=Dylan-DPC
Dylan DPC [Fri, 12 Jun 2020 10:28:31 +0000 (12:28 +0200)]
Rollup merge of #73273 - LeSeulArtichaut:patch-1, r=Dylan-DPC

Fix Zulip pings

r? @Dylan-DPC

4 years agoRollup merge of #73236 - GuillaumeGomez:cleanup-e0666, r=Dylan-DPC
Dylan DPC [Fri, 12 Jun 2020 10:28:29 +0000 (12:28 +0200)]
Rollup merge of #73236 - GuillaumeGomez:cleanup-e0666, r=Dylan-DPC

Clean up E0666 explanation

r? @Dylan-DPC

4 years agoRollup merge of #73225 - tmandry:issue-73050, r=oli-obk
Dylan DPC [Fri, 12 Jun 2020 10:28:27 +0000 (12:28 +0200)]
Rollup merge of #73225 - tmandry:issue-73050, r=oli-obk

Allow inference regions when relating consts

As first noticed by @eddyb, `super_relate_consts` doesn't need to check for inference vars since `eval` does it already (and handles lifetimes correctly by erasing them).

Fixes #73050

r? @oli-obk

4 years agoRollup merge of #73178 - petrochenkov:explint, r=varkor
Dylan DPC [Fri, 12 Jun 2020 10:28:25 +0000 (12:28 +0200)]
Rollup merge of #73178 - petrochenkov:explint, r=varkor

expand: More precise locations for expansion-time lints

First commit: a macro expansion doesn't have a `NodeId` associated with it, but it has a parent `DefId` which we can use for linting.
The observable effect is that lints associated with macro expansions can now be `allow`ed at finer-grained level than whole crate.

Second commit: each macro definition has a `NodeId` which we can use for linting, unless that macro definition was decoded from other crate.

4 years agoRollup merge of #72906 - lzutao:migrate-numeric-assoc-consts, r=dtolnay
Dylan DPC [Fri, 12 Jun 2020 10:28:23 +0000 (12:28 +0200)]
Rollup merge of #72906 - lzutao:migrate-numeric-assoc-consts, r=dtolnay

Migrate to numeric associated consts

The deprecation PR is #72885

cc #68490
cc rust-lang/rfcs#2700

4 years agoFix Zulip pings
LeSeulArtichaut [Fri, 12 Jun 2020 08:40:41 +0000 (10:40 +0200)]
Fix Zulip pings

4 years agoavoid computing cur_span all the time
Ralf Jung [Thu, 11 Jun 2020 07:53:38 +0000 (09:53 +0200)]
avoid computing cur_span all the time

4 years agofix const_prop spans and re-bless tests
Ralf Jung [Mon, 1 Jun 2020 09:17:38 +0000 (11:17 +0200)]
fix const_prop spans and re-bless tests

4 years agomake miri InterpCx TyCtxtAt a TyCtxt, and separately remember the root span of the...
Ralf Jung [Mon, 1 Jun 2020 08:15:17 +0000 (10:15 +0200)]
make miri InterpCx TyCtxtAt a TyCtxt, and separately remember the root span of the evaluation

4 years agox.py: do not build Miri by default
Ralf Jung [Thu, 11 Jun 2020 07:25:06 +0000 (09:25 +0200)]
x.py: do not build Miri by default

4 years agomake miri memory TyCtxtAt a TyCtxt
Ralf Jung [Mon, 1 Jun 2020 06:42:40 +0000 (08:42 +0200)]
make miri memory TyCtxtAt a TyCtxt

4 years agoAuto merge of #73266 - ehuss:update-cargo, r=ehuss
bors [Fri, 12 Jun 2020 04:46:03 +0000 (04:46 +0000)]
Auto merge of #73266 - ehuss:update-cargo, r=ehuss

Update cargo

2 commits in 1ec223effbbbf9fddd3453cdcae3a96a967608eb..79c769c3d7b4c2cf6a93781575b7f592ef974255
2020-06-09 20:03:14 +0000 to 2020-06-11 22:13:37 +0000
- Fix failure with missing readme. (rust-lang/cargo#8353)
- Some LTO fixes. (rust-lang/cargo#8349)

4 years agoUpdate cargo
Eric Huss [Fri, 12 Jun 2020 01:47:27 +0000 (18:47 -0700)]
Update cargo

4 years agoAuto merge of #69478 - avr-rust:avr-support-upstream, r=jonas-schievink
bors [Fri, 12 Jun 2020 01:28:37 +0000 (01:28 +0000)]
Auto merge of #69478 - avr-rust:avr-support-upstream, r=jonas-schievink

Enable AVR as a Tier 3 target upstream

Tracking issue: #44052.

Things intentionally left out of the initial upstream:

* The `target_cpu` flag

I have made the cleanup suggestions by @jplatte and @jplatte in https://github.com/avr-rust/rust/commit/043550d9db0582add42e5837f636f61acb26b915.

Anybody feel free to give the branch a test and see how it fares, or make suggestions on the code patch itself.

4 years agoUse the built cargo for cargotest.
Eric Huss [Fri, 12 Jun 2020 01:28:13 +0000 (18:28 -0700)]
Use the built cargo for cargotest.

4 years agoAuto merge of #73259 - Dylan-DPC:rollup-m6nw1n0, r=Dylan-DPC
bors [Thu, 11 Jun 2020 22:08:01 +0000 (22:08 +0000)]
Auto merge of #73259 - Dylan-DPC:rollup-m6nw1n0, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #73033 (Fix #[thread_local] statics as asm! sym operands)
 - #73036 (std: Enable atomic.fence emission on wasm32)
 - #73163 (Add long error explanation for E0724)
 - #73187 (Remove missed `cfg(bootstrap)`)
 - #73195 (Provide suggestion to convert numeric op LHS rather than unwrapping RHS)
 - #73247 (Add various Zulip notifications for prioritization)
 - #73254 (Add comment about LocalDefId -> DefId)

Failed merges:

r? @ghost

4 years agoRollup merge of #73254 - jyn514:local-def-id-comment, r=lcnr
Dylan DPC [Thu, 11 Jun 2020 22:05:36 +0000 (00:05 +0200)]
Rollup merge of #73254 - jyn514:local-def-id-comment, r=lcnr

Add comment about LocalDefId -> DefId

Now there are instructions on how to convert back and forth on both
structs, not just one.

See also https://github.com/rust-lang/rust/pull/73076

r? @lcnr

4 years agoRollup merge of #73247 - LeSeulArtichaut:patch-1, r=spastorino
Dylan DPC [Thu, 11 Jun 2020 22:05:34 +0000 (00:05 +0200)]
Rollup merge of #73247 - LeSeulArtichaut:patch-1, r=spastorino

Add various Zulip notifications for prioritization

Adapts `triagebot.toml` for rust-lang/triagebot#616 and adds various Zulip notifications for the Prioritization WG workflow.
We should also add indications about the procedure for handling those events, cc @rust-lang/wg-prioritization.

r? @spastorino
This should be merged as soon as possible after rust-lang/triagebot#616 is merged, cc @Mark-Simulacrum

4 years agoRollup merge of #73195 - ayazhafiz:i/73145, r=estebank
Dylan DPC [Thu, 11 Jun 2020 22:05:33 +0000 (00:05 +0200)]
Rollup merge of #73195 - ayazhafiz:i/73145, r=estebank

Provide suggestion to convert numeric op LHS rather than unwrapping RHS

Given a code

```rust
fn foo(x: u8, y: u32) -> bool {
    x > y
}
fn main() {}
```

it could be more helpful to provide a suggestion to do "u32::from(x)"
rather than "y.try_into().unwrap()", since the latter may panic.

We do this by passing the LHS of a binary expression up the stack into
the coercion checker.

Closes #73145

4 years agoRollup merge of #73187 - mati865:bootstrap-cleanup, r=Mark-Simulacrum
Dylan DPC [Thu, 11 Jun 2020 22:05:31 +0000 (00:05 +0200)]
Rollup merge of #73187 - mati865:bootstrap-cleanup, r=Mark-Simulacrum

Remove missed `cfg(bootstrap)`

4 years agoRollup merge of #73163 - ayushmishra2005:61137-add-long-error-code-e0724, r=davidtwco
Dylan DPC [Thu, 11 Jun 2020 22:05:29 +0000 (00:05 +0200)]
Rollup merge of #73163 - ayushmishra2005:61137-add-long-error-code-e0724, r=davidtwco

Add long error explanation for E0724

Add long explanation for the E0724 error code
Part of #61137

4 years agoRollup merge of #73036 - alexcrichton:update-wasm-fence, r=Mark-Simulacrum
Dylan DPC [Thu, 11 Jun 2020 22:05:27 +0000 (00:05 +0200)]
Rollup merge of #73036 - alexcrichton:update-wasm-fence, r=Mark-Simulacrum

std: Enable atomic.fence emission on wasm32

This commit removes the `#[cfg]` guards in `atomic::fence` on wasm
targets. Since these guards were originally added the upstream wasm
specification for threads gained an `atomic.fence` instruction, so LLVM
no longer panics on these intrinsics.

Although there aren't a ton of tests in-repo for this right now I've
tested locally and all of these fences generate `atomic.fence`
instructions in wasm.

Closes #65687
Closes #72997

4 years agoRollup merge of #73033 - Amanieu:asm-tls, r=oli-obk
Dylan DPC [Thu, 11 Jun 2020 22:05:19 +0000 (00:05 +0200)]
Rollup merge of #73033 - Amanieu:asm-tls, r=oli-obk

Fix #[thread_local] statics as asm! sym operands

The `asm!` RFC specifies that `#[thread_local]` statics may be used as `sym` operands for inline assembly.

This also fixes a regression in the handling of `#[thread_local]` during monomorphization which caused link-time errors with multiple codegen units, most likely introduced by #71192.

r? @oli-obk

4 years agoAdd comment about LocalDefId -> DefId
Joshua Nelson [Thu, 11 Jun 2020 21:16:38 +0000 (17:16 -0400)]
Add comment about LocalDefId -> DefId

Now there are instructions on how to convert back and forth on both
structs, not just one.

4 years agoAuto merge of #73246 - Dylan-DPC:rollup-xnm531f, r=Dylan-DPC
bors [Thu, 11 Jun 2020 18:11:07 +0000 (18:11 +0000)]
Auto merge of #73246 - Dylan-DPC:rollup-xnm531f, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #72180 (remove extra space from crate-level doctest names)
 - #73012 (Show `SyntaxContext` in formatted `Span` debug output)
 - #73097 (Try_run must only be used if toolstate is populated)
 - #73169 (Handle assembler warnings properly)
 - #73182 (Track span of function in method calls, and use this in #[track_caller])
 - #73207 (Clean up E0648 explanation)
 - #73230 (Suggest including unused asm arguments in a comment to avoid error)

Failed merges:

r? @ghost

4 years agoAdd long error explanation for E0724
Ayush Kumar Mishra [Tue, 9 Jun 2020 10:56:21 +0000 (16:26 +0530)]
Add long error explanation for E0724

Minor refactoring

Minor refactoring

Update src/librustc_error_codes/error_codes/E0724.md

Co-authored-by: David Wood <Q0KPU0H1YOEPHRY1R2SN5B5RL@david.davidtw.co>
Update src/librustc_error_codes/error_codes/E0724.md

Co-authored-by: David Wood <Q0KPU0H1YOEPHRY1R2SN5B5RL@david.davidtw.co>
Update src/librustc_error_codes/error_codes/E0724.md

Co-authored-by: David Wood <Q0KPU0H1YOEPHRY1R2SN5B5RL@david.davidtw.co>
Minor refactoring

4 years agoAdd various Zulip notifications for prioritization
LeSeulArtichaut [Thu, 11 Jun 2020 17:21:09 +0000 (19:21 +0200)]
Add various Zulip notifications for prioritization

4 years agoRollup merge of #73230 - Amanieu:asm-unused2, r=petrochenkov
Dylan DPC [Thu, 11 Jun 2020 17:04:20 +0000 (19:04 +0200)]
Rollup merge of #73230 - Amanieu:asm-unused2, r=petrochenkov

Suggest including unused asm arguments in a comment to avoid error

We require all arguments to an `asm!` to be used in the template string, just like format strings. However in some cases (e.g. `black_box`) it may be desirable to have `asm!` arguments that are not used in the template string.

Currently this is a hard error rather than a lint since `#[allow]` does not work on macros (#63221), so this PR suggests using the unused arguments in an asm comment as a workaround.

r? @petrochenkov

4 years agoRollup merge of #73207 - GuillaumeGomez:cleanup-e0648, r=Dylan-DPC
Dylan DPC [Thu, 11 Jun 2020 17:04:18 +0000 (19:04 +0200)]
Rollup merge of #73207 - GuillaumeGomez:cleanup-e0648, r=Dylan-DPC

Clean up E0648 explanation

r? @Dylan-DPC

4 years agoRollup merge of #73182 - Aaron1011:feature/call-fn-span, r=matthewjasper
Dylan DPC [Thu, 11 Jun 2020 17:04:16 +0000 (19:04 +0200)]
Rollup merge of #73182 - Aaron1011:feature/call-fn-span, r=matthewjasper

Track span of function in method calls, and use this in #[track_caller]

Fixes #69977

When we parse a chain of method calls like `foo.a().b().c()`, each
`MethodCallExpr` gets assigned a span that starts at the beginning of
the call chain (`foo`). While this is useful for diagnostics, it means
that `Location::caller` will return the same location for every call
in a call chain.

This PR makes us separately record the span of the function name and
arguments for a method call (e.g. `b()` in `foo.a().b().c()`). This
`Span` is passed through HIR lowering and MIR building to
`TerminatorKind::Call`, where it is used in preference to
`Terminator.source_info.span` when determining `Location::caller`.

This new span is also useful for diagnostics where we want to emphasize
a particular method call - for an example, see
https://github.com/rust-lang/rust/pull/72389#discussion_r436035990

4 years agoRollup merge of #73169 - Amanieu:asm-warnings, r=petrochenkov
Dylan DPC [Thu, 11 Jun 2020 17:04:14 +0000 (19:04 +0200)]
Rollup merge of #73169 - Amanieu:asm-warnings, r=petrochenkov

Handle assembler warnings properly

Previously all inline asm diagnostics were treated as errors, but LLVM sometimes emits warnings and notes as well.

Fixes #73160

r? @petrochenkov

4 years agoRollup merge of #73097 - Mark-Simulacrum:clippy-fail, r=oli-obk
Dylan DPC [Thu, 11 Jun 2020 17:04:12 +0000 (19:04 +0200)]
Rollup merge of #73097 - Mark-Simulacrum:clippy-fail, r=oli-obk

Try_run must only be used if toolstate is populated

Clippy's tests were failing the build, but that failure was ignored in favor of checking toolstate. This is the correct behavior for toolstate-checked tools, but Clippy no longer updates its toolstate status as it should always build.

The previous PR of this kind didn't catch this as I expected x.py failures to always lead to a non-successful build in CI, but that's not the case specifically for tool testing.

4 years agoRollup merge of #73012 - Aaron1011:feature/span-debug-ctxt, r=matthewjasper
Dylan DPC [Thu, 11 Jun 2020 17:04:09 +0000 (19:04 +0200)]
Rollup merge of #73012 - Aaron1011:feature/span-debug-ctxt, r=matthewjasper

Show `SyntaxContext` in formatted `Span` debug output

This is only really useful in debug messages, so I've switched to
calling `span_to_string` in any place that causes a `Span` to end up in
user-visible output.

4 years agoRollup merge of #72180 - euclio:rustdoc-test-extra-space, r=Dylan-DPC
Dylan DPC [Thu, 11 Jun 2020 17:04:08 +0000 (19:04 +0200)]
Rollup merge of #72180 - euclio:rustdoc-test-extra-space, r=Dylan-DPC

remove extra space from crate-level doctest names

Before:

```
running 2 tests
test src/test/rustdoc-ui/doctest-output.rs - foo::bar (line 11) ... ok
test src/test/rustdoc-ui/doctest-output.rs -  (line 5) ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
```

After:

```
running 2 tests
test src/test/rustdoc-ui/doctest-output.rs - foo::bar (line 11) ... ok
test src/test/rustdoc-ui/doctest-output.rs - (line 5) ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
```

4 years agoFix NLL test
Matthew Jasper [Thu, 11 Jun 2020 11:34:36 +0000 (12:34 +0100)]
Fix NLL test

4 years agoDocument some opaque types code
Matthew Jasper [Sun, 7 Jun 2020 18:52:05 +0000 (19:52 +0100)]
Document some opaque types code

4 years agoAllow all impl trait types to capture bound lifetimes
Matthew Jasper [Sun, 7 Jun 2020 18:42:08 +0000 (19:42 +0100)]
Allow all impl trait types to capture bound lifetimes

4 years agoRename `TyKind::Def` to `OpaqueDef`
Matthew Jasper [Sun, 7 Jun 2020 17:56:17 +0000 (18:56 +0100)]
Rename `TyKind::Def` to `OpaqueDef`

4 years agofixup! Provide suggestion to convert numeric op LHS rather than unwrapping RHS
Ayaz Hafiz [Thu, 11 Jun 2020 15:34:12 +0000 (08:34 -0700)]
fixup! Provide suggestion to convert numeric op LHS rather than unwrapping RHS

4 years agoProvide suggestion to convert numeric op LHS rather than unwrapping RHS
Ayaz Hafiz [Tue, 9 Jun 2020 18:45:40 +0000 (11:45 -0700)]
Provide suggestion to convert numeric op LHS rather than unwrapping RHS

Given a code

```rust
fn foo(x: u8, y: u32) -> bool {
    x > y
}
fn main() {}
```

it could be more helpful to provide a suggestion to do "u32::from(x)"
rather than "y.try_into().unwrap()", since the latter may panic.

We do this by passing the LHS of a binary expression up the stack into
the coercion checker.

Closes #73145

4 years agoRemove ImplItemKind::OpaqueTy from clippy
Matthew Jasper [Sun, 10 May 2020 14:05:06 +0000 (15:05 +0100)]
Remove ImplItemKind::OpaqueTy from clippy

4 years agoAdd more tests for type alias impl Trait
Matthew Jasper [Sun, 10 May 2020 11:22:45 +0000 (12:22 +0100)]
Add more tests for type alias impl Trait

4 years agoForbid lifetime elision in let position impl Trait
Matthew Jasper [Sun, 10 May 2020 11:18:55 +0000 (12:18 +0100)]
Forbid lifetime elision in let position impl Trait

This is consistent with types.

4 years agoRemove associated opaque types
Matthew Jasper [Sun, 10 May 2020 11:15:51 +0000 (12:15 +0100)]
Remove associated opaque types

They're unused now.

4 years agoStop special casing top level TAIT
Matthew Jasper [Sun, 10 May 2020 10:57:58 +0000 (11:57 +0100)]
Stop special casing top level TAIT

4 years agoMake pretty printing `TyKind::Def` do something
Matthew Jasper [Sun, 10 May 2020 11:06:01 +0000 (12:06 +0100)]
Make pretty printing `TyKind::Def` do something

4 years agoCheck associated opaque types in check_opaque_types
Matthew Jasper [Sun, 10 May 2020 10:25:23 +0000 (11:25 +0100)]
Check associated opaque types in check_opaque_types

4 years agoUse preinstalled MSYS2
Mateusz Mikuła [Tue, 9 Jun 2020 22:48:43 +0000 (00:48 +0200)]
Use preinstalled MSYS2

4 years agoFix the link in the TryFrom impl
Alexis Bourget [Thu, 11 Jun 2020 14:55:03 +0000 (16:55 +0200)]
Fix the link in the TryFrom impl

4 years agoClean up E0666 explanation
Guillaume Gomez [Thu, 11 Jun 2020 11:34:04 +0000 (13:34 +0200)]
Clean up E0666 explanation

4 years agoAuto merge of #73235 - Dylan-DPC:rollup-zp8oxhg, r=Dylan-DPC
bors [Thu, 11 Jun 2020 11:17:37 +0000 (11:17 +0000)]
Auto merge of #73235 - Dylan-DPC:rollup-zp8oxhg, r=Dylan-DPC

Rollup of 11 pull requests

Successful merges:

 - #72380 (Fix `is_const_context`, update `check_for_cast`)
 - #72941 (Ensure stack when building MIR for matches)
 - #72976 (Clean up E0642 explanation)
 - #73080 (doc/rustdoc: Fix incorrect external_doc feature flag)
 - #73155 (save_analysis: better handle paths and functions signature)
 - #73164 (Add new E0762 error code)
 - #73172 (Fix more clippy warnings)
 - #73181 (Automatically prioritize unsoundness issues)
 - #73183 (Support proc macros in intra doc link resolution)
 - #73208 (Fix doctest template)
 - #73219 (x.py: with --json-output, forward cargo's JSON)

Failed merges:

r? @ghost

4 years agoRollup merge of #73219 - RalfJung:cargo-json, r=Mark-Simulacrum
Dylan DPC [Thu, 11 Jun 2020 11:16:12 +0000 (13:16 +0200)]
Rollup merge of #73219 - RalfJung:cargo-json, r=Mark-Simulacrum

x.py: with --json-output, forward cargo's JSON

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

r? @Mark-Simulacrum