Commit Graph

234268 Commits

Author SHA1 Message Date
bors
19dd953540 Auto merge of #115644 - danakj:catalyst-asan, r=cjgillot,thomcc
Enable ASAN/LSAN/TSAN for *-apple-ios-macabi

The -macabi targets are iOS running on MacOS, and they use the runtime libraries for MacOS, thus they have the same sanitizers available as the *-apple-darwin targets.

This is based on the work of aacf3213b1.

Closes #113935.
2023-09-19 01:47:23 +00:00
bors
f3984ce5bb Auto merge of #115952 - matthiaskrgr:rollup-qzk8t4e, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #115869 (Avoid blessing cargo deps's source code in ui tests)
 - #115873 (Make `TyKind::Adt`'s `Debug` impl be more pretty)
 - #115879 (Migrate diagnostics in `hir_typeck/src/cast.rs`)
 - #115930 (coverage: Fix an unstable-sort inconsistency in coverage spans)
 - #115931 (Move mobile topbar title creation entirely into JS)
 - #115941 (Add myself to .mailmap)
 - #115943 (compiletest: Don't swallow some error messages.)
 - #115949 (Update browser-ui-test version)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-09-19 00:02:42 +00:00
Matthias Krüger
aa55d7d730
Rollup merge of #115949 - GuillaumeGomez:update-browser-ui-test, r=notriddle
Update browser-ui-test version

It includes the fix from `@notriddle` (https://github.com/GuillaumeGomez/browser-UI-test/pull/537).

r? `@notriddle`
2023-09-19 01:29:45 +02:00
Matthias Krüger
8c5fc204bd
Rollup merge of #115943 - ehuss:compiletest-errors, r=compiler-errors
compiletest: Don't swallow some error messages.

This updates some error handling in compiletest to display the underlying error rather than discarding it. There have been cases where the lack of error information makes it difficult to understand what went wrong.
2023-09-19 01:29:44 +02:00
Matthias Krüger
3ddad3773d
Rollup merge of #115941 - lnicola:lnicola-mailmap, r=Mark-Simulacrum
Add myself to .mailmap
2023-09-19 01:29:43 +02:00
Matthias Krüger
575e091b5c
Rollup merge of #115931 - GuillaumeGomez:remove-empty-h2, r=notriddle
Move mobile topbar title creation entirely into JS

I was looking at potential size improvements and saw that we had an empty `h2` tag for the mobile topbar title that was filled with JS. So at this point, I think it's fine to just completely generate it from JS, like that the w3c HTML validator will emit one less warning.

r? `@notriddle`
2023-09-19 01:29:43 +02:00
Matthias Krüger
3cf5a6beaa
Rollup merge of #115930 - Zalathar:spans-bug, r=compiler-errors
coverage: Fix an unstable-sort inconsistency in coverage spans

This code was calling `sort_unstable_by`, but failed to impose a total order on the initial spans. That resulted in unpredictable handling of closure spans, producing inconsistencies in the coverage maps and in user-visible coverage reports.

This PR fixes the problem by always sorting closure spans before otherwise-identical non-closure spans, and also switches to a stable sort in case the ordering is still not total.

---

In addition to the fix itself, this PR also contains a cleanup to the comparison function that I was working on when I discovered the bug.
2023-09-19 01:29:42 +02:00
Matthias Krüger
970ee09c22
Rollup merge of #115879 - clubby789:migrate-hir-typeck-cast, r=compiler-errors
Migrate diagnostics in `hir_typeck/src/cast.rs`
2023-09-19 01:29:42 +02:00
Matthias Krüger
48c605129b
Rollup merge of #115873 - BoxyUwU:tykind_adt_debug, r=oli-obk
Make `TyKind::Adt`'s `Debug` impl be more pretty

Currently `{:?}` on `Ty` for a `TyKind::Adt` would print as `Adt(Foo, [])`. This PR changes it to be `Foo` when there are no generics or `Foo<T>`/`Foo<T, U>` when there _are_ generics. Example from debug log:
`├─0ms DEBUG rustc_hir_analysis::astconv return=Bar<T/#0, U/#1>`

I should have done this in my initial PR for a prettier TyKind: Debug impl but I thought I would need to be accessing generics_of to figure out where in the "path" the generics would have to go??? but no, adts literally only have a single place the generics can go (on the end). Feel a bit silly about this :)

r? `@oli-obk`
2023-09-19 01:29:41 +02:00
Matthias Krüger
0eec5e3d0c
Rollup merge of #115869 - ferrocene:pa-fix-tests-cargo-remap, r=compiler-errors
Avoid blessing cargo deps's source code in ui tests

Before this PR, the source code of dependencies was included in UI test error messages whenever possible. Unfortunately, "whenever possible" means in some cases the source code wouldn't be injected, resulting in a test failure.

One such case is when `$CARGO_HOME` is remapped to something that is not present on disk [^1]. As the remapped path doesn't exist on disk, the source code wouldn't be showed in `tests/ui/issues/issue-21763.rs`:

```diff
    = note: required for `hashbrown::raw::RawTable<(Rc<()>, Rc<()>)>` to implement `Send`
 note: required because it appears within the type `HashMap<Rc<()>, Rc<()>, RandomState>`
   --> $HASHBROWN_SRC_LOCATION
-   |
-LL | pub struct HashMap<K, V, S = DefaultHashBuilder, A: Allocator + Clone = Global> {
-   |            ^^^^^^^
 note: required because it appears within the type `HashMap<Rc<()>, Rc<()>>`
   --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
 note: required by a bound in `foo`
```

This PR fixes the problem by always hiding dependencies source code in the error messages generated during UI tests. This is implemented with a new internal flag, `-Z ignore-directory-in-diagnostics-source-blocks=$path`, which compiletest passes during UI tests. Once this is merged, remapping the Cargo home will be supported.

This PR is best reviewed commit-by-commit.

[^1]: After being puzzled for a bit, I discovered why this never impacted `rust-lang/rust`: we don't remap `$CARGO_HOME` 😅. Instead, we set `$CARGO_HOME` to `/cargo` in CI, which sort-of-but-not-really achieves the same effect.
2023-09-19 01:29:41 +02:00
bors
65ea825f40 Auto merge of #115940 - matthiaskrgr:rollup-5ps9ln1, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #109409 (Add `minmax{,_by,_by_key}` functions to `core::cmp`)
 - #115494 (get rid of duplicate primitive_docs)
 - #115663 (ci: actions/checkout@v3 to actions/checkout@v4)
 - #115762 (Explain revealing of opaque types in layout_of ParamEnv)
 - #115891 (simplify inject_impl_of_structural_trait)
 - #115932 (Expand infra-ci reviewer list)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-09-18 21:29:56 +00:00
Guillaume Gomez
f27c06cac8 Update browser-ui-test version 2023-09-18 22:44:16 +02:00
bors
cebb9cfd4f Auto merge of #115748 - RalfJung:post-mono, r=oli-obk
move required_consts check to general post-mono-check function

This factors some code that is common between the interpreter and the codegen backends into shared helper functions. Also as a side-effect the interpreter now uses the same `eval` functions as everyone else to get the evaluated MIR constants.

Also this is in preparation for another post-mono check that will be needed for (the current hackfix for) https://github.com/rust-lang/rust/issues/115709: ensuring that all locals are dynamically sized.

I didn't expect this to change diagnostics, but it's just cycle errors that change.

r? `@oli-obk`
2023-09-18 19:41:21 +00:00
Eric Huss
10a5b9a0ed compiletest: Don't swallow some error messages. 2023-09-18 10:40:43 -07:00
Laurențiu Nicola
de6de23570 Add myself to .mailmap 2023-09-18 20:12:59 +03:00
Boxy
b2bf4b66f8 make more pretty 2023-09-18 17:29:13 +01:00
Matthias Krüger
966f240de2
Rollup merge of #115932 - Mark-Simulacrum:expand-review, r=Kobzol
Expand infra-ci reviewer list

r? `@Kobzol`
2023-09-18 18:27:21 +02:00
Matthias Krüger
864f7aafe4
Rollup merge of #115891 - RalfJung:structural-trait-derive, r=nnethercote
simplify inject_impl_of_structural_trait

There's a comment at `inject_impl_of_structural_trait` saying we cannot use `TraitDef`, but that comment is outdated -- we *can* use `TraitDef` nowadays since it has the `skip_path_as_bound` flag. (The flag needed some fixing, though.)
2023-09-18 18:27:20 +02:00
Matthias Krüger
e27c3e97ca
Rollup merge of #115762 - oli-obk:early_const_prop_lint2, r=compiler-errors
Explain revealing of opaque types in layout_of ParamEnv

r? `@compiler-errors`

~~I feel like `layout_of` is doing too many things at once, and I don't really know why. It could allow us to if callers could decide whether to reveal opaque types.~~

Looks like this also exists as a performance optimization. While we could probably figure out a way to do this, all the ones I came up with are fragile as `layout_of` callers now suddenly need to be careful what ParamEnv they pass in.
2023-09-18 18:27:20 +02:00
Matthias Krüger
0d0f4fd8a3
Rollup merge of #115663 - Gumichocopengin8:ci/update-github-action, r=Mark-Simulacrum
ci: actions/checkout@v3 to actions/checkout@v4

- Bump `actions/checkout` from v3 to v4 since v3 uses Node v16 whose support lasts until `11 Sep 2023` [Ref](https://endoflife.date/nodejs)
  - https://github.com/actions/checkout/releases/tag/v4.0.0
2023-09-18 18:27:19 +02:00
Matthias Krüger
0a66c87bd4
Rollup merge of #115494 - RalfJung:primitive_docs, r=Mark-Simulacrum
get rid of duplicate primitive_docs

Having this duplicate makes editing that file very annoying. And at least locally the generated docs still look perfectly fine...
2023-09-18 18:27:19 +02:00
Matthias Krüger
db9e217989
Rollup merge of #109409 - WaffleLapkin:progamer, r=dtolnay
Add `minmax{,_by,_by_key}` functions to `core::cmp`

This PR adds the following functions:

```rust
// mod core::cmp
#![unstable(feature = "cmp_minmax")]

pub fn minmax<T>(v1: T, v2: T) -> [T; 2]
where
    T: Ord;

pub fn minmax_by<T, F>(v1: T, v2: T, compare: F) -> [T; 2]
where
    F: FnOnce(&T, &T) -> Ordering;

pub fn minmax_by_key<T, F, K>(v1: T, v2: T, mut f: F) -> [T; 2]
where
    F: FnMut(&T) -> K,
    K: Ord;
```
(they are also `const` under `#[feature(const_cmp)]`, I've omitted `const` stuff for simplicity/readability)

----

Semantically these functions are equivalent to `{ let mut arr = [v1, v2]; arr.sort(); arr }`, but since they operate on 2 elements only, they are implemented as a single comparison.

Even though that's basically a sort, I think "sort 2 elements" operation is useful on it's own in many cases. Namely, it's a common pattern when you have 2 things, and need to know which one is smaller/bigger to operate on them differently.

I've wanted such functions countless times, most recently in #109402, so I thought I'd propose them.

----

r? libs-api
2023-09-18 18:27:18 +02:00
Maybe Waffle
0c3e0abbf8 Fill-in tracking issue for feature(cmp_minmax) 2023-09-18 16:21:03 +00:00
bors
b1575cb72e Auto merge of #115927 - lnicola:sync-from-ra, r=lnicola
⬆️ `rust-analyzer`

r? `@ghost`
2023-09-18 16:16:30 +00:00
Maybe Waffle
fe87063a18 Add minmax* functions to core::cmp 2023-09-18 16:13:25 +00:00
Oli Scherer
ee59531dfc Explain with_reveal_all_normalized usage 2023-09-18 15:17:52 +00:00
bors
cbcf9a5368 Auto merge of #115795 - Kobzol:opt-dist-custom, r=Mark-Simulacrum
Refactor `opt-dist` to simplify local building

This PR refactors the `opt-dist` tool to make it easier to invoke it locally, outside of CI, and thus simplify building PGO/BOLT optimized `rustc` builds e.g. for distro maintainers. It should also make it easier to run the PGO/BOLT workflow locally e.g. to profile performance or debug issues (looking at you, https://github.com/rust-lang/rust/pull/115554).
2023-09-18 14:26:40 +00:00
Mark Rousskov
d5643b1dec Expand infra-ci reviewer list 2023-09-18 10:13:49 -04:00
clubby789
9c5de75ce1 Migrate 'cast enum with drop to int' diagnostic 2023-09-18 14:07:05 +00:00
clubby789
80a9699117 Migrate 'trivial cast' lint 2023-09-18 14:07:05 +00:00
clubby789
82471e9f6c Migrate 'casting unknown pointer' diagnostic 2023-09-18 14:07:05 +00:00
clubby789
94920cc6e0 Migrate 'int to fat pointer' cast diagnostic 2023-09-18 14:07:03 +00:00
clubby789
c2841e2a1e Migrate 'cast to bool' diagnostic 2023-09-18 14:03:57 +00:00
clubby789
dcb3e70861 Migrate 'is_empty' diagnostics 2023-09-18 14:03:57 +00:00
clubby789
6496181208 Migrate 'lossy int2ptr cast' diagnostic 2023-09-18 14:03:57 +00:00
clubby789
bf693d1743 Migrate 'lossy ptr2int cast' diagnostic 2023-09-18 14:03:57 +00:00
Guillaume Gomez
354397f04d Move mobile topbar title creation entirely into JS 2023-09-18 15:52:21 +02:00
danakj
b7e98e13cd Document that the macabi sanitizers are shared with darwin
Do not rename and resign the darwin sanitizers a second time for
macabi.
2023-09-18 09:38:12 -04:00
danakj
4eb1b52794 Enable ASAN/LSAN/TSAN for *-apple-ios-macabi
The -macabi targets are iOS running on MacOS, and they use the runtime
libraries for MacOS, thus they have the same sanitizers available as the
*-apple-darwin targets.
2023-09-18 09:38:12 -04:00
Zalathar
01b67f4b26 coverage: Simplify sorting of coverage spans extracted from MIR
Switching to `Ordering::then_with` makes control-flow less complicated, and
there is no need to use `partial_cmp` here.
2023-09-18 23:15:25 +10:00
Zalathar
a4cb31bb58 coverage: Regression test for inconsistent handling of closure spans 2023-09-18 22:33:05 +10:00
bors
de68911f4a Auto merge of #115929 - matthiaskrgr:rollup-hhasy22, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #115558 (issue has since been fixed)
 - #115724 (Add myself to the mailmap)
 - #115811 (Make AIX known by bootstrap)
 - #115838 (inspect: closer to proof trees for coherence)
 - #115902 (Fix up a few CI images)
 - #115907 (nop_lift macros: ensure that we are using the right interner)
 - #115908 (Do not clone MIR for const-prop lint.)
 - #115916 (Add me as on vacation)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-09-18 11:56:46 +00:00
Jakub Beránek
ee451f8fac
Fix build on Windows 2023-09-18 13:45:42 +02:00
Zalathar
4690f97099 coverage: Fix an unstable-sort inconsistency in coverage spans
This code was calling `sort_unstable_by`, but failed to impose a total order on
the initial spans. That resulted in unpredictable handling of closure spans,
producing inconsistencies in the coverage maps and in user-visible coverage
reports.

This patch fixes the problem by always sorting closure spans before
otherwise-identical non-closure spans, and also switches to a stable sort in
case the ordering is still not total.
2023-09-18 21:28:56 +10:00
Matthias Krüger
5290cc9f23
Rollup merge of #115916 - jackh726:vacation, r=jackh726
Add me as on vacation
2023-09-18 13:02:20 +02:00
Matthias Krüger
c101c5fa50
Rollup merge of #115908 - cjgillot:lint-noclone, r=oli-obk
Do not clone MIR for const-prop lint.

Addresses https://github.com/rust-lang/rust/pull/115797#issuecomment-1721250533
2023-09-18 13:02:20 +02:00
Matthias Krüger
0d29cdd187
Rollup merge of #115907 - RalfJung:interner-check, r=compiler-errors
nop_lift macros: ensure that we are using the right interner

Right now someone could put down the wrong list name when using these macros, and everything would still build. Nothing does a type-check to ensure that the `$set` contains element of type `Self::Lifted`. Let's fix that.

For lists this is fairly easy; for the other interners we need to unwrap some newtypes which makes this more complicated.
2023-09-18 13:02:19 +02:00
Matthias Krüger
497701876f
Rollup merge of #115902 - Mark-Simulacrum:bump-ci, r=albertlarsan68
Fix up a few CI images

This forward-ports changes made on the stable branch to fix CI (https://github.com/rust-lang/rust/pull/115787).
2023-09-18 13:02:19 +02:00
Matthias Krüger
944c4134d2
Rollup merge of #115838 - lcnr:added-goals, r=compiler-errors
inspect: closer to proof trees for coherence

a continuation of #115751. Now explicitly store the added goals

r? ```@compiler-errors```
2023-09-18 13:02:18 +02:00
Matthias Krüger
c843ac2ad9
Rollup merge of #115811 - bzEq:make-aix-known, r=Mark-Simulacrum
Make AIX known by bootstrap

Use `x.py` to build rustc on AIX directly is failing
```
unknown OS type: AIX
Build completed unsuccessfully in 0:00:00
```
If kernel is `AIX`, we should return default triple `powerpc64-ibm-aix` for current rustc.
2023-09-18 13:02:18 +02:00