Commit Graph

119575 Commits

Author SHA1 Message Date
flip1995
891b0e2dff
Update Clippy 2020-04-29 16:09:04 +02:00
bors
28197b6226 Auto merge of #5545 - flip1995:rustup, r=flip1995
Rustup to rust-lang/rust#71518

changelog: none
2020-04-29 13:59:30 +00:00
bors
36d13cb01b Auto merge of #67343 - ecstatic-morse:qualif-structural-match, r=pnkfelix
Const qualification for `StructuralEq`

Furthers #62411. Resolves #62614.

The goal of this PR is to implement the logic in #67088 on the MIR instead of the HIR. It uses the `Qualif` trait to track `StructuralPartialEq`/`StructuralEq` in the final value of a `const`. Then, if we encounter a constant during HAIR lowering whose value may not be structurally matchable, we emit the `indirect_structural_match` lint.

This PR contains all the tests present in #67088 and emits the proper warnings for the corner cases. This PR does not handle #65466, which would require that we be [more aggressive](42abbd8878/src/librustc_mir_build/hair/pattern/const_to_pat.rs (L126-L130)) when checking matched types for `PartialEq`. I think that should be done separately.

Because this works on MIR and uses dataflow, this PR should accept more cases than #67088. Notably, the qualifs in the final value of a const are encoded cross-crate, so matching on a constant whose value is defined in another crate to be `Option::<TyWithCustomEqImpl>::None` should work. Additionally, if a `const` has branching/looping, we will only emit the warning if any possible control flow path could result in a type with a custom `PartialEq` impl ending up as the final value of a `const`. I'm not sure how #67088 handled this.

AFAIK, it's not settled that these are the semantics we actually want: it's just how the `Qualif` framework happens to work. If the cross-crate part is undesirable, it would be quite easy to change the result of `mir_const_qualif().custom_eq` to `true` before encoding it in the crate metadata. This way, other crates would have to assume that all publicly exported constants may not be safe for matching.

r? @pnkfelix
cc @eddyb
2020-04-29 13:59:22 +00:00
Bastian Kauschke
827d6f6c3d document stable counterparts of intrinsics 2020-04-29 15:50:21 +02:00
flip1995
cd3480991a
Rustup to rust-lang/rust#71518 2020-04-29 15:48:43 +02:00
Ralf Jung
07772fcf6f expand comment in memory.rs with extra soundness concerns 2020-04-29 14:56:40 +02:00
Ralf Jung
a03355dea0 some more test cases 2020-04-29 14:55:05 +02:00
bors
e91aebc1a3 Auto merge of #71664 - Dylan-DPC:rollup-eng60x9, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #71217 (Suggest `;` or assignment to drop borrows in tail exprs)
 - #71286 (Add regression test for #69654)
 - #71296 (Change wording on read_vectored docs)
 - #71654 (Update link to unstable book for llvm_asm macro)
 - #71657 (Add #24949 assoc constant static recursion test)

Failed merges:

r? @ghost
2020-04-29 10:48:11 +00:00
Dylan DPC
878e92872d
Rollup merge of #71657 - Daniel-Worrall:24949, r=estebank
Add #24949 assoc constant static recursion test

Closes #24949

Forced tidy fixes
2020-04-29 12:23:26 +02:00
Dylan DPC
4955c059f8
Rollup merge of #71654 - zachreizner:patch-1, r=jonas-schievink
Update link to unstable book for llvm_asm macro
2020-04-29 12:23:24 +02:00
Dylan DPC
fb1aa5624d
Rollup merge of #71296 - ChiefMilesEdgeworth:fix_doc_wording, r=Dylan-DPC
Change wording on read_vectored docs

Closes #70154

I'm happy to work with others to make the wording on this more clear. I think what I have is an improvement but may not be the final wording.
2020-04-29 12:23:22 +02:00
Dylan DPC
65527cbc1b
Rollup merge of #71286 - Alexendoo:test-issue-69654, r=Dylan-DPC
Add regression test for #69654

closes #69654

r? @eddyb
2020-04-29 12:23:20 +02:00
Dylan DPC
d0ff2295e0
Rollup merge of #71217 - estebank:tail-borrow-sugg, r=pnkfelix
Suggest `;` or assignment to drop borrows in tail exprs

Address the diagnostics part of #70844.

```
error[E0597]: `counter` does not live long enough
  --> $DIR/issue-54556-niconii.rs:22:20
   |
LL |     if let Ok(_) = counter.lock() { }
   |                    ^^^^^^^-------
   |                    |
   |                    borrowed value does not live long enough
   |                    a temporary with access to the borrow is created here ...
...
LL | }
   | -
   | |
   | `counter` dropped here while still borrowed
   | ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::result::Result<MutexGuard<'_>, ()>`
   |
help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
   |
LL |     if let Ok(_) = counter.lock() { };
   |                                      ^
```
2020-04-29 12:23:15 +02:00
cohenarthur
8558ccd5c4 safety-ptr: Add SAFETY on some unsafe blocks from libcore/ptr
Add documentation example to slice_from_raw_parts_mut()
Add SAFETY explanations to some unsafe blocks in libcore/ptr

* libcore/ptr/mod.rs
* libcore/ptr/unique.rs
* libcore/ptr/non_null.rs

safety-mod.rs: Add SAFETY to slice_from_raw_parts(),
slice_from_raw_parts_mut()

slice_from_raw_parts_mut: Add documentation example

safety-ptr-unique.rs: Add SAFETY to new() and cast()

safety-ptr-non_null.rs: Add SAFETY to new()

safety-ptr-non_null.rs: Add SAFETY to cast()

safety-ptr-non_null.rs: Add SAFETY to from() impls

safety-ptr-unique.rs: Add SAFETY to from() impls

safety-ptr-non_null.rs: Add SAFETY to new()

safety-ptr-unique.rs: Add SAFETY to new()

safety-ptr-mod.rs: Fix safety explanation

https://github.com/rust-lang/rust/pull/71507#discussion_r414488884

safety-prt-non_null.rs: Fix SAFETY comment syntax

safety-ptr-unique.rs: Fix syntax for empty()

safety-ptr-non_null.rs: Fix misuse of non-null for align_of()

safety-ptr-non_null.rs: Remove incorrect SAFETY comment

safety-ptr-unique.rs: Remove unsound SAFETY comment

safety-ptr-mod.rs: Add std comment on slice_from_raw_parts guarantee

safety-ptr-unique.rs: Remove incorrect safety comment

Creating a Unique from a NonNull has strict guarantees that the current
implementation does not guarantee

https://github.com/rust-lang/rust/pull/71507#discussion_r415035952

safety-ptr: Re-adding ignore-tidy directive
2020-04-29 11:18:31 +02:00
Ralf Jung
979bbf2ce1 also test reference into static field 2020-04-29 10:47:16 +02:00
bors
d9312a8db3 Auto merge of #71577 - tmiasko:backtrace-sys, r=Dylan-DPC
Update backtrace-sys crate to 0.1.36

* Fix an off-by-one error in backtrace-sys
* Only explicitly configure debuginfo in rustc-dep-of-std

https://github.com/rust-lang/backtrace-rs/compare/0.3.46...backtrace-sys-0.1.36

Fixes #71397.
2020-04-29 07:32:52 +00:00
Donough Liu
a9340b1f69 Rename function to suggest_deref_ref_or_into because it's suggesting
derefence instructions
2020-04-29 13:06:02 +08:00
Donough Liu
edfca5fe9c Move branch point upwards to avoid unnecessary mk_ptr() 2020-04-29 13:06:02 +08:00
bors
92019986aa Auto merge of #71518 - felix91gr:const_prop_bugfix_just_block_prop, r=wesleywiser
Const-prop bugfix: only add propagation inside own block for user variables

A testing spinoff of #71298. This one only adds the const-prop for locals that are user variables.
2020-04-29 03:04:46 +00:00
Esteban Küber
2c6094e5d0 Suggest ; or assignment to drop borrows in tail exprs
Address the diagnostics part of #70844.

```
error[E0597]: `counter` does not live long enough
  --> $DIR/issue-54556-niconii.rs:22:20
   |
LL |     if let Ok(_) = counter.lock() { }
   |                    ^^^^^^^-------
   |                    |
   |                    borrowed value does not live long enough
   |                    a temporary with access to the borrow is created here ...
...
LL | }
   | -
   | |
   | `counter` dropped here while still borrowed
   | ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::result::Result<MutexGuard<'_>, ()>`
   |
help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
   |
LL |     if let Ok(_) = counter.lock() { };
   |                                      ^
```
2020-04-28 18:47:06 -07:00
Daniel Worrall
e91c3a1d3d Add #24949 assoc constant static recursion test 2020-04-29 01:27:28 +01:00
Amanieu d'Antras
c6817ffb2c Fix test 2020-04-29 01:21:24 +01:00
Amanieu d'Antras
eb4725fc54 Remove Session::no_landing_pads() 2020-04-29 01:05:56 +01:00
Amanieu d'Antras
06e15a4ef9 Remove -Z no-landing-pads tests 2020-04-29 01:05:55 +01:00
Amanieu d'Antras
2f5bd9d0f1 Remove -Z no-landing-pads flag 2020-04-29 01:05:55 +01:00
Dylan MacKenzie
e4c650c00d Bless test that no longer warns 2020-04-28 15:27:46 -07:00
bors
825cf51ad7 Auto merge of #71486 - alexcrichton:arm64-lld, r=Mark-Simulacrum
Enable "full tools" option on ARM dist builders

This commit switches the `--enable-extended` option on the arm-related
dist builders to `--enable-full-tools`. This alias in `config.py`
corresponds to enabling a few more options:

* `rust.lld = true` - this is the main purpose of this PR, to enable LLD
  on ARM-related platforms. This means it will effectively unlock
  compilation of wasm programs from an arm host.

* `rust.llvm-tools = true` - it turns out that this option is largely
  ignored in rustbuild today. This is only read in one location to set
  some flags for the `llvm-tools` package, but the `llvm-tools` package
  is already produced on all of these builders. It's predicted that this
  will have no effect on build times.

* `rust.codegen-backends = ['llvm']` - historically this also enabled
  the emscripten backend, but that has long since been removed.

This brings the ARM dist builders in line with the x86_64 dist builders
using this flag. The hope is that the extra time spent on CI building
LLD will acceptable because it's cached by `sccache`, LLD is a
relatively small C++ project, and the dist builders are all clocking
well under 3 hours (the slowest of all builders) around 2 hours.

There's likely some possible cleanup that can happen with these
configure options since it doesn't look like they've aged too too well,
but I'm hopeful that possible refactorings, if necessary, could be
deferred to future PRs.
2020-04-28 22:18:03 +00:00
Dylan MacKenzie
900cf82d4d TYPE -> TYPE_ASCRIPTIONG 2020-04-28 14:58:50 -07:00
Dylan MacKenzie
532ba46402 Use path to refer to constants in cross-crate pattern tests 2020-04-28 14:58:50 -07:00
Dylan MacKenzie
e68a5c6800 Add cross-crate const in pattern tests 2020-04-28 14:58:50 -07:00
Dylan MacKenzie
b58da533bc Add branchy const in pattern tests 2020-04-28 14:58:50 -07:00
Dylan MacKenzie
135cfcb5cd FIXME: ignore test that ICEs 2020-04-28 14:58:50 -07:00
Dylan MacKenzie
66f2d44c73 Add tests from #67088 and the issues mentioned in its description 2020-04-28 14:58:50 -07:00
Dylan MacKenzie
796c0ca554 Incorporate MIR const-checker into Pat lowering 2020-04-28 14:58:50 -07:00
Dylan MacKenzie
6b54829b78 Add CustomEq qualif 2020-04-28 14:58:50 -07:00
Ralf Jung
a089801948 clarify comment 2020-04-28 23:54:47 +02:00
Ralf Jung
a84e2a0c91 add test for const-ref-to-cross-crate-mutable-static 2020-04-28 23:49:36 +02:00
Ralf Jung
e8ffa2182b better document const-pattern dynamic soundness checks, and fix a soundness hole 2020-04-28 23:48:22 +02:00
Ulrik Sverdrup
f654daf3a6 Vec IntoIter: Drop using raw slice
Update Vec drop with a comment to explain why we want to use a raw
slice, and extend this pattern to also include the Vec's IntoIter.
2020-04-28 23:31:32 +02:00
Dylan MacKenzie
0850c3bbb8 Pass Substs to in_adt_inherently 2020-04-28 14:25:40 -07:00
bors
6470169237 Auto merge of #71642 - ehuss:update-cargo, r=ehuss
Update cargo

11 commits in 8751eb3010d4cdb5329b5a6bd2b6d765c95b0dca..90931d9b31e8b854522fed00916504a3ac6d8619
2020-04-21 18:04:35 +0000 to 2020-04-28 01:56:59 +0000
- Use associated constants directly on primitive types instead of modules (rust-lang/cargo#8077)
- Clear `RUSTDOCFLAGS` before running tests (rust-lang/cargo#8168)
- Fix warning for `resolve` mismatch in workspace. (rust-lang/cargo#8169)
- Fix flaky linking_interrupted test. (rust-lang/cargo#8162)
- Fixed some unnecessary borrows and clones. (rust-lang/cargo#8146)
- Added warning when using restricted names in Windows. (rust-lang/cargo#8136)
- Add changelog about dylib uplift. (rust-lang/cargo#8161)
- Mention that cargo_metadata can parse json messages (rust-lang/cargo#8158)
- Re-enable rustc-info-cache test again (rust-lang/cargo#8155)
- Updates to path source walking. (rust-lang/cargo#8095)
- Bump to 0.46.0, update changelog (rust-lang/cargo#8153)
2020-04-28 19:05:00 +00:00
bors
9a3b0a0588 Auto merge of #5543 - matthiaskrgr:rustup_45, r=flip1995
rustup https://github.com/rust-lang/rust/pull/71292/

cc https://github.com/rust-lang/rust/issues/71608

---

changelog: none
2020-04-28 18:30:01 +00:00
Dylan MacKenzie
5577b3554d Suggest stage 1 if stage 0 fails 2020-04-28 10:14:56 -07:00
Samrat Man Singh
a6033e33e7 Fix numeric-cast tests for new into suggestion
Remove `integer-into.rs` since the numeric-cast tests already cover
these cases.
2020-04-28 21:40:03 +05:30
Samrat Man Singh
57dd22baad Suggest into to convert into isize only if uint is of width 8
Since Into<isize> is not implemented for uint of width greater than 8
2020-04-28 21:40:03 +05:30
bors
db98d32ea0 Auto merge of #71644 - Dylan-DPC:rollup-cq7plwa, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #71340 (Moving more build-pass tests to check-pass)
 - #71456 (Use lib crate type for SGX in `fn build_auxiliary`)
 - #71615 (share some common code for compile-time miri instances)
 - #71637 (Minor formatting changes in `cfg-sanitize.md`)
 - #71641 (Update books)

Failed merges:

r? @ghost
2020-04-28 15:56:45 +00:00
Dylan DPC
b17ef8669e
Rollup merge of #71641 - ehuss:update-books, r=ehuss
Update books

## nomicon

5 commits in 6eb24d6e9c0773d4aee68ed5fca121ce3cdf676a..4d2d275997746d35eabfc4d992dfbdcce2f626ed
2020-04-06 02:21:15 +0200 to 2020-04-27 10:24:52 -0400
- Fix example in FFI, section NPO
- Update implementation code of `split_at_mut`
- Use rust-lang/rust linkchecker on CI.
- Use just `std::_` instead of `::std::_`
- Remove illegal space.

## reference

2 commits in 3ce94caed4cf967106c51ae86be5e098f7875f11..ed22e6fbfcb6ce436e9ea3b4bb4a55b2fb50a57e
2020-04-11 17:00:27 +0200 to 2020-04-24 12:46:22 -0700
- Fix grammer for tuple patterns and tuple struct patterns (rust-lang-nursery/reference#794)
- Document drop scopes (rust-lang-nursery/reference#514)

## book

2 commits in f5db319e0b19c22964398d56bc63103d669e1bba..e37c0e84e2ef73d3a4ebffda8011db6814a3b02d
2020-04-13 08:06:03 -0500 to 2020-04-26 09:31:36 -0500
- Mention short-circuiting in Appendix 02 (rust-lang/book#2318)
- Increase HTTP buffer size and add 'Content-Length' header (rust-lang/book#2246)

## rust-by-example

8 commits in c106d1683c3a2b0960f0f0fb01728cbb19807332..ffc99581689fe2455908aaef5f5cf50dd03bb8f5
2020-04-09 09:14:39 -0300 to 2020-04-24 15:05:04 -0300
- Fix Example -&gt; Examples (rust-lang/rust-by-example#1340)
- Make unsuffixed literal plural (rust-lang/rust-by-example#1335)
- Ensure example error matches the comment (rust-lang/rust-by-example#1336)
- Add missing triple backticks (rust-lang/rust-by-example#1339)
- Clarify conditional compilation (rust-lang/rust-by-example#1338)
- Clarifies how to customize lib crate name (rust-lang/rust-by-example#1337)
- Fix bytes of youkoso in shiftjis (rust-lang/rust-by-example#1333)
- Fix possible typo (rust-lang/rust-by-example#1334)

## embedded-book

4 commits in 668fb07b6160b9c468f598e839c1e044db65de30..40beccdf1bb8eb9184a2e3b42db8b8c6e394247f
2020-04-13 12:38:16 +0000 to 2020-04-26 17:44:14 +0000
- Add hint on memory config to GDB debugging section  (rust-embedded/book#215)
- Adds cargo-generate to installation instructions  (rust-embedded/book#213)
- collections: Fix example allocator  (rust-embedded/book#206)
- Flip111/patch 8  (rust-embedded/book#233)
2020-04-28 17:55:50 +02:00
Dylan DPC
3d1f958b6c
Rollup merge of #71637 - mibac138:cfg-sanitize, r=petrochenkov
Minor formatting changes in `cfg-sanitize.md`
2020-04-28 17:55:48 +02:00
Dylan DPC
0bcdd5ffb8
Rollup merge of #71615 - RalfJung:share-machine-code, r=oli-obk
share some common code for compile-time miri instances

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

r? @oli-obk
2020-04-28 17:55:46 +02:00
Dylan DPC
45edd23825
Rollup merge of #71456 - mzohreva:mz/sgx-no-dylib, r=nikomatsakis
Use lib crate type for SGX in `fn build_auxiliary`

since SGX does not support `dylib`

cc @Goirad
2020-04-28 17:55:44 +02:00