Commit Graph

195848 Commits

Author SHA1 Message Date
Yuki Okushi
f4c25270d4
Rollup merge of #99643 - daxpedda:sign-ext-wasm, r=oli-obk
Add `sign-ext` target feature to the WASM target

Some target features are still missing from that list.
See #97808 for basically the same PR by `@alexcrichton.`

Related issue: #96472.
PR introducing this issue: #87402.
2022-07-25 18:46:52 +09:00
Yuki Okushi
921cfbe56f
Rollup merge of #99581 - nnethercote:improve-derive-packed-errors, r=estebank
Improve error messages involving `derive` and `packed`.

There are two errors involving `derive` and `packed`.

```
`#[derive]` can't be derived on a `#[repr(packed)]` struct with type or const parameters
`#[derive]` can't be derived on a `#[repr(packed)]` struct that does not derive Copy
```
The second one overstates things. It is possible to use derive on a
repr(packed) struct that doesn't derive Copy in two cases.
- If all the fields within the struct meet the required alignment: 1 for
  `repr(packed)`, or `N` for `repr(packed(N))`.
- If `Default` is the only trait derived.

This commit improves things in a few ways.
- Changes the errors to say `this trait can't be derived on this ...`.
  This is more accurate, because it's just *this* trait and *this*
  packed struct that are a problem, not *all* derived traits on *all*
  packed structs.
- Adds more details to the "ERROR" lines in the test case, enough to
  distinguish between the two error messages.
- Adds more cases to the test case that don't cause errors, e.g. `Default`
  derives.
- Uses a wider variety of builtin traits in the test case, for better coverage.

r? `@estebank`
2022-07-25 18:46:51 +09:00
Yuki Okushi
65d2392225
Rollup merge of #99494 - tmiasko:no-pie, r=Mark-Simulacrum
Use non-relocatable code in nofile-limit.rs test

To avoid using static-pie which is not essential to the test but which
was reported to cause problems on Void Linux where glibc is build
without support for static-pie.
2022-07-25 18:46:50 +09:00
Yuki Okushi
e726af8dd4
Rollup merge of #95916 - solid-rs:feat-kmc-solid-abort, r=Mark-Simulacrum
kmc-solid: Use `libc::abort` to abort a program

This PR updates the target-specific abort subroutine for the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets.

The current implementation uses a `hlt` instruction, which is the most direct way to notify a connected debugger but is not the most flexible way. This PR changes it to call the `abort` libc function, making it possible for a system designer to override its behavior as they see fit.
2022-07-25 18:46:48 +09:00
Yuki Okushi
0ecbcbb0ac
Rollup merge of #95040 - frank-king:fix/94981, r=Mark-Simulacrum
protect `std::io::Take::limit` from overflow in `read`

Resolves #94981
2022-07-25 18:46:47 +09:00
Takayuki Maeda
f85f37583d suggest removing the tuple struct field for the unwrapped value
add a test case for macro
2022-07-25 17:00:37 +09:00
bors
2f320a224e Auto merge of #99600 - tmiasko:subst-folder, r=petrochenkov
Tweak `SubstFolder` implementation
2022-07-25 07:52:41 +00:00
bors
7f93d4aa0d Auto merge of #98770 - klensy:no-string-dupes-ugly, r=cjgillot
rmeta: avoid embedding `StabilityLevel::Unstable` reason multiple times into .rmeta\.rlib files

Avoids bloating size of some rmeta\rlib files by not placing default string for `StabilityLevel::Unstable` reason multiple times, affects only stdlib\rustc artifacts. For stdlib cuts about 3% (diff of total size for patched\unpatched *.rmeta files of stage1-std) of file size, depending on crates.

fixes #88180
2022-07-25 05:27:17 +00:00
csmoe
6674c94d15 feat: impl export-executable-symbols 2022-07-25 05:20:23 +00:00
David Tolnay
63e74aba81
Expose size_hint() for TokenStream's iterator 2022-07-24 20:36:22 -07:00
bors
530c0a81d5 Auto merge of #99676 - thomcc:dont-overwrite, r=tmiasko
Don't overwrite CodegenFnAttrs when adding used compiler/linker

Pointed out by `@tmiasko` in https://github.com/rust-lang/rust/pull/93718#discussion_r928259163. Probably a better fix than https://github.com/rust-lang/rust/pull/99674 for https://github.com/rust-lang/rust/issues/99596, assuming it does fix the latter.

I don't have the ability to write a regression test for this at the moment, and am quite surprised this didn't cause other failures. The old code is clearly wrong though, but I'm not picky as to which of these is better to go with.
2022-07-25 02:46:36 +00:00
Nicholas Nethercote
168c5b1839 Improve error messages involving derive and packed.
There are two errors involving `derive` and `packed`.

```
`#[derive]` can't be derived on a `#[repr(packed)]` struct with type or const parameters
`#[derive]` can't be derived on a `#[repr(packed)]` struct that does not derive Copy
```
The second one overstates things. It is possible to use derive on a
repr(packed) struct that doesn't derive Copy in two cases.
- If all the fields within the struct meet the required alignment: 1 for
  `repr(packed)`, or `N` for `repr(packed(N))`.
- If `Default` is the only trait derived.

This commit improves things in a few ways.
- Changes the errors to say `$TRAIT can't be derived on this ...`.
  This is more accurate, because it's just $TRAIT and *this* packed
  struct that are a problem, not *all* derived traits on *all* packed
  structs.
- Adds more details to the "ERROR" lines in the test case, enough to
  distinguish between the two error messages.
- Adds more cases to the test case that don't cause errors, e.g. `Default`
  derives.
- Uses a wider variety of builtin traits in the test case, for better coverage.
2022-07-25 10:30:43 +10:00
bors
babff2211e Auto merge of #97581 - AngelicosPhosphoros:improve_calloc_check_in_vec_macro_for_tuples, r=Mark-Simulacrum
Support vec zero-alloc optimization for tuples and byte arrays

* Implement IsZero trait for tuples up to 8 IsZero elements;
* Implement IsZero for u8/i8, leading to implementation of it for arrays of them too;
* Add more codegen tests for this optimization.
* Lower size of array for IsZero trait because it fails to inline checks
2022-07-25 00:20:43 +00:00
bors
3ae03e027a Auto merge of #99603 - fasterthanlime:ra-subtree-2, r=jyn514
Convert rust-analyzer to an in-tree tool

This re-adds `rust-lang/rust-analyzer` as a git subtree rather than a submodule.

Closes https://github.com/rust-lang/rust-analyzer/issues/12815.

Prior attempt (research PR): https://github.com/rust-lang/rust/pull/99465

  * [x] Remove submodule: `git rm -f src/tools/rust-analyzer`
  * [x] Add subtree: `git subtree add -P src/tools/rust-analyzer https://github.com/rust-lang/rust-analyzer.git master`
  * [x] Move to `SourceType::InTree`,
  * [x] Enable `rust-analyzer/in-rust-tree` feature when built through `x.py`
  * [x] Add 'check' step
  * [x] Add 'test' step

With this PR, rust-analyzer becomes an "in-tree" tool. Syncs can happen in both directions, see [clippy's relevant book section](https://doc.rust-lang.org/nightly/clippy/development/infrastructure/sync.html).

Making sure `proc-macro-srv` doesn't break when the proc_macro bridge changes effectively becomes the responsibility of `rust-lang/rust` contributors. These days, that's mostly `@mystor,` who has been consulted throughout the process. I'm also making myself available in case there's questions / work needed that nobody else signed up for.

This doesn't change rust-analyzer's release cycle. After this PR is merged and the next nightly goes out, one can point `rust-analyzer.procMacro.server` to the rustup-provided `rust-analyzer` binary. Changes to improve the situation further (auto-discovery/install of the rust-analyzer component) will happen in `rust-lang/rust-analyzer` and be synced here eventually.
2022-07-24 21:36:31 +00:00
AngelicosPhosphoros
86d445eda8 Support vec zero-alloc optimization for tuples and byte arrays
* Implement IsZero trait for tuples up to 8 IsZero elements;
* Implement IsZero for u8/i8, leading to implementation of it for arrays of them too;
* Add more codegen tests for this optimization.
* Lower size of array for IsZero trait because it fails to inline checks
2022-07-24 15:56:39 -04:00
Michael Goulet
3bbe95ca0c Combine redundant obligation cause codes 2022-07-24 19:35:53 +00:00
Amos Wenger
fa0037a5d5 Only run proc-macro-srv tests for now (after discussion with @Veykril, @jyn514, and @lnicola) 2022-07-24 21:04:56 +02:00
Michael Goulet
2bbcdc7333 Handle additional lifetime bounds on GATs like on methods 2022-07-24 18:57:41 +00:00
bors
7fe022f5aa Auto merge of #99687 - RalfJung:rollup-bojacrc, r=RalfJung
Rollup of 4 pull requests

Successful merges:

 - #99644 (remove some provenance-related machine hooks that Miri no longer needs)
 - #99657 (Docs - remove unnecessary `mut` that gives a warning)
 - #99672 (Remove Clean trait implementation for more items)
 - #99678 (Update doc comments that refer to config parameter)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-24 18:55:31 +00:00
Ralf Jung
d10a7b1243 add miri-track-caller to some intrinsic-exposing methods 2022-07-24 14:49:33 -04:00
Michael Goulet
6bb7581a59 Slightly improve mismatched GAT where clause error 2022-07-24 18:39:59 +00:00
Ralf Jung
34d0c0abf6
Rollup merge of #99678 - danbev:rustc_parse-config-doc-comments, r=cjgillot
Update doc comments that refer to config parameter

This commit updates the `source_file_to_parser` and the
`maybe_source_file_to_parse` function's doc comments which currently
refer to a `config` parameter. The doc comments have been updated to
refer to the `session` parameter similar to the doc comment for
`try_file_to_source_file`, which also takes a `&Session` parameter.
2022-07-24 14:04:29 -04:00
Ralf Jung
06009c28f4
Rollup merge of #99672 - GuillaumeGomez:clean-trait-removal, r=Dylan-DPC
Remove Clean trait implementation for more items

Follow up of #99638.

cc `@camelid`
r? `@notriddle`
2022-07-24 14:04:28 -04:00
Ralf Jung
51b3d51cf4
Rollup merge of #99657 - Phosra:patch-1, r=Dylan-DPC
Docs - remove unnecessary `mut` that gives a warning

Fixes #99654.

A trivial linting fix for a Stdio example.

`@rustbot` label +T-lib
2022-07-24 14:04:27 -04:00
Ralf Jung
890cd7a496
Rollup merge of #99644 - RalfJung:interpret-int-ptr-transmute, r=oli-obk
remove some provenance-related machine hooks that Miri no longer needs

Then we can make `scalar_to_ptr` a method on `Scalar`. :)

Fixes https://github.com/rust-lang/miri/issues/2188
r? `@oli-obk`
2022-07-24 14:04:26 -04:00
bors
2a990f7c0f Auto merge of #99409 - tmiasko:atomic-tests, r=m-ou-se
Test codegen of atomic compare-exchange with additional memory orderings

* Add a test for atomic operations introduced in #97423 & #98383.
* Add a test for fallback code generation strategy used on LLVM 12 introduced in #98385. Use a separate test case instead of a revision system since test will be gone once LLVM 12 is no longer supported.
2022-07-24 16:26:56 +00:00
Amos Wenger
ee584c19c7 Make macros test order-resistant 2022-07-24 16:48:06 +02:00
Daniel Bevenius
045140a25b Update doc comments that refer to config parameter
This commit updates the source_file_to_parser and the
maybe_source_file_to_parse function's doc comments which currently
refer to a config parameter. The doc comments have been updated to
refer to the 'session' parameter similar to the doc comment for
try_file_to_source_file, which also takes a &Session parameter.
2022-07-24 16:40:24 +02:00
Amos Wenger
6c07c71821 Sort when iterating through CrateGraph 2022-07-24 16:11:05 +02:00
Amos Wenger
4e1a302efc Sort in DefMap::dump, since HashMap iteration order isn't defined 2022-07-24 16:04:20 +02:00
Amos Wenger
e436260d7a hir-def tests: sort results before comparing, since FxHashSet iteration order isn't guaranteed
(And, in fact, it failed on i686)
2022-07-24 15:55:26 +02:00
bors
c32dcbba18 Auto merge of #99670 - Amanieu:revert-99595, r=nikic
Revert "Mark atomics as unsupported on thumbv6m"

This is a breaking change for the `thumbv6m` target. See #99668 for discussion on how we can proceed forward from here.

This reverts commit 7514610219.

cc `@nikic`
2022-07-24 13:46:15 +00:00
Thom Chiovoloni
6cfd471ffe
Don't overwrite CodegenFnAttrs when adding used compiler/linker 2022-07-24 06:37:50 -07:00
Ralf Jung
f80bf1013d don't ICE on invalid dyn calls 2022-07-24 09:21:05 -04:00
Guillaume Gomez
e55b0206f3 Remove Clean trait implementation for Constant 2022-07-24 15:08:24 +02:00
Guillaume Gomez
8098f5faa8 Remove Clean trait implementation for FieldDef 2022-07-24 14:58:10 +02:00
Amanieu d'Antras
d931a587e6 Revert "Mark atomics as unsupported on thumbv6m"
This reverts commit 7514610219.
2022-07-24 13:12:08 +01:00
Amos Wenger
1bb63df1fd Fix .gitattributes for test_data 2022-07-24 14:05:35 +02:00
Deadbeef
65fca6db19 add const hack comment 2022-07-24 12:01:23 +00:00
Deadbeef
a89510e5f9 Add issue numbers 2022-07-24 12:01:22 +00:00
Deadbeef
9fc5463c18 Constify a few const (Partial)Ord impls 2022-07-24 12:01:22 +00:00
ouz-a
9f00d836af make sure has_deref is correct 2022-07-24 13:26:20 +03:00
bors
b4151a41a0 Auto merge of #93429 - fee1-dead-contrib:allow-super-trait-tilde-const, r=oli-obk
Allow `trait A: ~const B`

What's included: a minimal working change set for `~const` supertraits to work.

r? `@oli-obk`
2022-07-24 09:16:02 +00:00
Joshua Nelson
ee09dc5510 Small fixups
- use `path` instead of `paths`
- don't mark rust-analyzer as an optional tool
- print the cargo command that's run in the proc-macro-test build script

  this originally was part of a change to fix `test --stage 0 rust-analyzer`,
  but I'm going to leave that for a separate PR so it's easier to review.
2022-07-24 10:38:42 +02:00
Amos Wenger
e0add21c2b Move cfg attrs up to the mod definitions to disable sourcegen 2022-07-24 10:38:34 +02:00
Amos Wenger
753456232b Disable all source-gen tests at compile time 2022-07-24 10:38:28 +02:00
Amos Wenger
107e2653a6 Don't run slow tests in Rust CI, only RA CI 2022-07-24 10:38:19 +02:00
Amos Wenger
44f50c5fd2 Add comment about CARGO_WORKSPACE_DIR 2022-07-24 10:38:12 +02:00
Amos Wenger
37ed531fcc Use top-level path in tool Step 2022-07-24 10:38:06 +02:00
Amos Wenger
d42b28af41 Allow cross-compiling, build all crates 2022-07-24 10:37:59 +02:00