Commit Graph

221830 Commits

Author SHA1 Message Date
Matthias Krüger
57393be6fb
Rollup merge of #110135 - compiler-errors:revert-108031, r=davidtwco
Revert "Don't recover lifetimes/labels containing emojis as character literals"

Reverts PR #108031 per https://github.com/rust-lang/rust/pull/109754#issuecomment-1490452045

Fixes (doesnt close until beta backported) #109746

This reverts commit e3f9db5fc3.
This reverts commit 98b82aedba.
This reverts commit 380fa26413.
2023-04-12 22:04:35 +02:00
Matthias Krüger
5d6aeb9799
Rollup merge of #110133 - compiler-errors:issue-110131, r=petrochenkov
Do not use ImplDerivedObligationCause for inherent impl method error reporting

We were constructing a `TraitRef` out of impl substs, for an *inherent* impl that has no corresponding trait. Instead of doing that, let's construct a meaningful obligation cause code, and instead adjust the error reporting machinery to handle that correctly.

Fixes #110131
cc #106702, which introduced this regression
2023-04-12 22:04:34 +02:00
Matthias Krüger
c47937d32c
Rollup merge of #110122 - jyn514:check-stage1-llvm, r=ozkanonur
Fix x check --stage 1 when download-ci-llvm=false

Bootstrap tries to avoid building LLVM unless it needs to; in particular we only build it for `x build`, not `x check`. Unfortunately, the check forgot about existence of stages - it would break if you used `x check --stage 1`:
```
  = note: /usr/bin/ld: cannot find -lPolly: No such file or directory
          /usr/bin/ld: cannot find -lPollyISL: No such file or directory
```
Fix it to work for stage 1.

I recommend reading this commit-by-commit; the first one makes a bunch of whitespace changes but otherwise doesn't change the logic.
2023-04-12 22:04:34 +02:00
Matthias Krüger
92eb36461b
Rollup merge of #110103 - compiler-errors:new-solver-overflows, r=lcnr
Report overflows gracefully with new solver

avoid reporting overflows as ambiguity errors, so that the error message is clearer.

r? ```@lcnr```
2023-04-12 22:04:33 +02:00
Matthias Krüger
f56a265105
Rollup merge of #110089 - petrosagg:mpsc-ub, r=m-ou-se
sync::mpsc: synchronize receiver disconnect with initialization

Receiver disconnection relies on the incorrect assumption that `head.index != tail.index` implies that the channel is initialized (i.e `head.block` and `tail.block` point to allocated blocks). However, it can happen that `head.index != tail.index` and `head.block == null` at the same time which leads to a segfault when a channel is dropped in that state.

This can happen because initialization is performed in two steps. First, the tail block is allocated and the `tail.block` is set. If that is successful `head.block` is set to the same pointer. Importantly, initialization is skipped if `tail.block` is not null.

Therefore we can have the following situation:

1. Thread A starts to send the first value of the channel, observes that `tail.block` is null and begins initialization. It sets `tail.block` to point to a newly allocated block and then gets preempted. `head.block` is still null at this point.
2. Thread B starts to send the second value of the channel, observes that `tail.block` *is not* null and proceeds with writing its value in the allocated tail block and sets `tail.index` to 1.
3. Thread B drops the receiver of the channel which observes that `head.index != tail.index` (0 and 1 respectively), therefore there must be messages to drop. It starts traversing the linked list from `head.block` which is still a null pointer, leading to a segfault.

This PR fixes this problem by waiting for initialization to complete when `head.index != tail.index` and the `head.block` is still null. A similar check exists in `start_recv` for similar reasons.

Fixes #110001
2023-04-12 22:04:33 +02:00
Matthias Krüger
d40c827e9a
Rollup merge of #110035 - Ezrashaw:improve-test-attr-expansion-code, r=davidtwco
fix: ensure bad `#[test]` invocs retain correct AST

Fixes #109816

Ensures that a `StmtKind::Item` doesn't get converted into a plain `Item` (causing the ICE from the linked issue) Also unifies the error path a bit.
2023-04-12 22:04:32 +02:00
Matthias Krüger
559b2ea531
Rollup merge of #109810 - jyn514:rustdoc-opt-tests, r=TaKO8Ki
Replace rustdoc-ui/{c,z}-help tests with a stable run-make test

This make rustdoc resilient to changes in the debugging options while still testing that it matches rustc.

Fixes https://github.com/rust-lang/rust/issues/109391.
2023-04-12 22:04:32 +02:00
bors
59a05ad118 Auto merge of #110239 - matthiaskrgr:rollup-o90hx4s, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #109959 (Fix transmute intrinsic mir validation ICE)
 - #110176 (Renumbering cleanups)
 - #110182 (Use `itertools::Either` instead of own impl)
 - #110188 (Remove orphaned remove_dir_all implementation from rust-installer)
 - #110190 (Custom MIR: Support `BinOp::Offset`)
 - #110209 (Add regression test for #59003)
 - #110210 (`DescriptionCtx` cleanups)
 - #110217 (doc: loongarch: Fix typos)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-12 17:45:33 +00:00
Matthias Krüger
a954584412
Rollup merge of #110217 - rust-loongarch:fix-typos, r=GuillaumeGomez
doc: loongarch: Fix typos
2023-04-12 17:04:34 +02:00
Matthias Krüger
7614ea42fc
Rollup merge of #110210 - nnethercote:DescriptionCtx-cleanups, r=davidtwco
`DescriptionCtx` cleanups

Best reviewed one commit at a time.

r? `@davidtwco`
2023-04-12 17:04:33 +02:00
Matthias Krüger
49769260a3
Rollup merge of #110209 - JohnTitor:issue-59003, r=compiler-errors
Add regression test for #59003

Closes #59003
r? compiler-errors
2023-04-12 17:04:33 +02:00
Matthias Krüger
bb037e6fa7
Rollup merge of #110190 - cbeuw:mir-offset, r=oli-obk
Custom MIR: Support `BinOp::Offset`

Since offset doesn't have an infix operator, a new function `Offset` is added which is lowered to `Rvalue::BinaryOp(BinOp::Offset, ..)`

r? ```@oli-obk``` or ```@tmiasko``` or ```@JakobDegen```
2023-04-12 17:04:32 +02:00
Matthias Krüger
2118667ffa
Rollup merge of #110188 - Nilstrieb:remove-remove-dir-all, r=jyn514
Remove orphaned remove_dir_all implementation from rust-installer

I have no idea why it's here, but it's not used at all.

r? Mark-Simulacrum
2023-04-12 17:04:32 +02:00
Matthias Krüger
f21d8402ac
Rollup merge of #110182 - WaffleLapkin:neither, r=Nilstrieb
Use `itertools::Either` instead of own impl

Yeah.
2023-04-12 17:04:31 +02:00
Matthias Krüger
827b74c709
Rollup merge of #110176 - nnethercote:renumber-cleanups, r=lqd
Renumbering cleanups

r? ``@lqd``
2023-04-12 17:04:31 +02:00
Matthias Krüger
fd40f519c5
Rollup merge of #109959 - JakobDegen:transmute-validate, r=compiler-errors
Fix transmute intrinsic mir validation ICE

I stumbled across this at work, the minimal reproducer is included as a test which ICEs before this change.

I'm not 100% sure this is the right fix, but it matches what we do in `mir_assign_valid_types` so seems reasonable at least.

fixes #110151

r? `@lcnr` since they've been keeping the relevant logic correct, cc `@scottmcm`
2023-04-12 17:04:30 +02:00
bors
661b33f524 Auto merge of #109935 - michaelwoerister:fix-feed-in-eval-always, r=cjgillot
incr.comp.: Make sure dependencies are recorded when feeding queries during eval-always queries.

This PR makes sure we don't drop dependency edges when feeding queries during an eval-always query.

Background: During eval-always queries, no dependencies are recorded because the system knows to unconditionally re-evaluate them regardless of any actual dependencies. This works fine for these queries themselves but leads to a problem when feeding other queries: When queries are fed, we set up their dependency edges by copying the current set of dependencies of the feeding query. But because this set is empty for eval-always queries, we record no edges at all -- which has the effect that the fed query instances always look "green" to the system, although they should always be "red".

The fix is to explicitly add a dependency on the artificial "always red" dep-node when feeding during eval-always queries.

Fixes https://github.com/rust-lang/rust/issues/108481
Maybe also fixes issue https://github.com/rust-lang/rust/issues/88488.

cc `@jyn514`

r? `@cjgillot` or `@oli-obk`
2023-04-12 11:16:35 +00:00
Jynn Nelson
67b391968d Replace rustdoc-ui/{c,z}-help tests with a run-make test
This make rustdoc resilient to changes in the debugging options while
still testing that it matches rustc.
2023-04-12 05:34:21 -05:00
Jynn Nelson
bad2af1d38 Make rustdoc and rustc's help match exactly
Before, rustdoc was missing `-C passes=list` and the "Available options"
header.

Making these match allows testing that they match exactly.
2023-04-12 05:27:26 -05:00
bors
9be9b5e09a Auto merge of #107614 - compiler-errors:allow-elaborator-to-filter-only-super-traits, r=oli-obk
Split implied and super predicate queries, then allow elaborator to filter only supertraits

Split the `super_predicates_of` query into a new `implied_predicates_of` query. The former now only returns the *real* supertraits of a trait alias, and the latter now returns the implied predicates (which include all of the `where` clauses of the trait alias). The behavior of these queries is identical for regular traits.

Now that the two queries are split, we can add a new filter method to the elaborator, `filter_only_self()`, which can be used in instances that we need only the *supertrait* predicates, such as during the elaboration used in closure signature deduction. This toggles the usage of `super_predicates_of` instead of `implied_predicates_of` during elaboration of a trait predicate.

This supersedes #104745, and fixes the four independent bugs identified in that PR.
Fixes #104719
Fixes #106238
Fixes #110023
Fixes #109514

r? types
2023-04-12 08:39:19 +00:00
WANG Rui
f45417bd1c doc: loongarch: Fix typos 2023-04-12 15:16:25 +08:00
bors
0d7ed3ba84 Auto merge of #110214 - compiler-errors:rollup-mkig4t6, r=compiler-errors
Rollup of 10 pull requests

Successful merges:

 - #96971 (Initial support for loongarch64-unknown-linux-gnu)
 - #109894 (Remove Errors section from var_os docs)
 - #110000 (Rename tests/ui/unique to tests/ui/box/unit)
 - #110018 (Pass host linker to compiletest.)
 - #110104 ( Reword the docstring in todo! macro definition, fixing a typo)
 - #110113 (Fix `x test ui --target foo` when download-rustc is enabled)
 - #110126 (Support safe transmute in new solver)
 - #110155 (Fix typos in librustdoc, tools and config files)
 - #110162 (rustdoc: remove redundant expandSection code from main.js)
 - #110173 (kmc-solid: Implement `Socket::read_buf`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-12 04:50:01 +00:00
Michael Goulet
4c9cd9e739
Rollup merge of #110173 - solid-rs:patch/kmc-solid/socket-read-buf, r=cuviper
kmc-solid: Implement `Socket::read_buf`

Follow-up to #108326. Implements `Socket::read_buf` for the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets.
2023-04-11 20:28:50 -07:00
Michael Goulet
d22b019dbf
Rollup merge of #110162 - notriddle:notriddle/main-js-expand, r=GuillaumeGomez
rustdoc: remove redundant expandSection code from main.js

This functionality is already tested in `hash-item-expansion.goml`, and was implemented twice:

* First, in code that ran at load time and at hash change: 917cdd295d

* Later, the hash change event handler was itself run at load time, and the code handling both cases diverged in implementation, though their behavior still matches pretty well: f66a331335
2023-04-11 20:28:49 -07:00
Michael Goulet
e6975455d9
Rollup merge of #110155 - DaniPopes:rest-typos, r=jyn514
Fix typos in librustdoc, tools and config files

I used [`typos`](https://github.com/crate-ci/typos) to fix all typos, minus the ones present in #110153 and in #110154.

Refs #110150
2023-04-11 20:28:49 -07:00
Michael Goulet
87c9b3f35e
Rollup merge of #110126 - compiler-errors:new-solver-safe-transmute, r=oli-obk
Support safe transmute in new solver

Basically copies the same implementation as the old solver, but instead of looking for param types, we look for type or const placeholders.
2023-04-11 20:28:48 -07:00
Michael Goulet
2f5440c38a
Rollup merge of #110113 - jyn514:download-rustc-cross, r=albertlarsan68
Fix `x test ui --target foo` when download-rustc is enabled

Previously, we would never build the target std, only the host std:

```
; x t tests/ui/attributes --target wasm32-unknown-unknown
Building bootstrap
    Finished dev [unoptimized] target(s) in 0.02s
Building stage0 library artifacts (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.08s
Building tool compiletest (stage0)
    Finished release [optimized] target(s) in 0.09s
Check compiletest suite=ui mode=ui (x86_64-unknown-linux-gnu -> wasm32-unknown-unknown)
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { depth: 0, inner: Io { path: Some("/home/jyn/src/rust2/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/wasm32-unknown-unknown/lib"), err: Os { code: 2, kind: NotFound, message: "No such file or directory" } } }', src/tools/compiletest/src/main.rs:842:31
```

Helps with https://github.com/rust-lang/rust/issues/81930.
2023-04-11 20:28:48 -07:00
Michael Goulet
4f2f7fda10
Rollup merge of #110104 - kormosi:todo_typo, r=cuviper
Reword the docstring in todo! macro definition, fixing a typo
2023-04-11 20:28:47 -07:00
Michael Goulet
e6e46bae6f
Rollup merge of #110018 - jfgoog:host-and-target-linker, r=wesleywiser
Pass host linker to compiletest.

Tests marked `// force-host` were using the default linker, even if a custom linker was configured in config.toml.

This change adds a new flag, --host-linker, to compiletest, and renames --linker to --target-linker.
2023-04-11 20:28:47 -07:00
Michael Goulet
90b55973dd
Rollup merge of #110000 - reez12g:issue-109878, r=jackh726
Rename tests/ui/unique to tests/ui/box/unit

fixes https://github.com/rust-lang/rust/issues/109878

Since tests/ui/box already exists, I have temporarily named it boxed-box, but if another name sounds better, please let me know.
2023-04-11 20:28:46 -07:00
Michael Goulet
8a7a66572e
Rollup merge of #109894 - fleetingbytes:109893-var_os-never-returns-an-error, r=cuviper
Remove Errors section from var_os docs

Remove `Errors` section from `var_os` documentation, fixes #109893
2023-04-11 20:28:46 -07:00
Michael Goulet
4a24aab220
Rollup merge of #96971 - zhaixiaojuan:master, r=wesleywiser
Initial support for loongarch64-unknown-linux-gnu

Hi, We hope to add a new port in rust for LoongArch.

LoongArch intro
LoongArch is a RISC style ISA which is independently designed by Loongson
Technology in China. It is divided into two versions, the 32-bit version (LA32)
and the 64-bit version (LA64). LA64 applications have application-level
backward binary compatibility with LA32 applications. LoongArch is composed of
a basic part (Loongson Base) and an expanded part. The expansion part includes
Loongson Binary Translation (LBT), Loongson VirtualiZation (LVZ), Loongson SIMD
EXtension (LSX) and Loongson Advanced SIMD EXtension(LASX).

Currently the LA464 processor core supports LoongArch ISA and the Loongson
3A5000 processor integrates 4 64-bit LA464 cores. LA464 is a four-issue 64-bit
high-performance processor core. It can be used as a single core for high-end
embedded and desktop applications, or as a basic processor core to form an
on-chip multi-core system for server and high-performance machine applications.

Documentations:
ISA:
https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html
ABI:
https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html
More docs can be found at:
https://loongson.github.io/LoongArch-Documentation/README-EN.html

Since last year, we have locally adapted two versions of rust, rust1.41 and rust1.57, and completed the test locally.
I'm not sure if I'm submitting all the patches at once, so I split up the patches and here's one of the commits
2023-04-11 20:28:45 -07:00
bors
13d1802b88 Auto merge of #109895 - nikic:llvm-16-tests, r=cuviper
Add codegen tests for issues fixed by LLVM 16

Fixes #75978.
Fixes #99960.
Fixes #101048.
Fixes #101082.
Fixes #101814.
Fixes #103132.
Fixes #103327.
2023-04-12 02:30:21 +00:00
bors
e7271f4b92 Auto merge of #110194 - GuillaumeGomez:update-browser-ui-test, r=notriddle
Update browser-ui-test version

This update add the support for expressions, so we can now do this:

```
assert: 1 > 2 && ["a"] != ["b", "c"]
```

It also improved commands naming and updated puppeteer version.

r? `@notriddle`
2023-04-11 23:47:18 +00:00
Nicholas Nethercote
76d0c6f518 Inline and remove msg_span_from_early_bound_and_free_regions.
For similar reasons to the previous commit.
2023-04-12 08:02:38 +10:00
Nicholas Nethercote
877777f5bc Inline and remove DescriptionCtx::from_early_bound_and_free_regions.
It has a single call site, and the code is clearer with all region kinds
handled in one function, instead of splitting the handling across two
functions.

The commit also changes `DescriptionCtx::new` to use a more declarative
style, instead of creating a default `DescriptionCtx` and modifying it,
which I find easier to read.
2023-04-12 08:02:38 +10:00
Nicholas Nethercote
c9b0635679 Inline and remove DescriptionCtx::add_to.
It has a single callsite.
2023-04-12 08:02:32 +10:00
Nicholas Nethercote
74463214a6 Rename NllVisitor as RegionRenumberer.
It's a more descriptive name.
2023-04-12 07:44:37 +10:00
bors
9df3a39fb3 Auto merge of #110198 - weihanglo:update-cargo, r=weihanglo
Update cargo

17 commits in 0e474cfd7b16b018cf46e95da3f6a5b2f1f6a9e7..7bf43f028ba5eb1f4d70d271c2546c38512c9875
2023-03-31 23:15:58 +0000 to 2023-04-10 16:01:41 +0000

- docs(pkgid): Consistently use @ (rust-lang/cargo#11956)
- Fix credential token format validation. (rust-lang/cargo#11951)
- Validate token on publish. (rust-lang/cargo#11952)
- Clarify docs on `-C` that it appears before the command. (rust-lang/cargo#11947)
- Add `try_canonicalize` and use it over `std::fs::canonicalize` (rust-lang/cargo#11866)
- Fix typo (rust-lang/cargo#11944)
- docs(changelog): Change wording about auto-fix message (rust-lang/cargo#11943)
- Update home repo URL (rust-lang/cargo#11941)
- doc(changelog): `[env]` is a table, not a stable (rust-lang/cargo#11942)
- Stop using UncanonicalizedIter for QueryKind::Exact (rust-lang/cargo#11937)
- Don't query permutations of the path prefix. (rust-lang/cargo#11936)
- Fix typo in variable name (rust-lang/cargo#11931)
- Fix Cargo warning about unused sparse configuration key (rust-lang/cargo#11930)
- Switch benchsuite to the index archive. (rust-lang/cargo#11933)
- Update git2 (rust-lang/cargo#11928)
- Publish docs: Clarify requirements about the state of the index after publish. (rust-lang/cargo#11926)
- Call out the differences between the index JSON and the API or metadata. (rust-lang/cargo#11927)
2023-04-11 21:32:48 +00:00
Yuki Okushi
06ec5faccb
Add regression test for #59003
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-04-12 06:24:49 +09:00
Weihang Lo
f7c04edadc
Update cargo 2023-04-11 19:33:57 +01:00
Michael Goulet
7ec72efe10 Allow the elaborator to only filter to real supertraits 2023-04-11 17:45:42 +00:00
Michael Goulet
4560b61cd1 Broken tests 2023-04-11 17:45:42 +00:00
Michael Goulet
25c342f30a Split implied and super predicate queries 2023-04-11 17:45:42 +00:00
Michael Goulet
3dab259cb9 Split super_predicates_that_define_assoc_type query from super_predicates_of 2023-04-11 17:40:54 +00:00
Guillaume Gomez
010fa00b80 Update rustdoc GUI tests to new browser-ui-test version 2023-04-11 19:14:35 +02:00
Guillaume Gomez
8aba3f3264 Update browser-ui-test version to 0.15.0 2023-04-11 19:14:35 +02:00
bors
87a2408b06 Auto merge of #110003 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`
2023-04-11 16:51:23 +00:00
Nikita Popov
83f525cc28 Make test compatible with 32-bit 2023-04-11 17:19:07 +02:00
bors
45749b21b7 Auto merge of #110092 - clubby789:builtin-macros-translatable, r=compiler-errors
Migrate most of `rustc_builtin_macros` to diagnostic impls

cc #100717

This is a couple of days work, but I decided to stop for now before the PR becomes too big. There's around 50 unresolved failures when `rustc::untranslatable_diagnostic` is denied, which I'll finish addressing once this PR goes thtough

A couple of outputs have changed, but in all instances I think the changes are an improvement/are more consistent with other diagnostics (although I'm happy to revert any which seem worse)
2023-04-11 14:40:54 +00:00