Commit Graph

195979 Commits

Author SHA1 Message Date
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
Maybe Waffle
7f1af42190 Satisfy theme check 2022-07-24 16:48:35 +04: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
Maybe Waffle
d566334a94 add backticks 2022-07-24 15:10:39 +04:00
Maybe Waffle
9b9693c11b Add rustdoc test for #[rustc_must_implement_one_of] 2022-07-24 15:10:39 +04:00
Maybe Waffle
3da2553f2f Add support for #[rustc_must_implement_one_of] to rustdoc 2022-07-24 15:10:04 +04: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
Amos Wenger
4dedb5830f Use compiler.stage
Co-authored-by: Joshua Nelson <github@jyn.dev>
2022-07-24 10:37:53 +02:00
Amos Wenger
4ea2f8e48f Add test step for rust-analyzer, run it by default 2022-07-24 10:37:47 +02:00
Amos Wenger
d59abcf9b3 Check only tests and benches, not examples 2022-07-24 10:37:40 +02:00
Amos Wenger
9cf485c3db Add check step, stuck on 'no output generated for libgoto_def-hash rmeta' 2022-07-24 10:37:36 +02:00
Amos Wenger
0f2266d3cc Convert rust-analyzer to 'in-tree' tool, pass 'in-rust-tree' feature by default 2022-07-24 10:37:29 +02:00
Amos Wenger
43acb501b9 Add 'src/tools/rust-analyzer/' from commit '977e12a0bdc3e329af179ef3a9d466af9eb613bb'
git-subtree-dir: src/tools/rust-analyzer
git-subtree-mainline: 3c98486a0c
git-subtree-split: 977e12a0bd
2022-07-24 10:37:08 +02:00
Amos Wenger
3c98486a0c Remove rust-analyzer submodule 2022-07-24 10:36:44 +02:00
Deadbeef
666022730f Instantiate constness in wfcheck 2022-07-24 07:57:05 +00:00
bors
35a0617248 Auto merge of #98674 - RalfJung:miri-stacktrace-pruning, r=Mark-Simulacrum
miri: prune some atomic operation and raw pointer details from stacktrace

Since Miri removes `track_caller` frames from the stacktrace, adding that attribute can help make backtraces more readable (similar to how it makes panic locations better). I made them only show up with `cfg(miri)` to make sure the extra arguments induced by `track_caller` do not cause any runtime performance trouble.

This is also testing the waters for whether the libs team is okay with having these attributes in their code, or whether you'd prefer if we find some other way to do this. If you are fine with this, we will probably want to add it to a lot more functions (all the other atomic operations, to start).

Before:
```
error: Undefined Behavior: Data race detected between Atomic Load on Thread(id = 2) and Write on Thread(id = 1) at alloc1727 (current vector clock = VClock([9, 0, 6]), conflicting timestamp = VClock([0, 6]))
    --> /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/sync/atomic.rs:2594:23
     |
2594 |             SeqCst => intrinsics::atomic_load_seqcst(dst),
     |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Atomic Load on Thread(id = 2) and Write on Thread(id = 1) at alloc1727 (current vector clock = VClock([9, 0, 6]), conflicting timestamp = VClock([0, 6]))
     |
     = 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 `std::sync::atomic::atomic_load::<usize>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/sync/atomic.rs:2594:23
     = note: inside `std::sync::atomic::AtomicUsize::load` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/sync/atomic.rs:1719:26
note: inside closure at ../miri/tests/fail/data_race/atomic_read_na_write_race1.rs:22:13
    --> ../miri/tests/fail/data_race/atomic_read_na_write_race1.rs:22:13
     |
22   |             (&*c.0).load(Ordering::SeqCst)
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

After:
```
error: Undefined Behavior: Data race detected between Atomic Load on Thread(id = 2) and Write on Thread(id = 1) at alloc1727 (current vector clock = VClock([9, 0, 6]), conflicting timestamp = VClock([0, 6]))
  --> tests/fail/data_race/atomic_read_na_write_race1.rs:22:13
   |
22 |             (&*c.0).load(Ordering::SeqCst)
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Atomic Load on Thread(id = 2) and Write on Thread(id = 1) at alloc1727 (current vector clock = VClock([9, 0, 6]), conflicting timestamp = VClock([0, 6]))
   |
   = 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 closure at tests/fail/data_race/atomic_read_na_write_race1.rs:22:13
```
2022-07-24 06:46:46 +00:00
Michael Goulet
f7326989e6 Use VecMap::get in ConstraintLocator::check 2022-07-24 05:51:03 +00:00
Phosra
4855392111
Remove mut 2022-07-23 21:22:43 -07:00
bors
745193d197 Auto merge of #99251 - cuviper:hashbrown-0.12, r=Mark-Simulacrum
Upgrade indexmap and thorin-dwp to use hashbrown 0.12

This removes the last dependencies on hashbrown 0.11.

This also upgrades to hashbrown 0.12.3 to fix a double-free (#99372).
2022-07-24 04:03:29 +00:00
bors
4dbc89de3f Auto merge of #99251 - cuviper:hashbrown-0.12, r=Mark-Simulacrum
Upgrade indexmap and thorin-dwp to use hashbrown 0.12

This removes the last dependencies on hashbrown 0.11.

This also upgrades to hashbrown 0.12.3 to fix a double-free (#99372).
2022-07-24 04:03:29 +00:00
bors
db8086eb60 Auto merge of #95548 - rcvalle:rust-cfi-2, r=nagisa
Add fine-grained LLVM CFI support to the Rust compiler

This PR improves the LLVM Control Flow Integrity (CFI) support in the Rust compiler by providing forward-edge control flow protection for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types.

Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue https://github.com/rust-lang/rust/issues/89653).

LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto).

Thank you again, `@eddyb,` `@nagisa,` `@pcc,` and `@tmiasko` for all the help!
2022-07-24 01:22:36 +00:00
bors
fcad91868a Auto merge of #99652 - GuillaumeGomez:rollup-38v0x7y, r=GuillaumeGomez
Rollup of 6 pull requests

Successful merges:

 - #99298 (Make `ui-fulldeps/gated-plugins` and `ui-fulldeps/multiple-plugins` tests stage 2 only)
 - #99396 (Add some additional double-adjustment regression tests)
 - #99449 (Do not resolve associated const when there is no provided value)
 - #99595 (Mark atomics as unsupported on thumbv6m)
 - #99627 (Lock stdout once when listing tests)
 - #99638 (Remove Clean trait implementation for hir::Ty and middle::Ty)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-23 22:41:48 +00:00
bors
977e12a0bd Auto merge of #12859 - matklad:dont-color-the-whole-block-red-all-the-time-please, r=Veykril
feat: don't highlight the whole fn on return-type mismatch
2022-07-23 21:37:32 +00:00
Guillaume Gomez
d87a13fe0d
Rollup merge of #99638 - GuillaumeGomez:rm-clean-trait, r=notriddle
Remove Clean trait implementation for hir::Ty and middle::Ty

While going through the code, I realized that the "remove the Clean trait" effort which was started a while ago was never finished.

The idea behind it was to make it much simpler to go through the different clean steps (which is definitely not easy when you just have `something.clean(cx)`).

I'm planning to finish this effort.

cc ``@camelid``
r? ``@notriddle``
2022-07-23 23:34:32 +02:00
Guillaume Gomez
74c3da39f0
Rollup merge of #99627 - saethlin:lock-once, r=eddyb
Lock stdout once when listing tests

This is a marginal optimization for normal operation, but for `cargo miri nextest list` (which is invoked by `cargo miri nextest run`) this knocks the startup time on `regex` down from 87 seconds to 17 seconds. Still slow, but a nice 5x improvement.
2022-07-23 23:34:31 +02:00
Guillaume Gomez
90c6cde43a
Rollup merge of #99595 - nikic:thumbv6m-atomics, r=nagisa
Mark atomics as unsupported on thumbv6m

The thumbv6m target does not support atomics. Historically, LLVM
had a bug where atomic load/stores for this target were emitted
as plain load/stores rather than as libatomic calls. This was
fixed in https://reviews.llvm.org/D120026, which will be part of
LLVM 15. As we require that "atomic support" does not use libatomic,
we need to indicate that this target does not have native atomics.
2022-07-23 23:34:31 +02:00
Guillaume Gomez
3648dd552a
Rollup merge of #99449 - compiler-errors:assoc-const-missing-item, r=lcnr
Do not resolve associated const when there is no provided value

Fixes #98629, since now we just delay a bug when we're not able to evaluate a const item due to the value not actually being provided by anything. This means compilation proceeds forward to where the "missing item in impl" error is emitted.

----

The root issue here is that when we're looking for the defining `LeafDef` in `resolve_associated_item`, we end up getting the trait's AssocItem instead of the impl's AssocItem (which does not exist). This resolution "succeeds" even if the trait's item has no default value, and then since this item has no value to evaluate, it turns into a const eval error.

This root issue becomes problematic (as in #98629) when this const eval error happens in wfcheck (for example, due to normalizing the param-env of something that references this const). Since this happens sooner than the check that an impl actually provides all of the items that a trait requires (which happens during later typecheck), we end up aborting compilation early with only this un-informative message.

I'm not exactly sure _why_ this bug arises due to #96591 -- perhaps valtrees are evaluated more eagerly than in the old system?

r? ``@oli-obk`` or ``@lcnr`` since y'all are familiar with const eval and reviewed #96591, though feel free to reassign.

This is a regression from stable to beta, so I would be open to considering this for beta backport. It seems correct to me, especially given the improvements in the other UI tests this PR touches, but may have some side-effects that I'm unaware of...?
2022-07-23 23:34:30 +02:00
Guillaume Gomez
93f58b6b0d
Rollup merge of #99396 - compiler-errors:missing-tests, r=Mark-Simulacrum
Add some additional double-adjustment regression tests

I accidentally missed these when I rebased #98785

cc #98894 and #98897
2022-07-23 23:34:29 +02:00
Guillaume Gomez
a9dc6a6431
Rollup merge of #99298 - ChrisDenton:ignore-plugins-stage1, r=Mark-Simulacrum
Make `ui-fulldeps/gated-plugins` and `ui-fulldeps/multiple-plugins` tests stage 2 only

These test can fail on stage 1.

Fixes #99295
2022-07-23 23:34:28 +02:00
Aleksey Kladov
5bd84432dd internal: extract common code for adjusting diagnostic range 2022-07-23 22:24:44 +01:00
Aleksey Kladov
a436be44b2 feat: don't highlight the whole fn on return-type mismatch 2022-07-23 21:16:59 +01:00