Commit Graph

102523 Commits

Author SHA1 Message Date
bors
0f72ce1b27 Auto merge of #70628 - pietroalbini:gha-multiple-tries, r=Mark-Simulacrum
GHA: enable running multiple try builds at the same time

While for auto, try and PR builds we only want the latest commit to be tested, that's not true for try builds: each commit pushed to the branch is a different PR being tested, and we want multiple PRs to be tested in parallel if there is enough demand.

Fixes #70569
2020-04-02 09:10:06 +00:00
Eduard-Mihai Burtescu
8deff18529 tests: remove ignore directives from tests that mention core/alloc/std spans. 2020-04-02 11:48:34 +03:00
Eduard-Mihai Burtescu
f5892c00ac Translate the virtual /rustc/$hash prefix back to a real directory. 2020-04-02 11:39:41 +03:00
bors
127a11a344 Auto merge of #70362 - TimDiekmann:alloc-overhaul, r=Amanieu
Overhaul of the `AllocRef` trait to match allocator-wg's latest consens; Take 2

GitHub won't let me reopen #69889 so I make a new PR.

In addition to #69889 this fixes the unsoundness of `RawVec::into_box` when using allocators supporting overallocating. Also it uses `MemoryBlock` in `AllocRef` to unify `_in_place` methods by passing `&mut MemoryBlock`. Additionally, `RawVec` now checks for `size_of::<T>()` again and ignore every ZST. The internal capacity of `RawVec` isn't used by ZSTs anymore, as `into_box` now requires a length to be specified.

r? @Amanieu

fixes rust-lang/wg-allocators#38
fixes rust-lang/wg-allocators#41
fixes rust-lang/wg-allocators#44
fixes rust-lang/wg-allocators#51
2020-04-02 06:08:35 +00:00
Russell Cohen
f543689eb6 Handle unterminated raw strings with no #s properly
The modified code to handle parsing raw strings didn't properly account for the case where there was no "#" on either end and erroneously reported this strings as complete. This lead to a panic trying to read off the end of the file.
2020-04-02 01:02:55 -04:00
Lzu Tao
f87afec2ce Use Self over specific type in return position 2020-04-02 03:55:35 +00:00
bors
b793f403bd Auto merge of #70667 - flip1995:clippyup, r=Manishearth
Update Clippy

r? @Manishearth

Closes #70663
2020-04-02 03:16:46 +00:00
lzutao
4b66a28bb6
Add missing markdown rust annotation 2020-04-02 08:34:57 +07:00
Esteban Küber
8bedb7eac1 Remove duplicated code in trait selection 2020-04-01 15:44:13 -07:00
Dylan DPC
7d4d450da9
Rollup merge of #70662 - eddyb:compiletest-stdout-fix, r=Mark-Simulacrum
compiletest: don't use `std::io::stdout()`, as it bypasses `set_print`.

This PR undoes a change made during #69916, which became unnecessary during review but was left in by accident, and which isn't correct due to `libtest` using `std::io::set_print`, which overwrites the `println!` behavior but *not* `writeln!(std::io::stdout(), ...)`.

The effect of using `writeln!(std::io::stdout(), ...)` was that the diff output would show *while* running the tests, instead of at the end, when failing tests are listed.

r? @Mark-Simulacrum cc @oli-obk
2020-04-01 22:25:23 +02:00
Dylan DPC
37b2e3fe56
Rollup merge of #70649 - GuillaumeGomez:cleanup-e0468, r=Dylan-DPC
clean up E0468 explanation

r? @Dylan-DPC
2020-04-01 22:25:22 +02:00
Dylan DPC
0863e2ce01
Rollup merge of #70626 - pietroalbini:remove-webrender-cargotest, r=Mark-Simulacrum
cargotest: remove webrender

The current webrender commit occasionally fails without a reason, and the latest webrender commit is missing a dependency on our Windows builders. It's not worth installing an extra dependency for cargotest, and the spurious failure makes keeping this test not worth it.

r? @Mark-Simulacrum
2020-04-01 22:25:20 +02:00
Dylan DPC
1b40067ffc
Rollup merge of #70616 - anyska:fieldplacement-rename, r=oli-obk
rustc_target::abi: rename FieldPlacement to FieldsShape.

Originally suggested by @eddyb.
2020-04-01 22:25:18 +02:00
Dylan DPC
b919df21a9
Rollup merge of #70590 - RalfJung:miri-backtrace, r=oli-obk
Miri: make backtrace function names and spans match up

Currently, Miri backtraces are a bit confusing:
```
error: Undefined Behavior: entering unreachable code
  --> tests/compile-fail/never_transmute_void.rs:10:11
   |
10 |     match v {} //~ ERROR  entering unreachable code
   |           ^ entering unreachable code
   |
   = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
   = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
note: inside call to `f` at tests/compile-fail/never_transmute_void.rs:17:5
  --> tests/compile-fail/never_transmute_void.rs:17:5
   |
17 |     f(v); //~ inside call to `f`
   |     ^^^^
   = note: inside call to `main` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:67:34
   = note: inside call to closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:52:73
   = note: inside call to closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys_common/backtrace.rs:130:5
```
When reading this like a normal backtrace, one would expect that e.g. the backrace involves the "main" function at "libstd/rt.rs:67:34". But that is not actually where we are in the main function, that is *where the main function is called*.

This is not how backtraces are usually rendered (including e.g. with `RUST_BACKTRACE=1`). Usually we print next to each function name where inside that function the frame is currently executing, not where the *parent* frame is executing. With this PR and the Miri side at https://github.com/rust-lang/miri/pull/1283, the backtrace now looks as follows:
```
error: Undefined Behavior: entering unreachable code
  --> tests/compile-fail/never_transmute_void.rs:10:11
   |
10 |     match v {} //~ ERROR entering unreachable code
   |           ^ entering unreachable code
   |
   = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
   = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
   = note: inside `f` at tests/compile-fail/never_transmute_void.rs:10:11
note: inside `main` at tests/compile-fail/never_transmute_void.rs:17:5
  --> tests/compile-fail/never_transmute_void.rs:17:5
   |
17 |     f(v); //~ inside `main`
   |     ^^^^
   = note: inside closure at /home/r/src/rust/rustc/src/libstd/rt.rs:67:34
   = note: inside closure at /home/r/src/rust/rustc/src/libstd/rt.rs:52:73
   = note: inside `std::sys_common::backtrace::__rust_begin_short_backtrace::<[closure@DefId(1:6034 ~ std[87db]::rt[0]::lang_start_internal[0]::{{closure}}[0]::{{closure}}[0]) 0:&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/src/rust/rustc/src/libstd/sys_common/backtrace.rs:130:5
```
Now function name and printed line numbers match up in the notes.

This code is partially shared with const-eval, so the change also affects const-eval: instead of printing what is being called at some span, we print which function/constant this span is inside.

With this, we can also remove the `span` field from Miri's stack frames (which used to track the *caller span* of that frame, quite confusing), and then get of a whole lot of `span` arguments that ultimately just served to fill that field (and as a fallback for `caller_location`, which however was never actually used).

r? @oli-obk
2020-04-01 22:25:16 +02:00
Dylan DPC
0e0d84c13c
Rollup merge of #70535 - jonas-schievink:graph-refactor, r=nikomatsakis
Track the finalizing node in the specialization graph

Fixes https://github.com/rust-lang/rust/issues/70419
Fixes https://github.com/rust-lang/rust/issues/70442

r? @eddyb
2020-04-01 22:25:15 +02:00
Vytautas Astrauskas
baa6d557a7 In Thread::new, add a comment that a panic could cause a memory leak. 2020-04-01 12:46:14 -07:00
flip1995
93aa7142e3
Update Clippy 2020-04-01 21:06:06 +02:00
Thomas de Zeeuw
ba91e7e374 Fix link to write_vectored 2020-04-01 19:41:57 +02:00
Eduard-Mihai Burtescu
f181778538 compiletest: don't use std::io::stdout(), as it bypasses set_print. 2020-04-01 19:40:09 +03:00
Thomas de Zeeuw
9745b1fc52 Use unspecified over undefined in io::Write::write_all_vectored docs 2020-04-01 15:39:05 +02:00
Michael Woerister
98ead3e636 Update -Ccodegen-units docs wrt incr. comp. in rustc book. 2020-04-01 14:47:41 +02:00
Mazdak Farrokhzad
c1419b4c91
Rollup merge of #70652 - lzutao:patch-1, r=Centril
Add git repo address to unstable book
2020-04-01 14:32:21 +02:00
Mazdak Farrokhzad
9223bb5f32
Rollup merge of #70627 - spastorino:use-place-directly-its-copy, r=oli-obk
Use place directly its copy

r? @oli-obk
2020-04-01 14:32:19 +02:00
Mazdak Farrokhzad
43119deac1
Rollup merge of #70591 - cuviper:fulldeps-library-path, r=Mark-Simulacrum
Ensure LLVM is in the link path for "fulldeps" tests

This is a follow-up to #70123, which added `llvm-config --libdir` to the
`LIBRARY_PATH` for rustc tools. We need the same for "run-make-fulldeps"
and "ui-fulldeps" tests which depend on compiler libraries, implicitly
needing to link to `-lLLVM` as well.
2020-04-01 14:32:17 +02:00
Mazdak Farrokhzad
90cecab42b
Rollup merge of #70547 - wesleywiser:extract_can_unwind, r=eddyb
Add `can_unwind` field to `FnAbi`

This is a pure refactoring with no behavior changes.

Extracted out of #70467

r? @eddyb
2020-04-01 14:32:16 +02:00
Mazdak Farrokhzad
c739465b1b
Rollup merge of #70522 - rcoh:60762-raw-string-errors, r=petrochenkov
Improve error messages for raw strings (#60762)

This diff improves error messages around raw strings in a few ways:
- Catch extra trailing `#` in the parser. This can't be handled in the lexer because we could be in a macro that actually expects another # (see test)
- Refactor & unify error handling in the lexer between ByteStrings and RawByteStrings
- Detect potentially intended terminators (longest sequence of "#*" is suggested)

Fixes #60762
cc @estebank who reviewed the original (abandoned) PR for the same ticket.
r? @Centril
2020-04-01 14:32:14 +02:00
Mazdak Farrokhzad
84a4633880
Rollup merge of #70511 - ecstatic-morse:mir-dataflow-graphviz, r=davidtwco
Add `-Z dump-mir-dataflow` flag for dumping dataflow results visualization

Previously, to visualize the results of a MIR dataflow pass, one had to add a `#[rustc_mir(borrowck_graphviz_postflow)]` attribute to functions of interest. However, there is no way to specify this attribute on closures and generators, so it was impossible to view results for these MIR bodies.

This PR adds a flag, `-Z dump-mir-dataflow`, which will output the dataflow results for any functions specified in `-Z dump-mir` to the output directory specified by `-Z dump-mir-dir`. This behavior is modeled on the `-Z dump-mir-graphviz` flag.
2020-04-01 14:32:12 +02:00
lzutao
e39f542c55
Add git repo address to unstable book 2020-04-01 19:10:19 +07:00
Guillaume Gomez
3bcb3ef8d3 clean up E0468 explanation 2020-04-01 13:18:14 +02:00
Tim Diekmann
89ed59d884
Add missing allocation guard in RawVec::grow 2020-04-01 10:26:30 +02:00
bors
99009bf319 Auto merge of #70571 - RalfJung:miri, r=RalfJung
bump Miri

r? @ghost Cc @oli-obk

Fixes https://github.com/rust-lang/rust/issues/70521
2020-04-01 07:52:39 +00:00
bors
1a87c49e33 Auto merge of #70414 - lopsided98:armv6-gcc-8, r=pietroalbini
Upgrade GCC to 8.3.0, glibc to 2.17.0 and crosstool-ng to 1.24.0 for dist-arm-linux and dist-armhf-linux

Attempt to fix #69420 in the same manner as #65302 did for armv7l. I have tested that this eliminates the segfault while building a `hello_world` package on `arm-unknown-linux-gnueabihf`.

I have not been able to test whether the bug exists for `arm-unknown-linux-gnueabi` as well, but I suspect it does, so I upgraded the toolchain for that platform as well.
2020-04-01 03:56:44 +00:00
Wesley Wiser
036626f249 Address review feedback 2020-03-31 21:02:51 -04:00
Vytautas Astrauskas
5382347064 Use Box::into_raw instead of ManuallyDrop in Thread::new. 2020-03-31 18:02:08 -07:00
Valentin Lazureanu
dca3782c18 Renamed PerDefTables to Tables 2020-03-31 23:19:50 +00:00
Jonas Schievink
c7d9d89e9b Hide task_context when lowering body 2020-04-01 00:41:40 +02:00
Dylan DPC
8310320ebd
Rollup merge of #70632 - tspiteri:vec-new, r=sfackler
expand vec![] to Vec::new()

The current expansion of `vec![]` calls `into_vec` on a boxed slice, which results in longer IR, and even after optimization, some unwinding artifacts are still present in the IR. This PR uses `Vec::new()` for `vec![]`.

This also allows `vec![]` to be used in const expressions.
2020-04-01 00:27:26 +02:00
Dylan DPC
0979a2871c
Rollup merge of #70630 - ehuss:update-books, r=ehuss
Update books.

## reference

2 commits in e2f11fe4d6a5ecb471c70323197da43c70cb96b6..89dd146154474559536d5d4049a03831c501deea
2020-03-10 06:59:24 +0100 to 2020-03-31 09:42:10 -0700
- Clarify rule for end-of-line backslashes in strings (rust-lang-nursery/reference#784)
- Fix and clarify section on re-export (rust-lang-nursery/reference#780)

## book

1 commits in 6fb3705e5230311b096d47f7e2c91f9ce24393d0..c8841f2841a2d26124319ddadd1b6a245f9a1856
2020-02-12 13:48:57 -0500 to 2020-03-22 09:07:01 -0500
- Fix broken front_of_house.rs test on nightly. (rust-lang/book#2289)

## rust-by-example

7 commits in cb369ae95ca36b841960182d26f6d5d9b2e3cc18..edd2a7e687358712608896730c083cb76c7b401a
2020-03-14 12:13:22 -0500 to 2020-03-30 09:37:29 -0300
- feat: add doc attributes section to documentation (rust-lang/rust-by-example#1323)
- feat: add playpen topic (rust-lang/rust-by-example#1324)
- feat: add sentence about rustdoc & std library (rust-lang/rust-by-example#1322)
- fix: make spelling/style of rustdoc consistent (rust-lang/rust-by-example#1321)
- Rewrite section on 'static lifetime. (rust-lang/rust-by-example#1320)
- Remove deprecated `std::error::Error` functions and other minor changes (rust-lang/rust-by-example#1319)
- Remove mdbook version flags from README (rust-lang/rust-by-example#1318)

## nomicon

1 commits in 9f797e65e6bcc79419975b17aff8e21c9adc039f..411197b0e77590c967e37e8f6ec681abd359afe8
2020-03-04 03:45:13 +0100 to 2020-03-31 20:46:09 +0200
- Fix negative_impls feature. (rust-lang-nursery/nomicon#205)
2020-04-01 00:27:25 +02:00
Dylan DPC
ddcc281e89
Rollup merge of #70605 - Amanieu:pthread_msvcrt, r=varkor
Add missing -lmsvcrt on mingw after -lpthread

Fixes #70316
2020-04-01 00:27:23 +02:00
Dylan DPC
81f19ec909
Rollup merge of #70556 - Centril:fix-70552, r=estebank
parse_and_disallow_postfix_after_cast: account for `ExprKind::Err`.

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

r? @estebank
cc @daboross
2020-04-01 00:27:22 +02:00
Dylan DPC
8993358e77
Rollup merge of #70081 - lcnr:issue68387, r=varkor
add `unused_braces` lint

Add the lint `unused_braces` which is warn by default.

`unused_parens` is also extended and now checks anon consts.

closes #68387

r? @varkor
2020-04-01 00:27:20 +02:00
Dylan DPC
718ba0d23b
Rollup merge of #68770 - ssomers:btree_drain_filter, r=Amanieu
BTreeMap/BTreeSet: implement drain_filter

Provide an implementation of drain_filter for BTreeMap and BTreeSet. Should be optimal when the predicate picks only elements in leaf nodes with at least MIN_LEN remaining elements, which is a common case, at least when draining only a fraction of the map/set, and also when the predicate picks elements stored in internal nodes where the right subtree can easily let go of a replacement element.

The first commit adds benchmarks with an external, naive implementation. to compare how much this claimed optimality-in-some-cases is actually worth.
2020-04-01 00:27:18 +02:00
Vytautas Astrauskas
753bc7ddf8 Inline start_thread into its callers. 2020-03-31 15:15:14 -07:00
Santiago Pastorino
b46754ea99
Use Place directly in apply_call_return_effect on framework/tests, it's Copy 2020-03-31 18:49:24 -03:00
Santiago Pastorino
017608f5d2
Use Place directly in codegen_place_to_pointer, it's Copy 2020-03-31 17:37:55 -03:00
Santiago Pastorino
a865e779b0
Use Place directly in evaluate_array_len, it's Copy 2020-03-31 17:37:55 -03:00
Santiago Pastorino
1f5338cfd6
Use Place directly in codegen_transmute, it's Copy 2020-03-31 17:37:54 -03:00
Santiago Pastorino
5f8a6edbbb
Use Place directly on make_return_dest, it's Copy 2020-03-31 17:37:53 -03:00
Santiago Pastorino
afcd7fc51d
Use Place directly on codegen_drop_terminator, it's Copy 2020-03-31 17:37:52 -03:00
Santiago Pastorino
017620fdfc
Use Place directly in peek_at, it's Copy 2020-03-31 17:37:51 -03:00
Santiago Pastorino
947c1dcf92
Use Place directly on place_contents_drop_state_cannot_differ, it's Copy 2020-03-31 17:37:50 -03:00
Santiago Pastorino
5987b0f8be
Use Place directly in place_as_reborrow, it's Copy 2020-03-31 17:37:48 -03:00
Santiago Pastorino
f37d2b8a63
Use Place directly in librustc_mir_build, it's Copy 2020-03-31 17:37:24 -03:00
Trevor Spiteri
4d8273dea5 expand vec![] to Vec::new() 2020-03-31 21:37:13 +02:00
Vytautas Astrauskas
64e5327b6e Fix double-free and undefined behaviour in libstd::syn::unix::Thread::new. 2020-03-31 12:24:08 -07:00
Eric Huss
388f61b7f7 Update cargo 2020-03-31 12:15:13 -07:00
Eric Huss
722d3d8ef0 Update books. 2020-03-31 11:53:48 -07:00
Thomas de Zeeuw
33a49993b4 Add io::Write::write_all_vectored
Similar to io::Write::write_all but uses io::Write::write_vectored
instead.
2020-03-31 20:22:09 +02:00
Pietro Albini
824dcd424f
ci: disable cancel-outdated-builds for the try branch
While for auto, try and PR builds we only want the latest commit to be
tested, that's not true for try builds: each commit pushed to the branch
is a different PR being tested, and we want multiple PRs to be tested in
parallel if there is enough demand.

Fixes #70569
2020-03-31 19:49:36 +02:00
Santiago Pastorino
6a95bf884f
Use Place directly on Operand::place and friends, it's Copy 2020-03-31 14:45:07 -03:00
Santiago Pastorino
890b39381f
Use Place directly, it's Copy even more use cases 2020-03-31 14:45:05 -03:00
Santiago Pastorino
25528c1e28
Use Place directly, it's Copy more use cases 2020-03-31 14:44:01 -03:00
Santiago Pastorino
760bca4f5b
Use Place directly on check_mut_borrowing_layout_constrained_field, it's Copy 2020-03-31 14:44:00 -03:00
Santiago Pastorino
32a761809b
Use Place directly on remove_never_initialized_mut_locals, it's Copy 2020-03-31 14:43:58 -03:00
Santiago Pastorino
a67b28a96e
Use Place directly on borrow_of_local_data, it's Copy 2020-03-31 14:42:21 -03:00
Santiago Pastorino
f026441e32
Use Place directly on propagate_closure_used_mut_place, it's Copy 2020-03-31 14:42:21 -03:00
Santiago Pastorino
d45dca390c
Use Place directly, it's Copy 2020-03-31 14:42:20 -03:00
Dylan DPC
59809bc4c1
Rollup merge of #70614 - RalfJung:cons-prop-reloc, r=wesleywiser
remove unnecessary relocation check in const_prop

Unnecessary as per https://github.com/rust-lang/rust/issues/70356#issuecomment-606615292

Fixes https://github.com/rust-lang/rust/issues/70356
r? @oli-obk Cc @wesleywiser
2020-03-31 19:29:35 +02:00
Dylan DPC
6248b59316
Rollup merge of #70606 - GuillaumeGomez:cleanup-e0466, r=Dylan-DPC
Clean up E0466 explanation

r? @Dylan-DPC
2020-03-31 19:29:33 +02:00
Dylan DPC
b9546075ac
Rollup merge of #70600 - danielframpton:aarch64-windows-tests, r=alexcrichton
Ensure there are versions of test code for aarch64 windows

Remove the `cfg` flags that were preventing some tests from running on `aarch64-pc-windows-msvc`.

All the existing `target_os = windows` targets had the same `align()` and `size()` values, so this change just removes the `target_arch` flags.

r? @alexcrichton
2020-03-31 19:29:31 +02:00
Dylan DPC
0203ad2195
Rollup merge of #70268 - tmiasko:sanitizer-docs, r=steveklabnik
Document ThreadSanitizer in unstable-book
2020-03-31 19:29:29 +02:00
Dylan DPC
3e31006f3c
Rollup merge of #69458 - Luro02:master, r=GuillaumeGomez,ollie27
improve folder name for persistent doc tests

This fixes #69411, by using the entire path as folder name and storing already visited paths in a HashMap + appending a number to the file name for duplicates.
2020-03-31 19:29:28 +02:00
Dylan DPC
f62cfa76c5
Rollup merge of #69425 - lcnr:make_contiguous, r=Amanieu
add fn make_contiguous to VecDeque

Adds the following method to VecDeque:

```rust
pub fn make_contiguous(&mut self) -> &mut [T];
```

Taken from https://github.com/rust-lang/rust/pull/69400, after a suggestion by @CryZe https://github.com/rust-lang/rust/pull/69400#issuecomment-590216089

I am in favor of merging this instead of https://github.com/rust-lang/rust/pull/69400.
2020-03-31 19:29:26 +02:00
Pietro Albini
0110634c83
cargotest: remove webrender
The current webrender commit occasionally fails without a reason, and
the latest webrender commit is missing a dependency on our Windows
builders. It's not worth installing an extra dependency for cargotest,
and the spurious failure makes keeping this test not worth it.
2020-03-31 19:28:06 +02:00
Bastian Kauschke
bab327c725 update unused_braces wording 2020-03-31 19:01:49 +02:00
Bastian Kauschke
bcf35b1d80 add tests for unused_braces 2020-03-31 19:01:49 +02:00
Bastian Kauschke
698b20eeda update tests 2020-03-31 19:01:49 +02:00
Bastian Kauschke
21c5ccab10 fix internal lint fallout 2020-03-31 19:01:48 +02:00
Ralf Jung
96deb950ac const backtrace: do not skip first frame 2020-03-31 17:58:14 +02:00
Ralf Jung
ad74480cb2 avoid an unreachable fallback 2020-03-31 17:58:14 +02:00
Bastian Kauschke
e1afd26c52 fix docs 2020-03-31 16:50:06 +02:00
Russell Cohen
55a5eea763 Fix tests to handle debug_assert 2020-03-31 10:27:07 -04:00
Michael Woerister
408e6e3dbd Add a test case for incremental + codegen-units interaction. 2020-03-31 16:23:28 +02:00
Michael Woerister
1e5b4594e1 Make the rustc respect the -C codegen-units flag in incremental mode.
Before this commit `-C codegen-units` would just get silently be
ignored if `-C incremental` was specified too. After this commit
one can control the number of codegen units generated during
incremental compilation. The default is rather high at 256, so most
crates won't see a difference unless explicitly opting into a lower
count.
2020-03-31 16:11:16 +02:00
Mazdak Farrokhzad
976f8d59dd
Rollup merge of #70613 - matthiaskrgr:cl5ppy_squashed, r=Centril
more clippy fixes

* use is_empty() instead of len comparison (clippy::len_zero)
* use if let instead of while let loop that never loops (clippy::never_loop)
* remove redundant returns (clippy::needless_return)
* remove redundant closures (clippy::redundant_closure)
* use if let instead of match and wildcard pattern (clippy::single_match)
* don't repeat field names redundantly (clippy::redundant_field_names)

r? @Centril
2020-03-31 15:59:52 +02:00
Mazdak Farrokhzad
4aeeb81db5
Rollup merge of #70588 - Coder-256:str-split-at-docs, r=Dylan-DPC
Fix incorrect documentation for `str::{split_at, split_at_mut}`

The documentation for each method currently states:

> Panics if `mid` is not on a UTF-8 code point boundary, or if it is beyond the last code point of the string slice.

However, this is not consistent with the real behavior, or that of the corresponding methods for `[T]` slices. A comment inside each of the `str` methods states:

> is_char_boundary checks that the index is in [0, .len()]

That is what I would expect the behavior to be, and in fact this seems to be the real behavior. For example ([playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=8e03dcc209d4dd176df2297523f9fee1)):

```rust
fn main() {
    // Prints ("abc", "") and doesn't panic
    println!("{:?}", "abc".split_at(3));
}
```

In this case, I would interpret "the last code point of the string slice" to mean the byte at index 2 in UTF-8. However, it is possible to pass an index of 3, which is definitely "beyond the last code point of the string slice".

I think that this is much clearer, but feel free to bikeshed.
2020-03-31 15:59:50 +02:00
Mazdak Farrokhzad
cd4d1c7f6d
Rollup merge of #70585 - alexcrichton:fix-wasi-align-alloc, r=Mark-Simulacrum
std: Fix over-aligned allocations on wasm32-wasi

The wasm32-wasi target delegates its malloc implementation to the
functions in wasi-libc, but the invocation of `aligned_alloc` was
incorrect by passing the number of bytes requested first rather than the
alignment. This commit swaps the order of these two arguments to ensure
that we allocate over-aligned memory correctly.
2020-03-31 15:59:47 +02:00
Mazdak Farrokhzad
3ef70fe156
Rollup merge of #70562 - lcnr:const-arr_len, r=Centril
infer array len from pattern

closes #70529

This still errors in the following case

```rust
#![feature(const_generics)]
fn arr<const N: usize>() -> [u8; N] {
    todo!()
}

fn main() {
    match arr() {
        [5, ..] => (),
        //~^ ERROR cannot pattern-match on an array without a fixed length
        [_, _] => (),
    }
}
```
Considering that this should be rare and is harder to implement I would merge this PR without *fixing* the above.
2020-03-31 15:59:46 +02:00
Mazdak Farrokhzad
38cd294ed5
Rollup merge of #70561 - tshepang:obsolete-comment, r=petrochenkov
remove obsolete comment

Made obsolete by b5e35b128e
2020-03-31 15:59:44 +02:00
Mazdak Farrokhzad
65b85a571e
Rollup merge of #70555 - Centril:fix-70549, r=petrochenkov
resolve, `try_resolve_as_non_binding`: use `delay_span_bug` due to parser recovery

Fixes #70549

r? @petrochenkov
2020-03-31 15:59:43 +02:00
Mazdak Farrokhzad
cbe3266c65
Rollup merge of #70548 - Ersikan:master, r=GuillaumeGomez
Add long error code for error E0226

Added a long description message for error E0226, which previously did not exist.
As requested in issue #61137

r? @GuillaumeGomez
2020-03-31 15:59:41 +02:00
Mazdak Farrokhzad
9ee373fd94
Rollup merge of #69784 - benesch:fast-strip-prefix-suffix, r=kennytm
Optimize strip_prefix and strip_suffix with str patterns

As mentioned in https://github.com/rust-lang/rust/issues/67302#issuecomment-585639226.
I'm not sure whether adding these methods to `Pattern` is desirable—but they have default implementations so the change is backwards compatible. Plus it seems like they're slated for wholesale replacement soon anyway? #56345

----

Constructing a Searcher in strip_prefix and strip_suffix is
unnecessarily slow when the pattern is a fixed-length string. Add
strip_prefix and strip_suffix methods to the Pattern trait, and add
optimized implementations of these methods in the str implementation.
The old implementation is retained as the default for these methods.
2020-03-31 15:59:40 +02:00
Ana-Maria Mihalache
f259470da3 rustc_target::abi: rename FieldPlacement to FieldsShape. 2020-03-31 13:44:52 +00:00
Bastian Kauschke
b5223d2725 update VecDeque::as_(mut)_slice docs 2020-03-31 15:39:56 +02:00
Ralf Jung
afe1ffb190 remove unnecessary relocation check in const_prop 2020-03-31 15:27:45 +02:00
Matthias Krüger
08f2904dfa more clippy fixes
use is_empty() instead of len comparison (clippy::len_zero)
use if let instead of while let loop that never loops (clippy::never_loop)
remove redundant returns (clippy::needless_return)
remove redundant closures (clippy::redundant_closure)
use if let instead of match and wildcard pattern (clippy::single_match)
don't repeat field names redundantly (clippy::redundant_field_names)
2020-03-31 15:20:05 +02:00
Guillaume Gomez
194a3718ab Clean up E0466 explanation 2020-03-31 13:55:58 +02:00
Luro02
2e40ac7961
improve folder name for persistent doc tests 2020-03-31 13:47:37 +02:00
Amanieu d'Antras
1ae3b5022b Add missing -lmsvcrt on mingw after -lpthread
Fixes #70316
2020-03-31 12:27:09 +01:00
Ralf Jung
6073c7745e bump Miri 2020-03-31 09:16:59 +02:00
Ben Wolsieffer
55bdb61b48 Deduplicate crosstool-ng.sh 2020-03-30 20:09:45 -04:00
Josh Stone
6067315d58 Ensure LLVM is in the link path for "fulldeps" tests
This is a follow-up to #70123, which added `llvm-config --libdir` to the
`LIBRARY_PATH` for rustc tools. We need the same for "run-make-fulldeps"
and "ui-fulldeps" tests which depend on compiler libraries, implicitly
needing to link to `-lLLVM` as well.
2020-03-30 15:40:56 -07:00
Wesley Wiser
097e9e528f Add can_unwind field to FnAbi
This is a pure refactoring with no behavior changes.
2020-03-30 17:54:06 -04:00
Ralf Jung
d8a0600f56 remove a dead parameter that everyone sets to None 2020-03-30 23:08:21 +02:00
Ralf Jung
a1a583b3a2 stop unnecessarily passing around span argument for Miri function calls 2020-03-30 22:54:15 +02:00
Ralf Jung
abe143abf1 remove caller span from Miri stack frame 2020-03-30 22:17:59 +02:00
Jacob Greenfield
fcab1f947b
Fix incorrect documentation for str::{split_at, split_at_mut} 2020-03-30 15:48:52 -04:00
Jonas Schievink
fd8f8189d3 Format 2020-03-30 21:40:53 +02:00
Alex Crichton
ab2998bac3 std: Fix over-aligned allocations on wasm32-wasi
The wasm32-wasi target delegates its malloc implementation to the
functions in wasi-libc, but the invocation of `aligned_alloc` was
incorrect by passing the number of bytes requested first rather than the
alignment. This commit swaps the order of these two arguments to ensure
that we allocate over-aligned memory correctly.
2020-03-30 12:30:06 -07:00
Ralf Jung
39e189d3bd bless tests 2020-03-30 20:26:48 +02:00
Ralf Jung
2117817cfd Miri stacktrace: record span inside frame, not call-site span 2020-03-30 20:15:56 +02:00
Felix S. Klock II
0c4ad1fda6 Fix #69841 by updating LLVM submodule. Includes regression test for issue 69841. 2020-03-30 14:10:39 -04:00
bors
2113659479 Auto merge of #70574 - matthiaskrgr:submodule_upd, r=Centril
submodules: update clippy from 70b93aab to e170c849

Changes:
````
rustup  https://github.com/rust-lang/rust/pull/70536
Rustup to https://github.com/rust-lang/rust/pull/70449
readme: move "how to run single lint" instructions to "Allowing/denying lints" section.
git attribute macros not allowed in submodules
Deprecate REPLACE_CONSTS lint
Bump itertools
````

Fixes #70554
2020-03-30 17:54:18 +00:00
Jonas Schievink
12d9f4efaf Assert that the trait ref does not need inference 2020-03-30 19:48:32 +02:00
Jonas Schievink
b00ba382e0 Use query instead of impl_is_default fn 2020-03-30 19:48:32 +02:00
Jonas Schievink
e8910f51d8 Sync Instance::resolve with the projection code 2020-03-30 19:46:15 +02:00
Jonas Schievink
103771ce57 Add a test 2020-03-30 19:44:21 +02:00
Jonas Schievink
49ba323c8d spec. graph: track defining and finalizing impls 2020-03-30 19:44:21 +02:00
Jonas Schievink
a1e7495a41 Simplify NodeItem
The generic parameter is unused, and so is `map`
2020-03-30 19:38:26 +02:00
Bastian Kauschke
a3df1db8ee update tests, improve variable names 2020-03-30 19:34:16 +02:00
Bastian Kauschke
40c5eefdcd add test for array len inference 2020-03-30 19:13:47 +02:00
Bastian Kauschke
7f12561135
dedup docs
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2020-03-30 19:09:59 +02:00
Julien Philippon
32103b127f Correct long error message according to reviews 2020-03-30 19:02:01 +02:00
Tomasz Miąsko
6582299cdd Document ThreadSanitizer in unstable-book 2020-03-30 18:45:01 +02:00
Russell Cohen
20e21902bb Clean up redudant conditions and match exprs 2020-03-30 12:39:40 -04:00
Bastian Kauschke
50ab77384e infer arr len from pattern 2020-03-30 18:13:14 +02:00
Matthias Krüger
eef8e4814a submodules: update clippy from 70b93aab to e170c849
Changes:
````
rustup  https://github.com/rust-lang/rust/pull/70536
Rustup to https://github.com/rust-lang/rust/pull/70449
readme: move "how to run single lint" instructions to "Allowing/denying lints" section.
git attribute macros not allowed in submodules
Deprecate REPLACE_CONSTS lint
Bump itertools
````

Fixes #70554
2020-03-30 17:58:14 +02:00
Nikhil Benesch
ac478f2f61
Optimize strip_prefix and strip_suffix with str patterns
Constructing a Searcher in strip_prefix and strip_suffix is
unnecessarily slow when the pattern is a fixed-length string. Add
strip_prefix and strip_suffix methods to the Pattern trait, and add
optimized implementations of these methods in the str implementation.
The old implementation is retained as the default for these methods.
2020-03-30 11:10:21 -04:00
Dylan DPC
aaa8aa3181
Rollup merge of #70567 - JOE1994:patch-3, r=Centril
Fix broken link in README

Fix broken link to `rustc-dev-guide` section for `codegen`
2020-03-30 16:24:52 +02:00
Dylan DPC
298a89bff3
Rollup merge of #70559 - RalfJung:btree-test-miri, r=Mark-Simulacrum
fix BTreeMap test compilation with Miri

This got broken by https://github.com/rust-lang/rust/pull/70506
2020-03-30 16:24:51 +02:00
Dylan DPC
b99db6ee10
Rollup merge of #70546 - lqd:polonius_update, r=nikomatsakis
Polonius: update to 0.12.1, fix more move errors false positives, update test expectations

This PR:
- updates `polonius-engine` to version 0.12.1 to fix some move errors false positives
- fixes a fact generation mistake creating the other move errors false positives
- updates the test expectations for the polonius compare-mode so that all (minus the 2 OOMs) ui tests pass again (matching the [analysis doc](https://hackmd.io/CjYB0fs4Q9CweyeTdKWyEg?view) starting at case 34)

In my opinion, this is safe to rollup.

r? @nikomatsakis
2020-03-30 16:24:49 +02:00
Dylan DPC
47ffca296a
Rollup merge of #70479 - RalfJung:win-env, r=Mark-Simulacrum
avoid creating unnecessary reference in Windows Env iterator

Discovered in https://github.com/rust-lang/miri/pull/1225: the Windows `Env` iterator violates Stacked Borrows by creating an `&u16`, turning it into a raw pointer, and then accessing memory outside the range of that type.

There is no need to create a reference here in the first place, so the fix is trivial.
Cc @JOE1994
Cc https://github.com/rust-lang/unsafe-code-guidelines/issues/134
2020-03-30 16:24:44 +02:00
Youngsuk Kim
60e7473bdf
Fix broken link in README 2020-03-30 10:09:51 -04:00
Tshepang Lekhonkhobe
d6f71f0c9a remove obsolete comment
Made obsolete by b5e35b128e
2020-03-30 13:38:17 +02:00
Ralf Jung
5bbaac357d fix and test aliasing in swap_remove 2020-03-30 13:34:03 +02:00
Ralf Jung
8f479e362f fix aliasing in remove()
also add smoke test to detect relocation even in rustc runs
2020-03-30 13:24:55 +02:00
Mazdak Farrokhzad
9f86d28537 try_resolve_as_non_binding: span_bug -> delay_span_bug 2020-03-30 13:23:26 +02:00
Ralf Jung
4eacf45c9c also cover next() path of draining iterators 2020-03-30 13:01:15 +02:00
Ralf Jung
3411ade32e test more mutating vector methods 2020-03-30 12:24:02 +02:00
Ralf Jung
032d3cd553 fix BTreeMap test compilation with Miri 2020-03-30 12:04:05 +02:00
Ralf Jung
4393923168 add some tests 2020-03-30 11:58:16 +02:00
Ralf Jung
fa6c883074 fix ptr invalidation in Vec::truncate 2020-03-30 11:58:16 +02:00
Ralf Jung
86c1c43420 fix pointer invalidation when extnding a vector from an untrusted iterator 2020-03-30 11:58:16 +02:00
Ralf Jung
6556549fa6 fix Vec::extend invalidating unrelated pointers 2020-03-30 11:58:16 +02:00
Matthias Krüger
9bba047c2e Use if let instead of match when only matching a single variant (clippy::single_match)
Makes code more compact and reduces nestig.
2020-03-30 10:52:29 +02:00
Mazdak Farrokhzad
96d7353678 parse_and_disallow_postfix_after_cast: account for ExprKind::Err. 2020-03-30 09:55:57 +02:00
Stefan Lankes
9f6b96e461 move the definition of thread priorities to hermit-abi 2020-03-30 07:39:57 +02:00
Mazdak Farrokhzad
2a92839147 rustc -> rustc_middle part 5 -- fix tests 2020-03-30 07:21:44 +02:00
Mazdak Farrokhzad
39f06255d2 rustc -> rustc_middle part 4 -- pacify tidy 2020-03-30 07:19:55 +02:00
Mazdak Farrokhzad
1ccb0b4a02 rustc -> rustc_middle part 3 (rustfmt) 2020-03-30 07:19:55 +02:00
Stefan Lankes
6c80bdb388 reorder imports to pass the format check 2020-03-30 07:17:00 +02:00
Mazdak Farrokhzad
0cb9e36090 rustc -> rustc_middle part 2 2020-03-30 07:16:56 +02:00
Stefan Lankes
412083469e minor changes to pass the format check 2020-03-30 07:05:35 +02:00
Mazdak Farrokhzad
7710f2dd5c rustc -> rustc_middle part 1 2020-03-30 07:02:56 +02:00
Stefan Lankes
415aff0516 move OS constants to platform crate 2020-03-30 06:49:17 +02:00
bors
0afdf43dc1 Auto merge of #70449 - ecstatic-morse:visit-body, r=oli-obk
Make `Visitor::visit_body` take a plain `&Body`

`ReadOnlyBodyAndCache` has replaced `&Body` in many parts of the code base that don't care about basic block predecessors. This includes the MIR `Visitor` trait, which I suspect resulted in many unnecessary changes in #64736. This reverts part of that PR to reduce the number of places where we need to pass a `ReadOnlyBodyAndCache`.

In the long term, we should either give `ReadOnlyBodyAndCache` more ergonomic name and replace all uses of `&mir::Body` with it at the cost of carrying an extra pointer everywhere, or use it only in places that actually need access to the predecessor cache. Perhaps there is an even nicer alternative.

r? @Nashenas88
2020-03-30 02:04:00 +00:00
Julien Philippon
8f7eb6229c Add long error code for error E0226 2020-03-30 02:51:25 +02:00
Remy Rakic
5af11d261d bless output of ui test nll/user-annotations/closure-substs.rs
Trivial diagnostics grammar change
2020-03-30 01:30:26 +02:00
Remy Rakic
82424634a3 bless output of ui test impl-trait/multiple-lifetimes/error-handling.rs
Some impl Trait fixes lead to locating more accurately the cause of
a universal region error with a user annotation
2020-03-30 01:28:27 +02:00
Remy Rakic
fcd12bd2f4 bless output of ui test closures/closure-expected-type/expect-region-supply-region.rs
trivial diagnostics grammar change
2020-03-30 01:24:52 +02:00
Remy Rakic
c73d5db21f bless output of ui test nll/outlives-suggestion-simple.rs
trivial diagnostics wording change
2020-03-30 01:22:59 +02:00
Remy Rakic
2a7644746b bless output of ui test hrtb/hrtb-perfect-forwarding.rs
trivial formatting changes
2020-03-30 01:18:27 +02:00
Remy Rakic
860f71f141 Polonius fact generation: fix path access fact location
This will fix the other move errors false positives:
emitting the fact at the start point caused accesses to be at the
same point as an initialization fact of the return place of a call
on the following block, which emitted an error.
2020-03-30 01:13:03 +02:00
bors
4911572b2d Auto merge of #70009 - estebank:sugg-bound, r=Centril
Tweak `suggest_constraining_type_param`

Some of the bound restriction structured suggestions were incorrect while others had subpar output.

The only issue left is a suggestion for an already present bound when dealing with `const`s that should be handled independently.

Fix #69983.
2020-03-29 22:50:59 +00:00
Dylan MacKenzie
538cdef64b Use & to do deref coercion for ReadOnlyBodyAndCache 2020-03-29 13:30:26 -07:00
Esteban Küber
2c71894657 Tweak suggest_constraining_type_param
Some of the bound restriction structured suggestions were incorrect
while others had subpar output.
2020-03-29 13:13:17 -07:00
Dylan DPC
800ed0cd5d
Rollup merge of #70541 - lcnr:patch-1, r=varkor
prohibit_generics: update has_err for consts

r? @eddyb
2020-03-29 21:23:55 +02:00
Dylan DPC
1bf4873aac
Rollup merge of #70540 - jonas-schievink:link-attr-template, r=varkor
#[link]: mention wasm_import_module instead of cfg

`#[link(cfg)]` is perma-unstable and is not documented anywhere else. It makes more sense to mention `wasm_import_module` here since it's stable.

This makes it harder to hit https://github.com/rust-lang/rust/issues/70538 (if it weren't for this text, I wouldn't even know this feature existed).
2020-03-29 21:23:53 +02:00
Dylan DPC
5a7b377b6f
Rollup merge of #70539 - DutchGhost:test-62220, r=Dylan-DPC
add test for 62220

Closes #62220

Adds a test for https://github.com/rust-lang/rust/issues/62220.

Im not sure whether `check-pass` is sufficient here. I didn't put `run-pass` in, as I'm afraid that'll fail due to the `unimplemented!()` return in the code.
2020-03-29 21:23:52 +02:00
Dylan DPC
d009ce441f
Rollup merge of #69702 - anyska:tylayout-rename, r=oli-obk
Rename TyLayout to TyAndLayout.
2020-03-29 21:23:50 +02:00
Dylan MacKenzie
b641e9e358 Make Visitor::visit_body take a simple Body 2020-03-29 11:56:36 -07:00
Esteban Küber
e84cb65fe1 review comment: wording 2020-03-29 11:46:00 -07:00
Esteban Küber
c2e0e71a09 Suggest correct order for arguments when encountering early constraints
When encountering constraints before type arguments or lifetimes,
suggest the correct order.
2020-03-29 11:31:58 -07:00
Bastian Kauschke
8b762c5537
prohibit_generics: update has_err for consts 2020-03-29 18:34:42 +02:00
Dodo
61d419314f add a build-pass test for issue 62220 2020-03-29 18:27:54 +02:00
Russell Cohen
bceab25d6c Cleanup match expression 2020-03-29 12:02:28 -04:00
Jonas Schievink
042f4941e7 #[link]: mention wasm_import_module instead of cfg 2020-03-29 17:40:04 +02:00
Russell Cohen
82b2989ae0 More raw string tests 2020-03-29 11:34:15 -04:00
Russell Cohen
c15f86b4b3 Cleanup error messages, improve docstrings 2020-03-29 11:12:48 -04:00
Mazdak Farrokhzad
b851591731
Rollup merge of #70527 - Amanieu:fix_fastisel, r=Mark-Simulacrum
Update LLVM submodule

Fixes #70148
2020-03-29 16:48:24 +02:00
Mazdak Farrokhzad
b4491e50d5
Rollup merge of #70526 - Centril:less-attr, r=eddyb
reduce `rustc_attr` usage in places

This cleans up some unused `rustc_attr` dependencies.
2020-03-29 16:48:23 +02:00
Mazdak Farrokhzad
8212a1c7dc
Rollup merge of #70140 - Nemo157:result-flatten, r=Amanieu
Add Result<Result<T, E>, E>::flatten -> Result<T, E>

This PR makes this possible (modulo type inference):

```rust
assert_eq!(Ok(6), Ok(Ok(6)).flatten());
```

Tracking issue: #70142

<sub>largely cribbed directly from <https://github.com/rust-lang/rust/pull/60256></sub>
2020-03-29 16:48:21 +02:00
Mark Rousskov
56147219a5 Stabilize float::to_int_unchecked
This renames and stabilizes unsafe floating point to integer casts, which are
intended to be the substitute for the currently unsound `as` behavior, once that
changes to safe-but-slower saturating casts.
2020-03-29 10:27:07 -04:00
Stein Somers
0405db3a34 BTreeMap/BTreeSet: implement and test drain_filter 2020-03-29 16:05:53 +02:00
Stein Somers
a6cae3d5cf Add benchmarks of drain_filter-like behaviour 2020-03-29 16:05:53 +02:00
Amanieu d'Antras
4a4314e3e7 Update LLVM submodule 2020-03-29 11:12:55 +01:00
Mazdak Farrokhzad
59a69708e1 reduce rustc_attr usage in places 2020-03-29 12:01:11 +02:00
Tim Diekmann
c49f28005d Fix links for AllocInit methods 2020-03-29 12:00:51 +02:00
Tim Diekmann
fcd7092ae1 Revert "Fix links for AllocInit methods"
This reverts commit d241db2d4e.
2020-03-29 11:57:25 +02:00
Mazdak Farrokhzad
f31e56309a
Rollup merge of #70506 - ssomers:btreemap_testing_consts, r=RalfJung
BTreeMap testing: introduce symbolic constants and use height consistently

Doesn't change what or how much is tested, except for some exact integer types, just for convenience and because `node::CAPACITY` is a usize.

r? @RalfJung
2020-03-29 11:50:13 +02:00
Mazdak Farrokhzad
873bf46dc1
Rollup merge of #70101 - tmiasko:intrinsics-copy, r=eddyb
Add copy bound to atomic & numeric intrinsics
2020-03-29 11:50:12 +02:00
Mazdak Farrokhzad
c51fcb5f38
Rollup merge of #68692 - jyn514:vec-from-array, r=LukasKalbertodt
impl From<[T; N]> for Vec<T>

Closes https://github.com/rust-lang/rust/issues/67963
2020-03-29 11:50:10 +02:00
bors
8045865873 Auto merge of #70370 - petrochenkov:nosmatch, r=Centril
Remove attribute `#[structural_match]` and any references to it

A small remaining part of https://github.com/rust-lang/rust/issues/63438.
2020-03-29 06:33:42 +00:00
Russell Cohen
629e97a5a0 Improve error messages for raw strings (#60762)
This diff improves error messages around raw strings in a few ways:
- Catch extra trailing `#` in the parser. This can't be handled in the lexer because we could be in a macro that actually expects another # (see test)
- Refactor & unify error handling in the lexer between ByteStrings and RawByteStrings
- Detect potentially intended terminators (longest sequence of "#*" is suggested)
2020-03-29 00:43:43 -04:00
Tim Diekmann
d241db2d4e Fix links for AllocInit methods 2020-03-29 03:16:23 +01:00
Tim Diekmann
4309f6d9a1 Minor doc fixes in AllocInit::init 2020-03-29 01:52:21 +01:00
Tim Diekmann
3ade8ae660 Implement init and init_offset on AllocInit and mark it unsafe 2020-03-29 01:47:05 +01:00
Esteban Küber
dcb4e817bc Suggest correct order for args and constraints 2020-03-28 17:45:36 -07:00
Dylan DPC
be8d896a4e
Rollup merge of #70510 - RalfJung:bool-vs-boolean, r=Mark-Simulacrum
fix TryEnterCriticalSection return type

Source: https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-tryentercriticalsection
Fixes https://github.com/rust-lang/rust/issues/70504
2020-03-29 01:32:23 +01:00
Dylan DPC
acc1dc2906
Rollup merge of #70508 - RalfJung:scalar-from, r=eddyb
Miri: use more specialized Scalar::from_ constructors where appropriate
2020-03-29 01:32:22 +01:00
Dylan DPC
96e2934886
Rollup merge of #70503 - RalfJung:null, r=varkor
rename Scalar::{ptr_null -> null_ptr} and add "machine_" prefix like elsewhere

"NULL pointer" is just much more common terminology than "pointer-null".
Also I forgot two methods when renaming all the `Scalar` things to `(to|from)_machine_(u|i)size`.
2020-03-29 01:32:21 +01:00
Dylan DPC
a0d6eedfad
Rollup merge of #70235 - dillona:70182-check-before-using-git, r=Mark-Simulacrum
Validate git setup before accessing functionality

Closes #70182
2020-03-29 01:32:19 +01:00
Dylan DPC
d584f5a386
Rollup merge of #69937 - TyPR124:osstr_ascii, r=dtolnay
ASCII methods on OsStr

Would close #69566

I don't know enough about encodings to know if this is a valid change, however the comment on the issue suggests it could be.

This does two things:

1. Makes ASCII methods available on OsStr

2. Makes it possible to obtain a `&mut OsStr`. This is necessary to actually use `OsStr::make_ascii_*case` methods since they modify the underlying value. As far as I can tell, the only way to modify a `&mut OsStr` is via the methods I just added.

My original hope was to have these methods on `OsStrExt` for Windows, since the standard library already assumes `make_ascii_uppercase` is valid in Windows (see the change I made to windows/process.rs). If it is found these are not valid changes on non-Windows platforms, I can move the methods to the ext trait instead.
2020-03-29 01:32:17 +01:00
TyPR124
271d43b158 add tracking issue 2020-03-28 19:23:49 -04:00
TyPR124
ca4b40348e move doc links for consistency 2020-03-28 18:35:20 -04:00
TyPR124
3781a1a2ac remove unnecessary comments 2020-03-28 18:34:49 -04:00
TyPR124
235700fea0 use make_ascii_uppercase in windows/process.rs 2020-03-28 18:34:49 -04:00
TyPR124
cc584d5166 ascii methods on osstr 2020-03-28 18:34:48 -04:00
Stein Somers
e92d740b35 BTreeMap testing: introduce symbolic constants and refer to height consistently. 2020-03-28 23:30:43 +01:00
Dylan MacKenzie
4d1194c31a Ensure output dir for dataflow results exists 2020-03-28 14:09:34 -07:00
Dylan MacKenzie
c8004027ba Dump graphviz dataflow results with flag 2020-03-28 14:09:12 -07:00
Dylan MacKenzie
edbd7c8602 dump_enabled takes a DefId instead of MirSource 2020-03-28 14:07:07 -07:00
Dylan MacKenzie
4d099e6308 Add -Z dump-mir-dataflow 2020-03-28 14:05:59 -07:00
Esteban Küber
33d793c326 Point at all constraints before args 2020-03-28 13:48:04 -07:00
bors
77621317d6 Auto merge of #66938 - GuillaumeGomez:lint-for-no-crate-level-doc, r=Dylan-DPC
Add lint when no doc is present at the crate-level

Follow-up of #66267.

r? @kinnison
2020-03-28 20:11:01 +00:00
Ralf Jung
38c8ba33ef fix TryEnterCriticalSection return type 2020-03-28 21:10:11 +01:00
Tim Diekmann
bf6a46db31 Make fields in MemoryBlock public 2020-03-28 20:22:07 +01:00
Ralf Jung
bd9e046496 refmt 2020-03-28 19:51:54 +01:00
Ralf Jung
1f53fdc82c get rid of useless back-and-forth cast 2020-03-28 19:40:58 +01:00
Ralf Jung
1a0e69d34f use more specialized Scalar::from_ constructors where appropriate 2020-03-28 19:29:46 +01:00
bors
c52cee172f Auto merge of #70499 - Dylan-DPC:rollup-f9je1l8, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #70418 (Add long error explanation for E0703)
 - #70448 (Create output dir in rustdoc markdown render)
 - #70486 (Shrink Unicode tables (even more))
 - #70493 (Fix rustdoc.css CSS tab-size property)
 - #70495 (Replace last mention of IRC with Discord)

Failed merges:

r? @ghost
2020-03-28 17:15:32 +00:00
Ralf Jung
01dbaeda32 use machine_ prefix for target usize/isize 2020-03-28 17:51:11 +01:00
Ralf Jung
8bad4844b2 rename Scalar::{ptr_null -> null_ptr} 2020-03-28 16:57:33 +01:00
Dylan DPC
e3ccd5ba49
Rollup merge of #70495 - bkaestner:master, r=Mark-Simulacrum
Replace last mention of IRC with Discord

Mozilla's IRC service was shut down in March 2020. The official instant messaging variant has been Discord for a while, and most of the links were already replaced by #61524.

This was the last line that came up with `irc.mozilla.org` or any combination of "irc.*#[a-z]+" in a `git grep`:

    git grep -i -E "irc.*#[a-z]+"

As there is only one other link directly to Rust's discord, I used the same Markdown link `[rust-discord]` as in `bootstrap/README.md` to stay consistent. This might come in handy if the chat platform changes at a later point again.
2020-03-28 15:22:03 +01:00
Dylan DPC
f6111930d2
Rollup merge of #70493 - 0xd4d:rustdoc-tab-size, r=GuillaumeGomez
Fix rustdoc.css CSS tab-size property

This fixes the CSS tab size property names which are called `tab-size` / `-moz-tab-size` and not `tab-width`

Old issue https://github.com/rust-lang/rust/issues/49155 and related PR https://github.com/rust-lang/rust/pull/50947

tab-size: https://developer.mozilla.org/en-US/docs/Web/CSS/tab-size
2020-03-28 15:22:01 +01:00
Dylan DPC
7f1e6261bf
Rollup merge of #70486 - Mark-Simulacrum:unicode-shrink, r=dtolnay
Shrink Unicode tables (even more)

This shrinks the Unicode tables further, building upon the wins in #68232 (the previous counts differ due to an interim Unicode version update, see #69929.

The new data structure is slower by around 3x, on the benchmark of looking up every Unicode scalar value in each data set sequentially in every data set included. Note that for ASCII, the exposed functions on `char` optimize with direct branches, so ASCII will retain the same performance regardless of internal optimizations (or the reverse). Also, note that the size reduction due to the skip list (from where the performance losses come) is around 40%, and, as a result, I believe the performance loss is acceptable, as the routines are still quite fast. Anywhere where this is hot, should probably be using a custom data structure anyway (e.g., a raw bitset) or something optimized for frequently seen values, etc.

This PR updates both the bitset data structure, and introduces a new data structure similar to a skip list. For more details, see the [main.rs] of the table generator, which describes both. The commits mostly work individually and document size wins.

As before, this is tested on all valid chars to have the same results as nightly (and the canonical Unicode data sets), happily, no bugs were found.

[main.rs]: https://github.com/rust-lang/rust/blob/fb4a715e18b/src/tools/unicode-table-generator/src/main.rs

Set             | Previous |  New  |  % of old  | Codepoints | Ranges |
----------------|---------:|------:|-----------:|-----------:|-------:|
Alphabetic      |     3055 |  1599 |        52% |     132875 |    695 |
Case Ignorable  |     2136 |   949 |        44% |       2413 |    410 |
Cased           |      934 |   359 |        38% |       4286 |    141 |
Cc              |       43 |     9 |        20% |         65 |      2 |
Grapheme Extend |     1774 |   813 |        46% |       1979 |    344 |
Lowercase       |      985 |   867 |        88% |       2344 |    652 |
N               |     1266 |   419 |        33% |       1781 |    133 |
Uppercase       |      934 |   777 |        83% |       1911 |    643 |
White_Space     |      140 |    37 |        26% |         25 |     10 |
----------------|----------|-------|------------|------------|--------|
Total           |    11267 |  5829 |        51% |     -      |   -    |
2020-03-28 15:22:00 +01:00
Dylan DPC
bbd3634f5f
Rollup merge of #70448 - TimotheeGerber:rustdoc-create-output-dir, r=GuillaumeGomez
Create output dir in rustdoc markdown render

`rustdoc` command on a standalone markdown document fails because the output directory (which default to `doc/`) is not created, even when specified with the `--output` argument.

This PR adds the creation of the output directory before the file creation to avoid an unexpected error which is unclear.

I am not sure about the returned error code. I did not find a table explaining them. So I simply put the same error code that is returned when `File::create` fails because they are both related to file-system errors.

Resolve #70431
2020-03-28 15:21:58 +01:00
Dylan DPC
1f13089bef
Rollup merge of #70418 - PankajChaudhary5:master, r=Dylan-DPC
Add long error explanation for E0703

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

r? @GuillaumeGomez
2020-03-28 15:21:57 +01:00
bors
e768d6f0bc Auto merge of #70485 - matthiaskrgr:submodule_upd, r=Dylan-DPC
submodules: update clippy from 1ff81c1b to 70b93aab

Changes:
````
remove redundant import
rustup https://github.com/rust-lang/rust/pull/68404
rustup https://github.com/rust-lang/rust/pull/69644
rustup https://github.com/rust-lang/rust/pull/70344
Move verbose_file_reads to restriction
move redundant_pub_crate to nursery
readme: explain how to run only a single lint on a codebase
Remove dependency on `matches` crate
Move useless_transmute to nursery
nursery group -> style
Update for PR feedback
Auto merge of #5314 - ehuss:remove-git2, r=flip1995
Lint for `pub(crate)` items that are not crate visible due to the visibility of the module that contains them
````

Fixes #70456
2020-03-28 14:15:27 +00:00
Benjamin Kästner
dc8a9854d2 Replace last mention of IRC with Discord
Mozilla's IRC service was shut down in March 2020. The official
instant messaging variant has been Discord for a while, and most of
the links were already replaced by #61524.

This was the last line that came up with `irc.mozilla.org` or any
combination of "irc.*#[a-z]+" in a `git grep`:

    git grep -i -E "irc.*#[a-z]+"

As there is only one other link directly to Rust's discord, I used the
same Markdown link `[rust-discord]` as in `bootstrap/README.md` to
stay consistent. This might come in handy if the chat platform changes
at a later point again.

As an aside: for those interested in the use of IRC, Mozilla's [wiki]
still offers a lot of in-depth knowledge.

 [wiki]: https://wiki.mozilla.org/IRC
2020-03-28 12:38:52 +01:00
bors
b9d5ee5676 Auto merge of #70261 - Centril:angle-args-partition, r=varkor
Move arg/constraint partition check to validation & improve recovery

- In the first commit, we move the check rejecting e.g., `<'a, Item = u8, String>` from the parser into AST validation.
- We then use this to improve the code for parsing generic arguments.
- And we add recovery for e.g., `<Item = >` (missing), `<Item = 42>` (constant), and `<Item = 'a>` (lifetime).

This is also preparatory work for supporting https://github.com/rust-lang/rust/issues/70256.

r? @varkor
2020-03-28 11:13:09 +00:00
0xd4d
6d886aff35
Fix rustdoc.css CSS tab-size property 2020-03-28 11:49:12 +01:00
bors
b76238a3ee Auto merge of #70095 - jsgf:link-native, r=nagisa
Implement -Zlink-native-libraries

This implements a flag `-Zlink-native-libraries=yes/no`. If set to true/yes, or unspecified, then
native libraries referenced via `#[link]` attributes will be put on the linker line (ie, unchanged
behaviour).

If `-Zlink-native-libraries=no` is specified then rustc will not add the native libraries to the link
line. The assumption is that the outer build system driving the build already knows about the native
libraries and will specify them to the linker directly (for example via `-Clink-arg=`).

Addresses issue #70093
2020-03-28 08:16:47 +00:00
Russell Cohen
840a5769b0 Move raw string tests into the raw directory 2020-03-27 22:02:18 -04:00
bors
2acf32d9ad Auto merge of #70483 - Centril:rollup-slli4yf, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #70345 (Remove `no_integrated_as` mode.)
 - #70434 (suggest `;` on expr `mac!()` which is good as stmt `mac!()`)
 - #70457 (non-exhastive diagnostic: add note re. scrutinee type)
 - #70478 (Refactor type_of for constants)
 - #70480 (clarify hir_id <-> node_id method names)

Failed merges:

r? @ghost
2020-03-28 00:36:57 +00:00
Mark Rousskov
ad679a7f43 Update the documentation comment 2020-03-27 19:02:23 -04:00
Mark Rousskov
b6bc906004 Remove separate encoding for a single nonzero-mapping byte
In practice, for the two data sets that still use the bitset encoding (uppercase
and lowercase) this is not a significant win, so just drop it entirely. It costs
us about 5 bytes, and the complexity is nontrivial.
2020-03-27 19:02:23 -04:00
Mark Rousskov
9c1ceece20 Add skip list based implementation for smaller encoding
This arranges for the sparser sets (everything except lower and uppercase) to be
encoded in a significantly smaller context. However, it is also a performance
trade-off (roughly 3x slower than the bitset encoding). The 40% size reduction
is deemed to be sufficiently important to merit this performance loss,
particularly as it is unlikely that this code is hot anywhere (and if it is,
paying the memory cost for a bitset that directly represents the data seems
worthwhile).

Alphabetic     : 1599 bytes     (- 937 bytes)
Case_Ignorable : 949 bytes      (- 822 bytes)
Cased          : 359 bytes      (- 429 bytes)
Cc             : 9 bytes        (-  15 bytes)
Grapheme_Extend: 813 bytes      (- 675 bytes)
Lowercase      : 863 bytes
N              : 419 bytes      (- 619 bytes)
Uppercase      : 776 bytes
White_Space    : 37 bytes       (-  46 bytes)
Total table sizes: 5824 bytes   (-3543 bytes)
2020-03-27 19:02:23 -04:00
Matthias Krüger
6e01d0fdad submodules: update clippy from 1ff81c1b to 70b93aab
Changes:
````
remove redundant import
rustup https://github.com/rust-lang/rust/pull/68404
rustup https://github.com/rust-lang/rust/pull/69644
rustup https://github.com/rust-lang/rust/pull/70344
Move verbose_file_reads to restriction
move redundant_pub_crate to nursery
readme: explain how to run only a single lint on a codebase
Remove dependency on `matches` crate
Move useless_transmute to nursery
nursery group -> style
Update for PR feedback
Auto merge of #5314 - ehuss:remove-git2, r=flip1995
Lint for `pub(crate)` items that are not crate visible due to the visibility of the module that contains them
````

Fixes #70456
2020-03-27 23:43:22 +01:00
Bastian Kauschke
b3d744c9f5 add unused_braces, lint anon_const 2020-03-27 22:50:48 +01:00
Bastian Kauschke
e0a08351a2 add visit_anon_const to EarlyContextAndPass 2020-03-27 22:50:48 +01:00
Mazdak Farrokhzad
a023e6121f
Rollup merge of #70480 - lcnr:appayupyup, r=eddyb
clarify hir_id <-> node_id method names

resolves 2 FIXME.

r? @eddyb
2020-03-27 22:39:42 +01:00
Mazdak Farrokhzad
5b68f9c46a
Rollup merge of #70478 - lcnr:refactor-type_of, r=varkor
Refactor type_of for constants

If I have to look at this function for a few hours I want it to at least look good.

r? @varkor
2020-03-27 22:39:41 +01:00
Mazdak Farrokhzad
23d3fa266c
Rollup merge of #70457 - Centril:non-exhaustive-scrutinee-type, r=estebank
non-exhastive diagnostic: add note re. scrutinee type

This fixes https://github.com/rust-lang/rust/issues/67259 by adding a note:
```
    = note: the matched value is of type &[i32]
```
to non-exhaustive pattern matching errors.

r? @varkor @estebank
2020-03-27 22:39:39 +01:00
Mazdak Farrokhzad
cfe1e330b5
Rollup merge of #70434 - Centril:fix-34421, r=estebank
suggest `;` on expr `mac!()` which is good as stmt `mac!()`

Fixes https://github.com/rust-lang/rust/issues/34421 by implementing @jseyfried's suggestion in https://github.com/rust-lang/rust/issues/34421#issuecomment-301578683.

r? @petrochenkov
2020-03-27 22:39:38 +01:00
Mazdak Farrokhzad
08e867cc3a
Rollup merge of #70345 - nnethercote:rm-no_integrated_as, r=alexcrichton
Remove `no_integrated_as` mode.

Specifically, remove both `-Z no_integrated_as` and
`TargetOptions::no_integrated_as`. The latter was only used for the
`msp430_none_elf` platform, for which it's no longer required.

r? @alexcrichton
2020-03-27 22:39:37 +01:00
bors
0bf7c2ad77 Auto merge of #70162 - cjgillot:split_query, r=Zoxc
Move the query system to a dedicated crate

The query system `rustc::ty::query` is split out into the `rustc_query_system` crate.

Some commits are unformatted, to ease rebasing.

Based on #67761 and #69910.

r? @Zoxc
2020-03-27 21:36:51 +00:00
Mazdak Farrokhzad
42c5cfdfda add the label back but make it shorter 2020-03-27 21:52:09 +01:00
Jeremy Fitzhardinge
53c4e0c19a Implement -Zlink-native-libraries
This implements a flag `-Zlink-native-libraries=yes/no`. If set to true/yes, or unspecified, then
native libraries referenced via `#[link]` attributes will be put on the linker line (ie, unchanged
behaviour).

If `-Zlink-native-libraries=no` is specified then rustc will not add the native libraries to the link
line. The assumption is that the outer build system driving the build already knows about the native
libraries and will specify them to the linker directly (for example via `-Clink-arg=`).

Addresses issue #70093
2020-03-27 11:57:05 -07:00
Ana-Maria Mihalache
50d2c3abd5 Rename TyLayout to TyAndLayout. 2020-03-27 17:14:53 +00:00