Commit graph

141403 commits

Author SHA1 Message Date
Esteban Küber
0195f8d375 Hide unnecessary reference to trait
When the problem for a method not being found in its receiver is due to
arbitrary self-types, we don't want to mention importing or implementing
the trait, instead we suggest wrapping.
2021-03-29 20:39:42 -07:00
Cheng XU
974192cd98
Disallow octal format in Ipv4 string
In its original specification, leading zero in Ipv4 string is interpreted
as octal literals. So a IP address 0127.0.0.1 actually means 87.0.0.1.

This confusion can lead to many security vulnerabilities. Therefore, in
[IETF RFC 6943], it suggests to disallow octal/hexadecimal format in Ipv4
string all together.

Existing implementation already disallows hexadecimal numbers. This commit
makes Parser reject octal numbers.

Fixes #83648.

[IETF RFC 6943]: https://tools.ietf.org/html/rfc6943#section-3.1.1
2021-03-30 10:24:23 +08:00
bors
902ca44c19 Auto merge of #83664 - Dylan-DPC:rollup-wx6idpd, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #82331 (alloc: Added `as_slice` method to `BinaryHeap` collection)
 - #83130 (escape_ascii take 2)
 - #83374 (unix: Fix feature(unix_socket_ancillary_data) on macos and other BSDs)
 - #83543 (Lint on unknown intra-doc link disambiguators)
 - #83636 (Add a regression test for issue-82792)
 - #83643 (Remove a FIXME resolved by #73578)
 - #83644 (⬆️ rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-30 01:16:08 +00:00
Esteban Küber
6f2d8a018e Suggest box/pin/arc ing receiver on method calls 2021-03-29 18:14:44 -07:00
Amanieu d'Antras
26d260bfa4 Run LLVM coverage instrumentation passes before optimization passes
This matches the behavior of Clang and allows us to remove several
hacks which were needed to ensure functions weren't optimized away
before reaching the instrumentation pass.
2021-03-30 02:10:28 +01:00
Aman Arora
f2e52fffc2 2229: Produce a rustfix migration suggestion 2021-03-29 19:52:59 -04:00
JohnTitor
edacd0f981 Add a regression test for issue-82865 2021-03-30 07:34:49 +09:00
Dylan DPC
6738ee7d59
Rollup merge of #83644 - lnicola:rust-analyzer-2021-03-29, r=jonas-schievink
⬆️ rust-analyzer
2021-03-30 00:32:25 +02:00
Dylan DPC
fca8e7dd88
Rollup merge of #83643 - JohnTitor:is-freeze-no-longer-uses-span, r=RalfJung
Remove a FIXME resolved by #73578

r? ``@RalfJung``
2021-03-30 00:32:24 +02:00
Dylan DPC
6b5ba539c5
Rollup merge of #83636 - JohnTitor:const-generics-defualts-regg-test, r=lcnr
Add a regression test for issue-82792

Closes #82792

r? ``@lcnr``
2021-03-30 00:32:23 +02:00
Dylan DPC
25ade6910c
Rollup merge of #83543 - camelid:lint-unknown-disambiguator, r=jyn514
Lint on unknown intra-doc link disambiguators
2021-03-30 00:32:22 +02:00
Dylan DPC
772582e19e
Rollup merge of #83374 - reyk:fix/bsd-ancillary, r=joshtriplett
unix: Fix feature(unix_socket_ancillary_data) on macos and other BSDs

This adds support for CMSG handling on macOS and fixes it on OpenBSD and possibly other BSDs.

When traversing the CMSG list, the previous code had an exception for Android where the next element after the last pointer could point to the first pointer instead of NULL.  This is actually not specific to Android: the `libc::CMSG_NXTHDR` implementation for Linux and emscripten have a special case to return NULL when the length of the previous element is zero; most other implementations simply return the previous element plus a zero offset in this case.

This MR makes the check non-optional which fixes CMSG handling and a possible endless loop on such systems; tested with file descriptor passing on OpenBSD, Linux, and macOS.

This MR additionally adds `SocketAncillary::is_empty` because clippy is right that it should be added.

This belongs to the `feature(unix_socket_ancillary_data)` tracking issue:  https://github.com/rust-lang/rust/issues/76915

r? `@joshtriplett`
2021-03-30 00:32:21 +02:00
Dylan DPC
68964d1fc2
Rollup merge of #83130 - clarfonthey:escape, r=m-ou-se
escape_ascii take 2

The previous PR, #73111 was closed for inactivity; since I've had trouble in the past reopening closed PRs, I'm just making a new one.

I'm still running the tests locally but figured I'd open the PR in the meantime. Will fix whatever errors show up so we don't have to wait again for this.

r? ``@m-ou-se``
2021-03-30 00:32:20 +02:00
Dylan DPC
2843baaeb6
Rollup merge of #82331 - frol:feat/std-binary-heap-as-slice, r=Amanieu
alloc: Added `as_slice` method to `BinaryHeap` collection

I initially asked about whether it is useful addition on https://internals.rust-lang.org/t/should-i-add-as-slice-method-to-binaryheap/13816, and it seems there were no objections, so went ahead with this PR.

> There is [`BinaryHeap::into_vec`](https://doc.rust-lang.org/std/collections/struct.BinaryHeap.html#method.into_vec), but it consumes the value. I wonder if there is API design limitation that should be taken into account. Implementation-wise, the inner buffer is just a Vec, so it is trivial to expose as_slice from it.

Please, guide me through if I need to add tests or something else.

UPD: Tracking issue #83659
2021-03-30 00:32:18 +02:00
bors
50489e3b00 Auto merge of #82864 - jyn514:short-circuit, r=GuillaumeGomez
rustdoc: Don't enter an infer_ctxt in get_blanket_impls for impls that aren't blanket impls

Less broken version of https://github.com/rust-lang/rust/pull/82856.

get_blanket_impls is a *very* hot region of rustdoc, so even small changes like this should help. Unfortunately I don't have benchmarks for this until https://github.com/rust-lang/rustc-perf/pull/802 is merged.
2021-03-29 22:27:16 +00:00
Eric Huss
180ac80272 Update books 2021-03-29 13:53:10 -07:00
Josh Triplett
68dbdfb5bf Simplify Command::spawn (no semantic change)
This minimizes the size of an unsafe block, and allows outdenting some
complex code.
2021-03-29 13:37:24 -07:00
Vlad Frolov
595f3f25fc Updated the tracking issue # 2021-03-29 22:44:48 +03:00
bors
48691ea6e6 Auto merge of #83185 - jyn514:remove-dead-code, r=oli-obk
Remove (lots of) dead code

Builds on
- [ ] https://github.com/rust-lang/rust/pull/83161
- [x] https://github.com/rust-lang/rust/pull/83230
- [x] https://github.com/rust-lang/rust/pull/83197.

Found with https://github.com/est31/warnalyzer.
See https://github.com/rust-lang/rust/pull/77739 for a similar change in the past.

Dubious changes:
- Maybe some of the dead code in rustc_data_structures should be kept, in case someone wants to use it in the future?

TODO:
- [ ] check if any of the comments on the deleted code should be kept.
- [x] update the compiler documentation; right now it fails to build
- [x] finish moving `cfg(test)` changes into https://github.com/rust-lang/rust/pull/83197

cc `@est31`
2021-03-29 19:44:27 +00:00
JohnTitor
7e6fd40614 Do not emit a suggestion that causes the E0632 error 2021-03-30 03:00:25 +09:00
Joshua Nelson
526bb10701 Revert changes to sync data structures
There isn't currently a good reviewer for these, and I don't want to
remove things that will just be added again. I plan to make a separate
PR for these changes so the rest of the cleanup can land.
2021-03-29 13:50:40 -04:00
bors
2917eda69d Auto merge of #80839 - tblah:riscv64linux_links, r=Mark-Simulacrum
Riscv64linux Test fixes

Get tests passing again using the riscv64gc-unknown-linux-gnu docker image.

Test with
```
src/ci/docker/run.sh riscv64gc-linux
```

## linkcheck
Linkcheck tests that interdocument links in the documentation are correct. Some interdocument links go between rustc and tools (such as rustdoc and cargo). When cross compiling, rustc is built for the host while some tools are built for the target. This goes for the documentation too. Because of this, links in the rustc documentation reffering to cargo or rustdoc documentation look broken.

This issue is worked around by disabling linkcheck for cross compilation builds.

## run-make tests

#78911 seems to happen because `--target` was not passed to `rustc`, but the target linker was specified, causing the target linker to be called with options intended for the host.

Resolves #78911

In a separate issue, `issue-36710` was trying to run a binary built for the target on the host system. This will not work for any platform using `remote-test-server`/`client` (such as riscv64). I don't know of a way of skipping those platforms specifically, so I set this test to skip only on riscv64 for now.
2021-03-29 16:48:45 +00:00
bjorn3
cd7a011f37 Don't duplicate the extern providers once for each crate 2021-03-29 18:03:07 +02:00
bors
7750402c5e Auto merge of #83609 - klensy:c-str, r=m-ou-se
ffi::c_str removed bound checks on as_bytes, to_bytes

This removes bound checks on CString::as_bytes() and CStr::to_bytes() and adds test.
2021-03-29 14:07:32 +00:00
Ivan Tham
7d21972579
Wrap non-pre code blocks
Fix #83550 regression
2021-03-29 21:49:58 +08:00
Frank Steffahn
761296bcb3 Change back prelude headline 2021-03-29 15:14:14 +02:00
Laurențiu Nicola
79acd5e318 ⬆️ rust-analyzer 2021-03-29 16:12:26 +03:00
JohnTitor
48f9f0864b Remove a FIXME resolved by #73578 2021-03-29 21:41:50 +09:00
klensy
a0ff4612f2 ffi::c_str smaller as_bytes 2021-03-29 15:32:25 +03:00
Oli Scherer
5582b19559 Only emit a discrimiant tag for enums 2021-03-29 12:30:55 +00:00
Oli Scherer
c0e1191807 Don't build a ty::Const just to take it apart again 2021-03-29 12:30:55 +00:00
Oli Scherer
5b6ddd5026 Convert a closure into a method 2021-03-29 12:30:55 +00:00
bors
3aedcf06b7 Auto merge of #83637 - bjorn3:sync_cg_clif-2021-03-29, r=bjorn3
Sync rustc_codegen_cranelift

The main highlight of this sync is support for cross-compiling to Windows using MinGW. Native compilation with MinGW would also work I think, but using the MSVC toolchain is not yet supported as PE TLS is not yet implemented. Another nice improvement is that crate metadata is now loaded using mmap instead of by reading files. This improves compilation time a bit.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
2021-03-29 11:20:25 +00:00
Ömer Sinan Ağacan
8d7432af7b Replace tabs in err messages before rendering
This is done in other call sites, but was missing in one place.

Fixes #83638
2021-03-29 13:38:36 +03:00
bjorn3
5444b46234 Merge commit '0969bc6dde001e01e7e1f58c8ccd7750f8a49ae1' into sync_cg_clif-2021-03-29 2021-03-29 10:45:09 +02:00
JohnTitor
c9562fd2d0 Prefer 4 spaces 2021-03-29 17:32:27 +09:00
JohnTitor
29d4a7d377 Add a regression test for issue-82792 2021-03-29 17:31:12 +09:00
bors
40334da7a6 Auto merge of #83565 - RalfJung:miri, r=oli-obk
update Miri, and also run test suite with mir-opt-level=4

In the Miri repo, we run the Miri test suite once with default flags and once with `-O -Zmir-opt-level=4`. This helps identify and document situations where MIR optimizations mask UB -- it is okay for that to happen, but it might be god to look into it when it does happen. Recently these tests failed fairly frequently as new MIR optimizations were added, and since we only run them on the Miri side, it is not even clear which rustc PR introduced the change. So I propose we also run these tests in the rustc repo, such that toolstate tracking will tell us the exact PR (or at least the rollup) that caused the change.

r? `@oli-obk`
Fixes https://github.com/rust-lang/rust/issues/83590
2021-03-29 08:27:59 +00:00
bjorn3
0969bc6dde Rustup to rustc 1.53.0-nightly (4a20eb6a9 2021-03-28) 2021-03-29 10:26:20 +02:00
The8472
421f5d282a fix double-drop in in-place collect specialization 2021-03-29 04:48:13 +02:00
The8472
fa89c0fbcf add testcase for double-drop during Vec in-place collection 2021-03-29 04:39:23 +02:00
Camelid
141df6f60e Inline find_suffix closure that's only used once 2021-03-28 17:27:19 -07:00
Camelid
5497f158af Add test for weird backticks placement 2021-03-28 17:18:55 -07:00
Camelid
56347a173a Point to disambiguator instead of whole link
And, now that we do that, we can remove the explanatory note since the
error span should make it clear what the disambiguator is.
2021-03-28 17:18:51 -07:00
bors
cc4103089f Auto merge of #83605 - RalfJung:unaligned, r=petrochenkov
unaligned_references: align(N) fields in packed(N) structs are fine

This removes some false positives from the unaligned_references lint: in a `repr(packed(2))` struct, fields of alignment 2 (and less) are guaranteed to be properly aligned, so we do not have to consider them "disaligned".
2021-03-29 00:17:23 +00:00
ltdk
c20ba9cdae Add escape_default method to u8 and [u8] 2021-03-28 17:38:25 -04:00
bors
cb0e0db641 Auto merge of #83619 - petrochenkov:nx, r=nagisa
linker: Use data execution prevention options by default when linker supports them

Do it in a centralized way in `link.rs` instead of individual target specs.
r? `@nagisa`
2021-03-28 21:36:27 +00:00
Vadim Petrochenkov
cc5392e76b linker: Use data execution prevention options by default when linker supports them 2021-03-28 23:44:40 +03:00
bors
4a20eb6a9d Auto merge of #83602 - JohnTitor:cloudabi-flag-is-unnecessary, r=Xanewok
Remove unnecessary `ignore-cloudabi` flag

...since we dropped the CloudABI support.
2021-03-28 17:05:52 +00:00
klensy
84542d22a7 ffi::c_str added tests for empty strings 2021-03-28 19:58:49 +03:00