Commit Graph

223758 Commits

Author SHA1 Message Date
Michael Goulet
29ac429c9b
Rollup merge of #109410 - fmease:iat-alias-kind-inherent, r=compiler-errors
Introduce `AliasKind::Inherent` for inherent associated types

Allows us to check (possibly generic) inherent associated types for well-formedness.
Type inference now also works properly.

Follow-up to #105961. Supersedes #108430.
Fixes #106722.
Fixes #108957.
Fixes #109768.
Fixes #109789.
Fixes #109790.

~Not to be merged before #108860 (`AliasKind::Weak`).~

CC `@jackh726`
r? `@compiler-errors`

`@rustbot` label T-types F-inherent_associated_types
2023-05-08 09:30:21 -07:00
Michael Goulet
fcb275f85e
Rollup merge of #104070 - nbdd0121:unwind, r=Amanieu
Prevent aborting guard from aborting the process in a forced unwind

Fix #101469
2023-05-08 09:30:21 -07:00
bors
ce042889f7 Auto merge of #111346 - JohnTitor:rollup-6g5cg9z, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #105354 (Add deployment-target --print flag for Apple targets)
 - #110377 (Update max_atomic_width of armv7r and armv7_sony_vita targets to 64.)
 - #110638 (STD support for PSVita)
 - #111211 (Don't compute trait super bounds unless they're positive)
 - #111315 (Remove `identity_future` from stdlib)
 - #111331 (Mark s390x condition code register as clobbered in inline assembly)
 - #111332 (Improve inline asm for LoongArch)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-08 11:36:05 +00:00
Yuki Okushi
2a8adcc966
Rollup merge of #111332 - loongarch-rs:inline-asm, r=Amanieu
Improve inline asm for LoongArch

This PR is a sub-part of https://github.com/rust-lang/rust/pull/111235, to improve inline asm for LoongArch.

r? `@Amanieu`
2023-05-08 19:41:51 +09:00
Yuki Okushi
c122ac3e69
Rollup merge of #111331 - taiki-e:s390x-asm-cc, r=Amanieu
Mark s390x condition code register as clobbered in inline assembly

Various s390x instructions (arithmetic operations, logical operations, comparisons, etc. see also "Condition Codes" section in [z/Architecture Reference Summary](https://www.ibm.com/support/pages/zarchitecture-reference-summary)) modify condition code register `cc`, but AFAIK there is currently no way to mark it as clobbered in `asm!`.

`cc` register definition in LLVM:
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/SystemZ/SystemZRegisterInfo.td#L320

This PR also updates asm_experimental_arch docs in the unstable-book to mention s390x registers.

cc `@uweigand`

r? `@Amanieu`
2023-05-08 19:41:50 +09:00
Yuki Okushi
28b9696a9e
Rollup merge of #111315 - Swatinem:rm-identitiy-future, r=Mark-Simulacrum
Remove `identity_future` from stdlib

This function/lang_item was introduced in #104321 as a temporary workaround of future lowering. The usage and need for it went away in #104833.
After a bootstrap update, the function itself can be removed from `std`.
2023-05-08 19:41:50 +09:00
Yuki Okushi
c145d93395
Rollup merge of #111211 - compiler-errors:negative-bounds-super, r=TaKO8Ki
Don't compute trait super bounds unless they're positive

Fixes #111207

The comment is modified to explain the rationale for why we even have this recursive call to supertraits in the first place, which doesn't apply to negative bounds since they don't elaborate at all.
2023-05-08 19:41:49 +09:00
Yuki Okushi
4df84a1e4e
Rollup merge of #110638 - nikarh:vita, r=Mark-Simulacrum
STD support for PSVita

This PR adds std support for `armv7-sony-vita-newlibeabihf` target.

The work here is fairly similar to #95897, just for a different target platform.

This depends on the following pull requests:

rust-lang/backtrace-rs#523
rust-lang/libc#3209
2023-05-08 19:41:49 +09:00
Yuki Okushi
c9b4c63e01
Rollup merge of #110377 - chrisnc:armv7-atomic-64, r=cjgillot
Update max_atomic_width of armv7r and armv7_sony_vita targets to 64.

All armv7a and armv7r implementations support `ldrexd`/`strexd`, only armv7m does not.
2023-05-08 19:41:48 +09:00
Yuki Okushi
e3eb6a87bf
Rollup merge of #105354 - BlackHoleFox:apple-deployment-printer, r=oli-obk
Add deployment-target --print flag for Apple targets

This is very useful for crates that need to know what the Apple OS deployment target is for their build scripts or inside of a build environment. Right now, the defaults just get copy/pasted around the ecosystem since they've been stable for so long. But with #104385 in progress, that won't be true anymore and everything will need to move. Ideally whenever it happens again, this could be less painful as everything can ask the compiler what its default is instead.

To show examples of the copy/paste proliferation, here's some crates and/or apps that do:
- [cc](https://github.com/rust-lang/cc-rs/pull/708/files), Soon
-  [mac-notification-sys](https://github.com/h4llow3En/mac-notification-sys/pull/46/files#diff-d0d98998092552a1d3259338c2c71e118a5b8343dd4703c0c7f552ada7f9cb42R10-R12)
- [PyO3](ccb02d1aa1/src/target.rs (L755-L758))
- [Anki](613b5c1034/build/runner/src/bundle/artifacts.rs (L49-L54))
- [jsc-rs](3776726756/xtask/src/build.rs (L402-L405))
... and probably more that a simple GitHub codesearch didn't see
2023-05-08 19:41:48 +09:00
bors
c86e7fb60f Auto merge of #111342 - Dylan-DPC:rollup-b5p6wzy, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #110297 (Make `(try_)subst_and_normalize_erasing_regions` take `EarlyBinder`)
 - #110827 (Fix lifetime suggestion for type aliases with objects in them)
 - #111022 (Use smaller ints for bitflags)
 - #111056 (Fix some suggestions where a `Box<T>` is expected.)
 - #111262 (Further normalize msvc-non-utf8-ouput)
 - #111265 (Make generics_of has_self on RPITITs delegate to the opaque)
 - #111323 (Give a more helpful error when running the rustc shim directly)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-08 07:35:30 +00:00
Taiki Endo
e61bb8810b Mark s390x condition code register as clobbered in inline assembly 2023-05-08 15:42:56 +09:00
Dylan DPC
172ddccc50
Rollup merge of #111323 - jyn514:shim-error, r=Mark-Simulacrum
Give a more helpful error when running the rustc shim directly

cc https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/Building.20.60coretests.60.20by.20hand
2023-05-08 11:39:23 +05:30
Dylan DPC
940567068c
Rollup merge of #111265 - spastorino:has_self-opaque_ty, r=compiler-errors
Make generics_of has_self on RPITITs delegate to the opaque

r? `@compiler-errors`

I couldn't come up with a test case and none of the ones in the `tests` folder is impacted by this change, but I still think is the right thing to do.

Michael, let me know if you have ideas on how to add a test that's affected by this change.
2023-05-08 11:39:22 +05:30
Dylan DPC
c9433a4969
Rollup merge of #111262 - ChrisDenton:normalize-msvc-output, r=cjgillot
Further normalize msvc-non-utf8-ouput

Fixes #111256 by normalizing this tests down to the essential part so that it only tests for the Unicode output we expect. Also uses a file name that should never occur outside of this test.
2023-05-08 11:39:22 +05:30
Dylan DPC
aceb5d951b
Rollup merge of #111056 - JohnBobbo96:fix_box_suggestions, r=compiler-errors
Fix some suggestions where a `Box<T>` is expected.

This fixes #111011, and also adds a suggestion for boxing a unit type when a `Box<T>` was expected and an empty block was found.
2023-05-08 11:39:21 +05:30
Dylan DPC
c75543d648
Rollup merge of #111022 - Nilstrieb:smaller-bitflags, r=compiler-errors
Use smaller ints for bitflags

Free shrinking!
2023-05-08 11:39:21 +05:30
Dylan DPC
e04c9019f0
Rollup merge of #110827 - compiler-errors:issue-110761-followup, r=cjgillot
Fix lifetime suggestion for type aliases with objects in them

Fixes an issue identified in https://github.com/rust-lang/rust/issues/110761#issuecomment-1520678479

This suggestion, like many other borrowck suggestions, are very fragile and there are other ways to trigger strange behavior even after this PR, so this is just a small improvement and not a total rework 💀
2023-05-08 11:39:20 +05:30
Dylan DPC
71a1ac2c9a
Rollup merge of #110297 - kylematsuda:earlybinder_tcx_subst, r=BoxyUwU
Make `(try_)subst_and_normalize_erasing_regions` take `EarlyBinder`

Changes `subst_and_normalize_erasing_regions` and `try_subst_and_normalize_erasing_regions` to take  `EarlyBinder<T>` instead of `T`.

(related to #105779)

This was suggested by `@BoxyUwU` in https://github.com/rust-lang/rust/pull/107753#discussion_r1105828139. After changing `type_of` to return `EarlyBinder`, there were several places where the binder was immediately skipped to call `tcx.subst_and_normalize_erasing_regions`, only for the binder to be reconstructed inside of that method.

r? `@BoxyUwU`
2023-05-08 11:39:20 +05:30
bors
ea0c22ea4f Auto merge of #106621 - ozkanonur:enable-elided-lifetimes-for-doctests, r=Mark-Simulacrum
enable `rust_2018_idioms` lint group for doctests

With this change, `rust_2018_idioms` lint group will be enabled for compiler/libstd doctests.

Resolves #106086
Resolves #99144

Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-05-08 04:50:28 +00:00
John Bobbo
35985091cc
Fix suggestion for boxing an async closure body, and
also add a suggestion for boxing empty blocks.
2023-05-07 20:30:56 -07:00
WANG Rui
c5382adc65 Simplify match statement since variable arch that is predictable 2023-05-08 11:08:09 +08:00
WANG Rui
8ad78cb02c Mark LoongArch float-point condition flags as clobbered in inline assembly 2023-05-08 11:05:46 +08:00
bors
04c53444df Auto merge of #111309 - saethlin:InstSimplify, r=scottmcm
Rename InstCombine to InstSimplify

```
╭ ➜ ben@archlinux:~/rust
╰ ➤ rg -i instcombine
src/doc/rustc-dev-guide/src/mir/optimizations.md
134:may have been misapplied. Examples of this are `InstCombine` and `ConstantPropagation`.

src/ci/docker/host-x86_64/disabled/dist-x86_64-haiku/llvm-config.sh
38:                    instcombine instrumentation interpreter ipo irreader lanai \

tests/codegen/slice_as_from_ptr_range.rs
4:// min-llvm-version: 15.0 (because this is a relatively new instcombine)
```

r? `@scottmcm`
2023-05-08 01:28:50 +00:00
bors
ad6b20bf52 Auto merge of #111306 - Urgau:hashbrown-std-0.13, r=Amanieu
Update hashbrown from 0.12.3 to 0.13.1 for std

This PR updates hashbrown from 0.12.3 to 0.13.1 for std.

r? `@Amanieu`
2023-05-07 22:51:44 +00:00
bors
c4190f2d3a Auto merge of #111224 - jyn514:default-tidy, r=pietroalbini
Remove `tidy` key in PR CI

This avoids confusing error messages when adding an `auto` job to CI (as recommended in the dev-guide: https://rustc-dev-guide.rust-lang.org/tests/ci.html#using-ci-to-test).

cc https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Do.20.60needs-profiler-support.60.20tests.20not.20run.20in.20CI.3F/near/355302998

r? `@ghost`
2023-05-07 17:17:58 +00:00
Nilstrieb
f2645776dc Use smaller ints for bitflags 2023-05-07 18:24:46 +02:00
jyn
654f56e086 Give a more helpful error when running the rustc shim directly
cc https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/Building.20.60coretests.60.20by.20hand
2023-05-07 11:20:16 -05:00
Nikolay Arhipov
3ba3df3764 PS Vita std support 2023-05-07 18:57:43 +03:00
bors
613a5c95ae Auto merge of #111222 - scottmcm:constify-is_ascii, r=thomcc
Constify `[u8]::is_ascii` (unstably)

UTF-8 checking in `const fn`-stabilized back in 1.63 (#97367), but apparently somehow ASCII checking was never const-ified, despite being simpler.

New constness-tracking issue for `is_ascii`: #111090

I noticed this working on `ascii::Char`: #110998
2023-05-07 14:18:05 +00:00
Gary Guo
16abe6c83d Fix codegen test 2023-05-07 12:38:47 +01:00
Gary Guo
91afde57a2 Add todo for filter landing pad 2023-05-07 12:38:47 +01:00
Gary Guo
97926360e7 Fix num reserved clauses for landing pad 2023-05-07 12:38:47 +01:00
Gary Guo
ecd04fd1b5 Add test for unwinding past terminating POF 2023-05-07 12:38:47 +01:00
Gary Guo
37f7d322b8 Prevent aborting guard from aborting the process in a forced unwind 2023-05-07 12:35:54 +01:00
Gary Guo
62237536da Parse catch filter in personality function 2023-05-07 12:35:54 +01:00
Gary Guo
47171e0c50 Use landingpad filter to encode aborting landing pad 2023-05-07 12:35:54 +01:00
bors
0dddad0dc5 Auto merge of #111161 - compiler-errors:rtn-super, r=cjgillot
Support return-type bounds on associated methods from supertraits

Support `T: Trait<method(): Bound>` when `method` comes from a supertrait, aligning it with the behavior of associated type bounds (both equality and trait bounds).

The only wrinkle is that I have to extend `super_predicates_that_define_assoc_type` to look for *all* items, not just `AssocKind::Ty`. This will also be needed to support `feature(associated_const_equality)` as well, which is subtly broken when it comes to supertraits, though this PR does not fix those yet. There's a slight chance there's a perf regression here, in which case I guess I could split it out into a separate query.
2023-05-07 11:18:22 +00:00
Arpad Borsos
48dfbeee27
Remove identity_future from stdlib
This function/lang_item was introduced in #104321 as a temporary workaround of future lowering.
The usage and need for it went away in #104833.
After a bootstrap update, the function itself can be removed from `std`.
2023-05-07 10:52:01 +02:00
bors
8660707bb2 Auto merge of #111125 - xfix:inline-socketaddr-methods, r=Mark-Simulacrum
Inline SocketAddr methods
2023-05-07 08:20:11 +00:00
Scott McMurray
c8c5a587ac Tune the is_ascii implementation used for short slices 2023-05-06 22:56:43 -07:00
Kyle Matsuda
d27f40175f changes from review: add FIXME to clippy and change subst_identity to skip_binder in mir subst methods 2023-05-06 23:36:04 -06:00
bors
8cc75b56a6 Auto merge of #111311 - JohnTitor:rollup-vfpjm0d, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #105583 (Operand::extract_field: only cast llval if it's a pointer and replace bitcast w/ pointercast.)
 - #110094 (clean up `transmute`s in `core`)
 - #111150 (added TraitAlias to check_item() for missing_docs)
 - #111293 (rustc --explain E0726 - grammar fixing (it's => its + add a `the` where it felt right to do so))
 - #111300 (Emit while_true lint spanning the entire loop condition)
 - #111301 (Remove calls to `mem::forget` and `mem::replace` in `Option::get_or_insert_with`.)
 - #111303 (update Rust Unstable Book docs for `--extern force`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-07 05:20:29 +00:00
Yuki Okushi
8372eaee0b
Rollup merge of #111303 - mhammerly:extern-force-docs, r=JohnTitor
update Rust Unstable Book docs for `--extern force`

Options for `--extern` are documented in [The Rust Unstable Book](https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/extern-options.html). https://github.com/rust-lang/rust/pull/109421 added a new `force` option and this PR updates the documentation accordingly.
2023-05-07 14:12:17 +09:00
Yuki Okushi
816e0295b5
Rollup merge of #111301 - JohnBobbo96:cleanup_option_insert_methods, r=scottmcm
Remove calls to `mem::forget` and `mem::replace` in `Option::get_or_insert_with`.

This removes the unneeded calls to `mem::forget` and `mem::replace` in `Option::get_or_insert_with`.
2023-05-07 14:12:17 +09:00
Yuki Okushi
88a0204fcb
Rollup merge of #111300 - Flying-Toast:while_true_span_condition, r=compiler-errors
Emit while_true lint spanning the entire loop condition

The lint that suggests `loop {}` instead of `while true {}` has functionality to 'pierce' parenthesis in cases like `while (true) {}`. In these cases, the emitted span only went to the hi of the `true` itself, not spanning the entire loop condition.

Before:
```
warning: denote infinite loops with `loop { ... }`
 --> /tmp/foobar.rs:2:5
  |
2 |     while ((((((true)))))) {}
  |     ^^^^^^^^^^^^^^^^ help: use `loop`
  |
  = note: `#[warn(while_true)]` on by default
```

After:
```
warning: denote infinite loops with `loop { ... }`
 --> /tmp/foobar.rs:2:5
  |
2 |     while ((((((true)))))) {}
  |     ^^^^^^^^^^^^^^^^^^^^^^ help: use `loop`
  |
  = note: `#[warn(while_true)]` on by default
```

This is especially a problem for rustfix.
2023-05-07 14:12:16 +09:00
Yuki Okushi
4e4e5bf17d
Rollup merge of #111293 - Astroide:patch-1, r=compiler-errors
rustc --explain E0726 - grammar fixing (it's => its + add a `the` where it felt right to do so)

Very small fix
2023-05-07 14:12:16 +09:00
Yuki Okushi
61115cd753
Rollup merge of #111150 - mj10021:issue-111025-fix, r=petrochenkov
added TraitAlias to check_item() for missing_docs

As in issue #111025 the `missing_docs` was not being triggered for trait aliases.  I added `TraitAlias` to the pattern match for check_item(), and the lint seems to be behaving appropriately
2023-05-07 14:12:15 +09:00
Yuki Okushi
aef008aa6d
Rollup merge of #110094 - lukas-code:less-transmute, r=thomcc
clean up `transmute`s in `core`

* Use `transmute_unchecked` instead of `transmute_copy` for `MaybeUninit::transpose`.
* Use manual transmute for `Option<Ordering>` → `i8`.
2023-05-07 14:12:15 +09:00
Yuki Okushi
58597717e2
Rollup merge of #105583 - luqmana:bitcast-immediates, r=oli-obk
Operand::extract_field: only cast llval if it's a pointer and replace bitcast w/ pointercast.

Fixes #105439.

Also cc `@erikdesjardins,` looks like another place to cleanup as part of #105545
2023-05-07 14:12:14 +09:00