Commit Graph

197746 Commits

Author SHA1 Message Date
nidnogg
5101688d4f Addressed trailing newlines, odd whitespace skipped by x.py fmt 2022-08-22 12:38:16 -03:00
nidnogg
066796cece Addressing tidy check fail 2022-08-22 12:32:42 -03:00
nidnogg
649749c7b0 Addressing last comment on PR review 2022-08-22 12:14:49 -03:00
nidnogg
13abae2deb Switched errors to diags according to latest PRs 2022-08-22 00:02:36 -03:00
nidnogg
0a58b26e8a Hotfix ftl err name, added check for err.code in create_feature_err 2022-08-21 23:22:55 -03:00
nidnogg
4c82845b3a Fixed failing tests (missing labels), added automatic error code in create_feature_err() builder 2022-08-21 23:22:55 -03:00
nidnogg
d1f14ee1b0 Added several more migrations under ops.rs, failing some tests though 2022-08-21 23:22:54 -03:00
nidnogg
33e8aaf830 Migration on ops.rs for unstable const functions 2022-08-21 23:22:53 -03:00
nidnogg
70ea98633e Migrated Unallowed function pointer calls in interpreter/ops 2022-08-21 23:22:51 -03:00
nidnogg
6af8e46a9a Finished const_eval module migration, moving onto sibling folders 2022-08-21 23:22:50 -03:00
bors
0b71ffca18 Auto merge of #100654 - compiler-errors:rework-point-at-arg, r=estebank
Rework "point at arg" suggestions to be more accurate

Fixes #100560

Introduce a new set of `ObligationCauseCode`s which have additional bookeeping for what expression caused the obligation, and which predicate caused the obligation. This allows us to look at the _unsubstituted_ signature to find out which parameter or generic type argument caused an obligaton to fail.

This means that (in most cases) we significantly improve the likelihood of pointing out the right argument that causes a fulfillment error. Also, since this logic isn't happening in just the `select_where_possible_and_mutate_fulfillment()` calls in the argument checking code, but instead during all trait selection in `FnCtxt`, we are also able to point out the correct argument even if inference means that we don't know whether an obligation has failed until well after a call expression has been checked.

r? `@ghost`
2022-08-21 21:52:56 +00:00
bors
c0941dfb5a Auto merge of #100847 - matthiaskrgr:rollup-0ga531s, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #100556 (Clamp Function for f32 and f64)
 - #100663 (Make slice::reverse const)
 - #100697 ( Minor syntax and formatting update to doc comment on `find_vtable_types_for_unsizing`)
 - #100760 (update test for LLVM change)
 - #100761 (some general mir typeck cleanup)
 - #100775 (rustdoc: Merge source code pages HTML elements together v2)
 - #100813 (Add `/build-rust-analyzer/` to .gitignore)
 - #100821 (Make some docs nicer wrt pointer offsets)
 - #100822 (Replace most uses of `pointer::offset` with `add` and `sub`)
 - #100839 (Make doc for stdin field of process consistent)
 - #100842 (Add diagnostics lints to `rustc_transmute` module (zero diags))

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-21 19:05:18 +00:00
bors
650bff80a6 Auto merge of #100645 - notriddle:notriddle/rustdoc-diet-plan, r=GuillaumeGomez
rustdoc: strategic boxing to reduce the size of ItemKind and Type

The `Type` change redesigns `QPath` to box the entire data structure instead of boxing `self_type` and the `trait_`.

This reduces the size of several `ItemKind` variants, leaving `Impl` as the biggest variant. The `ItemKind` change boxes that variant's payload.
2022-08-21 16:40:26 +00:00
Matthias Krüger
5ba68df988
Rollup merge of #100842 - JhonnyBillM:enable-diag-lint-in-transmute, r=TaKO8Ki
Add diagnostics lints to `rustc_transmute` module (zero diags)

Module is complete because it has zero diagnostics.
2022-08-21 16:54:09 +02:00
Matthias Krüger
5e761f3f03
Rollup merge of #100839 - nelsonjchen:consistent_child_stdin_field_desc, r=thomcc
Make doc for stdin field of process consistent

The other fields use this format and example.
2022-08-21 16:54:08 +02:00
Matthias Krüger
a45f69f27d
Rollup merge of #100822 - WaffleLapkin:no_offset_question_mark, r=scottmcm
Replace most uses of `pointer::offset` with `add` and `sub`

As PR title says, it replaces `pointer::offset` in compiler and standard library with `pointer::add` and `pointer::sub`. This generally makes code cleaner, easier to grasp and removes (or, well, hides) integer casts.

This is generally trivially correct, `.offset(-constant)` is just `.sub(constant)`, `.offset(usized as isize)` is just `.add(usized)`, etc. However in some cases we need to be careful with signs of things.

r? ````@scottmcm````

_split off from #100746_
2022-08-21 16:54:07 +02:00
Matthias Krüger
fd403f5d17
Rollup merge of #100821 - WaffleLapkin:ptr_add_docs, r=scottmcm
Make some docs nicer wrt pointer offsets

This PR replaces `pointer::offset` with `pointer::add` and similarly `.cast().wrapping_add().cast()` with `.wrapping_byte_add()` **in docs**.

r? ``````@scottmcm``````

_split off from #100746_
2022-08-21 16:54:06 +02:00
Matthias Krüger
bc66f4085a
Rollup merge of #100813 - Nilstrieb:too-much-disk-space-gitignore, r=Mark-Simulacrum
Add `/build-rust-analyzer/` to .gitignore

To avoid rust-analyzer and rustc having to wait for each other, the [dev guide](https://rustc-dev-guide.rust-lang.org/building/suggested.html#configuring-rust-analyzer-for-rustc) mentions using another build directory for RA.

We should also put this into the .gitignore, just like the normal `build`.
2022-08-21 16:54:05 +02:00
Matthias Krüger
5518b6b686
Rollup merge of #100775 - GuillaumeGomez:reduce-span-v2, r=notriddle
rustdoc: Merge source code pages HTML elements together v2

This is the follow-up of https://github.com/rust-lang/rust/pull/100429.

I strongly recommend to review it one commit at a time because otherwise it's a lot at once.

For these ones, on each page, I run this JS: `document.getElementsByTagName('*').length`. The goal is to count the number of DOM elements. I took some pages that seemed big, but don't hesitate to check some others. I also added the "starting point" because it's quite nice to see how much the page was reduced thanks to these two PRs.

| file name | before #100429 | before this PR | with this PR | diff |
|-|-|-|-|-|
| std/lib.rs.html (source link on std crate page) | 3455 | 2332 | 1772 | 24% |
| alloc/vec/mod.rs.html (source on Vec type page) | 11012 | 5982 | 5833 | 2.5% |
| alloc/string.rs.html (source on String type page) | 10800 | 6010 | 5822 | 3.2% |
| std/sync/mutex.rs.html (source on Mutex type page) | 2953 | 2041 | 2038 | 0.1% |

So unsurprisingly, the more attributes you have, the bigger the difference.

You can test it [here](https://rustdoc.crud.net/imperio/reduce-span-v2/src/std/lib.rs.html).

cc ``````@jsha``````
r? ``````@notriddle``````
2022-08-21 16:54:04 +02:00
Matthias Krüger
9cf3bacfb2
Rollup merge of #100761 - lcnr:mir-typeck-cleanup, r=compiler-errors
some general mir typeck cleanup

this pr contains the parts of #95763 which already work correctly.

the remaining commits of that PR have some issues which are more complex to fix.

r? types
2022-08-21 16:54:04 +02:00
Matthias Krüger
938ebf9a83
Rollup merge of #100760 - krasimirgg:llvm-16-pic-level, r=nikic
update test for LLVM change

LLVM commit c2a3888793 updates the PIC level version selection. Updated an affected rust test to work under both the old and new behaviors.

Detected by our experimental rust + llvm @ HEAD bot:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/12829#0182b368-a405-47a2-b3da-9c79cb907bfe/701-709
2022-08-21 16:54:03 +02:00
Matthias Krüger
a2820257fc
Rollup merge of #100697 - eholk:doc-comment-update, r=compiler-errors
Minor syntax and formatting update to doc comment on `find_vtable_types_for_unsizing`

I noticed the code examples on this function weren't formatted as code, and also the that the syntax for trait objects was out of date (or just incorrect). This should bring it up to date.
2022-08-21 16:54:02 +02:00
Matthias Krüger
1cdcf508bb
Rollup merge of #100663 - clarfonthey:const-reverse, r=scottmcm
Make slice::reverse const

I remember this not being doable for some reason before, but decided to try it again and everything worked out in the tests.
2022-08-21 16:54:01 +02:00
Matthias Krüger
a5c16a5381
Rollup merge of #100556 - Alex-Velez:patch-1, r=scottmcm
Clamp Function for f32 and f64

I thought the clamp function could use a little improvement for readability purposes. The function now returns early in order to skip the extra bound checks.

If there was a reason for binding `self` to `x` or if this code is incorrect, please correct me :)
2022-08-21 16:54:01 +02:00
bors
3130203309 Auto merge of #100841 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/100779
2022-08-21 13:54:06 +00:00
Jhonny Bill Mena
c835d9c0d2 ADD - diagnostic lints to rustc_transmute
Module is complete because it has zero diagnostics.
2022-08-21 09:17:09 -04:00
Ralf Jung
4df65c3682 update Miri 2022-08-21 08:57:07 -04:00
bors
4b695f7c4e Auto merge of #100765 - Xiretza:session-diagnostic-unification, r=compiler-errors
Kind-less SessionDiagnostic derive

From https://github.com/rust-lang/rust/pull/100730#discussion_r949712629:

> Hm, maybe we should expose some `sess.struct_$SOMETHING` (like `struct_diagnostic`?) that is generic over `EmissionGuarantee`, then make the `SessionDiagnostic` derive generic, i.e.
>
> ```rust
> impl<'tcx> SessionDiagnostic for UnusedGenericParams {
>   fn into_diagnostic<T: EmissionGuarantee>( .. ) -> DiagnosticBuilder<'tcx, T> {
>     let mut diag = sess.struct_diagnostic(rustc_errors:..);
>     ..
>   }
> }
> ```

Discussed [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.23100717.20translation.20-.20kind-less.20derive).
2022-08-21 10:04:42 +00:00
Nelson Chen
7abbfa8c41 Make doc for stdin field of process consistent
The other fields use this format and example.
2022-08-21 01:56:26 -07:00
bors
39a9b88f4e Auto merge of #100627 - krasimirgg:lto-llvm-16, r=cuviper
llvm-wrapper: adapt for LLVM API change

No functional changes intended.

LLVM commit 633f5663c3 removed `createWriteThinLTOBitcodePass`.
This adapts PassWrapper similarly to the example mentioned upstream: 853b57fe80.

Detected via our experimental rust + llvm @ head bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/12768#0182a6be-ed6e-4dc6-a230-7a46f9d3a2c2/205-537
2022-08-21 07:19:49 +00:00
Xiretza
7f3a6fd7f6 Replace #[lint/warning/error] with #[diag] 2022-08-21 09:17:43 +02:00
Xiretza
bd0d3f745d Disallow #[primary_span] on LintDiagnostics 2022-08-21 09:17:43 +02:00
Xiretza
a960f8304c Make derived SessionDiagnostics generic on diagnostic level
Deriving SessionDiagnostic on a type no longer forces that diagnostic to
be one of warning, error, or fatal. The level is instead decided when
the struct is passed to the respective Handler::emit_*() method.
2022-08-21 09:17:43 +02:00
Xiretza
91ad4e38f5 Add Handler::struct_diagnostic()
This unifies the struct_{warn,error,fatal}() methods in one generic
method.
2022-08-21 09:17:43 +02:00
bors
aa8e761def Auto merge of #100624 - GuillaumeGomez:update-minifier-version, r=nnethercote
Update minifier version to 0.2.2

Following [this PR](https://github.com/GuillaumeGomez/minifier-rs/pull/98), the CSS minification should be much faster now (thanks to `@nnethercote).`

r? `@nnethercote`
2022-08-21 04:21:06 +00:00
Michael Goulet
d577eb09e5 Bless tests after #100769 2022-08-21 04:04:05 +00:00
Maybe Waffle
b2625e24b9 fix nitpicks from review 2022-08-21 06:36:11 +04:00
Michael Goulet
5212ac9dac Make check for overlapping closure span more accurate 2022-08-21 02:35:11 +00:00
Michael Goulet
d2f54b1990 Adjust messages, address some nits 2022-08-21 02:35:11 +00:00
Michael Goulet
2a16a127a0 More docs 2022-08-21 02:35:11 +00:00
Michael Goulet
8917894fda Targeted fixes addressing erroneous suggestions 2022-08-21 02:35:11 +00:00
Michael Goulet
6848ba2665 Comment a bit, use find_ancestor_in_same_ctxt to suppress some weird macro notes 2022-08-21 02:35:11 +00:00
Michael Goulet
292ab399b3 Point at struct field if possible 2022-08-21 02:35:11 +00:00
Michael Goulet
c0c6603c79 Deduplicate errors that come from places like normalization, sized 2022-08-21 02:35:11 +00:00
Michael Goulet
24559ce2fe Prefer non-Self non-method types over Self, first 2022-08-21 02:35:11 +00:00
Michael Goulet
c8746766cb Rework ambiguity errors 2022-08-21 02:35:11 +00:00
Michael Goulet
70b29f7c2d Note closure kind mismatch cause 2022-08-21 02:35:11 +00:00
Michael Goulet
52e2065ed4 Revert closure mismatch spans 2022-08-21 02:34:52 +00:00
Michael Goulet
3a1aa3c76e Do not favor projection type when pointing out arg causing fulfillment error 2022-08-21 02:34:52 +00:00
Michael Goulet
c9cb19d26e Skip mentioning lang item 2022-08-21 02:34:52 +00:00