Commit Graph

216624 Commits

Author SHA1 Message Date
David Wood
912783402f const_eval: implies_by in rustc_const_unstable
Extend support for `implies_by` (from `#[stable]` and `#[unstable]`)
to `#[rustc_const_stable]` and `#[rustc_const_unstable]`.

Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-08 15:09:11 +00:00
bors
6eb9f2dd67 Auto merge of #107788 - matthiaskrgr:rollup-mw10sli, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #107656 (Bump rust-installer)
 - #107757 (Allow automatically creating vscode `settings.json` with `x setup`)
 - #107769 (Rename `PointerSized` to `PointerLike`)
 - #107770 (rustdoc: use a newline instead of `<br>` to format code headers)
 - #107771 (Tweak ICE message)
 - #107773 (Clearly signal purpose of the yaml template)
 - #107776 (Docs: Fix format of headings in String::reserve)
 - #107779 (Remove astconv usage in diagnostic)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-08 07:43:37 +00:00
Matthias Krüger
fe26182281
Rollup merge of #107779 - compiler-errors:issue-107775, r=jackh726
Remove astconv usage in diagnostic

Fixes #107775

Location of the test sucks, I know, but I needed to put it somewhere 😓
The issue here is that the root cause of the issue has nothing to do with what's being tested, so I couldn't really give it a better name. Oh well.
2023-02-08 07:13:29 +01:00
Matthias Krüger
5e467f5dfa
Rollup merge of #107776 - dbrgn:docs-string-reserve-headings, r=cuviper
Docs: Fix format of headings in String::reserve

It was inconsistent with other doc comments in the same module (and the rest of the rust std docs).
2023-02-08 07:13:28 +01:00
Matthias Krüger
a4a164cc45
Rollup merge of #107773 - Mark-Simulacrum:rename-auto-template, r=estebank
Clearly signal purpose of the yaml template

Following up on https://github.com/rust-lang/rust/pull/106898#issuecomment-1383238532
2023-02-08 07:13:28 +01:00
Matthias Krüger
31345cd70a
Rollup merge of #107771 - estebank:ice-msg, r=compiler-errors
Tweak ICE message

Modify main message to be more conversational and emit one fewer note.
2023-02-08 07:13:27 +01:00
Matthias Krüger
86cc4141f7
Rollup merge of #107770 - notriddle:notriddle/br2nl, r=GuillaumeGomez
rustdoc: use a newline instead of `<br>` to format code headers

Since these elements now use `white-space: pre-wrap` since #107615, it's fine to use newlines for formatting, which is smaller and a bit less complicated.
2023-02-08 07:13:27 +01:00
Matthias Krüger
fabefe3f31
Rollup merge of #107769 - compiler-errors:pointer-like, r=eholk
Rename `PointerSized` to `PointerLike`

The old name was unnecessarily vague. This PR renames a nightly language feature that I added, so I don't think it needs any additional approval, though anyone can feel free to speak up if you dislike the rename.

It's still unsatisfying that we don't the user which of {size, alignment} is wrong, but this trait really is just a stepping stone for a more generalized mechanism to create `dyn*`, just meant for nightly testing, so I don't think it really deserves additional diagnostic machinery for now.

Fixes #107696, cc ``@RalfJung``
r? ``@eholk``
2023-02-08 07:13:26 +01:00
Matthias Krüger
b16a321b25
Rollup merge of #107757 - clubby789:setup-settings-json, r=jyn514
Allow automatically creating vscode `settings.json` with `x setup`

Closes #107703
2023-02-08 07:13:26 +01:00
Matthias Krüger
00efb0cb96
Rollup merge of #107656 - jonhoo:bump-rust-installer, r=Mark-Simulacrum
Bump rust-installer

Makes generation of `manifest.in` deterministic:
https://github.com/rust-lang/rust-installer/pull/120
2023-02-08 07:13:26 +01:00
bors
7ba4e95368 Auto merge of #107778 - weihanglo:update-cargo, r=weihanglo
Update cargo

12 commits in e84a7928d93a31f284b497c214a2ece69b4d7719..82c3bb79e3a19a5164e33819ef81bfc2c984bc56 2023-01-31 22:18:09 +0000 to 2023-02-04 22:52:16 +0000

- util toml targets: Do not infer directory as a file (rust-lang/cargo#11678)
- Add more guidance on how to implement unstable features (rust-lang/cargo#11675)
- Fix unstable chapter layout for codegen-backend (rust-lang/cargo#11676)
- refactor: mod.rs over "name".rs for consistency (rust-lang/cargo#11673)
- Verify source before recompile (rust-lang/cargo#11672)
- doc: more doc comments and intra-doc links (rust-lang/cargo#11669)
- Turn off debuginfo for build dependencies v2 (rust-lang/cargo#11252)
- config: Deny CARGO_HOME in [env] table (fixes rust-lang/cargo#11590) (rust-lang/cargo#11644)
- Fix the wrong comment (rust-lang/cargo#11651)
- Add partial support for SSH known hosts markers (rust-lang/cargo#11635)
- Replace `winapi` with `windows-sys` crate. (rust-lang/cargo#11656)
- Handle .cargo-ok being truncated (rust-lang/cargo#11665)

r? `@ghost`
2023-02-08 04:04:58 +00:00
bors
b082e80e20 Auto merge of #107688 - lukas-code:projection-with-lifetime, r=jackh726
ReErased regions are local

fix https://github.com/rust-lang/rust/issues/107678
fix https://github.com/rust-lang/rust/issues/107684
fix https://github.com/rust-lang/rust/issues/107686
fix https://github.com/rust-lang/rust/issues/107691
fix https://github.com/rust-lang/rust/issues/107730
2023-02-08 00:34:18 +00:00
Michael Goulet
6fdfdea8b1 Remove astconv usage in diagnostic 2023-02-07 23:08:25 +00:00
Weihang Lo
6f38fd5509
Update cargo
12 commits in e84a7928d93a31f284b497c214a2ece69b4d7719..82c3bb79e3a19a5164e33819ef81bfc2c984bc56
2023-01-31 22:18:09 +0000 to 2023-02-04 22:52:16 +0000

- util toml targets: Do not infer directory as a file (rust-lang/cargo#11678)
- Add more guidance on how to implement unstable features (rust-lang/cargo#11675)
- Fix unstable chapter layout for codegen-backend (rust-lang/cargo#11676)
- refactor: mod.rs over "name".rs for consistency (rust-lang/cargo#11673)
- Verify source before recompile (rust-lang/cargo#11672)
- doc: more doc comments and intra-doc links (rust-lang/cargo#11669)
- Turn off debuginfo for build dependencies v2 (rust-lang/cargo#11252)
- config: Deny CARGO_HOME in [env] table (fixes rust-lang/cargo#11590) (rust-lang/cargo#11644)
- Fix the wrong comment (rust-lang/cargo#11651)
- Add partial support for SSH known hosts markers (rust-lang/cargo#11635)
- Replace `winapi` with `windows-sys` crate. (rust-lang/cargo#11656)
- Handle .cargo-ok being truncated (rust-lang/cargo#11665)
2023-02-07 22:26:44 +00:00
bors
3f059f6046 Auto merge of #107768 - matthiaskrgr:rollup-9u4cal4, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #107719 (Remove `arena_cache` modifier from `upstream_monomorphizations_for`)
 - #107740 (Avoid locking the global context across the `after_expansion` callback)
 - #107746 (Split fn_ctxt/adjust_fulfillment_errors from fn_ctxt/checks)
 - #107749 (allow quick-edit convenience)
 - #107750 (make more readable)
 - #107755 (remove binder from query constraints)
 - #107756 (miri: fix ICE when running out of address space)
 - #107764 (llvm-16: Use Triple.h from new header location.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-07 20:58:20 +00:00
Danilo Bargen
4f36673e15 Docs: Fix format of headings in String::reserve 2023-02-07 21:32:28 +01:00
Mark Rousskov
8e2f57094f Clearly signal purpose of the yaml template 2023-02-07 14:31:38 -05:00
Esteban Küber
a7597a1526 Tweak ICE message
Modify main message to be more conversational and emit one fewer note.
2023-02-07 19:17:24 +00:00
Michael Goulet
2b70cbb8a5 Rename PointerSized to PointerLike 2023-02-07 19:05:53 +00:00
Michael Howell
8307fd7901 rustdoc: use a newline instead of <br> to format code headers
Since these elements now use `white-space: pre-wrap` since
784665d4ce, it's fine to use newlines
for formatting, which is smaller and a bit less complicated.
2023-02-07 11:23:25 -07:00
bors
bd39bbb4bb Auto merge of #107767 - matthiaskrgr:rollup-9m1qfso, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #100599 (Add compiler error E0523 long description and test)
 - #107471 (rustdoc: do not include empty default-settings tag in HTML)
 - #107555 (Modify existing bounds if they exist)
 - #107662 (Turn projections into copies in CopyProp.)
 - #107695 (Add test for Future inflating arg size to 3x )
 - #107700 (Run the tools builder on all PRs)
 - #107706 (Mark 'atomic_mut_ptr' methods const)
 - #107709 (Fix problem noticed in PR106859 with char -> u8 suggestion)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-07 17:19:47 +00:00
clubby789
eb18293cec Allow automatically creating vscode settings.json from bootstrap 2023-02-07 17:12:10 +00:00
Matthias Krüger
232213dd77
Rollup merge of #107764 - maurer:llvm-16, r=cuviper
llvm-16: Use Triple.h from new header location.

LLVM 16 has moved Triple.h from ADT and into TargetParser.

LLVM [landed a commit](62c7f035b4) this morning moving the header. This change should make rustc continue to build against LLVM main.
2023-02-07 17:57:18 +01:00
Matthias Krüger
d044c1bde4
Rollup merge of #107756 - RalfJung:miri-out-of-addresses, r=oli-obk
miri: fix ICE when running out of address space

Fixes https://github.com/rust-lang/miri/issues/2769
r? `@oli-obk`

I didn't add a test since that requires https://github.com/oli-obk/ui_test/issues/38 (host must be 64bit and target 32bit). Also the test takes ~30s, so I am not sure if we want to have it in the test suite?
2023-02-07 17:57:18 +01:00
Matthias Krüger
0e3af6af47
Rollup merge of #107709 - tialaramex:master, r=compiler-errors
Fix problem noticed in PR106859 with char -> u8 suggestion

HN reader `@ayosec` noticed that my #106859 a few weeks back, malfunctions if you have a Unicode escape, the code suggested b'\u{0}' if you tried to use '\u{0}' where a byte should be, when of course b'\u{0}' is not a byte literal, regardless of the codepoint you can't write Unicode escapes in a byte literal at all.

My proposed fix here just checks that the "character" you wrote is fewer than 5 bytes, thus allowing \x7F and similar escapes but conveniently forbidding even the smallest Unicode escape \u{0} before offering the suggestion as before.

I have provided an updated test which includes examples which do and don't work because of this additional rule.
2023-02-07 17:57:17 +01:00
Matthias Krüger
505d05d3f7
Rollup merge of #107755 - lcnr:no-binder, r=oli-obk
remove binder from query constraints

r? types
2023-02-07 17:57:17 +01:00
Matthias Krüger
26b532f1ce
Rollup merge of #107750 - tshepang:readability, r=GuillaumeGomez
make more readable
2023-02-07 17:57:17 +01:00
Matthias Krüger
e45984b774
Rollup merge of #107706 - tgross35:atomic-as-mut-ptr, r=m-ou-se
Mark 'atomic_mut_ptr' methods const

There's nothing that would block these methods from being const (just an UnsafeCell get), and it would be helpful for FFI interfaces in static contexts

Related tracking issue: #66893
2023-02-07 17:57:16 +01:00
Matthias Krüger
c149682ea0
Rollup merge of #107749 - tshepang:editing-convenience, r=michaelwoerister
allow quick-edit convenience
2023-02-07 17:57:16 +01:00
Matthias Krüger
b2284b9fd1
Rollup merge of #107700 - jyn514:tools-builder, r=Mark-Simulacrum
Run the tools builder on all PRs

Previously, it would only run on changes to subtrees, submodules, or select directories. That made it so that changes to the compiler that broke tools would only be detected on a full bors merge. This makes it so the tools builder runs by default, making it easier to catch breaking changes to clippy (which was the most affected).

r? ``@Mark-Simulacrum`` cc ``@pietroalbini`` ``@flip1995`` ``@m-ou-se``
2023-02-07 17:57:16 +01:00
Matthias Krüger
cf7aa57279
Rollup merge of #107746 - Nathan-Fenner:nathanf/clean-up-adjust_fulfillment_errors, r=compiler-errors
Split fn_ctxt/adjust_fulfillment_errors from fn_ctxt/checks

This is a follow-up from #106477, addressing a small number of the `FIXME`s that were added, by moving some functions into the new(er) `adjust_fulfillment_errors` module.

More cleanup is possible for this file (and I'll hopefully get around to doing some of that soon) but the very first thing is to just move these functions out.

There should be no "real" changes in this PR, besides minor adjustments to imports and the functions being transferred.
2023-02-07 17:57:16 +01:00
Matthias Krüger
4b859c3f2f
Rollup merge of #107695 - Swatinem:futcallx3, r=compiler-errors
Add test for Future inflating arg size to 3x

This adds one more test that should track improvements to generator
layout, like https://github.com/rust-lang/rust/issues/62958 and https://github.com/rust-lang/rust/issues/62575.

In particular, this test highlights suboptimal layout, as the storage
for the argument future is not being reused across its usage as `upvar`,
`local` and `awaitee` (being polled to completion).

This is on top of https://github.com/rust-lang/rust/pull/107692 (as those would conflict with each other)

It is a minimal repro for code mentioned in https://github.com/moka-rs/moka/issues/212#issuecomment-1416914616 (CC `@tatsuya6502)`
2023-02-07 17:57:15 +01:00
Matthias Krüger
8709e9be5a
Rollup merge of #107740 - oli-obk:lock_tcx, r=petrochenkov
Avoid locking the global context across the `after_expansion` callback

r? `@petrochenkov`

This was noticed in https://github.com/model-checking/kani/pull/2184#issuecomment-1416566982

This didn't have a perf impact, as it's just an additional 2 or 3 RefCell locks being created.
2023-02-07 17:57:15 +01:00
Matthias Krüger
306dbaf574
Rollup merge of #107662 - cjgillot:copy-projection, r=oli-obk
Turn projections into copies in CopyProp.

The current implementation can leave behind projections that are moved out several times.

This PR widens the check to turn such moves into copies: a move out of a projection of a copy is equivalent to a copy of the original projection.
2023-02-07 17:57:15 +01:00
Matthias Krüger
401fe5c000
Rollup merge of #107719 - WaffleLapkin:de-arena-allocates-you-UwU, r=cjgillot
Remove `arena_cache` modifier from `upstream_monomorphizations_for`

Arena-caching a pointer is pretty meaningless as far as I can tell.
2023-02-07 17:57:15 +01:00
Matthias Krüger
917662a8f6
Rollup merge of #107555 - edward-shen:edward-shen/dup-trait-suggestion, r=compiler-errors
Modify existing bounds if they exist

Fixes #107335.

This implementation is kinda gross but I don't really see a better way to do it.

This primarily does two things: Modifies `suggest_constraining_type_param` to accept a new parameter that indicates a span to be replaced instead of added, if presented, and limit the additive suggestions to either suggest a new bound on an existing bound (see newly added unit test) or add the generics argument if a generics argument wasn't found.

The former change is required to retain the capability to add an entirely new bounds if it was entirely omitted.

r? ``@compiler-errors``
2023-02-07 17:57:14 +01:00
Matthias Krüger
44bc2db484
Rollup merge of #107471 - notriddle:notriddle/default-settings, r=GuillaumeGomez
rustdoc: do not include empty default-settings tag in HTML
2023-02-07 17:57:14 +01:00
Matthias Krüger
6d225bb080
Rollup merge of #100599 - MatthewPeterKelly:add-E0523-description-and-test, r=compiler-errors,GuillaumeGomez
Add compiler error E0523 long description and test

This PR is one step towards addressing:  https://github.com/rust-lang/rust/issues/61137.
2023-02-07 17:57:13 +01:00
Matthew Maurer
147c51e17d llvm-16: Use Triple.h from new header location.
LLVM 16 has moved Triple.h from ADT and into TargetParser
2023-02-07 06:51:58 -08:00
bors
5dd0e1b7ae Auto merge of #107671 - CastilloDel:master, r=estebank
Fix suggestions rendering when the diff span is multiline

Fixes #92741

cc `@estebank`

I think, I finally fixed. I still want to go back and try to clean up the code a bit. I'm open to suggestions.

Some examples of the new suggestions:

```
help: consider removing the borrow
  |
2 -     &
  |
```
```
help: consider removing the borrow
  |
2 -     &
3 -     mut
  |
```
```
help: consider removing the borrow
  |
2 -     &
3 -     mut if true { true } else { false }
2 +     if true { true } else { false }
  |
```

Should we add a test to ensure this behavior doesn't disappear in the future?
2023-02-07 13:29:45 +00:00
Ralf Jung
2900ba15b3 miri: fix ICE when running out of address space 2023-02-07 13:26:31 +01:00
lcnr
a04f31dc34 remove binder from query constraints 2023-02-07 10:59:18 +01:00
bors
e4dd9edb76 Auto merge of #107704 - jyn514:tidy-ci, r=Mark-Simulacrum
Run `expand-yaml-anchors` in `x test tidy`

Previously, the pre-commit hook which runs `x test tidy` could pass only to have CI fail within the first 30 seconds. This adds about 30 seconds to `test tidy` (for an initial run, much less after the tool is built the first time) in exchange for catching errors in `.github/workflows/ci.yml` before they're pushed.
2023-02-07 09:58:58 +00:00
Arpad Borsos
7a7b2e3521
Add test for Future inflating arg size to 3x
This adds one more test that should track improvements to generator
layout, like #62958 and #62575.

In particular, this test highlights suboptimal layout, as the storage
for the argument future is not being reused across its usage as `upvar`,
`local` and `awaitee` (being polled to completion).
2023-02-07 08:52:15 +01:00
bors
dffea43fc1 Auto merge of #106180 - RalfJung:dereferenceable-generators, r=nbdd0121
make &mut !Unpin not dereferenceable, and Box<!Unpin> not noalias

See https://github.com/rust-lang/unsafe-code-guidelines/issues/381 and [this LLVM discussion](https://discourse.llvm.org/t/interaction-of-noalias-and-dereferenceable/66979). The exact semantics of how `noalias` and `dereferenceable` interact are unclear, and `@comex` found a case of LLVM actually exploiting that ambiguity for optimizations. I think for now we should treat LLVM `dereferenceable` as implying a "fake read" to happen immediately at the top of the function (standing in for the spurious reads that LLVM might introduce), and that fake read is subject to all the usual `noalias` restrictions. This means we cannot put `dereferenceable` on `&mut !Unpin` references as those references can alias with other references that are being read and written inside the function (e.g. for self-referential generators), meaning the fake read introduces aliasing conflicts with those other accesses.

For `&` this is already not a problem due to https://github.com/rust-lang/rust/pull/98017 which removed the `dereferenceable` attribute for other reasons.

Regular `&mut Unpin` references are unaffected, so I hope the impact of this is going to be tiny.

The first commit does some refactoring of the `PointerKind` enum since I found the old code very confusing each time I had to touch it. It doesn't change behavior.

Fixes https://github.com/rust-lang/miri/issues/2714

EDIT: Turns out our `Box<!Unpin>` treatment was incorrect, too, so the PR also fixes that now (in codegen and Miri): we do not put `noalias` on these boxes any more.
2023-02-07 03:35:10 +00:00
Tshepang Mbambo
a002c05726 make more readable 2023-02-07 04:54:01 +02:00
Tshepang Mbambo
63dc0b86be allow quick-edit convenience 2023-02-07 04:41:13 +02:00
Nathan Fenner
4c053668d6 Split fn_ctxt/adjust_fulfillment_errors from fn_ctxt/checks 2023-02-06 17:24:25 -08:00
bors
35d6d70a64 Auto merge of #107693 - petrochenkov:metable, r=oli-obk
rustc_metadata: Encode/decode some `LazyArrays` without an `Option`

and a couple of related changes, see individual commits.

Addresses comments in https://github.com/rust-lang/rust/pull/107166#discussion_r1083417124 and https://github.com/rust-lang/rust/pull/107166#discussion_r1083768417, cc `@cjgillot` `@oli-obk.`
2023-02-07 00:03:02 +00:00
Nick Lamb
747cdc0dfd Fix problem noticed in PR106859 with char -> u8 suggestion 2023-02-06 21:48:10 +00:00