Commit Graph

3599 Commits

Author SHA1 Message Date
许杰友 Jieyou Xu (Joe)
b5208b3611
Don't suggest impl Trait in path position 2023-07-08 00:04:33 +08: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
Matthias Krüger
72e0e177d5
Rollup merge of #113395 - compiler-errors:new-solver-dyn-star-selection, r=oli-obk
Dont ICE for `dyn* Trait: Trait` (built-in object) goals during selection in new trait solver

We were ICEing too eagerly during selection for `dyn*` goals -- both for dyn unsizing candidates and for built-in object candidates. The former should only be performed on `dyn` objects, but the latter are totally fine.
2023-07-06 12:12:12 +02:00
Michael Goulet
906d2b172c Structurally normalize again for byte string lit pat checking 2023-07-06 07:11:25 +00:00
bors
b112bc5529 Auto merge of #113348 - saethlin:metadata-module-not-compiled, r=Nilstrieb
Remove some unnecessary(?) normalization

https://github.com/rust-lang/rust/issues/59774#issuecomment-1550966711
2023-07-06 05:33:54 +00:00
Michael Goulet
3acaa568c2 Prefer object candidates over impl candidates in new selection 2023-07-06 04:57:17 +00:00
Michael Goulet
cd26d10edf Dont ICE for dyn* Trait: Trait goals during selection in new trait solver 2023-07-06 03:10:11 +00:00
fee1-dead
2bc0ae3f33
Rollup merge of #113350 - chenyukang:yukang-fix-113342-parser, r=compiler-errors
Fix the issue of wrong diagnosis for extern pub fn

Fixes #113342
2023-07-06 09:20:34 +08:00
fee1-dead
1830b80c2d
Rollup merge of #113334 - fmease:revert-lexing-c-str-lits, r=compiler-errors
Revert the lexing of `c"…"` string literals

Fixes \[after beta-backport\] #113235.
Further progress is tracked in #113333.

This PR *manually* reverts parts of #108801 (since a git-revert would've been too coarse-grained & messy)
and git-reverts #111647.

CC `@fee1-dead` (#108801) `@klensy` (#111647)
r? `@compiler-errors`

`@rustbot` label F-c_str_literals beta-nominated
2023-07-06 09:20:33 +08:00
fee1-dead
a105aa227f
Rollup merge of #113163 - JohnTitor:issue-112895, r=compiler-errors
Add a regression test for #112895

Closes #112895 if the second option is enough to close the issue
r? `@compiler-errors`
2023-07-06 09:20:32 +08:00
Zalathar
e4b81f6d71 Re-enable some coverage tests on Linux 2023-07-06 10:19:31 +10:00
Ben Kimock
4e21e9e039 Remove some unnecessary normalization 2023-07-05 19:52:28 -04:00
Yuki Okushi
40f2fbf61e
Add a regression test for #112895
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-07-06 02:50:22 +09:00
Yuki Okushi
86728e74e0
Add a regression test for #109054
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-07-06 02:45:54 +09:00
bors
5dac6b320b Auto merge of #113370 - compiler-errors:rollup-8gvyy8e, r=compiler-errors
Rollup of 8 pull requests

Successful merges:

 - #113010 (rust-installer & rls: remove exclusion from rustfmt & tidy )
 - #113317 ( -Ztrait-solver=next: stop depending on old solver)
 - #113319 (`TypeParameterDefinition` always require a `DefId`)
 - #113320 (Add some extra information to opaque type cycle errors)
 - #113321 (Move `ty::ConstKind` to `rustc_type_ir`)
 - #113337 (Winnow specialized impls during selection in new solver)
 - #113355 (Move most coverage code out of `rustc_codegen_ssa`)
 - #113356 (Add support for NetBSD/riscv64 aka. riscv64gc-unknown-netbsd.)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-05 16:08:43 +00:00
jyn
f7287b9a2c don't try to cross-compile sanitizer tests
this was a pre-existing latent bug, we just didn't have any CI builders exercising it.

fixes the following errors:
```
 ---- [ui] tests/ui/sanitize/new-llvm-pass-manager-thin-lto.rs#opt1 stdout ----

error in revision `opt1`: test compilation failed although it shouldn't!
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/sanitize/new-llvm-pass-manager-thin-lto.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=i686-unknown-linux-gnu" "--cfg" "opt1" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Cstrip=debuginfo" "--remap-path-prefix=/checkout/tests/ui=fake-test-src-base" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/sanitize/new-llvm-pass-manager-thin-lto.opt1/a" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/i686-unknown-linux-gnu/native/rust-test-helpers" "-Clinker=x86_64-linux-gnu-gcc" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/sanitize/new-llvm-pass-manager-thin-lto.opt1/auxiliary" "-Zsanitizer=address" "-Clto=thin" "-Copt-level=1"
--- stderr -------------------------------
error: linking with `x86_64-linux-gnu-gcc` failed: exit status: 1
   = note: x86_64-linux-gnu-gcc: error: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/i686-unknown-linux-gnu/lib/librustc-nightly_rt.asan.a: No such file or directory

failures:
    [ui] tests/ui/sanitize/badfree.rs
    [ui] tests/ui/sanitize/address.rs
    [ui] tests/ui/sanitize/use-after-scope.rs
    [ui] tests/ui/sanitize/new-llvm-pass-manager-thin-lto.rs#opt0
    [ui] tests/ui/sanitize/new-llvm-pass-manager-thin-lto.rs#opt1
```
2023-07-05 11:04:28 -05:00
Michael Goulet
c31fe41453
Rollup merge of #113337 - compiler-errors:next-solver-winnow-specializing, r=lcnr
Winnow specialized impls during selection in new solver

We need to be able to winnow impls that are specialized by more specific impls in order for codegen to be able to proceed.

r? ``@lcnr``
2023-07-05 08:45:45 -07:00
Michael Goulet
b2b1a50751
Rollup merge of #113321 - BoxyUwU:move_constkind_to_typeir, r=oli-obk
Move `ty::ConstKind` to `rustc_type_ir`

Needed this in another PR for custom debug impls, and this will also be required to move the new solver into a separate crate that does not use `TyCtxt` so that r-a and friends can depend on the trait solver.

Rebased on top of #113325, only the second and third commits needs reviewing
2023-07-05 08:45:45 -07:00
Michael Goulet
0334b64cbb
Rollup merge of #113320 - oli-obk:eval_obligation_query, r=petrochenkov,BoxyUwU
Add some extra information to opaque type cycle errors

Plus a bunch of cleanups.

This should help users debug query cycles due to auto trait checking. We'll probably want to fix cycle errors in most (or all?) cases by looking at the current item's hidden types (new solver does this), and by delaying the auto trait checks to after typeck.
2023-07-05 08:45:44 -07:00
bors
e4cd161006 Auto merge of #113210 - fee1-dead-contrib:effects-mvp, r=oli-obk
Effects/keyword generics MVP

This adds `feature(effects)`, which adds `const host: bool` to the generics of const functions, const traits and const impls. This will be used to replace the current logic around const traits.

r? `@oli-obk`
2023-07-05 13:42:00 +00:00
León Orell Valerian Liehr
22fd6a6abf
Add regression test 2023-07-05 13:45:12 +02:00
León Orell Valerian Liehr
c6643b50ea
Revert the lexing of c_str_literals 2023-07-05 13:11:17 +02:00
Boxy
62174bfe72 Deal with fallout 2023-07-05 09:46:30 +01:00
yukang
f25463e848 Fix the issue of wrong diagnosis for extern pub fn 2023-07-05 16:25:46 +08:00
Oli Scherer
f80aec7429 Test that you can't circumvent the Sized bound check 2023-07-05 07:46:05 +00:00
Oli Scherer
25e3785b86 Make unused_associated_type_bounds's lint level changeable 2023-07-05 07:46:05 +00:00
Oli Scherer
ce3cff47e0 Add more tests 2023-07-05 07:46:05 +00:00
Oli Scherer
9e98feb84c Add some extra information to opaque type cycle errors 2023-07-05 07:43:35 +00:00
Oli Scherer
9cacfae3e9 Fix some tests to *only* test their main issue and not have secondary failures 2023-07-05 07:43:35 +00:00
Oli Scherer
a49b736568 Lint now-unnecessary associated type bounds 2023-07-05 07:42:53 +00:00
Oli Scherer
ca581f9161 Don't require associated types with Self: Sized bounds in dyn Trait objects 2023-07-05 07:42:53 +00:00
Michael Goulet
d2a1803d6f Winnow specializing impls 2023-07-05 06:18:48 +00:00
Eric Mark Martin
261c023123 rename constants in mir dump test 2023-07-05 04:28:45 +00:00
Eric Mark Martin
afccc44402 add mir dump test 2023-07-05 02:23:43 +00:00
Matthias Krüger
7996908c4f
Rollup merge of #113324 - lcnr:const-evaluatable-goal, r=BoxyUwU
implement `ConstEvaluatable` goals in new solver

this only supports stable const generics. `feature(generic_const_exprs)` needs to extend that function is non-trivial ways. Leaving this for someone else or some later date.

r? `@BoxyUwU`
2023-07-04 17:46:28 +02:00
lcnr
abcaf30f9b implement ConstEvaluatable goals in new solver
we don't yet handle `generic_const_exprs`, someone else
can do that :3
2023-07-04 15:54:18 +02:00
bors
4dbc7e3092 Auto merge of #113309 - chenyukang:yukang-fix-89640-space, r=Nilstrieb
Detect extra space in keyword for better hint

Fixes #89640

r? `@Nilstrieb`

I met the same issue, then found out this old issue :)
2023-07-04 12:04:57 +00:00
Deadbeef
30b21b758a add test 2023-07-04 11:47:46 +00:00
yukang
799d2917e7 Detect extra space in keyword for better hint 2023-07-04 18:13:31 +08:00
bors
cd68ead9ec Auto merge of #113303 - compiler-errors:yeet-chalk, r=lcnr
Remove chalk support from the compiler

Removes chalk (`-Ztrait-solver=chalk`) from the compiler and prunes any dead code resulting from this, mainly:
* Remove the chalk compatibility layer in `compiler/rustc_traits/src/chalk`
* Remove the chalk flag `-Ztrait-solver=chalk` and its `TraitEngine` implementation
* Remove `TypeWellFormedFromEnv` (and its many `bug!()` match arms)
* Remove the chalk migration mode from compiletest
* Remove the `chalkify` UI tests (do we want to keep any of these, but migrate them to `-Ztrait-solver=next`??)

Fulfills rust-lang/types-team#93.

r? `@jackh726`
2023-07-04 09:09:09 +00:00
Trevor Gross
3c9a7491c2 Add a test for PartialEq across Allocators breaking inference (#113283)
Verify that `PartialEq` implementations do not break type inference
when comparing types across different allocators. This catches a
regression in current nightly introduced in 001b081cc1 (alloc: Allow
comparing `Box`s over different allocators")

`Box` is the only type that currently impelements this, but tests are
included for `Rc` and `Arc` to prevent future regresssions.
2023-07-04 05:00:46 -04:00
bors
52d8c490a3 Auto merge of #113304 - cuviper:indexmap-2, r=Mark-Simulacrum
Upgrade to indexmap 2.0.0

The new version was already added to the tree as an indirect dependency
in #113046, but now our direct dependents are using it too.
2023-07-04 06:49:20 +00:00
bors
0130c3a06e Auto merge of #113215 - compiler-errors:rpitit-predicates-tweaks, r=spastorino
Make RPITITs assume/require their parent method's predicates

Removes a FIXME from the `param_env` query where we were manually adding the parent function's predicates to the RPITIT's assumptions.

r? `@spastorino`
2023-07-04 04:24:24 +00:00
bors
e728b5b98d Auto merge of #112917 - chenyukang:yukang-fix-112590, r=estebank
Suggest importing for partial mod path matching in name resolving

Fixes #112590
2023-07-04 02:01:24 +00:00
Michael Goulet
c6fcbaae0f Remove compare mode 2023-07-03 21:40:04 +00:00
Michael Goulet
810fbf086d Remove chalk from the compiler 2023-07-03 21:40:04 +00:00
Josh Stone
2b091ff3e2 Bless ui-fulldeps/missing-rustc-driver-error
The specific crates have changed, but the expected "help" remains.
2023-07-03 14:27:23 -07:00
bors
0ab38e95bb Auto merge of #108611 - davidtwco:issue-94223-external-abi-fn-ptr-in-internal-abi-fn, r=jackh726
lint/ctypes: ext. abi fn-ptr in internal abi fn

Fixes #94223.

- In the improper ctypes lint, instead of skipping functions with internal ABIs, check that the signature doesn't contain any fn-ptr types with external ABIs that aren't FFI-safe.
- When computing the ABI for fn-ptr types, remove an `unwrap` that assumed FFI-safe types in foreign fn-ptr types.
  - I'm not certain that this is the correct approach.
2023-07-03 20:30:28 +00:00
Guillaume Gomez
157bab670f
Rollup merge of #113286 - fmease:iat-dont-select-if-not-enabled, r=compiler-errors
Don't perform selection if inherent associated types are not enabled

Fixes #113265.

As discussed
r? `@compiler-errors`
2023-07-03 18:46:14 +02:00
Guillaume Gomez
ef21fd57c5
Rollup merge of #113285 - GuillaumeGomez:display-long-inline-cfg, r=notriddle
[rustdoc] Fix display of long inline cfg labels

Fixes #87957.
Fixes #112880.

Before:

![Screenshot from 2023-07-03 13-25-47](https://github.com/rust-lang/rust/assets/3050060/401e2c6b-2cfd-4ae3-9d15-b5e1dfec4201)

After:

![Screenshot from 2023-07-03 13-24-49](https://github.com/rust-lang/rust/assets/3050060/e42a34a8-bf60-409d-8a0c-1669d09e7e1e)

r? `@notriddle`
2023-07-03 18:46:14 +02:00
David Wood
9137fea30d
lint/ctypes: check other types for ext. fn-ptr ty
Extend previous checks for external ABI fn-ptrs to use in internal
statics, constants, type aliases and algebraic data types.

Signed-off-by: David Wood <david.wood@huawei.com>
2023-07-03 13:40:20 +01:00
David Wood
c75b080d7d
lint/ctypes: multiple external fn-ptrs in ty
Extend previous commit's support for checking for external fn-ptrs in
internal fn types to report errors for multiple found fn-ptrs.

Signed-off-by: David Wood <david.wood@huawei.com>
2023-07-03 13:40:20 +01:00
David Wood
eddfce53c1
abi: avoid ice for non-ffi-safe fn ptrs
Remove an `unwrap` that assumed FFI-safe types in foreign fn-ptr types.

Signed-off-by: David Wood <david.wood@huawei.com>
2023-07-03 13:40:20 +01:00
David Wood
e3f90bca50
lint/ctypes: ext. abi fn-ptr in internal abi fn
Instead of skipping functions with internal ABIs, check that the
signature doesn't contain any fn-ptr types with external ABIs that
aren't FFI-safe.

Signed-off-by: David Wood <david.wood@huawei.com>
2023-07-03 13:40:20 +01:00
León Orell Valerian Liehr
838f85d6f7
Don't perform selection if IATs are not enabled 2023-07-03 14:33:38 +02:00
Guillaume Gomez
9d130582ab Add GUI test for long inline cfg labels display 2023-07-03 13:26:40 +02:00
bors
737b461555 Auto merge of #113086 - lcnr:rust8, r=compiler-errors
implement deep normalization via the new solver

together with #112869 this should remove all uses of the old solver with `-Ztrait-solver=next`.

see https://hackmd.io/V0qsUB_fTxexfQO_pcOcrg for a description of this PR. Will move that doc to the `rustc-dev-guide` after merging this.

r? `@compiler-errors`
2023-07-03 07:38:26 +00:00
lcnr
30ed152330 update tests 2023-07-03 09:12:15 +02:00
Matthias Krüger
0aac35db10
Rollup merge of #113258 - GuillaumeGomez:migrate-gui-test-color-19, 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-02 23:30:46 +02:00
bors
bf0e22b298 Auto merge of #108537 - GuillaumeGomez:rustdoc-search-whitespace-as-separator, r=notriddle
rustdoc: Allow whitespace as path separator like double colon

Fixes https://github.com/rust-lang/rust/issues/108447.

I think it makes sense since it allows more common cases, however it also makes the syntax heavier. Not sure what the rest of the team thinks about it. In any case we'll need to go through FCP.

Full explanation for the changes is available [here](https://github.com/rust-lang/rust/pull/108537#issuecomment-1589480564).

r? `@notriddle`
2023-07-02 18:49:29 +00:00
bors
131a03664e Auto merge of #113040 - Kobzol:llvm-remark-streamer, r=tmiasko
Add `-Zremark-dir` unstable flag to write LLVM optimization remarks to YAML

This PR adds an option for `rustc` to emit LLVM optimization remarks to a set of YAML files, which can then be digested by existing tools, like https://github.com/OfekShilon/optview2. When `-Cremark-dir` is passed, and remarks are enabled (`-Cremark=all`), the remarks will be now written to the specified directory, **instead** of being printed to standard error output.  The files are named based on the CGU from which they are being generated.

Currently, the remarks are written using the LLVM streaming machinery, directly in the diagnostics handler. It seemed easier than going back to Rust and then form there back to C++ to use the streamer from the diagnostics handler. But there are many ways to implement this, of course, so I'm open to suggestions :)

I included some comments with questions into the code. Also, I'm not sure how to test this.

r? `@tmiasko`
2023-07-02 12:48:44 +00:00
Jakub Beránek
62728c7aaf
Add rustc option to output LLVM optimization remarks to YAML files 2023-07-02 13:41:36 +02:00
Guillaume Gomez
c7847e991a Migrate GUI colors test to original CSS color format 2023-07-02 11:15:23 +02:00
Matthias Krüger
74a272d3d7
Rollup merge of #113231 - Urgau:fix_false_positive_drop_copy, r=Nilstrieb
Fix `dropping_copy_types` lint from linting in match-arm with side-effects

This PR fixes an issue with the `dropping_copy_types` and `dropping_references` lints when not all patterns that can have side-effects were detected and ignored.

Nearly _fixes_ https://github.com/rust-lang/rust/issues/112653 (will need beta-backport to completely fix the issue)
r? ``@Nilstrieb``
2023-07-02 10:27:21 +02:00
Matthias Krüger
37c50653fe
Rollup merge of #113228 - GuillaumeGomez:migrate-gui-test-color-18, 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-02 10:27:20 +02:00
yukang
b26701ea79 add testcase for 112590 2023-07-02 15:35:18 +08:00
bors
8e2d5e3a58 Auto merge of #112910 - lqd:mcp510, r=petrochenkov
Implement most of MCP510

This implements most of what remains to be done for MCP510:
- turns `-C link-self-contained` into a `+`/`-` list of components, like `-C link-self-contained=+linker,+crto,+libc,+unwind,+sanitizers,+mingw`. The scaffolding is present for all these expected components to be implemented and stabilized in the future on their own time. This PR only handles the `-Zgcc-ld=lld` subset of these link-self-contained components as  `-Clink-self-contained=+linker`
- handles  `-C link-self-contained=y|n`  as-is today, for compatibility with `rustc_codegen_ssa:🔙🔗:self_contained`'s [explicit opt-in and opt-out](9eee230cd0/compiler/rustc_codegen_ssa/src/back/link.rs (L1671-L1676)).
- therefore supports our plan to opt out of `rust-lld` (when it's enabled by default) even for current `-Clink-self-contained` users, with e.g. `-Clink-self-contained -Clink-self-contained=-linker`
- turns `add_gcc_ld_path` into its expected final form, by using the `-C link-self-contained=+linker`  CLI flag, and whether the `LinkerFlavor`  has the expected `Cc::Yes` and `Lld::Yes` shape (this is not yet the case in practice for any CLI linker flavor)
- makes the [new clean linker flavors](https://github.com/rust-lang/rust/pull/96827#issuecomment-1208441595) selectable in the CLI in addition to the legacy ones, in order to opt-in to using `cc` and `lld` to emulate `-Zgcc-ld=lld`
- ensure the new `-C link-self-contained` components, and `-C linker-flavor`s are unstable, and require `-Z unstable-options` to be used

The up-to-date set of flags for the future stable CLI version of `-Zgcc-ld=lld` is currently: `-Clink-self-contained=+linker -Clinker-flavor=gnu-lld-cc -Zunstable-options`.

It's possible we'll also need to do something for distros that don't ship `rust-lld`, but maybe there are already no tool search paths to be added to `cc` in this situation anyways.

r? `@petrochenkov`
2023-07-02 02:25:01 +00:00
Jan-Mirko Otter
a0bd381052 test-various: run codegen and assembly tests 2023-07-02 02:22:22 +02:00
Eric Mark Martin
b9e991a105 add thir-print test 2023-07-01 15:15:22 -04:00
Jan-Mirko Otter
211946c357 add run-make test for wasm-exceptions 2023-07-01 20:24:15 +02:00
Jan-Mirko Otter
65aeac610c add assembly-test: wasm-exceptions 2023-07-01 20:24:15 +02:00
Jan-Mirko Otter
db76154817 add codegen-test: wasm-exceptions 2023-07-01 20:24:15 +02:00
Urgau
908574b5e7 Fix dropping_copy_types lint from linting in match-arm with side-effects 2023-07-01 16:05:55 +02:00
Matthias Krüger
ca7e27a71c
Rollup merge of #113182 - compiler-errors:rpit-stricter-captures, r=oli-obk
Error when RPITITs' hidden types capture more lifetimes than their trait definitions

This implements a stricter set of captures rules for RPITITs. They now may only capture:
1. Lifetimes from the impl header (both the self type and any trait substs -- we may want to restrict just to the self type's lifetimes, but the PR makes that easy to do, too)
2. Lifetimes mentioned by the `impl Trait` in the trait method's definition.

Namely, they may not mention lifetimes from the method (early or late) that are not mentioned in the `impl Trait`.

cc #105258 which I think was trying to do this too, though I'm not super familiar with what exactly differs from that or why that one was broken.
cc #112194 (doesn't fix this issue per se, because it's still an open question, but I think this is objectively better than the status quo, and gets us closer to resolving that issue.)

Technically is a fix for the ICE in #108580, but it turns that issue into an error now. We can decide separately whether or not nested RPITITs should capture lifetimes from their parents.

r? ``@oli-obk``
2023-07-01 13:46:01 +02:00
Matthias Krüger
9082287213
Rollup merge of #113174 - chenyukang:yukang-fix-102972-loop-next, r=compiler-errors
Better messages for next on a iterator inside for loops

Fixes #102972
2023-07-01 13:46:01 +02:00
Matthias Krüger
b63bc0645f
Rollup merge of #113168 - bvanjoi:fix-85992, r=petrochenkov
fix(resolve): skip assertion judgment when NonModule is dummy

Fixes #85992

## Why #85992 panic

During `resolve_imports`, the `path_res` of the import `issue_85992_extern_2::Outcome` is pointing to `external::issue_85992_extern_2` instead of `crate::issue_85992_extern_2`. As a result `import.imported_module.set` had been executed.

Attached 1: the state of `early_resolve_ident_in_lexical_scope` during the `resolve_imports` for `use issue_85992_extern_2::Outcome` is as follows:

|iter in `visit_scopes`  | `scope` | `result.binding` |
| -    | -               | -                                                            |
| init | -               | -                                                            |
| 0    | `CrateRoot`     | Err(Determined)     |
| 1    | `ExternPrelude` | pointing to the `issue_85992_extern_2`(external) |

However, during finalization for `issue_85992_extern_2::Outcome`, the `innermost_result` was pointed to `crate::issue_85992_extern_2` and no ambiguity was generated, leading to a panic.

Attached 2: the state of `early_resolve_ident_in_lexical_scope` during the `finalize_import` for `use issue_85992_extern_2::Outcome` is as follows:

|iter in `visit_scopes`  | `scope` | `result.binding` | `innermost_result` |
| -    | -               | -                                                            | -                     |
| init | -               | -                                                            | `None`                |
| 0    | `CrateRoot`     | pointing to `use crate::issue_85992_extern_2` **(introdcued by dummy)**    | same as `result` but with a `Some` wapper|
| 1    | `ExternPrelude` | pointing to the `issue_85992_extern_2`(external) | smae as above |

## Try to solve

Skip assertion judgment when `NonModule` is dummy

r? `@petrochenkov`
2023-07-01 13:46:00 +02:00
Guillaume Gomez
c607e206be Migrate GUI colors test to original CSS color format 2023-07-01 13:18:28 +02:00
bors
e5bb341f0e Auto merge of #111992 - ferrocene:pa-panic-abort-tests-bench, r=m-ou-se
Test benchmarks with `-Z panic-abort-tests`

During test execution, when a `#[bench]` benchmark is encountered it's executed once to check whether it works. Unfortunately that was not compatible with `-Z panic-abort-tests`: the feature works by spawning a subprocess for each test, which prevents the use of dynamic tests as we cannot pass closures to child processes, and before this PR the conversion from benchmark to test was done by turning benchmarks into dynamic tests whose closures execute the benchmark once.

The approach this PR took was to add two new kinds of `TestFn`s: `StaticBenchAsTestFn` and `DynBenchAsTestFn` (⚠️ **this is a breaking change** ⚠️). With that change, a `StaticBenchFn` can be converted into a `StaticBenchAsTestFn` without creating dynamic tests, and making it possible to test `#[bench]` functions with `-Z panic-abort-tests`. The subprocess test runner also had to be updated to perform the conversion from benchmark to test when appropriate.

Along with the bug fix, in the first commit I refactored how tests are executed: rather than executing the test function in multiple places across `libtest`, there is now a private `TestFn::into_runnable()` method, which returns either a `RunnableTest` or `RunnableBench`, on which you can call the `run()` method. This simplified the rest of the changes in the PR.

This PR is best reviewed commit-by-commit.
Fixes https://github.com/rust-lang/rust/issues/73509
2023-07-01 07:07:50 +00:00
Eric Mark Martin
7dfb9eda25 add regression test 2023-07-01 02:28:15 -04:00
bohan
549f48d0ed fix(resolve): skip assertion judgment when NonModule is dummy 2023-07-01 11:53:31 +08:00
Rémy Rakic
38f5a9964b comment, and bless, unstable linker flavor test 2023-06-30 21:13:24 +00:00
Rémy Rakic
6594f365fe add end-to-end test 2023-06-30 21:13:24 +00:00