Commit Graph

208021 Commits

Author SHA1 Message Date
lcnr
fb3ab13a1c rustc_hir_typeck: fix paths and partially mv files 2022-10-20 17:53:14 +02:00
lcnr
f468a90bad rustc_hir_typeck: move whole files 2022-10-20 17:53:14 +02:00
bors
53728ff751 Auto merge of #103185 - chenyukang:yukang/fix-span-next-point, r=davidtwco
Fix the bug of next_point in source_map

There is a bug in `next_point`, the new span won't move to next position when be called in the first time.

For this reason, our current code is working like this:
1. When we really want to move to the next position, we called two times of `next_point`
2. Some code which use `next_point` actually done the same thing with `shrink_to_hi`

This fix make sure when `next_point` is called, span will move with the width at least 1, and also work correctly in the scenario of multiple bytes.

Ref: https://github.com/rust-lang/rust/pull/103140#discussion_r997710998

r? `@davidtwco`
2022-10-20 10:40:09 +00:00
bors
4b3b731b55 Auto merge of #103220 - compiler-errors:deny-infers, r=lcnr
Deny hashing ty/re/ct inference variables

cc `@cjgillot` and https://github.com/rust-lang/rust/pull/102695#issuecomment-1275706528
r? `@lcnr`

best reviewed one commit at a time, mostly because the second commit that fixes `ClosureOutlivesRequirement` is mostly noise because of losing its `<'tcx>` lifetime parameter.
2022-10-20 05:56:56 +00:00
bors
ebdde35dce Auto merge of #103205 - spastorino:fix-rpits-lifetime-remapping, r=cjgillot
Do anonymous lifetimes remapping correctly for nested rpits

Closes #103141

r? `@cjgillot` `@nikomatsakis`

This fixes a stable to stable regression that in my opinion is `P-critical` so, we probably want to backport it all the way up to stable.
2022-10-20 03:07:17 +00:00
bors
cb9467515b Auto merge of #102417 - oli-obk:opaque_lifetimes2, r=jackh726
Require lifetime bounds for opaque types in order to allow hidden types to capture said lifetimes

fixes #96996

cc `@aliemjay`
2022-10-20 00:22:17 +00:00
bors
57781b24c5 Auto merge of #103264 - matthiaskrgr:rollup-3ja4spo, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #103211 (rustdoc: remove class name `location` from sidebar sibling nav)
 - #103223 (Use already checked RHS ty for LHS deref suggestions)
 - #103237 (Clean up codeblock-tooltip rustdoc-gui test)
 - #103239 (Allow #[unstable] impls for fn() with unstable abi.)
 - #103246 (Mark `rust-analyzer` as a host-only tool)
 - #103257 (rustdoc: move `setting-line` color CSS to settings.css)
 - #103258 (Make miri read_dir test a little more robust)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-19 21:17:09 +00:00
Santiago Pastorino
49ce8a22b0
Do anonymous lifetimes remapping correctly for nested rpits 2022-10-19 16:49:39 -03:00
Santiago Pastorino
fb5475887f
Extract orig_opt_local_def_id as a function 2022-10-19 16:49:39 -03:00
Matthias Krüger
652417e332
Rollup merge of #103258 - SUPERCILEX:miri, r=RalfJung
Make miri read_dir test a little more robust

r? `@RalfJung`
2022-10-19 21:38:42 +02:00
Matthias Krüger
952c15622a
Rollup merge of #103257 - notriddle:notriddle/setting-line, r=GuillaumeGomez
rustdoc: move `setting-line` color CSS to settings.css
2022-10-19 21:38:42 +02:00
Matthias Krüger
e85def73b5
Rollup merge of #103246 - ferrocene:pa-rust-analyzer-hosts, r=Mark-Simulacrum
Mark `rust-analyzer` as a host-only tool

All tools meant to be shipped with host toolchains only should be marked as `ONLY_HOSTS = true`, but rust-analyzer was marked as `ONLY_HOSTS = false` incorrectly. This meant that bootstrap attempted to build rust-analyzer for cross-compilation-only targets, causing errors because libstd is not present on some of them.

It will still be possible to cross-compile rust-analyzer by passing a different `--host` flag to `./x`, like you can cross-compile other tools.

The problem can be reproduced by running:

```
./x build src/tools/rust-analyzer --target x86_64-unknown-linux-gnu,aarch64-unknown-none
```
2022-10-19 21:38:41 +02:00
Matthias Krüger
12775ce16a
Rollup merge of #103239 - m-ou-se:unstable-abi-fn-impl-check, r=lcnr
Allow #[unstable] impls for fn() with unstable abi.

This allows `#[unstable]` trait impls for `extern "unwind-C" fn()`, based on the fact that that abi and therefore that type is unstable.

See https://github.com/rust-lang/rust/pull/101263#issuecomment-1283099947
2022-10-19 21:38:41 +02:00
Matthias Krüger
d17cef67a2
Rollup merge of #103237 - GuillaumeGomez:codeblock-tooltip-cleanup, r=notriddle
Clean up codeblock-tooltip rustdoc-gui test

r? ``@notriddle``
2022-10-19 21:38:40 +02:00
Matthias Krüger
e500dcb8cb
Rollup merge of #103223 - compiler-errors:deref-sugg-slow, r=wesleywiser
Use already checked RHS ty for LHS deref suggestions

There's no reason to do the `check_lhs_assignable` and RHS `check_expr_with_hint` in that order, so invert them and use the typeck results to avoid exponential blowup on error.

Fixes #103219
2022-10-19 21:38:40 +02:00
Matthias Krüger
433f736b86
Rollup merge of #103211 - notriddle:notriddle/dot-location, r=GuillaumeGomez
rustdoc: remove class name `location` from sidebar sibling nav

Preview: https://notriddle.com/notriddle-rustdoc-demos/sidebar-location/std/vec/struct.Vec.html

This change tweaks the CSS to apply most of its styles to `.sidebar h2`, cleaning up a few redundant rules from `.mobile-topbar .location` and restoring useful navigation aids in mobile mode.

## Before

![location-before](https://user-images.githubusercontent.com/1593513/196521014-d8730830-c3a2-4ed7-9266-05454cd31e05.png)

## After

![location-after](https://user-images.githubusercontent.com/1593513/196521020-75ec1fa5-b3dc-4c5d-97b6-afccb5fbe00a.png)
2022-10-19 21:38:39 +02:00
Alex Saveau
b0f693552d
Make miri read_dir test a little more robust
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-10-19 11:48:56 -07:00
Michael Goulet
6b0ef9c810 Deny const variables as well 2022-10-19 17:11:40 +00:00
Michael Goulet
1e2eb97c6e Don't call own_existential_vtable_entries on unresolved trait ref 2022-10-19 17:11:40 +00:00
Michael Goulet
a6b5f95fb0 Make ClosureOutlivesRequirement not rely on an unresolved type 2022-10-19 17:10:59 +00:00
Michael Goulet
91af4f5d0b Don't hash non-fresh Ty::Infer or RegionKind::Infer 2022-10-19 17:10:58 +00:00
Michael Howell
db570586a5 rustdoc: move setting-line color CSS to settings.css 2022-10-19 09:24:09 -07:00
bors
4b8f431995 Auto merge of #103214 - Nilstrieb:set-theory, r=petrochenkov
Use Set instead of Vec in transitive_relation

Helps with #103195. It doesn't fix the underlying quadraticness but it makes it _a lot_ faster to an extent where even doubling the amount of nested references still takes less than two seconds (50s on nightly).

I want to see whether this causes regressions (because the vec was usually quite small) or improvements (as lookup for bigger sets is now much faster) in real code.
2022-10-19 13:53:06 +00:00
yukang
eb8aa9759d Add testcase for next_point, fix more trivial issues in find_width_of_character_at_span 2022-10-19 21:08:00 +08:00
Pietro Albini
5b7bd2fed8
mark rust-analyzer as a host-only tool
All tools meant to be shipped with host toolchains only should be marked
as `ONLY_HOSTS = true`, but rust-analyzer was marked as `ONLY_HOSTS =
false` incorrectly. This meant that bootstrap attempted to build
rust-analyzer for cross-compilation-only targets, causing errors because
libstd is not present on some of them.

It will still be possible to cross-compile rust-analyzer by passing a
different --host flag to ./x, like you can cross-compile other tools.
2022-10-19 14:33:17 +02:00
Mara Bos
c4f829b2e5 Allow #[unstable] impl for fn() -> UnstableType.
(But not fn() -> !, which is stable.)
2022-10-19 13:34:18 +02:00
Mara Bos
5420fa3881 Add test for #[unstable] impl for fn() -> !. 2022-10-19 13:25:37 +02:00
bors
d7dd01fe8b Auto merge of #103228 - Dylan-DPC:rollup-31yiauw, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #102863 (Standardize "use parentheses to call" suggestions between typeck and trait selection)
 - #103034 (Let expressions on RHS shouldn't be terminating scopes)
 - #103127 (Make transpose const and inline)
 - #103153 (Allow `Vec::leak` when using `no_global_oom_handling`)
 - #103182 (Clean up query descriptions)
 - #103216 (Consider patterns in fn params in an `Elided(Infer)` lifetime rib.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-19 11:12:10 +00:00
nils
d45f025c90
Use Set instead of Vec in transitive_relation 2022-10-19 12:50:28 +02:00
Mara Bos
a44a22d5f4 Add test. 2022-10-19 12:41:56 +02:00
Mara Bos
ead96f7f74 Allow #[unstable] impls for fn() with unstable abi. 2022-10-19 12:41:35 +02:00
Mara Bos
e60016eb55 Split is_stable from rustc_target::spec::abi::is_enabled. 2022-10-19 12:41:11 +02:00
Guillaume Gomez
afccb65c9c Clean up codeblock-tooltip rustdoc-gui test 2022-10-19 12:12:26 +02:00
Guillaume Gomez
ffe24e5bc6 Update browser-ui-test version to 0.12.7 2022-10-19 11:08:13 +02:00
Dylan DPC
32159e3fa4
Rollup merge of #103216 - cjgillot:issue-103210, r=jackh726
Consider patterns in fn params in an `Elided(Infer)` lifetime rib.

Fixes https://github.com/rust-lang/rust/issues/103210
2022-10-19 14:05:54 +05:30
Dylan DPC
02d6135b5f
Rollup merge of #103182 - Nilstrieb:query-desc-cleanup, r=oli-obk
Clean up query descriptions

Use the same tense everywhere and prefer display over debug, as these descriptions are user facing.
2022-10-19 14:05:53 +05:30
Dylan DPC
d056ea8828
Rollup merge of #103153 - ChrisDenton:leak-oom, r=m-ou-se
Allow `Vec::leak` when using `no_global_oom_handling`

As [the documentation notes](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.leak), `Vec::leak` hasn't allocated since 1.57.

cc `@Ericson2314` in case I'm missing something.
2022-10-19 14:05:53 +05:30
Dylan DPC
f4afb9d9ec
Rollup merge of #103127 - SUPERCILEX:inline-const-uninit, r=scottmcm
Make transpose const and inline

r? `@scottmcm`

- These should have been const from the beginning since we're never going to do more than a transmute.
- Inline these always because that's what every other method in MaybeUninit which simply casts does. :) Ok, but a stronger justification is that because we're taking in arrays by `self`, not inlining would defeat the whole purpose of using `MaybeUninit` due to the copying.
2022-10-19 14:05:52 +05:30
Dylan DPC
48c5e0c262
Rollup merge of #103034 - nathanwhit:let-chains-rhs-temporaries, r=wesleywiser
Let expressions on RHS shouldn't be terminating scopes

Fixes #100276.

Before this PR, we were unconditionally marking the RHS of short-circuiting binary expressions as a terminating scope.

In the case of a let chain where the `let` expression was on the RHS, this meant that temporaries within the `let` expr would only live until the end of the expression. Since this only affected the RHS, this led to surprising behavior ([example](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=d1b0a5d1f01882f9c89c2194a75eb19f)).

After this PR, we only mark the RHS as a terminating scope if it is not a `let` expression.
2022-10-19 14:05:52 +05:30
Dylan DPC
5c2c476ad1
Rollup merge of #102863 - compiler-errors:call-suggestion-on-unimplemented, r=nagisa
Standardize "use parentheses to call" suggestions between typeck and trait selection

1. Suggest calling constructors, since they're basically `FnDef`s but they have a different def kind and hir representation, so we were leaving them out.
2. Standardize the call suggestions between trait fulfillment errors and type mismatch. In the type mismatch suggestion, we suggest `/* Ty */` as the placeholder for an arg, and not the parameter's name, which is less helpful.
3. Use `predicate_must_hold_modulo_regions` instead of matching on `EvaluationResult` -- this might cause some suggestions to be filtered out, but we really shouldn't be suggesting a call if it "may" hold, only when it "must" hold.
4. Borrow some logic from `extract_callable_info` to generalize this suggestion to fn pointers, type parameters, and opaque types.

Fixes #102852
2022-10-19 14:05:51 +05:30
bors
5605ed8536 Auto merge of #103180 - ferrocene:pa-qemu-user-mode, r=Mark-Simulacrum
Handle core dumps output in QEMU user mode

In addition to the whole-system emulation/virtualization, QEMU also supports user-mode emulation, where the emulation happens as a normal process inside the parent system. This allows running most tests by simply spawning remote-test-server inside user-mode emulation.

Unfortunately, QEMU always writes its own message in addition to the system one when a core dump happens, which breaks a few tests which match on the exact output of the system.

This PR changes those tests to strip the (possible) QEMU output before checking if the output is expected.
2022-10-19 08:26:55 +00:00
bors
84365fff0a Auto merge of #103225 - matthiaskrgr:rollup-1zkv87y, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #103166 (Optimize `slice_iter.copied().next_chunk()`)
 - #103176 (Fix `TyKind::is_simple_path`)
 - #103178 (Partially fix `src/test/run-make/coverage-reports` when cross-compiling)
 - #103198 (Update cargo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-19 05:41:14 +00:00
Matthias Krüger
7f6b5819b5
Rollup merge of #103198 - weihanglo:update-cargo, r=ehuss
Update cargo

6 commits in b332991a57c9d055f1864de1eed93e2178d49440..3ff044334f0567ce1481c78603aeee7211b91623 2022-10-13 22:05:28 +0000 to 2022-10-17 20:25:00 +0000
- Some tiny refactors around `ops::cargo_compile` (rust-lang/cargo#11243)
- Polish docs for module `build_context` (rust-lang/cargo#11241)
- Remove sparse+ prefix for index.crates.io (rust-lang/cargo#11247)
- docs(add): Add missing flags to reference (rust-lang/cargo#11240)
- Document `cargo remove` (rust-lang/cargo#11227)
- fix: Update help headings to  match clap (rust-lang/cargo#11239)
2022-10-19 07:15:32 +02:00
Matthias Krüger
6a168e4538
Rollup merge of #103178 - ferrocene:pa-coverage-reports-tests, r=Mark-Simulacrum
Partially fix `src/test/run-make/coverage-reports` when cross-compiling

The test does not work on cross-compiled targets because the --target flag was not passed to rustc inside the test. This commit fixes that by adding the flag to the invocations.

Note that the test still fails on cross-compiled targets using remote-test, as remote-test is not capable (yet) of sending back to the host system the `*.profraw` file generated by the instrumentation.

Because of that, this is only a partial fix, and the test has been ignored on cross-compilation.
2022-10-19 07:15:31 +02:00
Matthias Krüger
e86bc89831
Rollup merge of #103176 - nnethercote:fix-TyKind-is_simple_path, r=spastorino
Fix `TyKind::is_simple_path`

Fixes #103157.

r? `@spastorino`
2022-10-19 07:15:31 +02:00
Matthias Krüger
d6eb7bca09
Rollup merge of #103166 - the8472:copied-next-chunk, r=m-ou-se
Optimize `slice_iter.copied().next_chunk()`

```
OLD:
test iter::bench_copied_array_chunks                               ... bench:         371 ns/iter (+/- 7)
NEW:
test iter::bench_copied_array_chunks                               ... bench:          31 ns/iter (+/- 0)
```

The default `next_chunk` implementation suffers from having to assemble the array byte by byte via `next()`, checking the `Option<&T>` and then dereferencing `&T`. The specialization copies the chunk directly from the slice.
2022-10-19 07:15:30 +02:00
Michael Goulet
d38dc68aa3 Use already checked RHS ty for LHS deref suggestions 2022-10-19 04:20:48 +00:00
Michael Goulet
35f1570732 instantiate -> construct 2022-10-19 02:55:23 +00:00
bors
415d8fcc3e Auto merge of #103213 - matthiaskrgr:rollup-diloxg3, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #101889 (doc: rewrite doc for uint::{carrying_add,borrowing_sub})
 - #102507 (More slice::partition_point examples)
 - #103164 (rustdoc: remove CSS ``@media` (min-width: 701px)`)
 - #103189 (Clean up code-color and headers-color rustdoc GUI tests)
 - #103203 (Retrieve LLVM version from llvm-filecheck binary if it is not set yet)
 - #103204 (Add some more autolabels)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-19 02:53:24 +00:00
Michael Goulet
7eb2d4e7d0 Generalize call suggestion for unsatisfied predicate 2022-10-19 02:06:19 +00:00