Commit Graph

220057 Commits

Author SHA1 Message Date
Ezra Shaw
05b5046633
feat: implement error recovery in expected_ident_found 2023-03-20 20:54:41 +13:00
Ezra Shaw
b4e17a5098
refactor: improve "ident starts with number" error 2023-03-19 20:24:06 +13:00
Ezra Shaw
c9ddb73184
refactor: refactor identifier parsing somewhat 2023-03-19 20:20:20 +13:00
bors
85123d2504 Auto merge of #109284 - matthiaskrgr:rollup-aaublsx, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #109102 (Erase escaping late-bound regions when probing for ambiguous associated types)
 - #109200 (Fix index out of bounds in `suggest_trait_fn_ty_for_impl_fn_infer`)
 - #109211 (E0206 - update description )
 - #109222 (Do not ICE for unexpected lifetime with ConstGeneric rib)
 - #109235 (fallback to lstat when stat fails on Windows)
 - #109248 (Pass the right HIR back from `get_fn_decl`)
 - #109251 (Suggest surrounding the macro with `{}` to interpret as a statement)
 - #109256 (Check for llvm-tools before install)
 - #109257 (resolve: Improve debug impls for `NameBinding`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-18 03:16:32 +00:00
Matthias Krüger
0d4a56cc21
Rollup merge of #109257 - petrochenkov:bindebug, r=WaffleLapkin
resolve: Improve debug impls for `NameBinding`

Print at least the Some/None/Ok/Err status of the nested bindings if not the bindings themselves.
Noticed while reviewing https://github.com/rust-lang/rust/pull/108729.
2023-03-18 00:05:55 +01:00
Matthias Krüger
01edab6024
Rollup merge of #109256 - chaitanyav:fix_108948, r=albertlarsan68
Check for llvm-tools before install

Fixes #108948
````@jpalus```` Please review
2023-03-18 00:05:55 +01:00
Matthias Krüger
7e5705e5c6
Rollup merge of #109251 - MU001999:master, r=Nilstrieb
Suggest surrounding the macro with `{}` to interpret as a statement

Fixes #109237
2023-03-18 00:05:54 +01:00
Matthias Krüger
d91858b080
Rollup merge of #109248 - compiler-errors:get_fn_decl-aaa, r=WaffleLapkin
Pass the right HIR back from `get_fn_decl`

Fixes #109232

Makes sure that the `fn_id: HirId` that we pass to `suggest_missing_return_type` matches up with the `fn_decl: hir::FnDecl` that we pass to it, so the late-bound vars that we fetch from the former match up with the types in the latter...

This HIR suggestion code really needs a big refactor. I've tried to do it in the past (a couple of attempts), but it's a super tangled mess. It really shouldn't be passing around things like `hir::Node` and just deal with `LocalDefId`s everywhere... Anyways, I'd rather fix this ICE, now.
2023-03-18 00:05:54 +01:00
Matthias Krüger
2a3c0e34cb
Rollup merge of #109235 - chaitanyav:master, r=ChrisDenton
fallback to lstat when stat fails on Windows

Fixes #109106
````@ChrisDenton```` please let me know if this is the expected behavior for stat on windows
2023-03-18 00:05:53 +01:00
Matthias Krüger
dfd2b6493a
Rollup merge of #109222 - chenyukang:yukang/fix-109143, r=petrochenkov
Do not ICE for unexpected lifetime with ConstGeneric rib

Fixes #109143
r? ````@petrochenkov````

Combining this test with the previous test will affect the previous diagnostics, so I added a separate test case.
2023-03-18 00:05:53 +01:00
Matthias Krüger
e7d6369ed4
Rollup merge of #109211 - mili-l:mili_l/update_e0206_description, r=WaffleLapkin
E0206 - update description

added `union` to description
2023-03-18 00:05:52 +01:00
Matthias Krüger
55d5cd5e95
Rollup merge of #109200 - compiler-errors:issue-109191, r=WaffleLapkin
Fix index out of bounds in `suggest_trait_fn_ty_for_impl_fn_infer`

Fixes #109191
2023-03-18 00:05:52 +01:00
Matthias Krüger
0ee7539e96
Rollup merge of #109102 - compiler-errors:ambig-assoc-in-non-lt-binder, r=jackh726
Erase escaping late-bound regions when probing for ambiguous associated types

Fixes #109090
2023-03-18 00:05:52 +01:00
bors
13afbdaa06 Auto merge of #108862 - Mark-Simulacrum:bootstrap-bump, r=pietroalbini
Bump bootstrap compiler to 1.69 beta

r? `@pietroalbini`
2023-03-17 19:00:38 +00:00
NagaChaitanya Vellanki
32c589b236 Modify code style as per comments 2023-03-17 10:44:22 -07:00
Michael Goulet
08c913279f Pass the right HIR back from get_fn_decl 2023-03-17 15:39:05 +00:00
Michael Goulet
79ad7cca45 Erase escaping late-bound regions when probing for ambiguous associated types 2023-03-17 15:33:24 +00:00
bors
03b01c5bec Auto merge of #109253 - matthiaskrgr:rollup-2xmv5zk, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #108958 (Remove box expressions from HIR)
 - #109044 (Prevent stable `libtest` from supporting `-Zunstable-options`)
 - #109155 (Fix riscv64 fuchsia LLVM target name)
 - #109156 (Fix linker detection for clang with prefix)
 - #109181 (inherit_overflow: adapt pattern to also work with v0 mangling)
 - #109198 (Install projection from RPITIT to default trait method opaque correctly)
 - #109215 (Use sort_by_key instead of sort_by)
 - #109229 (Fix invalid markdown link references)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-17 14:56:30 +00:00
Jamilya Shurukhova
c4bb47ac36
Update compiler/rustc_error_codes/src/error_codes/E0206.md
Co-authored-by: Waffle Maybe <waffle.lapkin@gmail.com>
2023-03-17 15:50:37 +01:00
Jamilya Shurukhova
05dc132adb E0206 - code review changes 2023-03-17 14:54:39 +01:00
bors
c50c62d225 Auto merge of #109241 - saethlin:miri, r=oli-obk
update Miri

r? `@oli-obk`
2023-03-17 12:01:17 +00:00
Vadim Petrochenkov
2a5208011d resolve: Improve debug impls for NameBinding
Print at least the Some/None/Ok/Err status of the nested bindings if not the bindings themselves.
2023-03-17 13:34:15 +04:00
NagaChaitanya Vellanki
97740a648f Check for llvm-tools before install 2023-03-17 02:33:31 -07:00
bors
2d64f229a0 Auto merge of #109085 - tmiasko:index-based, r=WaffleLapkin
Use index based drop loop for slices and arrays

Instead of building two kinds of drop pair loops, of which only one will be eventually used at runtime in a given monomorphization, always use index based loop.
2023-03-17 08:17:21 +00:00
Matthias Krüger
0584bde849
Rollup merge of #109229 - DaniPopes:link-references, r=notriddle
Fix invalid markdown link references

Fixes invalid link references in librustdoc's template documentation.
`[text](link)` was interpreted as a relative path to the file, making the link invalid, while `[text][label]` references a label defined in the file itself: <https://www.markdownguide.org/basic-syntax/#reference-style-links>
2023-03-17 08:42:41 +01:00
Matthias Krüger
a530f72268
Rollup merge of #109215 - est31:sort_by_key, r=Nilstrieb
Use sort_by_key instead of sort_by

I went over the cases where sort_by is used and in these two, one can use sort_by_key instead.
2023-03-17 08:42:40 +01:00
Matthias Krüger
246d989a30
Rollup merge of #109198 - compiler-errors:new-rpitit-default-body, r=spastorino
Install projection from RPITIT to default trait method opaque correctly

1. For new lowering strategy `-Zlower-impl-trait-in-trait-to-assoc-ty`, install the correct default trait method projection predicates (RPITIT -> opaque). This makes default trait body tests pass!

2. Fix two WF-checking bugs -- first, we want to make sure that we're always looking for an opaque type in `check_return_position_impl_trait_in_trait_bounds`. That's because the RPITIT projections are normalized to opaques during wfcheck. Second, fix RPITIT's param-envs by not adding the projection predicates that we install on trait methods to make default RPITITs work -- I left a comment why.

3. Also, just a small drive-by for `rustc_on_unimplemented`. Not sure if it affects any tests, but can't hurt.

r? ````@spastorino,```` based off of #109140
2023-03-17 08:42:40 +01:00
Matthias Krüger
edd6b42565
Rollup merge of #109181 - durin42:v0-mangle-inherit_overflow, r=Nilstrieb
inherit_overflow: adapt pattern to also work with v0 mangling

This test was failing under new-symbol-mangling = true. Adapt pattern to work in both cases.

Related to #106002 from December.
2023-03-17 08:42:39 +01:00
Matthias Krüger
cd6d1653cc
Rollup merge of #109156 - taiki-e:linker-detection, r=petrochenkov
Fix linker detection for clang with prefix

https://github.com/rust-lang/rust/pull/106489 removed check for clang with prefix. It says:

> Also remove the check for -clang, since there are no architecture specific variants of clang (to my knowledge).

However, when doing cross-compilation, a wrapper script for clang with the target name as a prefix is sometimes used.

1716932743/src/ci/docker/host-x86_64/dist-various-2/Dockerfile (L62)

1716932743/src/ci/docker/scripts/freebsd-toolchain.sh (L76-L80)

1716932743/src/ci/docker/host-x86_64/dist-various-2/Dockerfile (L40)

1716932743/compiler/rustc_target/src/spec/aarch64_pc_windows_gnullvm.rs (L7)

It seems the regression did not occur on the targets mentioned above because the default linker flavor is gcc, but it did occur on targets where the default linker flavor is not gcc (fd352f3ffa).

r? ````@petrochenkov````
2023-03-17 08:42:39 +01:00
Matthias Krüger
023154e2ce
Rollup merge of #109155 - taiki-e:riscv64-fuchsia-fix-llvm-target, r=tmandry
Fix riscv64 fuchsia LLVM target name

Currently, riscv64gc-unknown-fuchsia (added in #108722) sets riscv64*gc*-unknown-fuchsia as the LLVM target.

1716932743/compiler/rustc_target/src/spec/riscv64gc_unknown_fuchsia.rs (L5)

However, riscv64*gc*-\* is not a valid LLVM target and causes the following error.

```console
$ rustc --print cfg --target riscv64gc-unknown-fuchsia
error: could not create LLVM TargetMachine for triple: riscv64gc-unknown-fuchsia: No available targets are compatible with triple "riscv64gc-unknown-fuchsia"
```

As with other RISC-V targets, the LLVM target should use riscv64-\*, not riscv64*gc*-\*.

1716932743/compiler/rustc_target/src/spec/riscv64gc_unknown_freebsd.rs (L5)
1716932743/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_gnu.rs (L5)

I confirmed that riscv64-unknown-fuchsia is recognized as a valid LLVM target by using custom targets.

```console
# create a custom target with `"llvm-target": "riscv64-unknown-fuchsia" from no-std riscv64gc target.
$ rustc --print target-spec-json -Z unstable-options --target riscv64gc-unknown-none-elf | grep -v is-builtin | sed 's/"llvm-target".*/"llvm-target": "riscv64-unknown-fuchsia",/' > riscv64gc-unknown-fuchsia.json

$ rustc --print cfg --target riscv64gc-unknown-fuchsia.json
debug_assertions
panic="abort"
target_abi=""
target_arch="riscv64"
target_endian="little"
target_env=""
target_feature="a"
target_feature="c"
target_feature="d"
target_feature="f"
target_feature="m"
...

$ cat riscv64gc-unknown-fuchsia.json
{
  "arch": "riscv64",
  "code-model": "medium",
  "cpu": "generic-rv64",
  "data-layout": "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128",
  "eh-frame-header": false,
  "emit-debug-gdb-scripts": false,
  "features": "+m,+a,+f,+d,+c",
  "linker": "rust-lld",
  "linker-flavor": "ld.lld",
  "llvm-abiname": "lp64d",
  "llvm-target": "riscv64-unknown-fuchsia",
  "max-atomic-width": 64,
  "panic-strategy": "abort",
  "relocation-model": "static",
  "supported-sanitizers": [
    "kernel-address"
  ],
  "target-pointer-width": "64"
}

# Check the current master's LLVM target name causes an error
$ sed -i 's/riscv64-unknown-fuchsia/riscv64gc-unknown-fuchsia/' riscv64gc-unknown-fuchsia.json
$ rustc --print cfg --target riscv64gc-unknown-fuchsia.json
error: could not create LLVM TargetMachine for triple: riscv64gc-unknown-fuchsia: No available targets are compatible with triple "riscv64gc-unknown-fuchsia"
```

r? ````@tmandry````
2023-03-17 08:42:38 +01:00
Matthias Krüger
0e7117be31
Rollup merge of #109044 - thomcc:disallow-unstable-libtest, r=jyn514
Prevent stable `libtest` from supporting `-Zunstable-options`

Took a while for me to get around to this but seems trivial (unless I'm missing some reason this will break all our tests). Fixes #75526

Basically `libtest` already tries to handle this in 501ad021b9/library/test/src/cli.rs (L310-L318)

But that env var was not passed. I'm guessing at one point [this code](501ad021b9/src/bootstrap/compile.rs (L842-L844)) (or a common ancestor) was used to compile the standard library/libtest, but that is no longer the case (or perhaps it never worked, I don't have time to go digging).

I don't love that this is a "allow unstable by default" situation, as it means things like [`rustc-build-sysroot`](https://github.com/RalfJung/rustc-build-sysroot) could accidentally get unstable (CC ````@RalfJung)```` even if this is fixed here, but it's consistent with what happens in `rustc_feature`, so... yeah.

This is user-facing after all, even if it's hard to imagine the outcome of that conversation being "lets continue allowing use of `-Zunstable-features` from stable rust" (especially since a `RUSTC_BOOTSTRAP=1`-shaped loophole remains)... I think it probably should get a vibe check in the t-libs meeting (and plausibly a relnote along the lines of "hey `cargo test -- -Zunstable-options --some --unstable --stuff=here` used to work on stable, that's been fixed, sorry").

I'll nominate it for that after CI comes up green (I've done a smoke check but don't know what (if anything) will need `bootstrap` to enable `RUSTC_BOOTSTRAP=1` when running tests)

r? ````@jyn514````
2023-03-17 08:42:38 +01:00
Matthias Krüger
13ff2d42cd
Rollup merge of #108958 - clubby789:unbox-the-hir, r=compiler-errors
Remove box expressions from HIR

After #108516, `#[rustc_box]` is used at HIR->THIR lowering and this is no longer emitted, so it can be removed.

This is based on top of #108471 to help with conflicts, so 43490488ccacd1a822e9c621f5ed6fca99959a0b is the only relevant commit (sorry for all the duplicated pings!)

````@rustbot```` label +S-blocked
2023-03-17 08:42:37 +01:00
Mu42
550e3087d1 Suggest surrounding the macro with {} to interpret as a statement 2023-03-17 14:36:22 +08:00
NagaChaitanya Vellanki
0aad0b32ae run rustfmt on changes 2023-03-16 17:07:41 -07:00
NagaChaitanya Vellanki
2dbda0af15 fallback to lstat when stat fails on Windows 2023-03-16 16:57:55 -07:00
yukang
827a990255 Do not ICE for unexpected lifetime with ConstGeneric rib 2023-03-17 07:36:18 +08:00
bors
3831a25490 Auto merge of #2817 - saethlin:rustup, r=saethlin
rustup

Doing a sync just before I do a rustc-push
2023-03-16 23:05:57 +00:00
Ben Kimock
ba1c09429e Merge from rustc 2023-03-16 19:03:22 -04:00
Ben Kimock
689f24e904 Preparing for merge from rustc 2023-03-16 19:03:17 -04:00
bors
511364e787 Auto merge of #108944 - cjgillot:clear-local-info, r=oli-obk
Wrap the whole LocalInfo in ClearCrossCrate.

MIR contains a lot of information about locals. The primary purpose of this information is the quality of borrowck diagnostics.

This PR aims to drop this information after MIR analyses are finished, ie. starting from post-cleanup runtime MIR.
2023-03-16 19:59:56 +00:00
DaniPopes
7a1a02ec9b
Fix invalid markdown link references 2023-03-16 20:55:50 +01:00
bors
e386217dd9 Auto merge of #107270 - cjgillot:remove-zst, r=oli-obk
Replace ZST operands and debuginfo by constants.

This is work that ConstProp will not have to do.
Split from https://github.com/rust-lang/rust/pull/107267
2023-03-16 16:40:53 +00:00
bors
b024de1673 Auto merge of #2785 - Vanille-N:tree-borrows-merge, r=RalfJung
Tree borrows

This PR implements the experimental Tree Borrows (TB) rules for tracking reference aliasing, as an optional alternative to Stacked Borrows (SB).

SB and TB are mutually exclusive. Using `-Zmiri-tree-borrows` replaces every invocation of SB with the equivalent TB procedure.

A detailed explanation of the TB rules is currently under review, you can find the latest version [here [work in progress]](https://github.com/Vanille-N/tree-borrows/blob/master/model/treebor.pdf).

This PR does NOT yet include
- enough `fail` tests for TB (although TB is less reliant than SB on `fail` tests to check that the implementation matches the design due to `pass` tests being more strict)
- good diagnostics for TB violations
2023-03-16 14:55:28 +00:00
Neven Villani
782b869224 TB: select tests to run both TB and SB 2023-03-16 14:56:18 +01:00
Neven Villani
e243206ae3 TB: new tests 2023-03-16 14:56:18 +01:00
Neven Villani
8741303f6e TB: document TB changes in README 2023-03-16 14:56:16 +01:00
Neven Villani
8bbb0404f8 TB: integration 2023-03-16 14:54:00 +01:00
Neven Villani
0afab595b4 TB: Reborrow policy and connection to the main machine 2023-03-16 14:52:46 +01:00
Neven Villani
7d4e8b9bc0 TB: error and tree formatting 2023-03-16 14:52:46 +01:00
Neven Villani
eb3ff3ccb0 TB: tree traversal 2023-03-16 14:52:46 +01:00