Commit Graph

224122 Commits

Author SHA1 Message Date
Oli Scherer
f321c8d39d Document some arguments 2023-05-09 15:33:51 +00:00
klensy
3c03cce341 bump windows crate 0.46 -> 0.48 in workspace 2023-05-09 18:20:13 +03:00
Scott Mabin
53e49f4c6e Add esp-idf platform support page 2023-05-09 16:18:07 +01:00
bors
3a37c2f052 Auto merge of #111371 - compiler-errors:revert-110907, r=petrochenkov
Revert "Populate effective visibilities in `rustc_privacy`"

This reverts commit cff85f22f5, cc #110907. It needs to be fixed, but there are too many issues being reported that I wanted to put up a revert until a proper fix can be committed.

Fixes a ton of issues where private but still reachable impls were missing during codegen:
Fixes #111320
Fixes #111321
Fixes #111334
Fixes #111357
Fixes #111368
Fixes #111373
Fixes #111377
Fixes #111386
Fixes #111387

`@bors` p=1

r? `@petrochenkov`
2023-05-09 15:16:17 +00:00
Oli Scherer
44e86e77e4 Separate config building from Miri command building 2023-05-09 14:46:27 +00:00
Oli Scherer
37c3af4841 Update to latest ui_test crate version.
Also stops using github actions groups that conflict with our groups as github does not nest them
2023-05-09 14:40:16 +00:00
Mara Bos
d5843ddaf1 Limit lifetime of format_args!() with inlined args. 2023-05-09 16:08:40 +02:00
bors
f7b831ac8a Auto merge of #110285 - KisaragiEffective:sync-stdarch, r=Amanieu
stdarch: update submodule

We need [this commit](cf3deeae3a) introduced by [stdarch#1411](https://github.com/rust-lang/stdarch/pull/1411) in order to merge #110189.

Note to myself: `git pull && git submodule update --remote library/stdarch`
2023-05-09 12:28:34 +00:00
Zalathar
9addf0651c Correctly mark parameter RustMappingRegions as pointer-to-const
The regions don't need to be mutable because we pass a copy of them to LLVM
instead, and this matches the `*const` in the Rust-side signature.
2023-05-09 18:43:12 +10:00
bors
ecd3dbab4e Auto merge of #111380 - Dylan-DPC:rollup-xiptbhn, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #110304 (Add GNU Property Note)
 - #110504 (Tweak borrow suggestion span)
 - #110583 (tweak "make mut" spans when assigning to locals)
 - #110694 (Implement builtin # syntax and use it for offset_of!(...))
 - #111120 (Suggest let for possible binding with ty)
 - #111252 (Min specialization improvements)
 - #111361 (Update books)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-09 08:16:26 +00:00
Zalathar
7cab196e7c Isolate coverage FFI type layouts from their underlying LLVM C++ types 2023-05-09 18:08:32 +10:00
Oli Scherer
b7f570fff3 Keep encoding attributes for closures 2023-05-09 07:54:18 +00:00
Nilstrieb
e8ab648902 Rename expected_trait_ref to self_ty_trait_ref
This trait ref is derived from the self type and then equated to the
trait ref from the obligation.

For example, for `fn(): Fn(u32)`, `self_ty_trait_ref` is `Fn()`, which
is then equated to `Fn(u32)` (which will fail, causing the obligation to
fail).
2023-05-09 07:16:59 +00:00
Nilstrieb
41a9cbeb64 Shrink SelectionError a lot
`SelectionError` used to be 80 bytes (on 64 bit). That's quite big.
Especially because the selection cache contained `Result<_,
SelectionError>. The Ok type is only 32 bytes, so the 80 bytes
significantly inflate the size of the cache.

Most variants of the `SelectionError` seem to be hard errors, only
`Unimplemented` shows up in practice (for cranelift-codegen, it occupies
23.4% of all cache entries). We can just box away the biggest variant,
`OutputTypeParameterMismatch`, to get the size down to 16 bytes, well
within the size of the Ok type inside the cache.
2023-05-09 07:10:47 +00:00
Dylan DPC
9d913eb9e4
Rollup merge of #111361 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/edition-guide

1 commits in 6038be9d37d7251c966b486154af621d1794d7af..f63e578b92ff43e8cc38fcaa257b660f45c8a8c2
2023-04-26 18:40:19 UTC to 2023-04-26 18:40:19 UTC

- Fix grammar (rust-lang/edition-guide#281)

## rust-embedded/book

2 commits in 897fcf566f16bf87bf37199bdddec1801fd00532..d9eb4c3f75435b008881062ffa77bf0d1527b37d
2023-05-08 10:06:29 UTC to 2023-05-08 07:19:03 UTC

- Update Interoperability section (rust-embedded/book#351)
- Update c-with-rust.md (rust-embedded/book#352)

## rust-lang/reference

3 commits in 1f8dc727e94ae4ef92adf70df979521a1ea1143e..28dc0f3576b55f5e57c5d6e65cd68ba3161e9fd5
2023-05-06 20:25:36 UTC to 2023-05-05 01:51:00 UTC

- Add an entry for macro_rules in the "Weak keywords" lexer block (rust-lang/reference#1356)
- Document f16c target feature (rust-lang/reference#1337)
- Fix example for non-x86 targets (rust-lang/reference#1334)

## rust-lang/rust-by-example

4 commits in 31961fe22521a779070a44a8f30a2b00a20b6212..8ee9528b72b927cff8fd32346db8bbd1198816f0
2023-05-01 21:18:34 UTC to 2023-04-25 11:19:41 UTC

- add: zero padding example (rust-lang/rust-by-example#1706)
- Update reenter_question_mark.md (rust-lang/rust-by-example#1705)
- Clarify array out-of-bounds behavior. (rust-lang/rust-by-example#1703)
- Update README.md (rust-lang/rust-by-example#1704)

## rust-lang/rustc-dev-guide

2 commits in 2a5eb92197e9cf8fe91164dcbf4f9b88c0d7e73d..28dbeaf5c44bc7f5111ad412e99f2d7c5cec6c90
2023-05-02 02:20:21 UTC to 2023-04-26 19:09:10 UTC

- Add unset-exec-env compiletest header. (rust-lang/rustc-dev-guide#1682)
- extend the sixth trait system requirement (rust-lang/rustc-dev-guide#1671)
2023-05-09 12:33:47 +05:30
Dylan DPC
f748bb1402
Rollup merge of #111252 - matthewjasper:min-spec-improvements, r=compiler-errors
Min specialization improvements

- Don't allow specialization impls with no items, such implementations are probably not correct and only occur as mistakes in the compiler and standard library
- Fix a missing normalization call
- Adds spans for lifetime errors from overly general specializations

Closes #79457
Closes #109815
2023-05-09 12:33:46 +05:30
Dylan DPC
8c51701b8a
Rollup merge of #111120 - chenyukang:yukang-suggest-let, r=Nilstrieb
Suggest let for possible binding with ty

Origin from https://github.com/rust-lang/rust/pull/109128#discussion_r1179866137

r? `@Nilstrieb`
2023-05-09 12:33:46 +05:30
Dylan DPC
dbd090c655
Rollup merge of #110694 - est31:builtin, r=petrochenkov
Implement builtin # syntax and use it for offset_of!(...)

Add `builtin #` syntax to the parser, as well as a generic infrastructure to support both item and expression position builtin syntaxes. The PR also uses this infrastructure for the implementation of the `offset_of!` macro, added by #106934.

cc `@petrochenkov` `@DrMeepster`

cc #110680 `builtin #` tracking issue
cc #106655 `offset_of!` tracking issue
2023-05-09 12:33:45 +05:30
Dylan DPC
ff30b8cb7b
Rollup merge of #110583 - Ezrashaw:tweak-make-mut-spans, r=estebank
tweak "make mut" spans when assigning to locals

Work towards fixing #106857

This PR just cleans up a lot of spans which is helpful before properly fixing the issues. Best reviewed commit-by-commit.

r? `@estebank`
2023-05-09 12:33:45 +05:30
Dylan DPC
2ecc72217b
Rollup merge of #110504 - compiler-errors:tweak-borrow-sugg, r=cjgillot
Tweak borrow suggestion span

Avoids a `span_to_snippet` call when we don't need to surround the expression in parentheses. The fact that the suggestion was using the whole span of the expression rather than just appending a `&` was prevented me from using `// run-rustfix` in another PR (https://github.com/rust-lang/rust/pull/110432#discussion_r1170500484).

Also some drive-by renames of functions that have been annoying me for a bit.
2023-05-09 12:33:44 +05:30
Dylan DPC
02a85bd038
Rollup merge of #110304 - cchiw:master, r=davidtwco
Add GNU Property Note

Fix #103001

Generates the missing property note:
```
Displaying notes found in: .note.gnu.property
  Owner                Data size 	Description
  GNU                  0x00000010	NT_GNU_PROPERTY_TYPE_0	      Properties: x86 feature: IBT
```
2023-05-09 12:33:44 +05:30
bors
7e7483d26e Auto merge of #110152 - ChrisDenton:windows-sys, r=thomcc
Start using `windows sys` for Windows FFI bindings in std

Switch to using windows-sys for FFI. In order to avoid some currently contentious issues, this uses windows-bindgen to generate a smaller set of bindings instead of using the full crate.

Unlike the windows-sys crate, the generated bindings uses `*mut c_void` for handle types instead of `isize`. This to sidestep opsem concerns about mixing pointer types and integers between languages. Note that `SOCKET` remains defined as an integer but instead of being a usize, it's changed to fit the [standard library definition](a41fc00eaf/library/std/src/os/windows/raw.rs (L12-L16)):

```rust
#[cfg(target_pointer_width = "32")]
pub type SOCKET = u32;
#[cfg(target_pointer_width = "64")]
pub type SOCKET = u64;
```

The generated bindings also customizes the `#[link]` imports. I hope to switch to using raw-dylib but I don't want to tie that too closely with the switch to windows-sys.

---

Changes outside of the bindings are, for the most part, fairly minimal (e.g. some differences in `*mut` vs. `*const` or a few types differ). One issue is that our own bindings sometimes mix in higher level types, like `BorrowedHandle`. This is pretty adhoc though.
2023-05-09 05:20:41 +00:00
yukang
4d219d0666 move sugg to derive session diagnostic 2023-05-09 11:51:04 +08:00
bors
33a01e2e93 Auto merge of #110027 - nbdd0121:dieting, r=m-ou-se
Add `#[inline]` to functions that are never called

This makes libcore binary size reduce by ~300 bytes. Not much, but these functions are never called so it doesn't make sense for them to get into the binary anyway.
2023-05-09 02:41:46 +00:00
bors
90c02c1bc1 Auto merge of #111296 - Sp00ph:const_gcd, r=nagisa,Mark-Simulacrum
Always const-evaluate the GCD in `slice::align_to_offsets`

Use an inline `const`-block to force the compiler to calculate the GCD at compile time, even in debug mode. This shouldn't affect the behavior of the program at all, but it drastically cuts down on the number of instructions emitted with optimizations disabled.

With the current implementation, a single `slice::align_to` instantiation (specifically `<[u8]>::align_to::<u128>()`) generates 676 instructions (on x86-64). Forcing the GCD computation to be const cuts it down to 327 instructions, so just over 50% less. This is obviously not representative of actual runtime gains, but I still see it as a significant win as long as it doesn't degrade compile times.

Not having to worry about LLVM const-evaluating the GCD function also allows it to use the textbook recursive euclidean algorithm instead of a much more complicated iterative implementation with multiple `unsafe`-blocks.
2023-05-08 23:47:39 +00:00
Michael Goulet
5fcf2e6edc Revert "Populate effective visibilities in rustc_privacy"
This reverts commit cff85f22f5.
2023-05-08 21:47:44 +00:00
Michael Goulet
e315bbf736 test for reachable private impl 2023-05-08 21:44:21 +00:00
bors
2f2c438dce Auto merge of #111358 - compiler-errors:rollup-yv27vrp, r=compiler-errors
Rollup of 6 pull requests

Successful merges:

 - #104070 (Prevent aborting guard from aborting the process in a forced unwind)
 - #109410 (Introduce `AliasKind::Inherent` for inherent associated types)
 - #111004 (Migrate `mir_transform` to translatable diagnostics)
 - #111118 (Suggest struct when we get colon in fileds in enum)
 - #111170 (Diagnostic args are still args if they're documented)
 - #111354 (Fix miscompilation when calling default methods on `Future`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-08 21:00:50 +00:00
Caio
0285611096 Move tests 2023-05-08 17:58:01 -03:00
bors
dfe31889e1 Auto merge of #111007 - JakobDegen:nrvo, r=tmiasko
Disable nrvo mir opt

See #111005 and #110902 . The ICE can definitely be hit on stable, the miscompilation I'm not sure about. The pass makes some pretty sketchy assumptions though, and we should not have it on while that's the case.

I'm not going to work on actually fixing this, it's probably not excessively difficult though.

r? rust-lang/mir-opt
2023-05-08 18:10:26 +00:00
rustbot
bf7e07f627 Update books 2023-05-08 13:00:54 -04:00
Michael Goulet
bbea63f627
Rollup merge of #111354 - jonas-schievink:enable-future-combinators, r=compiler-errors
Fix miscompilation when calling default methods on `Future`

In https://github.com/rust-lang/rust/issues/111264 I discovered a lingering miscompilation when calling a default method on `Future` (none currently exist). https://github.com/rust-lang/rust/pull/111279 added a debug assertion, which sadly doesn't help much since to my knowledge stage0 is not built with them enabled, and it still doesn't make default methods work like they should.

This PR fixes `resolve_instance` to resolve default methods on `Future` correctly, allowing library contributors to add `Future` combinators without running into ICEs or miscompilations. I've tested this as part of https://github.com/rust-lang/rust/pull/111347, but no test is included here (assuming that future methods include their own tests that would cover this sufficiently).

r? `@compiler-errors`
2023-05-08 09:30:23 -07:00
Michael Goulet
24ba82de4e
Rollup merge of #111170 - compiler-errors:diag-doc, r=petrochenkov
Diagnostic args are still args if they're documented

Fixes https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.60.23.5Bderive.28Diagnostic.29.5D.60.20works.20badly.20with.20docs/near/355597997

There's a lot of really strange code incongruencies between `Diagnostic` and `Subdiagnostic` derive. Perhaps those macros need some more overhaul, but I didn't really want to do it today.
2023-05-08 09:30:23 -07:00
Michael Goulet
beb49671c2
Rollup merge of #111118 - chenyukang:yukang-sugg-struct, r=compiler-errors
Suggest struct when we get colon in fileds in enum

A follow-up fix for https://github.com/rust-lang/rust/pull/109128

From: https://github.com/rust-lang/rust/pull/109128#discussion_r1179304932

r? `@estebank`
2023-05-08 09:30:22 -07:00
Michael Goulet
68594142b1
Rollup merge of #111004 - clubby789:migrate-mir-transform, r=oli-obk
Migrate `mir_transform` to translatable diagnostics

cc #100717
2023-05-08 09:30:22 -07:00
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
Jonas Schievink
3bbb69eaa0 Fix miscompilation when adding default method to Future 2023-05-08 17:06:48 +02:00
Oli Scherer
5c6e2342f6 Encode types in SMIR 2023-05-08 14:23:19 +00:00
bors
a0111af531 Auto merge of #110824 - cjgillot:const-prop-index, r=JakobDegen,oli-obk
ConstProp into PlaceElem::Index.

Noticed this while looking at keccak output MIR.

This pass aims to replace `ProjectionElem::Index` with `ProjectionElem::ConstantIndex` during ConstProp.

r? `@ghost`
2023-05-08 14:23:13 +00:00
Oli Scherer
7f74ae57e8 Create a trait to abstract over the smir API 2023-05-08 14:23:04 +00: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
bors
a477b81c7e Auto merge of #2880 - RalfJung:sync, r=RalfJung
increase timing slack for sync tests; port tests to 2021 edition
2023-05-08 11:19:01 +00:00
Ralf Jung
3309f120f2 port tests to 2021 edition 2023-05-08 13:18:40 +02:00
Jakob Degen
8e2da80fc5 Disable nrvo mir opt 2023-05-08 03:55:41 -07: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