Commit Graph

250705 Commits

Author SHA1 Message Date
Matthias Krüger
a2122dc1e3
Rollup merge of #122439 - Nadrieril:store-built-place, r=compiler-errors
match lowering: build the `Place` instead of keeping a `PlaceBuilder` around

Outside of `MatchPair::new` we don't construct new places, so we don't need to keep a `PlaceBuilder` around.

A bit annoyingly we have to store an `Option<Place>` even though it's never `None` after simplification, but the alternative would be to re-entangle `MatchPair` construction and simplification and I'd rather not do that.
2024-03-27 05:21:15 +01:00
bors
435b525514 Auto merge of #122958 - jieyouxu:port-backtrace-dylib-dep, r=workingjubilee
Port backtrace dylib-dep test to a ui test

Original test: [dylib-dep](6fa4b85b99/crates/dylib-dep)
Part of #122899.
2024-03-27 01:08:47 +00:00
bors
a1b499134a Auto merge of #123108 - matthiaskrgr:rollup-zossklv, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #108675 (Document `adt_const_params` feature in Unstable Book)
 - #122120 (Suggest associated type bounds on problematic associated equality bounds)
 - #122589 (Fix diagnostics for async block cloning)
 - #122835 (Require `DerefMut` and `DerefPure` on `deref!()` patterns when appropriate)
 - #123049 (In `ConstructCoroutineInClosureShim`, pass receiver by mut ref, not mut pointer)
 - #123055 (enable cargo miri test doctests)
 - #123057 (unix fs: Make hurd using explicit new rather than From)
 - #123087 (Change `f16` and `f128` clippy stubs to be nonpanicking)
 - #123103 (Rename `Inherited` -> `TypeckRootCtxt`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-26 22:25:03 +00:00
Matthias Krüger
781b225831
Rollup merge of #123103 - compiler-errors:inherited-is-a-weird-name, r=oli-obk
Rename `Inherited` -> `TypeckRootCtxt`

`Inherited` is a confusing name. Rename it to `TypeckRootCtxt`.

I don't think this needs a type MCP or anything since it's not nearly as pervasive as `FnCtxt` , for example.

r? `@lcnr` `@oli-obk`
2024-03-26 21:23:51 +01:00
Matthias Krüger
7af95edd29
Rollup merge of #123087 - tgross35:clippy-f16-f128-check-stubs, r=blyxyas
Change `f16` and `f128` clippy stubs to be nonpanicking

It turns out there is a bit of a circular dependency - I cannot add anything to `core` because Clippy fails, and I can't actually add correct Clippy implementations without new implementations from `core`.

Change some of the Clippy stubs from `unimplemented!` to success values and leave a FIXME in their place to mitigate this.

Fixes <https://github.com/rust-lang/rust/issues/122587>
2024-03-26 21:23:50 +01:00
Matthias Krüger
ac5ffa51cd
Rollup merge of #123057 - sthibaul:systemtime, r=jhpratt
unix fs: Make hurd using explicit new rather than From

408c0ea216 ("unix time module now return result") dropped the From impl for SystemTime, breaking the hurd build (and probably the horizon build)

Fixes #123032
2024-03-26 21:23:50 +01:00
Matthias Krüger
b8e8d658a7
Rollup merge of #123055 - onur-ozkan:miri-rustdoc, r=RalfJung
enable cargo miri test doctests

This was the cleanest solution that came to my mind so far.

cc `@RalfJung`

Resolves #123028
2024-03-26 21:23:49 +01:00
Matthias Krüger
b63dca138e
Rollup merge of #123049 - compiler-errors:coroutine-closure-rcvr, r=oli-obk
In `ConstructCoroutineInClosureShim`, pass receiver by mut ref, not mut pointer

The receivers were compatible at codegen time, but did not necessarily have the same layouts due to niches, which was caught by miri.

Fixes rust-lang/miri#3400

r? oli-obk
2024-03-26 21:23:49 +01:00
Matthias Krüger
0029a11d7d
Rollup merge of #122835 - compiler-errors:deref-pure, r=Nadrieril
Require `DerefMut` and `DerefPure` on `deref!()` patterns when appropriate

Waiting on the deref pattern syntax pr to merge

r? nadrieril
2024-03-26 21:23:48 +01:00
Matthias Krüger
20770ac3fc
Rollup merge of #122589 - wutchzone:121547, r=compiler-errors
Fix diagnostics for async block cloning

Closes #121547

r? diagnostics
2024-03-26 21:23:48 +01:00
Matthias Krüger
ff8cdc9e14
Rollup merge of #122120 - fmease:sugg-assoc-ty-bound-on-eq-bound, r=compiler-errors
Suggest associated type bounds on problematic associated equality bounds

Fixes #105056. TL;DR: Suggest `Trait<Ty: Bound>` on `Trait<Ty = Bound>` in Rust >=2021.

~~Blocked on #122055 (stabilization of `associated_type_bounds`), I'd say.~~ (merged)
2024-03-26 21:23:47 +01:00
Matthias Krüger
9162776c66
Rollup merge of #108675 - Shadlock0133:adt_const_params, r=compiler-errors
Document `adt_const_params` feature in Unstable Book
2024-03-26 21:23:47 +01:00
bors
47ecded352 Auto merge of #118644 - madsmtm:macos-weak-linking-test, r=compiler-errors
Add test for Apple's `-weak_framework` linker argument

The [`-weak_framework`](https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html) linker argument can sometimes be useful to reduce startup times, and to link newer frameworks while still having older deployment targets.

So I made a test to ensure that it continues to work.

Discussed in https://github.com/rust-lang/rust/issues/99427.
2024-03-26 20:22:54 +00:00
Michael Goulet
bf7a745077 Inherited -> TypeckRootCtxt 2024-03-26 15:22:46 -04:00
许杰友 Jieyou Xu (Joe)
7764e8ace3
Port backtrace dylib-dep test to a ui test 2024-03-26 19:07:12 +00:00
Nadrieril
14f186c756 Store Place instead of PlaceBuilder in MatchPair 2024-03-26 19:26:16 +01:00
Nadrieril
3878b3716d Rename 2024-03-26 19:26:16 +01:00
bors
3b370cf46a Auto merge of #123098 - matthiaskrgr:rollup-39v4rf3, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #122766 (store segment and module in `UnresolvedImportError`)
 - #122996 (simplify_branches: add comment)
 - #123047 (triagebot: Add notification of 2024 issues)
 - #123066 (CFI: (actually) check that methods are object-safe before projecting their receivers to `dyn Trait` in CFI)
 - #123067 (match lowering: consistently merge simple or-patterns)
 - #123069 (Revert `cargo update` changes and bump `download-artifact` to v4)
 - #123070 (Add my former address to .mailmap)
 - #123086 (Fix doc link to BufWriter in std::fs::File documentation)
 - #123090 (Remove `CacheSelector` trait now that we can use GATs)
 - #123091 (Delegation: fix ICE on wrong `self` resolution)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-26 17:44:57 +00:00
Trevor Gross
2cfd5326a5 Change f16 and f128 clippy stubs to be nonpanicking
It turns out there is a bit of a circular dependency - I cannot add
anything to `core` because Clippy fails, and I can't actually add
correct Clippy implementations without new implementations from `core`.

Change some of the Clippy stubs from `unimplemented!` to success values
and leave a FIXME in their place to mitigate this.

Fixes <https://github.com/rust-lang/rust/issues/122587>
2024-03-26 13:37:00 -04:00
Michael Goulet
22bc5c538d In ConstructCoroutineInClosureShim, pass receiver by ref, not pointer 2024-03-26 12:10:51 -04:00
Matthias Krüger
4d1fb9e98a
Rollup merge of #123091 - Bryanskiy:delegation-fixes, r=petrochenkov
Delegation: fix ICE on wrong `self` resolution

fixes https://github.com/rust-lang/rust/issues/122874

Delegation item should be wrapped in a `rib` to behave like a regular function during name resolution.

r? `@petrochenkov`
2024-03-26 17:06:43 +01:00
Matthias Krüger
e7c983cca5
Rollup merge of #123090 - oli-obk:gatify, r=compiler-errors
Remove `CacheSelector` trait now that we can use GATs

No change in behaviour. Just noticed while digging around in the query infrastructure
2024-03-26 17:06:43 +01:00
Matthias Krüger
a4bf7224cb
Rollup merge of #123086 - ding-young:fix-ref-to-BufWriter, r=the8472
Fix doc link to BufWriter in std::fs::File documentation

It seems that doc link to `BufWriter` in `std::fs::File` doc leads to `BufReader`, not `BufWriter`.
See https://doc.rust-lang.org/std/fs/struct.File.html
2024-03-26 17:06:42 +01:00
Matthias Krüger
9ea8f23504
Rollup merge of #123070 - kpreid:patch-1, r=workingjubilee
Add my former address to .mailmap
2024-03-26 17:06:42 +01:00
Matthias Krüger
17aabac072
Rollup merge of #123069 - clubby789:un-often-cargo-update, r=Kobzol
Revert `cargo update` changes and bump `download-artifact` to v4

Revert #122489 and #122698

https://github.com/rust-lang/rust/pull/122951#issuecomment-2017430266
The failures + https://github.com/rust-lang/rust-log-analyzer/issues/81 are causing some annoying spam. I don't think this is _that_ important for now and I don't know enough GHA to fix it 😓
2024-03-26 17:06:41 +01:00
Matthias Krüger
94e8c6c334
Rollup merge of #123067 - Nadrieril:always-simplify-or, r=oli-obk
match lowering: consistently merge simple or-patterns

There are two places where we expand or-patterns in match lowering: the main one is `test_candidates_with_or`, and there's one in `match_candidates` that's an optimization for the simple case where the whole pattern is just one or-pattern.

To reduce duplication, we merge or-pattern alternatives into a single block when possible, but we only to that in `test_candidates_with_or`. This PR fixes this oversight and merges them in `match_candidates` too.

This is a part of splitting up https://github.com/rust-lang/rust/pull/122046 into smaller bits.
2024-03-26 17:06:41 +01:00
Matthias Krüger
1fd3ee0660
Rollup merge of #123066 - maurer:cfi-erased-lifetime-ice, r=compiler-errors
CFI: (actually) check that methods are object-safe before projecting their receivers to `dyn Trait` in CFI

`trait_object_ty` assumed that associated types would be fully determined by the trait. This is *almost* true - const parameters and type parameters are no longer allowed, but lifetime parameters are. Since we erase all lifetime parameters anyways, instantiate it with as many erased regions as it needs.

Fixes: #123053

r? `@compiler-errors`
2024-03-26 17:06:40 +01:00
Matthias Krüger
6ecbc343f7
Rollup merge of #123047 - ehuss:triagebot-edition-2024, r=fmease
triagebot: Add notification of 2024 issues

This adds a notification for 2024 issues to Zulip.
2024-03-26 17:06:40 +01:00
Matthias Krüger
d549d4f5a7
Rollup merge of #122996 - RalfJung:simplify_branches, r=cjgillot
simplify_branches: add comment

I am not quite sure why this simplification is done here and not in InstSimplify but 🤷

r? `@cjgillot`
2024-03-26 17:06:39 +01:00
Matthias Krüger
03f5c4f05f
Rollup merge of #122766 - bvanjoi:fix-115185, r=petrochenkov
store segment and module in `UnresolvedImportError`

Fixes #115185

An easy fix. r? `@Nilstrieb`
2024-03-26 17:06:38 +01:00
clubby789
c2de5aff71 Revert cargo update changes 2024-03-26 15:36:12 +00:00
Samuel Thibault
7b4e507961 unix fs: Make hurd and horizon using explicit new rather than From
408c0ea216 ("unix time module now return result") dropped the From
impl for SystemTime, breaking the hurd and horizon builds.

Fixes #123032
2024-03-26 15:58:00 +01:00
bors
536606bc5d Auto merge of #122939 - joboet:proc_macro_bridge_state, r=petrochenkov
Simplify proc macro bridge state

Currently, `proc_macro` uses a `ScopedCell` to store the client-side proc-macro bridge. Unfortunately, this requires the `Bridge`, which has non-negligible size, to be copied out and back again on every access. In some cases, the optimizer might be able to elide these copies, but in general, this is suboptimal.

This PR removes `ScopedCell` and employs a similar trick as in [`scoped_tls`](https://crates.io/crates/scoped-tls), meaning that the only thing stored in TLS is a pointer to the state, which now is a `RefCell`. Access to the pointer is then scoped so that it is always within the lifetime of the reference to the state. Unfortunately, `scoped_tls` requires the referenced type to be `'static`, which `Bridge` is not, therefore we cannot simply copy that macro but have to reimplement its TLS trick.

This removes the `#[forbid(unsafe_code)]` on the `client` module so that we do not have to export `Bridge`, which currently is private, to the whole crate. I can change that, if necessary.
2024-03-26 13:05:59 +00:00
Oli Scherer
3b94f33c23 Remove CacheSelector trait now that we can use GATs 2024-03-26 11:03:23 +00:00
Bryanskiy
17c6101864 Delegation: fix ICE on wrong self resolution 2024-03-26 14:00:51 +03:00
bors
519d892f95 Auto merge of #121387 - oli-obk:eager_const_failures_regression, r=lcnr
Avoid some unnecessary query invocations.

Specifically this inlines `const_eval_poly` and avoids computing the generic params, the param env, normalizing the param env and erasing lifetimes on everything.

should fix the perf regression from https://github.com/rust-lang/rust/pull/121087
2024-03-26 10:52:11 +00:00
ding-young
a241ffc6b6 Fix link to BufWriter 2024-03-26 18:04:19 +09:00
bors
b13a71a2e7 Auto merge of #123081 - Muscraft:update-cargo, r=Muscraft,workingjubilee
Update cargo

5 commits in a510712d05c6c98f987af24dd73cdfafee8922e6..499a61ce7a0fc6a72040084862a68b2603e770e8
2024-03-25 03:45:54 +0000 to 2024-03-26 04:17:04 +0000
- fix: do not borrow shell across registry query (rust-lang/cargo#13647)
- Do not strip debuginfo by default for MSVC (rust-lang/cargo#13630)
- chore(deps): update msrv (rust-lang/cargo#13577)
- Fix doc collision for lib/bin with a dash in the inferred name. (rust-lang/cargo#13640)
- refactor: Make lint names snake_case (rust-lang/cargo#13635)

r? ghost
2024-03-26 08:49:46 +00:00
onur-ozkan
69af113f44 enable cargo miri test doctests
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-03-26 10:27:34 +03:00
bors
73476d4990 Auto merge of #122849 - clubby789:no-metadata, r=petrochenkov
Don't emit load metadata in debug mode

r? `@ghost`
2024-03-26 06:46:43 +00:00
Scott Schafer
3d58ef9e3c
Update cargo 2024-03-26 00:06:06 -06:00
bors
8b9e47c136 Auto merge of #123065 - workingjubilee:rollup-bve45ex, r=workingjubilee
Rollup of 10 pull requests

Successful merges:

 - #122707 (Fix a typo in the alloc::string::String docs)
 - #122769 (extend comments for reachability set computation)
 - #122892 (fix(bootstrap/dist): use versioned dirs when vendoring)
 - #122896 (Update stdarch submodule)
 - #122923 (In `pretty_print_type()`, print `async fn` futures' paths instead of spans.)
 - #122950 (Add regression tests for #101903)
 - #123039 (Update books)
 - #123042 (Import the 2021 prelude in the core crate)
 - #123044 (`Instance` is `Copy`)
 - #123051 (did I mention that tests are super cool? )

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-26 02:07:49 +00:00
Kevin Reid
22da5e0082
Add my former address to .mailmap 2024-03-25 18:48:54 -07:00
Eric Huss
d0bf6e6948 triagebot: Add notification of 2024 issues 2024-03-25 17:29:04 -07:00
bors
c98ea0d808 Auto merge of #111769 - saethlin:ctfe-backtrace-ctrlc, r=RalfJung
Print a backtrace in const eval if interrupted

Demo:
```rust
#![feature(const_eval_limit)]
#![const_eval_limit = "0"]

const OW: u64 = {
    let mut res: u64 = 0;
    let mut i = 0;
    while i < u64::MAX {
        res = res.wrapping_add(i);
        i += 1;
    }
    res
};

fn main() {
    println!("{}", OW);
}
```
```
╭ ➜ ben@archlinux:~/rust
╰ ➤ rustc +stage1 spin.rs
^Cerror[E0080]: evaluation of constant value failed
 --> spin.rs:8:33
  |
8 |         res = res.wrapping_add(i);
  |                                 ^ Compilation was interrupted

note: erroneous constant used
  --> spin.rs:15:20
   |
15 |     println!("{}", OW);
   |                    ^^

note: erroneous constant used
  --> spin.rs:15:20
   |
15 |     println!("{}", OW);
   |                    ^^
   |
   = note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0080`.
```
2024-03-26 00:04:03 +00:00
Michael Goulet
fc1d7d275b Extract helper, fix comment on DerefPure 2024-03-25 19:39:45 -04:00
Michael Goulet
5fdc7555c1 Require DerefMut if deref pattern has nested ref mut binding 2024-03-25 19:39:45 -04:00
Michael Goulet
b56279569b Require DerefPure for patterns 2024-03-25 19:39:45 -04:00
Nadrieril
d1d9aa3108 Consistently merge simplifiable or-patterns 2024-03-25 23:52:17 +01:00
Matthew Maurer
70e1d23895 CFI: Pad out associated type resolution with erased lifetimes
`trait_object_ty` assumed that associated types would be fully
determined by the trait. This is *almost* true - const parameters and
type parameters are no longer allowed, but lifetime parameters are.
Since we erase all lifetime parameters anyways, instantiate it with as
many erased regions as it needs.

Fixes: #123053
2024-03-25 22:46:21 +00:00