Commit Graph

229077 Commits

Author SHA1 Message Date
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
bors
89c2596dde Auto merge of #2959 - RalfJung:vectest, r=RalfJung
vec tets: ensure pointer is still writeable

Under Tree Borrows, a pointer can become read-only: still allowing reads but not permitting writes any more. So these tests that want to check that pointers remain valid need to do writes to ensure that pointers indeed remain fully valid.
2023-07-03 12:00:27 +00:00
Ralf Jung
a68afa2211 vec tets: ensure pointer is still writeable 2023-07-03 13:58:42 +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
Ralf Jung
4951d5f404 remove outdated comment 2023-07-03 11:59:19 +02:00
Ralf Jung
46c1e61792 send link to PR to Zulip 2023-07-03 11:29:46 +02:00
bors
a8b6ec1667 Auto merge of #2955 - rust-lang:rustup2023-07-03, r=oli-obk
Automatic sync from rustc
2023-07-03 08:16:58 +00:00
Oli Scherer
6a21b2ddc2 Silence clippy on FIXME'd code and fix the new lints otherwise 2023-07-03 08:15:34 +00: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
dd19f1f527 Update rustix
The issue has been fixed.
2023-07-03 07:20:51 +00: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
lcnr
4d42de6d1b add instrument to register_predicate_obligation 2023-07-03 09:12:14 +02:00
lcnr
bd0d533d23 fix structurally relate for weak aliases 2023-07-03 09:12:14 +02:00
lcnr
8ebb3d49e4 rename structurally_resolved_type 2023-07-03 09:12:14 +02:00
The Miri Conjob Bot
707afc389a fmt 2023-07-03 06:35:03 +00:00
The Miri Conjob Bot
1505dd86d1 Merge from rustc 2023-07-03 06:32:31 +00:00
The Miri Conjob Bot
17e17e1e81 Preparing for merge from rustc 2023-07-03 06:25:04 +00:00
bors
1623634aa5 Auto merge of #113271 - matthiaskrgr:rollup-2ik4vaj, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #113253 (Fixed documentation of from<CString> for Rc<CStr>: Arc -> Rc)
 - #113258 (Migrate GUI colors test to original CSS color format)
 - #113259 (Suggest `x build library` for a custom toolchain that fails to load `core`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-03 05:07:26 +00:00
Jubilee Young
634f95295f Remove MIPS host CI workflows 2023-07-02 22:04:46 -07:00
bors
d5a74249c8 Auto merge of #112882 - DrMeepster:new_un_derefer, r=oli-obk
Rewrite `UnDerefer`

Currently, `UnDerefer` is used by drop elaboration to undo the effects of the `Derefer` pass. However, it just recreates the original places with derefs in the middle of the projection. Because `ProjectionElem::Deref` is intended to be removed completely in the future, this will not work forever.

This PR introduces a `deref_chain` method that returns the places behind `DerefTemp` locals in a place and rewrites the move path code to use this. In the process, `UnDerefer` was merged into `MovePathLookup`. Now that move paths use the same places as in the MIR, the other uses of `UnDerefer` no longer require it.

See #98145
cc `@ouz-a`
r? `@oli-obk`
2023-07-03 02:46:39 +00:00
bors
571c9fc8a9 Auto merge of #113176 - workingjubilee:backtrace-0.3.68, r=thomcc
Backtrace 0.3.68

Uptakes these releases:
- https://github.com/rust-lang/backtrace-rs/releases/tag/0.3.68

r? `@thomcc`
2023-07-03 00:21:29 +00:00