Commit Graph

265123 Commits

Author SHA1 Message Date
Ben Kimock
8be9fed672 Fix compile error in solid's remove_dir_all 2024-09-02 14:58:00 -04:00
Jakub Beránek
fa77b9d21c
Remove kobzol vacation status 2024-09-02 20:06:37 +02:00
Boxy
5d47b4d198 mailmapper? 2024-09-02 18:15:26 +01:00
David Wood
7ac5fdaf99
mailmap: add new email for davidtwco
Signed-off-by: David Wood <david@davidtw.co>
2024-09-02 18:12:20 +01:00
bors
bd53aa3bf7 Auto merge of #129317 - compiler-errors:expectation-subtyping, r=lcnr
Use equality when relating formal and expected type in arg checking

#129059 uncovered an interesting issue in argument checking. When we check arguments, we create three sets of types:
* Formals
* Expected
* Actuals

The **actuals** are the types of the argument expressions themselves. The **formals** are the types from the signature that we're checking. The **expected** types are the formal types, but passed through `expected_inputs_for_expected_outputs`:

a971212545/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs (L691-L725)

This method attempts to constrain the formal inputs by relating the [expectation](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_typeck/expectation/enum.Expectation.html) of the call expression and the formal output.

When we check an argument, we get the expression's actual type, and then we first attempt to coerce it to the expected type:

a971212545/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs (L280-L293)

Then we subtype the expected type and the formal type:

a971212545/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs (L299-L305)

However, since we are now recording the right coercion target (since #129059), we now end up recording the expected type to the typeck results, rather than the actual.

Since that expected type was [fudged](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/struct.InferCtxt.html#method.fudge_inference_if_ok), it has fresh variables. And since the expected type is only subtyped against the formal type, if that expected type has a bivariant parameter, it will likely remain unconstrained since `Covariant * Bivariant = Bivariant` according to [xform](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/enum.Variance.html#method.xform). This leads to an unconstrained type variable in writeback.

AFAICT, there's no reason for us to be using subtyping here, though. The expected output is already related to the expectation by subtyping:

a971212545/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs (L713)

So the formals don't need "another" indirection of subtyping in the argument checking... So I've changed it to use equality here. We could alternatively fix this by requiring WF for all the expected types to constrain their bivariant parameters, but this seems a bit overkill.

Fixes #129286
2024-09-02 16:08:50 +00:00
oskgo
7494224e74 clarify language around non-null ptrs in slice::raw 2024-09-02 15:49:18 +02:00
Alex Gaynor
06e3552ad0
Remove stray word in a comment 2024-09-02 09:44:03 -04:00
bors
a4601859ae Auto merge of #129873 - matthiaskrgr:rollup-bv849ud, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #127474 (doc: Make block of inline Deref methods foldable)
 - #129678 (Deny imports of `rustc_type_ir::inherent` outside of type ir + new trait solver)
 - #129738 (`rustc_mir_transform` cleanups)
 - #129793 (add extra linebreaks so rustdoc can identify the first sentence)
 - #129804 (Fixed some typos in the standard library documentation/comments)
 - #129837 (Actually parse stdout json, instead of using hacky contains logic.)
 - #129842 (Fix LLVM ABI NAME for riscv64imac-unknown-nuttx-elf)
 - #129843 (Mark myself as on vacation for triagebot)
 - #129858 (Replace walk with visit so we dont skip outermost expr kind in def collector)

Failed merges:

 - #129777 (Add `unreachable_pub`, round 4)
 - #129868 (Remove kobzol vacation status)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-02 13:41:42 +00:00
cuishuang
25c4aa8979 chore: remove repetitive words
Signed-off-by: cuishuang <imcusg@gmail.com>
2024-09-02 19:02:28 +08:00
Alexander Cyon
00de006f22
chore: Fix typos in 'compiler' (batch 2) 2024-09-02 07:50:22 +02:00
Alexander Cyon
ac69544a17
chore: Fix typos in 'compiler' (batch 1) 2024-09-02 07:42:38 +02:00
Alexander Cyon
5780c1ca5e
chore: Fix typos in 'compiler' (batch 3) 2024-09-02 07:33:41 +02:00
bors
9b82580c73 Auto merge of #129798 - weihanglo:update-cargo, r=weihanglo
Update cargo

9 commits in 8f40fc59fb0c8df91c97405785197f3c630304ea..c1fa840a85eca53818895901a53fae34247448b2
2024-08-21 22:37:06 +0000 to 2024-08-29 21:03:53 +0000
- fix(resolve): With `latest` message, differentiate actionable updates (rust-lang/cargo#14461)
- fix(pkgid): Allow open namespaces in PackageIdSpec's (rust-lang/cargo#14467)
- feat(resolve): Report incompatible-with-rustc when MSRV-resolver is disabled (rust-lang/cargo#14459)
- fix(resolve): Report incompatible packages with precise Rust version (rust-lang/cargo#14457)
- fix(resolve): Dont show locking workspace members (rust-lang/cargo#14445)
- Log details of failure if no errors were seen (rust-lang/cargo#14453)
- More helpful missing feature error message (rust-lang/cargo#14436)
- feat: Add matches_prerelease semantic (rust-lang/cargo#14305)
- refactor(update): Prepare for smarter update messages (rust-lang/cargo#14440)

r? ghost
2024-09-02 05:13:21 +00:00
Matthias Krüger
38b6a66def
Rollup merge of #129858 - compiler-errors:async-def, r=cjgillot
Replace walk with visit so we dont skip outermost expr kind in def collector

This affects async closures with macros as their body expr. Fixes #129855.

r? ``@cjgillot`` or anyone else
2024-09-02 04:19:31 +02:00
Matthias Krüger
3ea3397943
Rollup merge of #129843 - tgross35:triagebot-vacation, r=tgross35
Mark myself as on vacation for triagebot

I'll be on vacation for a couple weeks coming up pretty soon.

r? ``@ghost``
2024-09-02 04:19:31 +02:00
Matthias Krüger
efad457ad5
Rollup merge of #129842 - no1wudi:master, r=saethlin
Fix LLVM ABI NAME for riscv64imac-unknown-nuttx-elf

This patch fix https://github.com/rust-lang/rust/issues/129825

For the riscv64imac target, the LLVM ABI NAME should be "lp64", which is the default ABI if not specified for the riscv64imac target.
2024-09-02 04:19:30 +02:00
Matthias Krüger
5c3370d684
Rollup merge of #129837 - aDotInTheVoid:test-better-json, r=jieyouxu
Actually parse stdout json, instead of using hacky contains logic.

Fixes up the test added in #128963, to actually parse the stdout to JSON, instead of just checking that it contains `{"`.

CC ``@GuillaumeGomez``

r? ``@jieyouxu``
2024-09-02 04:19:30 +02:00
Matthias Krüger
820540aaa0
Rollup merge of #129804 - ranger-ross:fixed-documentation-typos, r=Noratrieb
Fixed some typos in the standard library documentation/comments

I spent some time to fix a few typos in `library/std` and `library/core`
2024-09-02 04:19:29 +02:00
Matthias Krüger
8c2898989f
Rollup merge of #129793 - lolbinarycat:doc-missing-newlines, r=workingjubilee
add extra linebreaks so rustdoc can identify the first sentence

there should probably be a lint against this in rustdoc, it causes too many lines to be shown in the short documentation overviews

expecially noticable for the slice primative type: https://doc.rust-lang.org/std/index.html
2024-09-02 04:19:29 +02:00
Matthias Krüger
dce26656ea
Rollup merge of #129738 - nnethercote:rustc_mir_transform-cleanups, r=cjgillot
`rustc_mir_transform` cleanups

A bunch of small improvements I made while looking closely at this code.

r? `@saethlin`
2024-09-02 04:19:28 +02:00
Matthias Krüger
e0039171ff
Rollup merge of #129678 - compiler-errors:type-ir-inherent, r=fmease
Deny imports of `rustc_type_ir::inherent` outside of type ir + new trait solver

We shouldn't encourage using `rustc_type_ir::inherent` outside of the new solver[^1], though this can happen by accident due to rust-analyzer, for example. See https://github.com/rust-lang/rust/pull/127537#discussion_r1733813842 for an example in practice.

r? fmease

[^1]: Unless we go the fully radical approach of always using these inherent methods everywhere in favor of inherent methods, which would be a major overhaul of the compiler, IMO. I don't really want to consider that possibility right now, tho.
2024-09-02 04:19:28 +02:00
Matthias Krüger
c90991db17
Rollup merge of #127474 - tesuji:foldable-inline-derefs, r=t-rustdoc
doc: Make block of inline Deref methods foldable

After:
![image](https://github.com/rust-lang/rust/assets/15225902/3e8ab320-dbf7-436f-9be0-d0ef82664663)
Before:
![image](https://github.com/rust-lang/rust/assets/15225902/f6f7635d-d4c3-437e-a2d9-147726287b05)

Fix  #127470.

Current status:
- [x] Bug when hovering over title "Methods from ...": The anchor sign $ overlaps with `[-]`: https://github.com/rust-lang/rust/pull/127474#issuecomment-2222930038
    => Fixed by https://github.com/rust-lang/rust/pull/127474#issuecomment-2228886292
2024-09-02 04:19:27 +02:00
bors
e71f952912 Auto merge of #129063 - the8472:cold-opt-size, r=Amanieu
Apply size optimizations to panic machinery and some cold functions

* std dependencies gimli and addr2line are now built with opt-level=s
* various panic-related methods and `#[cold]` methods are now marked `#[optimize(size)]`

Panics should be cold enough that it doesn't make sense to optimize them for speed. The only tradeoff here is if someone does a lot of backtrace captures (without panics) and printing then the opt-level change might impact their perf.

Seems to be the first use of the optimize attribute. Tracking issue #54882
2024-09-02 00:58:50 +00:00
binarycat
0064bd1b99 add extra linebreaks so rustdoc can identify the first sentence
there should probably be a lint against this in rustdoc, it causes
too many lines to be shown in the short documentation overviews

expecially noticable for the slice primative type:
https://doc.rust-lang.org/std/index.html
2024-09-01 14:22:50 -07:00
bors
94885bc699 Auto merge of #129854 - Kobzol:revert-127537, r=lqd
Revert "Auto merge of #127537 - veluca93:struct_tf, r=BoxyUwU"

This reverts https://github.com/rust-lang/rust/pull/127537 (commit acb4e8b625), reversing changes made to 100fde5246.

Opening to see if this can help resolve the recent perf. results [instability](https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/Weird.20perf.20results).
2024-09-01 19:46:46 +00:00
Michael Goulet
91854453f2 Deny imports of rustc_type_ir::inherent outside of type ir + new trait solver 2024-09-01 12:16:18 -04:00
bors
a48861a627 Auto merge of #127313 - cjgillot:single-expect, r=jieyouxu
Rewrite lint_expectations in a single pass.

This PR aims at reducing the perf regression from https://github.com/rust-lang/rust/pull/120924#issuecomment-2202486203 with drive-by simplifications.

Basically, instead of using the lint level builder, which is slow, this PR splits `lint_expectations` logic in 2:
- listing the `LintExpectations` is done in `shallow_lint_levels_on`, on a per-owner basis;
- building the unstable->stable expectation id map is done by iterating on attributes.

r? ghost for perf
2024-09-01 15:50:48 +00:00
Rémy Rakic
d30b5f0003 update object dependency to deduplicate wasmparser 2024-09-01 15:36:44 +00:00
Michael Goulet
7ab44cddc9 Replace walk with visit so we dont skip outermost expr kind in def collector 2024-09-01 11:16:50 -04:00
Ralf Jung
32a30dd005 compiler_fence documentation: emphasize synchronization, not reordering 2024-09-01 16:58:44 +02:00
Jakub Beránek
47e6b5deed Revert "Auto merge of #127537 - veluca93:struct_tf, r=BoxyUwU"
This reverts commit acb4e8b625, reversing
changes made to 100fde5246.
2024-09-01 16:35:53 +02:00
Ralf Jung
0e5628d7de tweak wording regarding Box validity 2024-09-01 11:21:37 +02:00
bors
1a1cc050d8 Auto merge of #127897 - nyurik:add-qnx-70-target, r=saethlin
add `aarch64_unknown_nto_qnx700` target - QNX 7.0 support for aarch64le

This backports the QNX 7.1 aarch64 implementation to 7.0.

* [x] required `-lregex` disabled, see https://github.com/rust-lang/libc/pull/3775 (released in libc 0.2.156)
* [x] uses `libgcc.a` instead of `libgcc_s.so` (7.0 used ancient GCC 5.4 which didn't have gcc_s)
* [x] a fix in `backtrace` crate to support stack traces https://github.com/rust-lang/backtrace-rs/pull/648

This PR bumps libc dependency to 0.2.158

CC: to the folks who did the [initial implementation](https://doc.rust-lang.org/rustc/platform-support/nto-qnx.html): `@flba-eb,` `@gh-tr,` `@jonathanpallant,` `@japaric`

# Compile target

```bash
# Configure qcc build environment
source _path_/_to_/qnx7.0/qnxsdp-env.sh

# Tell rust to use qcc when building QNX 7.0 targets
export build_env='
    CC_aarch64-unknown-nto-qnx700=qcc
    CFLAGS_aarch64-unknown-nto-qnx700=-Vgcc_ntoaarch64le_cxx
    CXX_aarch64-unknown-nto-qnx700=qcc
    AR_aarch64_unknown_nto_qnx700=ntoaarch64-ar'

# Build rust compiler, libs, and the remote test server
env $build_env ./x.py build \
  --target x86_64-unknown-linux-gnu,aarch64-unknown-nto-qnx700 \
  rustc library/core library/alloc library/std src/tools/remote-test-server

rustup toolchain link stage1 build/host/stage1
```

# Compile "hello world"

```bash
source _path_/_to_/qnx7.0/qnxsdp-env.sh

cargo new hello_world
cd hello_world
cargo +stage1 build --release --target aarch64-unknown-nto-qnx700
```

# Configure a remote for testing

Do this from a new shell - we will need to run more commands in the previous one.  I ran into these two issues, and found some workarounds.

* Temporary dir might not work properly
* Default `remote-test-server` has issues binding to an address

```
# ./remote-test-server
starting test server
thread 'main' panicked at src/tools/remote-test-server/src/main.rs:175:29:
called `Result::unwrap()` on an `Err` value: Os { code: 249, kind: AddrNotAvailable, message: "Can't assign requested address" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

Specifying `--bind` param actually fixes that, and so does setting `TMPDIR` properly.

```bash
# Copy remote-test-server to remote device. You may need to use sftp instead.
# ATTENTION: Note that the path is different from the one in the remote testing documentation for some reason
scp ./build/x86_64-unknown-linux-gnu/stage1-tools-bin/remote-test-server  qnxdevice:/path/

# Run ssh with port forwarding - so that rust tester can connect to the local port instead
ssh -L 12345:127.0.0.1:12345 qnxdevice

# on the device, run
rm -rf tmp && mkdir -p tmp && TMPDIR=$PWD/tmp ./remote-test-server --bind 0.0.0.0:12345
```

# Run test suit

Assume all previous environment variables are still set, or re-init them

```bash
export TEST_DEVICE_ADDR="localhost:12345"

# tidy needs to be skipped due to using un-published libc dependency
export exclude_tests='
    --exclude src/bootstrap
    --exclude src/tools/error_index_generator
    --exclude src/tools/linkchecker
    --exclude src/tools/tidy
    --exclude tests/ui-fulldeps
    --exclude rustc
    --exclude rustdoc
    --exclude tests/run-make-fulldeps'

env $build_env ./x.py test  $exclude_tests --stage 1 --target aarch64-unknown-nto-qnx700
```

try-job: dist-x86_64-msvc
2024-09-01 08:00:25 +00:00
bors
78d5c04d9c Auto merge of #129841 - matthiaskrgr:rollup-pkavdtl, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #128495 (core: use `compare_bytes` for more slice element types)
 - #128641 (refactor: standardize duplicate processes in parser)
 - #129207 (Lint that warns when an elided lifetime ends up being a named lifetime)
 - #129493 (Create opaque definitions in resolver.)
 - #129619 (Update stacker to 0.1.17)
 - #129672 (Make option-like-enum.rs UB-free and portable)
 - #129780 (add crashtests for several old unfixed ICEs)
 - #129832 (Remove stray dot in `std::char::from_u32_unchecked` documentation)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-01 04:21:26 +00:00
Trevor Gross
a0073104ad Mark myself as on vacation for triagebot 2024-08-31 21:24:47 -05:00
Huang Qi
de7a14e977 Fix LLVM ABI NAME for riscv64imac-unknown-nuttx-elf
This patch fix https://github.com/rust-lang/rust/issues/129825

For the riscv64imac target, the LLVM ABI NAME should be "lp64",
which is the default ABI if not specified for the riscv64imac target.
2024-09-01 09:59:09 +08:00
Matthias Krüger
2261ffa19f
Rollup merge of #129832 - eduardosm:stray-dot, r=jhpratt
Remove stray dot in `std::char::from_u32_unchecked` documentation
2024-09-01 03:58:06 +02:00
Matthias Krüger
f040e689c0
Rollup merge of #129780 - cyrgani:master, r=compiler-errors
add crashtests for several old unfixed ICEs

Adds several new crashtests for some older ICEs that did not yet have any.
Tests were added for #128097, #119095, #117460 and #126443.
2024-09-01 03:58:05 +02:00
Matthias Krüger
d24336b8c9
Rollup merge of #129672 - saethlin:enum-debuginfo-tests, r=Mark-Simulacrum
Make option-like-enum.rs UB-free and portable

Fixes https://github.com/rust-lang/rust/issues/129662

(or, at least the parts of it that aren't https://github.com/rust-lang/rust/issues/128973)
2024-09-01 03:58:05 +02:00
Matthias Krüger
62b8fdb7da
Rollup merge of #129619 - sunshowers:update-stacker, r=Mark-Simulacrum
Update stacker to 0.1.17

The main new feature is support for detecting the current stack size on illumos. (See [my blog post] for the context which led to this.)

[my blog post]: https://sunshowers.io/posts/rustc-segfault-illumos/

try-job: x86_64-mingw
2024-09-01 03:58:04 +02:00
Matthias Krüger
07d5c250be
Rollup merge of #129493 - cjgillot:early-opaque-def, r=petrochenkov
Create opaque definitions in resolver.

Implementing https://github.com/rust-lang/rust/issues/129023#issuecomment-2306079532

That was easier than I expected.

r? `@petrochenkov`
2024-09-01 03:58:04 +02:00
Matthias Krüger
1063c0dd37
Rollup merge of #129207 - GrigorenkoPV:elided-is-named, r=cjgillot
Lint that warns when an elided lifetime ends up being a named lifetime

As suggested in https://github.com/rust-lang/rust/issues/48686#issuecomment-1817334575

Fixes #48686
2024-09-01 03:58:03 +02:00
Matthias Krüger
da65b9064f
Rollup merge of #128641 - Konippi:standardize-duplicate-processes-in-parser, r=scottmcm
refactor: standardize duplicate processes in parser

## Summary
This PR refactors the `read_number` function to standardize duplicate code, improve readability, and enhance efficiency.

## Changes
- Merged the logic for both `max_digits` cases into a single `read_atomically` closure
- Simplified control flow and reduced code duplication
2024-09-01 03:58:03 +02:00
Matthias Krüger
a073004484
Rollup merge of #128495 - joboet:more_memcmp, r=scottmcm
core: use `compare_bytes` for more slice element types

`bool`, `NonZero<u8>`, `Option<NonZero<u8>>` and `ascii::Char` can be compared the same way as `u8`.
2024-09-01 03:58:02 +02:00
bors
43eaa5c624 Auto merge of #129790 - BoxyUwU:bump-version, r=BoxyUwU
Bump to 1.83

https://forge.rust-lang.org/release/process.html#bump-the-stable-version-number-t-6-days-friday-the-week-before
2024-09-01 01:53:11 +00:00
Alona Enraght-Moony
f78979e687 Actually parse stdout json, instead of using hacky contains logic. 2024-08-31 22:08:38 +00:00
The 8472
c218c75456 exclude tools with deps that have size asserts 2024-08-31 23:56:45 +02:00
The 8472
df20808f4d inhibit layout randomization for Box 2024-08-31 23:56:45 +02:00
The 8472
1e377c5b9f enable layout randomization in x86_64-gnu-llvm-17 CI job 2024-08-31 23:56:45 +02:00
The 8472
e3169f76e6 when -Zrandomize-layout is enabled disable alloc test testing internal struct sizes 2024-08-31 23:56:45 +02:00