Commit graph

141140 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
Tom Eccles
1fa48cf181 test: run-make: skip tests on unsupported platforms
The tests issue-36710 and incr-prev-body-beyond-eof were changed in a
previous commit so that the correct target was passed to rustc
(previously rustc was building for the host not for the specific
target).

Since that change it turns out that these platforms never worked (they
only appeared to work because rustc was actually building for the host
architecture).

The wasm architectures fall over trying to build the C++ file in
issue-36710. They look for clang (which isn't installed in the
test-various docker container). If clang is installed, they can't find
a wasm c++ standard library to link to.

nvtptx64-nvidia-cuda fails in rustc saying it can't find std. The rust
platforms support page says that std is supported on cuda so this is
surprising.

dist-i586-gnu-i586-i686-musl can't find the C++ compiler. There is only
a musl-gcc and no musl-g++ in /musl-i586/bin/. The Docker image probably
needs tweaking.
2021-03-28 16:50:56 +01:00
Tom Eccles
e7505fb745 test: run-make: flag tests which won't work in no-std environments 2021-03-28 16:50:47 +01:00
Tom Eccles
980961e330 ci: docker: x86_64: specify host explicitly 2021-03-28 16:50:16 +01:00
Tom Eccles
b2a97ff415 bootstrap: don't run linkcheck when crosscompiling
When we cross compile, some things (and their documentation) are built
for the host (e.g. rustc), while others (and their documentation) are built
for the target. This generated documentation will have broken links
between documentation for different platforms e.g. between rustc and
cargo.
2021-03-28 16:50:16 +01:00
Tom Eccles
8b40dd1f50 ci: docker: riscv64gc: specify host explicitly 2021-03-28 16:50:16 +01:00
Tom Eccles
d9dc5d83e2 run-make: skip issue-36710 on riscv64 and armhf
The test assumes it can run target binaries on the host. This not true
for riscv64 CI (or for other platforms using remote-test-server).
2021-03-28 16:49:58 +01:00
Tom Eccles
a143d6d467 run-make: Specify --target to rustc
Resolves #78911

The target's linker was used but rustc wasn't told to build for that
target (instead defaulting to the host). This led to the host instead of
the target getting tested and to the linker getting inappropriate
arguments.
2021-03-28 16:48:48 +01:00
bors
0239876020 Auto merge of #83582 - jyn514:might-not, r=joshtriplett
may not -> might not

may not -> might not

"may not" has two possible meanings:
1. A command: "You may not stay up past your bedtime."
2. A fact that's only sometimes true: "Some cities may not have bike lanes."

In some cases, the meaning is ambiguous: "Some cars may not have snow
tires." (do the cars *happen* to not have snow tires, or is it
physically impossible for them to have snow tires?)

This changes places where the standard library uses the "description of
fact" meaning to say "might not" instead.

This is just `std::vec` for now - if you think this is a good idea I can
convert the rest of the standard library.
2021-03-28 14:16:03 +00:00
Ralf Jung
1ab05c13dd adjust old test 2021-03-28 14:49:35 +02:00
bors
d4c96de64f Auto merge of #83577 - geeklint:slice_to_ascii_case_doc_links, r=m-ou-se
Adjust documentation links for slice::make_ascii_*case

The documentation for the functions `slice::to_ascii_lowercase` and `slice::to_ascii_uppercase` contain the suggestion

> To lowercase the value in-place, use `make_ascii_lowercase`

however the link to the suggested method takes you to the page for `u8`, rather than the method of that name on the same page.
2021-03-28 11:34:55 +00:00
Ralf Jung
ee1caae33c unaligned_references: align(N) fields in packed(N) structs are fine 2021-03-28 12:54:19 +02:00
Ralf Jung
a515cfd966 update Miri 2021-03-28 11:23:17 +02:00
bors
505ed7fb1b Auto merge of #83593 - petrochenkov:nounwrap, r=nagisa
rustc_target: Avoid unwraps when adding linker flags

These `unwrap`s assume that some linker flags were already added by `*_base::opts()` methods, but that's doesn't necessarily remain the case when we are reducing the number of flags hardcoded in targets, as https://github.com/rust-lang/rust/pull/83587 shows.

r? `@nagisa`
2021-03-28 08:53:51 +00:00
JohnTitor
4a314b9911 Remove unnecessary ignore-cloudabi flag 2021-03-28 15:34:59 +09:00
bors
5208f63ba8 Auto merge of #81728 - Qwaz:fix-80335, r=joshtriplett
Fixes API soundness issue in join()

Fixes #80335
2021-03-28 06:32:34 +00:00
bors
1df20569dd Auto merge of #81354 - SkiFire13:binary-search-assume, r=nagisa
Instruct LLVM that binary_search returns a valid index

This allows removing bound checks when the return value of `binary_search` is used to index into the slice it was call on. I also added a codegen test for this, not sure if it's the right thing to do (I didn't find anything on the dev guide), but it felt so.
2021-03-28 03:51:22 +00:00
Joshua Nelson
f3523544f1 Address more review comments
- Add back various diagnostic methods on `Session`.

  It seems unfortunate to duplicate these in so many places, but in the
  meantime, making the API inconsistent between `Session` and `Diagnostic`
  also seems unfortunate.

- Add back TyCtxtAt methods

  These will hopefully be used in the near future.

- Add back `with_const`, it would need to be added soon after anyway.
- Add back `split()` and `get_mut()`, they're useful.
2021-03-27 22:19:32 -04:00
Joshua Nelson
230e396a76 Fix compiler docs 2021-03-27 22:16:34 -04:00
Joshua Nelson
de0fda9558 Address review comments
- Add back `HirIdVec`, with a comment that it will soon be used.
- Add back `*_region` functions, with a comment they may soon be used.
- Remove `-Z borrowck_stats` completely. It didn't do anything.
- Remove `make_nop` completely.
- Add back `current_loc`, which is used by an out-of-tree tool.
- Fix style nits
- Remove `AtomicCell` with `cfg(parallel_compiler)` for consistency.
2021-03-27 22:16:34 -04:00
Joshua Nelson
441dc3640a Remove (lots of) dead code
Found with https://github.com/est31/warnalyzer.

Dubious changes:
- Is anyone else using rustc_apfloat? I feel weird completely deleting
  x87 support.
- Maybe some of the dead code in rustc_data_structures, in case someone
  wants to use it in the future?
- Don't change rustc_serialize

  I plan to scrap most of the json module in the near future (see
  https://github.com/rust-lang/compiler-team/issues/418) and fixing the
  tests needed more work than I expected.

TODO: check if any of the comments on the deleted code should be kept.
2021-03-27 22:16:33 -04:00
Joshua Nelson
785aeac521 Remove unused DiagnosticBuilder::sub function
`Diagnostic::sub` is only ever used directly; it doesn't need to be
included in the builder.
2021-03-27 22:16:33 -04:00
bors
3bfc85149e Auto merge of #83587 - petrochenkov:asneeded, r=nagisa
linker: Use `--as-needed` by default when linker supports it

Do it in a centralized way in `link.rs` instead of individual target specs.
Majority of relevant target specs were already passing it.
2021-03-28 01:00:25 +00:00