Commit Graph

3577 Commits

Author SHA1 Message Date
Matthias Krüger
70c637808f
Rollup merge of #113331 - chenyukang:yukang-fix-112590-false-positive, r=estebank
Add filter with following segment while lookup typo for path

From the discussion: https://github.com/rust-lang/rust/pull/112917#discussion_r1239150173

Seems we can not get the assoc items for `Struct`, `Enum` in the resolving phase.
A obvious filter is avoid suggesting the same name with the following segment path.

Use `following_seg` can extend the function `smart_resolve_partial_mod_path_errors` for more scenarios, such as `std::sync_error::atomic::AtomicBool` in test case.

r? `@estebank`
2023-07-10 12:01:32 +02:00
bors
02d1ee4834 Auto merge of #113127 - jieyouxu:fix-error-color-summary, r=davidtwco
Set error handler output format as soon as possible

Should fix https://github.com/rust-lang/rust/pull/112692#issuecomment-1611585904.
2023-07-10 00:10:53 +00:00
bors
70d7283d24 Auto merge of #113389 - Zalathar:re-enable, r=Mark-Simulacrum
Re-enable some coverage tests on Linux

These tests were originally disabled (on all platforms) in #110393, because those changes had made them start failing on Linux for unclear reasons.

I tried to re-enable them unconditionally in #111179, since they worked locally on my Mac, but I found that they were still failing on Linux, so I gave up at that time.

Later while working on #112300 I was able to re-enable them on Windows and Mac, since those changes made it possible to add specific `ignore-` directives to individual tests. I noticed at the time that the tests actually seemed to be working again on Linux, but by that point I didn't want to risk more CI failures, so I left them disabled on Linux with an intention to re-enable them later.

Now I'm going back to re-enable them on Linux too, since they seem to work fine.

---

Because `run-coverage` tests are sensitive to line numbers, and `x test tidy` doesn't like leading blank lines, I've replaced the old comment/ignore with an informative comment that occupies the same number of lines.
2023-07-09 21:37:56 +00:00
Matthias Krüger
ec479bae7f
Rollup merge of #113469 - JohnTitor:rm-default-free-fn, r=Amanieu
Remove `default_free_fn` feature

Closes #73014
r? ``@Amanieu``
2023-07-09 16:33:37 +02:00
Matthias Krüger
6a20f681d5
Rollup merge of #113247 - mirkootter:test-wasm-exceptions-nostd, r=Mark-Simulacrum
Add Tests for native wasm exceptions

### Motivation
In PR #111322, I added support for native WASM exceptions. I was asked by ``@davidtwco`` to add some tests for it in a follow up PR, which seems like a very good idea.

This PR adds three tests for this feature:
* codegen: ensure the correct LLVM instructions are used
* assembly: ensure the correct WASM instructions are used
* run-make: ensure the exception handling works; the WASM code is run using a small nodejs script which demonstrates the exception handling

### Complications
There are a few changes beside adding the tests, which were necessary
* Tests for the wasm32-unknown-unknown target are (as far as I know) only run on `test-various`. Its docker image uses nodejs-15, which is very old. Experimental support for wasm-exceptions was added in nodejs16. In nodejs 18.12 (LTS), they are stable.
  - --> increase nodejs to 18.12 in `test-various`
* codegen/assembly tests are not performed for the wasm32-unknown-unknown target yet
  - --> add those to `test-various` as well

Due to the last point, some tests are run which have not run before (assembly+codegen tests for wasm32-unknown-unknown). I added `// ignore wasm32-bare` for those which failed

### Local testing
I run all tests locally using both `test-various` and `wasm32`. As far as I know, none of the other systems run any test for wasm32 targets.
2023-07-09 16:33:36 +02:00
Matthias Krüger
4406a92cd1
Rollup merge of #111618 - cjgillot:name-return-place, r=tmiasko
Always name the return place.

MIR opts more and more consider `_0` as just another local, so there is no point in keeping the special case in debug-info logic.
2023-07-09 16:33:35 +02:00
bors
83964c156d Auto merge of #113491 - matthiaskrgr:rollup-mueqz7h, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #113005 (Don't call `query_normalize` when reporting similar impls)
 - #113064 (std: edit [T]::swap docs)
 - #113138 (Add release notes for 1.71.0)
 - #113217 (resolve typerelative ctors to adt)
 - #113254 (Use consistent formatting in Readme)
 - #113482 (Migrate GUI colors test to original CSS color format)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-08 20:56:57 +00:00
Matthias Krüger
de9b9c833b
Rollup merge of #113482 - GuillaumeGomez:migrate-gui-test-color-20, r=notriddle
Migrate GUI colors test to original CSS color format

Follow-up of https://github.com/rust-lang/rust/pull/111459.

r? ``@notriddle``
2023-07-08 20:53:30 +02:00
Matthias Krüger
b637be7a17
Rollup merge of #113217 - ericmarkmartin:lower-type-relative-ctor-to-adt, r=cjgillot
resolve typerelative ctors to adt

Associated issue: #110508

r? ``@spastorino``
2023-07-08 20:53:29 +02:00
Matthias Krüger
48a0d038fa
Rollup merge of #113005 - compiler-errors:dont-query-normalize, r=cjgillot
Don't call `query_normalize` when reporting similar impls

Firstly, It's sketchy to be using `query_normalize` at all during HIR typeck -- it's asking for an ICE 😅. Secondly, we're normalizing an impl trait ref that potentially has parameter types in `ty::ParamEnv::empty()`, which is kinda sketchy as well.

The only UI test change from removing this normalization is that we don't evaluate anonymous constants in impls, which end up giving us really ugly suggestions:

```
error[E0277]: the trait bound `[X; 35]: Default` is not satisfied
 --> /home/gh-compiler-errors/test.rs:4:5
  |
4 |     <[X; 35] as Default>::default();
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `[X; 35]`
  |
  = help: the following other types implement trait `Default`:
            &[T]
            &mut [T]
            [T; 32]
            [T; core::::array::{impl#30}::{constant#0}]
            [T; core::::array::{impl#31}::{constant#0}]
            [T; core::::array::{impl#32}::{constant#0}]
            [T; core::::array::{impl#33}::{constant#0}]
            [T; core::::array::{impl#34}::{constant#0}]
          and 27 others
```

So just fold the impls with a `BottomUpFolder` that calls `ty::Const::eval`. This doesn't work totally correctly with generic-const-exprs, but it's fine for stable code, and this is error reporting after all.
2023-07-08 20:53:27 +02:00
bors
d1389b9b48 Auto merge of #113484 - matthiaskrgr:rollup-goq2u0d, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #112931 (Enable zlib in LLVM on aarch64-apple-darwin)
 - #113158 (tests: unset `RUSTC_LOG_COLOR` in a test)
 - #113173 (CI: include workflow name in concurrency group)
 - #113335 (Reveal opaques in new solver)
 - #113390 (CGU formation tweaks)
 - #113399 (Structurally normalize again for byte string lit pat checking)
 - #113412 (Add basic types to SMIR)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-08 18:36:58 +00:00
Matthias Krüger
39f558f8cf
Rollup merge of #113412 - spastorino:smir-types-1, r=oli-obk
Add basic types to SMIR

Still incomplete but I think this can be merged and we can keep iterating over it.

r? ``@oli-obk``
2023-07-08 15:49:47 +02:00
Matthias Krüger
8dc9461c91
Rollup merge of #113399 - compiler-errors:next-solver-byte-pat-again, r=oli-obk
Structurally normalize again for byte string lit pat checking

We need to structurally normalize the pointee of a match scrutinee when trying to match byte string patterns -- we used[^1] to call `structurally_resolve_type`, which errors for type vars[^2], but lcnr added `try_structurally_resolve_type`[^3] in the mean time, which is the right thing to use here since it's totally opportunistic.

Fixes rust-lang/trait-system-refactor-initiative#38

[^1]: #112428
[^2]: #112993
[^3]: #113086
2023-07-08 15:49:47 +02:00
Matthias Krüger
f3f1b0394d
Rollup merge of #113335 - compiler-errors:reveal-opaques-in-new-solver, r=lcnr
Reveal opaques in new solver

We were testing against the wrong reveal mode 😨

Also a couple of misc commits that I don't want to really put in separate prs

r? ``@lcnr``
2023-07-08 15:49:46 +02:00
Matthias Krüger
b70c5538b6
Rollup merge of #113158 - davidtwco:unset-rustc-log-color-in-test, r=wesleywiser
tests: unset `RUSTC_LOG_COLOR` in a test

Setting `RUSTC_LOG_COLOR=always` is sometimes useful if tools that one pipes `RUSTC_LOG` into support coloured output, but it makes this test fail because it has a `.stderr` file with `WARN` log output.
2023-07-08 15:49:45 +02:00
bors
9bb6fbe261 Auto merge of #113376 - Nilstrieb:pointer-coercions-are-not-casts-because-that-sounds-way-to-general-aaaa, r=oli-obk
Rename `adjustment::PointerCast` and variants using it to `PointerCoercion`

It makes it sounds like the `ExprKind` and `Rvalue` are supposed to represent all pointer related casts, when in reality their just used to share a little enum variants. Make it clear there these are only coercions and that people who see this and think "why are so many pointer related casts not in these variants" aren't insane.

This enum was added in #59987. I'm not sure whether the variant sharing is actually worth it, but this at least makes it less confusing.

r? oli-obk
2023-07-08 13:48:30 +00:00
Camille GILLOT
d7983a2f23 Always name the return place. 2023-07-08 15:38:40 +02:00
Guillaume Gomez
50b4d1f413 Migrate GUI colors test to original CSS color format 2023-07-08 14:56:15 +02:00
bors
ce519c5945 Auto merge of #113474 - compiler-errors:rollup-07x1up7, r=compiler-errors
Rollup of 8 pull requests

Successful merges:

 - #113413 (Add needs-triage to all new issues)
 - #113426 (Don't ICE in `resolve_bound_vars` when associated return-type bounds are in bad positions)
 - #113427 (Remove `variances_of` on RPITIT GATs, remove its one use-case)
 - #113441 (miri: check that assignments do not self-overlap)
 - #113453 (Remove unused from_method from rustc_on_unimplemented)
 - #113456 (Avoid calling report_forbidden_specialization for RPITITs)
 - #113466 (Update cargo)
 - #113467 (Fix comment of `fn_can_unwind`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-08 10:46:29 +00:00
Michael Goulet
cf1f8c55d5
Rollup merge of #113456 - spastorino:new-rpitit-31, r=compiler-errors
Avoid calling report_forbidden_specialization for RPITITs

Fixes #113438

r? ``@compiler-errors``
2023-07-07 22:12:18 -07:00
Michael Goulet
37a05d8054
Rollup merge of #113453 - spastorino:new-rpitit-30, r=compiler-errors
Remove unused from_method from rustc_on_unimplemented

Fixes #113439

`on_unimplemented_note` was calling `item_name` for RPITITs and that produced ICEs. I've added a regression test for that but also have removed `from_method` symbol entirely because it wasn't even used and by doing that the `item_name` call was also removed.

r? ``@compiler-errors``
2023-07-07 22:12:17 -07:00
Yuki Okushi
a088e7961c
Remove default_free_fn feature
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-07-08 12:10:12 +09:00
Michael Goulet
b7191d8388 Don't ICE in resolve_bound_vars when associated return-type bounds are in bad positions 2023-07-07 19:43:23 +00:00
Santiago Pastorino
24326ee508
Avoid calling report_forbidden_specialization for RPITITs 2023-07-07 16:24:08 -03:00
Santiago Pastorino
6d80879ab9
Add regression test for RPITITs 2023-07-07 15:58:25 -03:00
Santiago Pastorino
9ca51b92d4
Add Float ty to SMIR 2023-07-07 13:47:55 -03:00
Santiago Pastorino
42eccffce3
Add Uint ty to SMIR 2023-07-07 13:47:33 -03:00
Santiago Pastorino
458ead41d6
Add Int ty to SMIR 2023-07-07 13:47:09 -03:00
Santiago Pastorino
73e816e37c
Add Char ty to SMIR 2023-07-07 13:46:40 -03:00
Santiago Pastorino
61adcaf87b
Add rustc_ty_to_ty basic tests 2023-07-07 13:45:54 -03:00
Nilstrieb
2beabbbf6f Rename adjustment::PointerCast and variants using it to PointerCoercion
It makes it sound like the `ExprKind` and `Rvalue` are supposed to represent all pointer related
casts, when in reality their just used to share a some enum variants. Make it clear there these
are only coercion to make it clear why only some pointer related "casts" are in the enum.
2023-07-07 18:17:16 +02:00
Michael Goulet
f55b046931 Normalize opaques during codegen in new solver 2023-07-07 16:02:25 +00:00
Michael Goulet
713f9bb5d1 Mark more hanging new-solver tests 2023-07-07 16:02:24 +00:00
Michael Goulet
010ee7b0e0 Remove an AFIT test that isn't an AFIT test 2023-07-07 16:02:24 +00:00
Oli Scherer
c3004a7b65 Treat closures as part of their parent 2023-07-07 13:17:00 +00:00
Oli Scherer
b549ba1bd4 Fix one layer of closures not being able to constrain opaque types 2023-07-07 13:17:00 +00:00
Oli Scherer
ef52dc7bb8 Add regression test 2023-07-07 13:17:00 +00:00
Oli Scherer
907f97e411 Remove normalization from opaque_types_defined_by 2023-07-07 13:17:00 +00:00
Oli Scherer
4c99872efe Require TAITs to be mentioned in the signatures of functions that register hidden types for them 2023-07-07 13:13:18 +00:00
Michael Goulet
45cb1ba9d3
Rollup merge of #113421 - spastorino:new-rpitit-29, r=compiler-errors
Do not assert >1 RPITITs on collect_return_position_impl_trait_in_trait_tys

Fixes #113403

Assert on collect_return_position_impl_trait_in_trait_tys is not correct when we call it from type_of(GAT). The included test is an example of a situation that collector collects 0 types.

r? `@compiler-errors`
2023-07-06 20:11:41 -07:00
Michael Goulet
901c863644
Rollup merge of #113419 - spastorino:new-rpitit-28, r=compiler-errors
Avoid calling item_name for RPITIT

Fixes #113405

r? `@compiler-errors`
2023-07-06 20:11:41 -07:00
Michael Goulet
f1c90985e8
Rollup merge of #113397 - compiler-errors:new-select-prefer-obj, r=lcnr
Prefer object candidates in new selection

`dyn Any` shouldn't be using [this implementation](https://doc.rust-lang.org/std/any/trait.Any.html#impl-Any-for-T) during codegen.

Prefer object candidates over other candidates, except for other object candidates.
2023-07-06 20:11:40 -07:00
Michael Goulet
7913d76cb9
Rollup merge of #113318 - tgross35:113283-allocator-trait-eq, r=m-ou-se
Revert "alloc: Allow comparing Boxs over different allocators", add regression test

Temporary fix for #113283

Adds a test to fix the regression introduced in 001b081cc1 and revert that commit. The test fails without the revert.
2023-07-06 20:11:40 -07:00
Michael Goulet
1cb31e71d6
Rollup merge of #113164 - JohnTitor:issue-109054, r=compiler-errors
Add a regression test for #109054

Closes #109054
r? ``@compiler-errors``
2023-07-06 20:11:39 -07:00
yukang
37b40e592a adjust smart_resolve_partial_mod_path_errors 2023-07-07 10:19:30 +08:00
yukang
9763472e2b smart_resolve_partial_mod_path_errors should not suggest parent 2023-07-07 10:18:20 +08:00
yukang
6f53e61887 Add filter with next segment while lookup typo for path 2023-07-07 09:00:50 +08:00
Michael Goulet
388c230cf7 Don't call type_of on TAIT in defining scope in new solver 2023-07-06 20:13:22 +00:00
Santiago Pastorino
07a230b5a5
Do not assert >1 RPITITs on collect_return_position_impl_trait_in_trait_tys 2023-07-06 17:07:11 -03:00
Santiago Pastorino
c0c155137b
Avoid calling item_name for RPITIT 2023-07-06 16:18:24 -03:00