Commit Graph

214676 Commits

Author SHA1 Message Date
Michael Goulet
e77e8eb945 Don't store spans in assumed_wf_types actually 2023-01-08 19:38:17 +00:00
Michael Goulet
0bddce5090 Normalize assumed_wf_types after wfchecking is complete, for better spans 2023-01-08 18:50:09 +00:00
Michael Goulet
ca554efaf7 Improve spans of non-WF implied bound types 2023-01-08 18:50:08 +00:00
bors
cc47b06998 Auto merge of #106449 - GuillaumeGomez:rustdoc-gui-retry-mechanism, r=Mark-Simulacrum
Add retry mechanism for rustdoc GUI tests to reduce flakyness

Part of #93784.

I added 3 retries for failing GUI tests. An important note: if more than half of total tests fail, I don't retry because it's very likely not flakyness anymore at this point but a missing update after changes.
2023-01-08 17:49:31 +00:00
bors
f77b68a3cb Auto merge of #13860 - danieleades:clippy, r=lnicola
fix a bunch of clippy lints

fixes a bunch of clippy lints for fun and profit

i'm aware of this repo's position on clippy. The changes are split into separate commits so they can be reviewed separately
2023-01-08 17:29:57 +00:00
Yukang
0e570e58f2
Remove extra space 2023-01-08 22:51:42 +08:00
bors
fa51fc01ca Auto merge of #106235 - compiler-errors:rework-bounds-collection, r=davidtwco
Rework `Bounds` collection

I think it's weird for the `Bounds` struct in astconv to store its predicates *almost* converted into real predicates... so we do this eagerly, instead of lazily.
2023-01-08 14:40:52 +00:00
bors
e6485ed22a Auto merge of #105733 - compiler-errors:ty-ct-late-flags, r=cjgillot
Add type flags support for `Ty` and `Const` late-bound variables

I've been working on `for<T>` binders, and these will eventually be useful.
2023-01-08 11:51:41 +00:00
bors
8ea62f6c30 Auto merge of #106588 - JohnTitor:rollup-4z80tjx, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #103104 (Stabilize `main_separator_str`)
 - #106410 (Suggest `mut self: &mut Self` for `?Sized` impls)
 - #106457 (Adjust comments about pre-push.sh hook)
 - #106546 (jsondoclint: Check local items in `paths` are also in `index`.)
 - #106557 (Add some UI tests and reword error-code docs)
 - #106562 (Clarify examples for `VecDeque::get/get_mut`)
 - #106580 (remove unreachable error code `E0313`)
 - #106581 (Do not emit wrong E0308 suggestion for closure mismatch)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-08 09:00:31 +00:00
Yuki Okushi
789ebdca47
Rollup merge of #106581 - estebank:bad-suggestion, r=compiler-errors
Do not emit wrong E0308 suggestion for closure mismatch

Found in #76353.
2023-01-08 17:01:49 +09:00
Yuki Okushi
6459a51c3f
Rollup merge of #106580 - Ezrashaw:remove-e0313, r=compiler-errors
remove unreachable error code `E0313`

Fixes #103742
Makes #103433 redundant

Implements removal of `E0313`. I agree with the linked issue that this error code is unreachable but if someone could confirm that would be great, are crater runs done for this sort of thing?

Also removed a redundant `// ignore-tidy-filelength` that I found while reading code.

cc ``@GuillaumeGomez`` #61137
2023-01-08 17:01:49 +09:00
Yuki Okushi
14ce60333d
Rollup merge of #106562 - clubby789:vec-deque-example, r=Mark-Simulacrum
Clarify examples for `VecDeque::get/get_mut`

Closes #106114

``@rustbot`` label +A-docs
2023-01-08 17:01:48 +09:00
Yuki Okushi
3b5afa590b
Rollup merge of #106557 - Ezrashaw:ui-test-fixups-1, r=GuillaumeGomez
Add some UI tests and reword error-code docs

Added UI tests for `E0013` and `E0015`. Error code docs for `E0015` were a bit unclear (they referred to all non-const errors in const context, when only non-const functions applied), so I touched them up a bit.

I also fixed up some issues in the new `error_codes.rs` tidy check (linked #106341), that I overlooked previously.

r? ``@GuillaumeGomez``
2023-01-08 17:01:48 +09:00
Yuki Okushi
7997ff6612
Rollup merge of #106546 - aDotInTheVoid:jsondoclint-path-local-item, r=notriddle
jsondoclint: Check local items in `paths` are also in `index`.

Would have caught #104064 (if core.json was linted in CI).

Closes #106433.

r? rustdoc
2023-01-08 17:01:47 +09:00
Yuki Okushi
3edc7e0414
Rollup merge of #106457 - kadiwa4:no-bless, r=Mark-Simulacrum
Adjust comments about pre-push.sh hook

Follow-up to #101175.
2023-01-08 17:01:47 +09:00
Yuki Okushi
fe075319e6
Rollup merge of #106410 - clubby789:borrow-mut-self-mut-self-diag, r=compiler-errors
Suggest `mut self: &mut Self` for `?Sized` impls

Closes #106325
Closes #93078

The suggestion is _probably_ not what the user wants (hence `MaybeIncorrect`) but at least makes the problem in the above issues clearer. It might be better to add a note explaining why this is the case, but I'm not sure how best to word that so this is a start.

``@rustbot`` label +A-diagnostics
2023-01-08 17:01:46 +09:00
Yuki Okushi
ed77ffe166
Rollup merge of #103104 - SUPERCILEX:sep-ref, r=dtolnay
Stabilize `main_separator_str`

See reasoning here: https://github.com/rust-lang/rust/issues/94071#issuecomment-1279872605. Closes #94071.
2023-01-08 17:01:46 +09:00
Michael Goulet
49f849a3d2 Mention signature rather than fn pointers when comparing impl/trait methods 2023-01-08 03:49:24 +00:00
Michael Goulet
3c41003873 Add type flags support for Ty and Const late-bound regions 2023-01-08 03:37:20 +00:00
Esteban Küber
ebbc5dafd3 Do not emit wrong E0308 suggestion for closure mismatch 2023-01-08 01:53:39 +00:00
Esteban Küber
d85d38b7b8 Add test 2023-01-08 01:53:08 +00:00
Ezra Shaw
93c0d8d5d5
remove unreachable error code E0313 2023-01-08 14:47:12 +13:00
bors
2afe58571e Auto merge of #104658 - thomcc:rand-update-and-usable-no_std, r=Mark-Simulacrum
Update `rand` in the stdlib tests, and remove the `getrandom` feature from it.

The main goal is actually removing `getrandom`, so that eventually we can allow running the stdlib test suite on tier3 targets which don't have `getrandom` support. Currently those targets can only run the subset of stdlib tests that exist in uitests, and (generally speaking), we prefer not to test libstd functionality in uitests, which came up recently in https://github.com/rust-lang/rust/pull/104095 and https://github.com/rust-lang/rust/pull/104185. Additionally, the fact that we can't update `rand`/`getrandom` means we're stuck with the old set of tier3 targets, so can't test new ones.

~~Anyway, I haven't checked that this actually does allow use on tier3 targets (I think it does not, as some work is needed in stdlib submodules) but it moves us slightly closer to this, and seems to allow at least finally updating our `rand` dep, which definitely improves the status quo.~~ Checked and works now.

For the most part, our tests and benchmarks are fine using hard-coded seeds. A couple tests seem to fail with this (stuff manipulating the environment expecting no collisions, for example), or become pointless (all inputs to a function become equivalent). In these cases I've done a (gross) dance (ab)using `RandomState` and `Location::caller()` for some extra "entropy".

Trying to share that code seems *way* more painful than it's worth given that the duplication is a 7-line function, even if the lines are quite gross. (Keeping in mind that sharing it would require adding `rand` as a non-dev dep to std, and exposing a type from it publicly, all of which sounds truly awful, even if done behind a perma-unstable feature).

See also some previous attempts:
- https://github.com/rust-lang/rust/pull/86963 (in particular https://github.com/rust-lang/rust/pull/86963#issuecomment-885438936 which explains why this is non-trivial)
- https://github.com/rust-lang/rust/pull/89131
- https://github.com/rust-lang/rust/pull/96626#issuecomment-1114562857 (I tried in that PR at the same time, but settled for just removing the usage of `thread_rng()` from the benchmarks, since that was the main goal).
- https://github.com/rust-lang/rust/pull/104185
- Probably more. It's very tempting of a thing to "just update".

r? `@Mark-Simulacrum`
2023-01-08 01:34:05 +00:00
Ezra Shaw
ae61c250cd
doc/test: add UI test and reword docs for E0013 and E0015 2023-01-08 13:33:09 +13:00
Kevin Reid
288e89bf76 Document that Vec::from_raw_parts[_in] must be given a pointer from the correct allocator. 2023-01-07 15:56:36 -08:00
bors
e5d46a5bda Auto merge of #106573 - matthiaskrgr:rollup-zkgfsta, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #101936 (Migrating rustc_infer to session diagnostics (part 3))
 - #104081 (PhantomData layout guarantees)
 - #104543 (Migrate `codegen_ssa` to diagnostics structs - [Part 3])
 - #105128 (Add O(1) `Vec -> VecDeque` conversion guarantee)
 - #105517 (Fix process-panic-after-fork.rs to pass on newer versions of Android.)
 - #105859 (Point out span where we could introduce higher-ranked lifetime)
 - #106509 (Detect closures assigned to binding in block)
 - #106553 (docs: make `HashSet::retain` doctest more clear)
 - #106556 (rustdoc: remove no-op mobile CSS `.content { margin-left: 0 }`)
 - #106564 (Change to immutable borrow when cloning element of RepeatN)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-07 22:42:39 +00:00
Matthias Krüger
3076f26988
Rollup merge of #106564 - Folyd:feat-repeatn, r=scottmcm
Change to immutable borrow when cloning element of RepeatN
2023-01-07 20:43:23 +01:00
Matthias Krüger
98ad442946
Rollup merge of #106556 - notriddle:notriddle/margin-left-content-mobile, r=GuillaumeGomez
rustdoc: remove no-op mobile CSS `.content { margin-left: 0 }`

This rule was added to override non-zero left margin on `.content`, which was removed in 135281ed15 and the margin-left was put on the docblock.
2023-01-07 20:43:23 +01:00
Matthias Krüger
ee1992c695
Rollup merge of #106553 - Ezrashaw:fix-hashset-doctest, r=JohnTitor
docs: make `HashSet::retain` doctest more clear

Fixes #106535

Extremely simple fix suggested by ``@compiler-errors`` in the linked issue.
2023-01-07 20:43:22 +01:00
Matthias Krüger
1e6710da59
Rollup merge of #106509 - estebank:closure-in-block, r=davidtwco
Detect closures assigned to binding in block

Fix #58497.
2023-01-07 20:43:22 +01:00
Matthias Krüger
0c8d11b97c
Rollup merge of #105859 - compiler-errors:hr-lifetime-add, r=davidtwco
Point out span where we could introduce higher-ranked lifetime

Somewhat addresses #105422, but not really. We don't have that much useful information here since we're still in resolution :^(

Maybe this suggestion isn't worth it. If the reviewer has an idea how we can get a more succinct binder information for a structured suggestion, it would be appreciated.
2023-01-07 20:43:21 +01:00
Matthias Krüger
3d18c4d62d
Rollup merge of #105517 - pcc:process-panic-after-fork, r=davidtwco
Fix process-panic-after-fork.rs to pass on newer versions of Android.

The test process-panic-after-fork.rs was checking that abort() resulted in SIGSEGV on Android. This non-standard behavior was fixed back in 2013, so let's fix the test to also accept the standard behavior on Android.
2023-01-07 20:43:20 +01:00
Matthias Krüger
d7519c3639
Rollup merge of #105128 - Sp00ph:vec_vec_deque_conversion, r=dtolnay
Add O(1) `Vec -> VecDeque` conversion guarantee

(See #105072)
2023-01-07 20:43:20 +01:00
Matthias Krüger
771cfa5581
Rollup merge of #104543 - JhonnyBillM:migrate-codegen-ssa-to-diagnostics-structs-pt3, r=davidtwco
Migrate `codegen_ssa` to diagnostics structs - [Part 3]

Completes migrating `codegen_ssa` module except 2 outstanding errors that depend on other crates:
1. [`rustc_middle::mir::interpret::InterpError`](b6097f2e1b/compiler/rustc_middle/src/mir/interpret/error.rs (L475)): I saw `rustc_middle` is unassigned, I am open to take this work.

2.  `codegen_llvm`'s use of `fn span_invalid_monomorphization_error`, which I started to replace in the [last commit](9a31b3cdda) of this PR, but would like to know the team's preference on how we should keep replacing the other macros:
2.1. Update macros to expect a `Diagnostic`
2.2. Remove macros and expand the code on each use.
See [some examples of the different options in this experimental commit](64aee83e80)

_Part 2 - https://github.com/rust-lang/rust/pull/103792_

r? ``@davidtwco``
Cc ``@compiler-errors``
2023-01-07 20:43:19 +01:00
Matthias Krüger
08653c8c57
Rollup merge of #104081 - joshlf:patch-6, r=dtolnay
PhantomData layout guarantees
2023-01-07 20:43:19 +01:00
Matthias Krüger
405e48f1ac
Rollup merge of #101936 - IntQuant:issue-100717-infer-4, r=compiler-errors
Migrating rustc_infer to session diagnostics (part 3)

``@rustbot`` label +A-translation
r? rust-lang/diagnostics
cc https://github.com/rust-lang/rust/issues/100717

Seems like a part of static_impl_trait.rs emits suggestions in a loop, and note.rs needs to have two instances of the same subdiagnostic, so these will need to wait until we have eager translation/list support.
Other than that, there is only error_reporting/mod.rs left to migrate.
2023-01-07 20:43:18 +01:00
Sky
eddb479ad3
Don't derive Debug for OnceWith & RepeatWith 2023-01-07 14:28:44 -05:00
bors
ee0412d1ef Auto merge of #106036 - JohnTitor:issue-86106, r=nikic
Add regression test for #86106

Closes #86106
r? `@nikic`

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-01-07 19:26:25 +00:00
dependabot[bot]
41d290d671
Bump d3-color and d3-graphviz in /editors/code
Bumps [d3-color](https://github.com/d3/d3-color) to 3.1.0 and updates ancestor dependency [d3-graphviz](https://github.com/magjac/d3-graphviz). These dependencies need to be updated together.


Updates `d3-color` from 2.0.0 to 3.1.0
- [Release notes](https://github.com/d3/d3-color/releases)
- [Commits](https://github.com/d3/d3-color/compare/v2.0.0...v3.1.0)

Updates `d3-graphviz` from 4.1.1 to 5.0.2
- [Release notes](https://github.com/magjac/d3-graphviz/releases)
- [Changelog](https://github.com/magjac/d3-graphviz/blob/master/CHANGELOG.md)
- [Commits](https://github.com/magjac/d3-graphviz/compare/v4.1.1...v5.0.2)

---
updated-dependencies:
- dependency-name: d3-color
  dependency-type: indirect
- dependency-name: d3-graphviz
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-07 19:20:08 +00:00
bors
1bd1a09593 Auto merge of #13876 - lnicola:zip-artifacts, r=lnicola
feat: Package Windows release artifacts as ZIP and add symbols file

Closes #13872
Closes #7747
CC #10371

This allows us to ship a format that's easier to handle on Windows. As a bonus, we can also include the PDB, to get useful stack traces. Unfortunately, it adds a couple of dependencies to `xtask`, increasing the debug build times from 1.28 to 1.58 s (release from 1.60s to 2.20s) on my system.
2023-01-07 19:19:37 +00:00
bors
7449f9fa10 Auto merge of #13894 - lowr:patch/fallback-before-final-obligation-resolution, r=lnicola
Apply fallback before final obligation resolution

Fixes #13249
Fixes #13518

We've been applying fallback to type variables independently even when there are some unresolved obligations that associate them. This PR applies fallback to unresolved scalar type variables before the final attempt of resolving obligations, which enables us to infer more.

Unlike rustc, which has separate storages for each kind of type variables, we currently don't have a way to retrieve only integer/float type variables without folding/visiting every single type we've inferred. I've repurposed `TypeVariableData` as bitflags that also hold the kind of the type variable it's referring to so that we can "reconstruct" scalar type variables from their indices.

This PR increases the number of ??ty for rust-analyzer repo not because we regress and fail to infer the existing code but because we fail to infer the new code. It seems we have problems inferring some functions bitflags produces.
2023-01-07 19:03:34 +00:00
bors
b1691f6413 Auto merge of #105323 - cjgillot:simplify-const-prop, r=davidtwco
Perform SimplifyLocals before ConstProp.

MIR before `ConstProp` may have a lot of dead writes, this makes `ConstProp` do unnecessary work.

r? `@ghost`
2023-01-07 16:13:18 +00:00
Folyd
a139fd0627 Change to immutable borrow when cloning element of RepeatN 2023-01-07 23:50:07 +08:00
clubby789
fed349957d Clarify examples for VecDeque::get/get_mut 2023-01-07 14:38:21 +00:00
bors
a2112fcb0a Auto merge of #106519 - estebank:tail-unit, r=cjgillot
Detect bindings assigned blocks without tail expressions

Fix #44173.
2023-01-07 13:24:12 +00:00
Ali MJ Al-Nasrawy
bf228ace5c don't eagerly normalize SelfCtor type
Delay until user annotations are registered.
See the added test.
2023-01-07 13:42:16 +03:00
Ali MJ Al-Nasrawy
030d60f1c7 more tests 2023-01-07 13:42:16 +03:00
Ali MJ Al-Nasrawy
dca15fd5b9 rename create_raw_ty -> handle_raw_ty 2023-01-07 13:42:15 +03:00
Ali MJ Al-Nasrawy
8afd3c47a8 remove unnecessary normalize call 2023-01-07 13:42:15 +03:00
Ali MJ Al-Nasrawy
c6a17bf8bc make ascribe_user_type a TypeOp
Projection types in user annotations may contain inference variables.
This makes the normalization depend on the unification with the actual
type and thus requires a separate TypeOp to track the obligations.
Otherwise simply calling `TypeChecker::normalize` would ICE with
"unexpected ambiguity"
2023-01-07 13:41:41 +03:00