Commit Graph

228849 Commits

Author SHA1 Message Date
Trevor Gross
a635bf7a3b Revert "alloc: Allow comparing Boxs over different allocators"
This reverts commit 001b081cc1.

This change was done as the above commit introduces a regression in type
inference. Regression test located at
`tests/ui/type-inference/issue-113283-alllocator-trait-eq.rs`
2023-07-04 05:02:00 -04:00
Boxy
276d628cac move logic for flags into separate function 2023-07-04 10:01:54 +01: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
Chris Denton
4309954187
Test Child::kill behaviour on exited process 2023-07-04 09:50:49 +01:00
lcnr
312994243a extend comment 2023-07-04 10:34:27 +02:00
Boxy
adefeb80c3 change flag name 2023-07-04 09:17:41 +01:00
Boxy
2ad00f471a reviews 2023-07-04 09:13:10 +01:00
lcnr
b468bfb361 -Ztrait-solver=next: stop depending on old solver 2023-07-04 10:06:39 +02: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
0c73b41cd6 remove TypeWellFormedFromEnv 2023-07-03 21:40:04 +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
Josh Stone
d9b1fa93c4 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-03 13:51:54 -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
Trevor Gross
6a1c10bd85 Add a simple markdown parser for formatting rustc --explain
Currently, the output of `rustc --explain foo` displays the raw markdown in a
pager. This is acceptable, but using actual formatting makes it easier to
understand.

This patch consists of three major components:

1.  A markdown parser. This is an extremely simple non-backtracking recursive
    implementation that requires normalization of the final token stream
2.  A utility to write the token stream to an output buffer
3.  Configuration within rustc_driver_impl to invoke this combination for
    `--explain`. Like the current implementation, it first attempts to print to
    a pager with a fallback colorized terminal, and standard print as a last
    resort.

    If color is disabled, or if the output does not support it, or if printing
    with color fails, it will write the raw markdown (which matches current
    behavior).

    Pagers known to support color are: `less` (with `-r`), `bat` (aka `catbat`),
    and `delta`.

The markdown parser does not support the entire markdown specification, but
should support the following with reasonable accuracy:

-   Headings, including formatting
-   Comments
-   Code, inline and fenced block (no indented block)
-   Strong, emphasis, and strikethrough formatted text
-   Links, anchor, inline, and reference-style
-   Horizontal rules
-   Unordered and ordered list items, including formatting

This parser and writer should be reusable by other systems if ever needed.
2023-07-03 16:04:18 -04:00
Boxy
040aa58d0a add flag for disabling global cache and printing proof trees on error 2023-07-03 21:00:16 +01:00
bors
8931edf746 Auto merge of #113293 - GuillaumeGomez:rollup-2395uw0, r=GuillaumeGomez
Rollup of 3 pull requests

Successful merges:

 - #112869 (Implement selection via new trait solver)
 - #113285 ([rustdoc] Fix display of long inline cfg labels)
 - #113286 (Don't perform selection if inherent associated types are not enabled)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-03 17:21:14 +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
Guillaume Gomez
4668d3e737
Rollup merge of #112869 - compiler-errors:sketchy-new-select, r=lcnr
Implement selection via new trait solver

Implements selection via the new solver by calling into `assemble_and_evaluate_candidates`, doing a very light-weight "winnow" to choose one candidate over the others, and then re-confirming that candidate outside of the `EvalCtxt` in order to compute the information necessary for the `ImplSource`.

This selection routine is best effort -- if it receives an ambiguous response from the `EvalCtxt`, then it may return ambiguity if the work to re-confirm the goal is not "easy" -- right now, that means everything except for object and impl goals. Since we don't want to reimplement all of the work of the `compute_builtin_*` methods in the solver internals, we bail out if we encounter ambiguity more often than the old solver. This should only barely affect [method selection](f798ada7ba/compiler/rustc_hir_typeck/src/method/probe.rs (L1447)) and not codegen. It can be made more precise later if needed.

r? `@lcnr`
2023-07-03 18:46:13 +02:00
Michael Goulet
f3f8793268 Helpers for creating EvalCtxts, some comments 2023-07-03 15:58:33 +00:00
Michael Goulet
298c0d1a62 Implement selection in new trait solver 2023-07-03 15:53:27 +00:00
bors
3ae0ef79fe Auto merge of #113288 - Nilstrieb:revert-dev, r=oli-obk
Revert "Suggest `x build library` for a custom toolchain that fails to load `core`"

This reverts commit b913f5593d.

CI builds with profile=nightly, causing different test output.

Making the output depend on the release channel was not a great idea and we have to be more careful with this.

I did not realize that the change could have such effects on test output but it's kinda obvious with hindsight >.<.
2023-07-03 14:59:49 +00:00
David Wood
2227422920
lint: refactor to make logic a bit cleaner
Signed-off-by: David Wood <david@davidtw.co>
2023-07-03 14:29:04 +01:00
David Wood
f1e287948b
lint: stop normalizing types to avoid recur limits
This was causing compilation failures in the
performance benchmarking as diesel hit recursion
limits.

Signed-off-by: David Wood <david@davidtw.co>
2023-07-03 14:12:20 +01:00
Nilstrieb
ba0f5dcd14 Revert "Suggest x build library for a custom toolchain that fails to load core"
This reverts commit b913f5593d.

CI builds with profile=nightly, causing different test output.

Making the output depend on the release channel was not a great idea.
2023-07-03 12:48:52 +00: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
bors
f798ada7ba Auto merge of #113275 - Nilstrieb:perm, r=fee1-dead
link to PERMITTED_DEPENDENCIES in tidy error
2023-07-03 12:24:14 +00:00
Ralf Jung
e1338cc254 enable test_join test in Miri 2023-07-03 14:05:55 +02:00
The 8472
7916a2c1c9 Use Lrc::make_mut instead of Lrc::get_mut 2023-07-03 13:40:25 +02:00
The 8472
14e57d7c13 perform TokenStream replacement in-place when possible in expand_macro 2023-07-03 13:29:15 +02:00
Guillaume Gomez
9d130582ab Add GUI test for long inline cfg labels display 2023-07-03 13:26:40 +02:00
Guillaume Gomez
75cc2b8e8c Fix display of long inline cfg labels 2023-07-03 13:26:37 +02:00
Jonathan Pallant (Ferrous Systems)
d8790b87bb
Update platform-support.md
Updates the descriptions of the various ARM targets in platform-support.md so they are a little more consistent.

For example, all instances of ARMv7 changed to ARMv7-A (as opposed to ARMv7-R and ARMv7-M).
2023-07-03 11:16:47 +01: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
be6a344365 rebase 2023-07-03 09:24:02 +02:00
Nilstrieb
1e8ae5f6cb link to PERMITTED_DEPENDENCIES in tidy error 2023-07-03 07:18:42 +00:00
lcnr
30ed152330 update tests 2023-07-03 09:12:15 +02:00
lcnr
412c6e0b07 review 2023-07-03 09:12:15 +02:00
lcnr
a2dfed6711 deeply_normalize pass in fulfill cx for old solver 2023-07-03 09:12:15 +02:00
lcnr
5378f07d64 use deeply_normalize for assumed_wf_types 2023-07-03 09:12:14 +02:00
lcnr
d2c7449189 add a try_structurally_resolve_type in coerce 2023-07-03 09:12:14 +02:00
lcnr
42067596c2 add deep normalization via the new solver 2023-07-03 09:12:14 +02:00