Commit Graph

268059 Commits

Author SHA1 Message Date
Jonathan Dönszelmann
159e67d446
rename RcBox to RcInner for consistency 2024-10-11 00:14:17 +02:00
bors
d0141af514 Auto merge of #131492 - flip1995:clippy-master-backport, r=matthiaskrgr
Clippy: Backport `needless_return` fix

r? `@Manishearth`

This cherry-picks https://github.com/rust-lang/rust-clippy/pull/13464, so that it gets into master and with that into `beta` tomorrow, so that the bug in this lint doesn't hit `beta`.

Changes look quite big, but most of them are whitespace changes because of the introduction of an `_inner` function. In reality it only adds 2 checks.
2024-10-10 17:53:52 +00:00
bors
8d94e06ec9 Auto merge of #131263 - compiler-errors:solver-relating, r=lcnr
Introduce SolverRelating type relation to the new solver

Redux of #128744.

Splits out relate for the new solver so that implementors don't need to implement it themselves.

r? lcnr
2024-10-10 14:59:40 +00:00
bors
4cc494bbfe Auto merge of #131495 - matthiaskrgr:rollup-lwf2u4i, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #130625 (Fix a few relative paths in rustc doc)
 - #131397 (fix/update teach_note from 'escaping mutable ref/ptr' const-check)
 - #131479 (Apple: Avoid redundant `-Wl,-dylib` flag when linking)
 - #131480 (Fix hardcoded strip path when cross-compiling from Linux to Darwin)
 - #131482 (structurally resolve adts and tuples expectations too)
 - #131484 (Add myself back to review rotation)
 - #131491 (impossible obligations fast path)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-10 11:00:28 +00:00
Matthias Krüger
1c62cff897
Rollup merge of #131491 - lcnr:nalgebra-perrrrf, r=compiler-errors
impossible obligations fast path

fixes the remaining performance regression in nalgebra for #130654

r? `@compiler-errors`

Fixes #124894
2024-10-10 12:49:22 +02:00
Matthias Krüger
7eb5621e12
Rollup merge of #131484 - jhpratt:review-rotation, r=jieyouxu
Add myself back to review rotation
2024-10-10 12:49:21 +02:00
Matthias Krüger
02930953d8
Rollup merge of #131482 - compiler-errors:struct-res, r=lcnr
structurally resolve adts and tuples expectations too

r? lcnr
2024-10-10 12:49:21 +02:00
Matthias Krüger
68313623fc
Rollup merge of #131480 - madsmtm:macos-fix-strip-binary, r=nnethercote
Fix hardcoded strip path when cross-compiling from Linux to Darwin

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

I fear that https://github.com/rust-lang/rust/pull/131405 might end up taking some time, so opening this PR to resolve the regression.

`@rustbot` label O-apple
2024-10-10 12:49:20 +02:00
Matthias Krüger
173c50fb0e
Rollup merge of #131479 - madsmtm:avoid-redundant-dylib, r=jieyouxu
Apple: Avoid redundant `-Wl,-dylib` flag when linking

Seems to have been introduced all the way back in e338a4154b, but should be redundant, `-dynamiclib` should already make `cc` set `-dylib` when linking.

Spotted this while trying to get `-Clinker-flavor=gcc` and `-Clinker-flavor=ld` closer together, not that important to fix.

`@rustbot` label O-apple
2024-10-10 12:49:19 +02:00
Matthias Krüger
a2c43eb806
Rollup merge of #131397 - RalfJung:const-escaping-ref-teach, r=chenyukang
fix/update teach_note from 'escaping mutable ref/ptr' const-check

The old note was quite confusing since it talked about statics, but the message is also shown for consts. So let's reword to something that is true for both of them.
2024-10-10 12:49:19 +02:00
Matthias Krüger
6d41be2700
Rollup merge of #130625 - heiseish:issue-124028-fix, r=jieyouxu
Fix a few relative paths in rustc doc

## Changes

- Don't inline the doc for re-exporting some structs that have relative paths in doc.

## Context

See #124028.

- Most of the relative links in rustdoc are there because of circular import (so syntax like `[MyType]: rustc_foo::bar` is difficult to achieve when we cannot import `rustc_xxx` due to circular import)
- Here, I disable new links for re-exports. I think it's fine for re-exported items in `hir::*`.
- There is a few more relative links in other `rustc` crates, however they are not addressed in this PR, as they are not re-exported and/so the relative paths are working.

Closes #124028.

r​? `@fmease`

Let me know if I miss anything or there's any other way to address this issue.
2024-10-10 12:49:18 +02:00
lcnr
d6fd45c2e3 impossible obligations check fast path 2024-10-10 06:09:50 -04:00
Michael Goulet
8715bfbf0e Make super combine into fns 2024-10-10 06:07:52 -04:00
Michael Goulet
a4cd2202ef Use SolverRelating in favor of TypeRelating in the old solver where possible 2024-10-10 06:07:52 -04:00
Michael Goulet
30a2ecddb4 Remove unnecessary StructurallyRelateAliases from CombineFields/TypeRelating 2024-10-10 06:07:52 -04:00
Michael Goulet
3da257a98d Use SolverRelating in new solver 2024-10-10 06:07:52 -04:00
Michael Goulet
efb1c23ff6 Introduce SolverRelating 2024-10-10 06:07:51 -04:00
Michael Goulet
ce7a61b9d0 Uplift super_combine 2024-10-10 06:07:51 -04:00
Michael Goulet
09da2ebd63 Move ty::Error branch into super_combine_tys 2024-10-10 06:07:51 -04:00
bors
a21a9fe332
Auto merge of #13464 - y21:issue13458, r=flip1995
Don't warn on proc macro generated code in `needless_return`

Fixes #13458
Fixes #13457
Fixes #13467
Fixes #13479
Fixes #13481
Fixes #13526
Fixes #13486

The fix is unfortunately a little more convoluted than just simply adding a `is_from_proc_macro`. That check *does*  fix the issue, however it also introduces a bunch of false negatives in the tests, specifically when the returned expression is in a different syntax context, e.g. `return format!(..)`.

The proc macro check builds up a start and end pattern based on the HIR nodes and compares it to a snippet of the span, however that would currently fail for `return format!(..)` because we would have the patterns `("return", <something inside of the format macro>)`, which doesn't compare equal. So we now return an empty string pattern for when it's in a different syntax context.

"Hide whitespace" helps a bit for reviewing the proc macro detection change

changelog: none
2024-10-10 11:34:13 +02:00
bors
de19f2b73d Auto merge of #131453 - onur-ozkan:llvm-ci-check-for-rustc-ci, r=Kobzol
disable `download-rustc` if LLVM submodule has changes in CI

We can't use CI rustc while using in-tree LLVM (which happens in LLVM submodule update PRs) and this PR handles that by ignoring CI-rustc in CI and failing in non-CI environments.
2024-10-10 08:31:30 +00:00
onur-ozkan
b198a46665 disable download-rustc if LLVM submodule has changes in CI
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-10-10 08:55:15 +03:00
Jacob Pratt
e481599536
Add myself back to review rotation 2024-10-10 01:09:13 -04:00
Michael Goulet
2a8f08083f Structurallyresolve adts and tuples expectations too 2024-10-10 00:34:06 -04:00
Mads Marquart
09b634a4ba Fix hardcoded strip path when cross-compiling from Linux to Darwin 2024-10-10 04:03:48 +02:00
Mads Marquart
d6aaf7b036 Avoid redundant -Wl,-dylib flag when linking 2024-10-10 03:51:11 +02:00
bors
df1b5d3cc2 Auto merge of #131466 - matthiaskrgr:rollup-3qtz83x, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #123951 (Reserve guarded string literals (RFC 3593))
 - #130827 (Library: Rename "object safe" to "dyn compatible")
 - #131383 (Add docs about slicing slices at the ends)
 - #131403 (Fix needless_lifetimes in rustc_serialize)
 - #131417 (Fix methods alignment on mobile)
 - #131449 (Decouple WASIp2 sockets from WasiFd)
 - #131462 (Mention allocation errors for `open_buffered`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-10 01:12:11 +00:00
bors
fc0f045dd1 Auto merge of #131458 - matthiaskrgr:rollup-82qeotv, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #131382 (Add "reference" as a known compiletest header)
 - #131420 (Dont ICE when encountering post-mono layout cycle error)
 - #131424 (compiler: Stop reexporting enum-globs from `rustc_target::abi`)
 - #131426 (Fix quotation marks around debug line in `src/ci/run.sh`)
 - #131435 (Ignore broken-pipe-no-ice on apple (specifically macOS) for now)
 - #131447 (add more crash tests)
 - #131456 (Fix typo in E0793)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-09 22:21:43 +00:00
Matthias Krüger
7a76489454
Rollup merge of #131462 - cuviper:open_buffered-error, r=RalfJung
Mention allocation errors for `open_buffered`

This documents that `File::open_buffered` may return an error on allocation failure.
2024-10-09 23:03:50 +02:00
Matthias Krüger
866869bbbd
Rollup merge of #131449 - nickrum:wasip2-net-decouple-fd, r=alexcrichton
Decouple WASIp2 sockets from WasiFd

This is a follow up to #129638, decoupling WASIp2's socket implementation from WASIp1's `WasiFd` as discussed with `@alexcrichton.`

Quite a few trait implementations in `std::os::fd` rely on the fact that there is an additional layer of abstraction between `Socket` and `OwnedFd`. I thus had to add a thin `WasiSocket` wrapper struct that just "forwards" to `OwnedFd`. Alternatively, I could have added a lot of conditional compilation to `std::os::fd`, which feels even worse.

Since `WasiFd::sock_accept` is no longer accessible from `TcpListener` and since WASIp2 has proper support for accepting sockets through `Socket::accept`, the `std::os::wasi::net` module has been removed from WASIp2, which only contains a single `TcpListenerExt` trait with a `sock_accept` method as well as an implementation for `TcpListener`. Let me know if this is an acceptable solution.
2024-10-09 23:03:50 +02:00
Matthias Krüger
47344c3179
Rollup merge of #131417 - GuillaumeGomez:mobile-methods-left-margin, r=notriddle
Fix methods alignment on mobile

I realized that on mobile, the methods are not aligned the same depending if they have documentation or not:

| before | after |
|-|-|
| ![Screenshot from 2024-10-08 20-40-22](https://github.com/user-attachments/assets/d31ba5e1-cf84-431f-9b2b-9962bc5a0365) | ![image](https://github.com/user-attachments/assets/ffde2161-bfcb-4462-8c5b-88538e61b366) |

r? `@notriddle`
2024-10-09 23:03:49 +02:00
Matthias Krüger
50f7e80423
Rollup merge of #131403 - practicalrs:fix_needless_lifetimes_p2, r=petrochenkov
Fix needless_lifetimes in rustc_serialize

Hi,

This PR fixes the following clipy warnings:

```
warning: the following explicit lifetimes could be elided: 'a
   --> compiler/rustc_serialize/src/serialize.rs:328:6
    |
328 | impl<'a, S: Encoder, T: Encodable<S>> Encodable<S> for Cow<'a, [T]>
    |      ^^                                                    ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    = note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
    |
328 - impl<'a, S: Encoder, T: Encodable<S>> Encodable<S> for Cow<'a, [T]>
328 + impl<S: Encoder, T: Encodable<S>> Encodable<S> for Cow<'_, [T]>
    |

warning: the following explicit lifetimes could be elided: 'a
   --> compiler/rustc_serialize/src/serialize.rs:348:6
    |
348 | impl<'a, S: Encoder> Encodable<S> for Cow<'a, str> {
    |      ^^                                   ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
    |
348 - impl<'a, S: Encoder> Encodable<S> for Cow<'a, str> {
348 + impl<S: Encoder> Encodable<S> for Cow<'_, str> {
    |

warning: the following explicit lifetimes could be elided: 'a
   --> compiler/rustc_serialize/src/serialize.rs:355:6
    |
355 | impl<'a, D: Decoder> Decodable<D> for Cow<'a, str> {
    |      ^^                                   ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
    |
355 - impl<'a, D: Decoder> Decodable<D> for Cow<'a, str> {
355 + impl<D: Decoder> Decodable<D> for Cow<'_, str> {
```

Best regards,
Michal
2024-10-09 23:03:49 +02:00
Matthias Krüger
d58345010c
Rollup merge of #131383 - AngelicosPhosphoros:better_doc_for_slice_slicing_at_ends, r=cuviper
Add docs about slicing slices at the ends

Closes https://github.com/rust-lang/rust/issues/60783
2024-10-09 23:03:48 +02:00
Matthias Krüger
627d0b4067
Rollup merge of #130827 - fmease:library-mv-obj-save-dyn-compat, r=ibraheemdev
Library: Rename "object safe" to "dyn compatible"

Completed T-lang FCP: https://github.com/rust-lang/lang-team/issues/286#issuecomment-2338905118.
Tracking issue: https://github.com/rust-lang/rust/issues/130852

Regarding https://github.com/rust-lang/rust/labels/relnotes, I guess I will manually open a https://github.com/rust-lang/rust/labels/relnotes-tracking-issue since this change affects everything (compiler, library, tools, docs, books, everyday language).

r? ghost
2024-10-09 23:03:47 +02:00
Matthias Krüger
b41e939cb5
Rollup merge of #123951 - pitaj:reserve-guarded-strings, r=traviscross
Reserve guarded string literals (RFC 3593)

Implementation for RFC 3593, including:
- lexer / parser changes
- diagnostics
- migration lint
- tests

We reserve `#"`, `##"`, `###"`, `####`, and any other string of four or more repeated `#`. This avoids infinite lookahead in the lexer, though we still use infinite lookahead in the parser to provide better forward compatibility diagnostics.

This PR does not implement any special lexing of the string internals:
- strings preceded by one or more `#` are denied
- regardless of the number of trailing `#`
- string contents are lexed as if it was just a bare `"string"`

Tracking issue: #123735
RFC: rust-lang/rfcs#3593
2024-10-09 23:03:47 +02:00
bors
eb4e234674 Auto merge of #131461 - onur-ozkan:ignore-ci-rustc-change-test, r=onur-ozkan
ignore `ci_rustc_if_unchanged_logic` test

Temporary hotfix for unblocking CI.

r? ghost
2024-10-09 19:51:01 +00:00
onur-ozkan
118f7a6b88 ignore ci_rustc_if_unchanged_logic test
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-10-09 22:44:29 +03:00
Josh Stone
7b52e6bc47 Mention allocation errors for open_buffered 2024-10-09 12:43:23 -07:00
Guillaume Gomez
5e6033ea8b Strengthen some GUI tests 2024-10-09 21:23:20 +02:00
Guillaume Gomez
12d5f0aa2c Add GUI regression test for methods left margin on mobile 2024-10-09 21:01:08 +02:00
Guillaume Gomez
16844e2485 Fix methods alignment on mobile 2024-10-09 21:01:08 +02:00
Matthias Krüger
0fe2532a37
Rollup merge of #131456 - kupiakos:patch-3, r=compiler-errors
Fix typo in E0793

`s/references/reference/`
2024-10-09 20:27:26 +02:00
Matthias Krüger
55b4ee7233
Rollup merge of #131447 - matthiaskrgr:morecrashtests, r=compiler-errors
add more crash tests

r? `@jieyouxu`
2024-10-09 20:27:26 +02:00
Matthias Krüger
8630de37a3
Rollup merge of #131435 - jieyouxu:macos-pipe, r=Zalathar
Ignore broken-pipe-no-ice on apple (specifically macOS) for now

This test fails for me locally (initially reported by Zalathar) because apparently on macOS it doesn't say "internal compiler error" but it does report the std I/O panic, and it doesn't exit with a code of 101 but instead terminates with a wait signal of SIGPIPE.

Ignore this test on apple for now, until we try to actually address the underlying issue.

See https://github.com/rust-lang/rust/pull/131155 and https://github.com/rust-lang/rust/issues/131436 for more context.
2024-10-09 20:27:25 +02:00
Matthias Krüger
639346eac5
Rollup merge of #131426 - cuviper:ci-debug-quotes, r=jieyouxu
Fix quotation marks around debug line in `src/ci/run.sh`

Without this change, the markdown-style backticks are treated as a shell
command substitution, which fails like so:

    /checkout/src/ci/run.sh: line 58: DISABLE_CI_RUSTC_IF_INCOMPATIBLE: command not found
    debug:  configured.

r? onur-ozkan
2024-10-09 20:27:25 +02:00
Matthias Krüger
e642442f12
Rollup merge of #131424 - workingjubilee:stem-the-tyde-of-glob-imports, r=jieyouxu
compiler: Stop reexporting enum-globs from `rustc_target::abi`

Three enums had **all** their variants glob-exported into a distressingly large amount of the tree. Cease to do that, and also cease to glob import the contents of the module that contained them. Redirect relevant imports to their actual source, the `rustc_abi` crate.

No functional changes.
2024-10-09 20:27:24 +02:00
Matthias Krüger
f144469bda
Rollup merge of #131420 - compiler-errors:post-mono-layout-cycle, r=wesleywiser
Dont ICE when encountering post-mono layout cycle error

It's possible to encounter post-mono layout cycle errors in `fn_abi_of_instance`. Don't ICE in those cases.

This was originally discovered in an async fn, but that's not the only way to encounter such an error (which the other test I added should demonstrate).

Error messsages suck, but this fix is purely about suppressing the ICE.

Fixes #131409
2024-10-09 20:27:24 +02:00
Matthias Krüger
b76667aed2
Rollup merge of #131382 - ehuss:compiletest-reference, r=jieyouxu
Add "reference" as a known compiletest header

This adds the "reference" compiletest header so that the Rust reference can add annotations to the test suite in order to link tests to individual rules in the reference.

Tooling in the reference repo will be responsible for collecting these annotations and linking to the tests.

More details are in MCP 783: https://github.com/rust-lang/compiler-team/issues/783

There is a change from the MCP in that I am not adding the JSON collection to compiletest (at least, not yet). In looking at this more closely, that actually makes things more difficult for our tooling, so I'm leaving it out for now. If in the future it looks like something we want, then I think we can add it later.

There are a few tests here which need adjusting due to the legacy header check. `@jieyouxu` indicated on Zulip that we could potentially remove the legacy header check, in which case those changes can be dropped from this PR.

r? `@jieyouxu`
2024-10-09 20:27:23 +02:00
Alyssa Haroldsen
12ce6f6564
Fix typo in E0793 2024-10-09 10:28:16 -07:00
León Orell Valerian Liehr
e08dc0491a
Library: Rename "object safe" to "dyn compatible" 2024-10-09 18:48:29 +02:00