Commit Graph

242026 Commits

Author SHA1 Message Date
bors
deace71034 Auto merge of #119324 - compiler-errors:rollup-c6eqcg9, r=compiler-errors
Rollup of 5 pull requests

Successful merges:

 - #119235 (Add missing feature gate for sanitizer CFI cfgs)
 - #119240 (Make some non-diagnostic-affecting `QPath::LangItem` into regular `QPath`s)
 - #119297 (Pass DeadItem and lint as consistent group in dead-code.)
 - #119307 (Clean up some lifetimes in `rustc_pattern_analysis`)
 - #119323 (add test for coercing never to infinite type)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-12-26 19:28:49 +00:00
Michael Goulet
a5b3d139b3
Rollup merge of #119323 - lukas-code:test-never-to-infinite, r=compiler-errors
add test for coercing never to infinite type

Closes https://github.com/rust-lang/rust/issues/113197.

This was fixed in https://github.com/rust-lang/rust/pull/118308, probably 1978168c13.
2023-12-26 13:29:14 -05:00
Michael Goulet
e1be642b41
Rollup merge of #119307 - compiler-errors:pat-lifetimes, r=Nadrieril
Clean up some lifetimes in `rustc_pattern_analysis`

This PR removes some redundant lifetimes. I figured out that we were shortening the lifetime of an arena-allocated `&'p DeconstructedPat<'p>` to `'a DeconstructedPat<'p>`, which forced us to carry both lifetimes when we could otherwise carry just one.

This PR also removes and elides some unnecessary lifetimes.

I also cherry-picked 0292eb9bb9b897f5c0926c6a8530877f67e7cc9b, and then simplified more lifetimes in `MatchVisitor`, which should make #119233 a very simple PR!

r? Nadrieril
2023-12-26 13:29:14 -05:00
Michael Goulet
65aaece6c0
Rollup merge of #119297 - cjgillot:issue-119267, r=petrochenkov
Pass DeadItem and lint as consistent group in dead-code.

Fixes https://github.com/rust-lang/rust/issues/119267
2023-12-26 13:29:13 -05:00
Michael Goulet
e7bd402a38
Rollup merge of #119240 - compiler-errors:lang-item-more, r=petrochenkov
Make some non-diagnostic-affecting `QPath::LangItem` into regular `QPath`s

The rest of 'em affect diagnostics, so leave them alone... for now.

cc #115178
2023-12-26 13:29:13 -05:00
Michael Goulet
50e380c8f3
Rollup merge of #119235 - Urgau:missing-feature-gate-sanitizer-cfi-cfgs, r=Nilstrieb
Add missing feature gate for sanitizer CFI cfgs

Found during the review of https://github.com/rust-lang/rust/pull/118494 in https://github.com/rust-lang/rust/pull/118494#discussion_r1416079288.

cc `@rcvalle`
2023-12-26 13:29:13 -05:00
bors
a75fed74b6 Auto merge of #119042 - bvanjoi:fix-118697-2, r=compiler-errors
fallback `default` to `None` during ast-lowering for lifetime binder

Fixes #118697

This is another attempt. It has a fallback, setting `default` to `None` and emit an error for non-lifetime binders during ast lowering.

r? `@compiler-errors`
2023-12-26 17:30:42 +00:00
Lukas Markeffsky
29036045c3 add test for coercing never to infinite type 2023-12-26 17:57:33 +01:00
Lukas Markeffsky
cb2fc0967f rename tests 2023-12-26 17:50:30 +01:00
bors
e1fadb2c35 Auto merge of #119133 - scottmcm:assert-unchecked, r=thomcc
Add `hint::assert_unchecked`

Libs-API expressed interest, modulo bikeshedding, in https://github.com/rust-lang/libs-team/issues/315#issuecomment-1863159430

I think that means this is good for nightly, since we can always rename it before stabilization.

Tracking issue: https://github.com/rust-lang/rust/issues/119131
2023-12-26 15:31:44 +00:00
bors
2fe50cd72c Auto merge of #119129 - jyn514:verbose, r=compiler-errors,estebank
rework `-Zverbose`

implements the changes described in https://github.com/rust-lang/compiler-team/issues/706

the first commit is only a name change from `-Zverbose` to `-Zverbose-internals` and does not change behavior. the second commit changes diagnostics.

possible follow up work:
- `ty::pretty` could print more info with `--verbose` than it does currently. `-Z verbose-internals` shows too much info in a way that's not helpful to users. michael had ideas about this i didn't fully understand: https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/uplift.20some.20-Zverbose.20calls.20and.20rename.20to.E2.80.A6.20compiler-team.23706/near/408984200
- `--verbose` should imply `-Z write-long-types-to-disk=no`. the code in `ty_string_with_limit` should take `--verbose` into account (apparently this affects `Ty::sort_string`, i'm not familiar with this code). writing a file to disk should suggest passing `--verbose`.

r? `@compiler-errors` cc `@estebank`
2023-12-26 12:27:29 +00:00
bors
ea7ef7b6c2 Auto merge of #119315 - RalfJung:miri, r=RalfJung
Miri subtree update

r? `@ghost`
2023-12-26 10:29:03 +00:00
bors
a815c3b69c Auto merge of #119313 - matthiaskrgr:rollup-41x48j6, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #119287 (Fix doc typo for read_exact_at)
 - #119294 (fix `./configure --set change-id`)
 - #119303 (Update sysinfo)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-12-26 08:22:57 +00:00
bohan
e16efbd23a fallback default to None during ast-loweing for lifetime binder 2023-12-26 16:10:29 +08:00
Matthias Krüger
f7dc91f25f
Rollup merge of #119303 - GuillaumeGomez:update-sysinfo, r=onur-ozkan
Update sysinfo

A small bugfix was released for sysinfo so updating once again.

r? ``@onur-ozkan``
2023-12-26 08:48:34 +01:00
Matthias Krüger
c59de6b117
Rollup merge of #119294 - jyn514:configure-change-id, r=onur-ozkan
fix `./configure --set change-id`

the logic for this is kinda hacky and treats whitespace as significant d1e26401bc/src/bootstrap/configure.py (L485-L491)

r? ``@onur-ozkan``
2023-12-26 08:48:33 +01:00
Matthias Krüger
e1b3f45178
Rollup merge of #119287 - AlexBuz:patch-1, r=the8472
Fix doc typo for read_exact_at

This adds an "s" at the end of "byte" to make it plural, as it should be here.
2023-12-26 08:48:33 +01:00
bors
4658d3816c Auto merge of #3241 - rust-lang:rustup-2023-12-26, r=RalfJung
Automatic Rustup
2023-12-26 07:22:44 +00:00
bors
f6456285dd Auto merge of #119285 - lch361:split-no-panic, r=the8472
Removed redundant bounds checking at Split's next and next_back methods

Since these methods are using `Iterator::rposition`, which always returns a valid index, then there is no point in regular indexing with bounds checking
2023-12-26 06:24:22 +00:00
The Miri Conjob Bot
236ae9905a Merge from rustc 2023-12-26 05:00:54 +00:00
The Miri Conjob Bot
f2407d98de Preparing for merge from rustc 2023-12-26 04:54:17 +00:00
bors
1ab783112a Auto merge of #119258 - compiler-errors:closure-kind, r=eholk
Make closures carry their own ClosureKind

Right now, we use the "`movability`" field of `hir::Closure` to distinguish a closure and a coroutine. This is paired together with the `CoroutineKind`, which is located not in the `hir::Closure`, but the `hir::Body`. This is strange and redundant.

This PR introduces `ClosureKind` with two variants -- `Closure` and `Coroutine`, which is put into `hir::Closure`. The `CoroutineKind` is thus removed from `hir::Body`, and `Option<Movability>` no longer needs to be a stand-in for "is this a closure or a coroutine".

r? eholk
2023-12-26 04:25:53 +00:00
Michael Goulet
7e00e9736d Make some non-diagnostic-affecting QPath::LangItem into regular qpaths 2023-12-26 04:07:38 +00:00
Michael Goulet
48d089a800 Merge 'thir and 'p 2023-12-26 03:15:41 +00:00
Nadrieril
2b4f84f2b2 thir::Visitor only needs to visit &'thir data 2023-12-26 03:15:18 +00:00
bors
2271c26e4a Auto merge of #119146 - nnethercote:rm-DiagCtxt-api-duplication, r=compiler-errors
Remove `DiagCtxt` API duplication

`DiagCtxt` defines the internal API for creating and emitting diagnostics: methods like `struct_err`, `struct_span_warn`, `note`, `create_fatal`, `emit_bug`. There are over 50 methods.

Some of these methods are then duplicated across several other types: `Session`, `ParseSess`, `Parser`, `ExtCtxt`, and `MirBorrowckCtxt`. `Session` duplicates the most, though half the ones it does are unused. Each duplicated method just calls forward to the corresponding method in `DiagCtxt`. So this duplication exists to (in the best case) shorten chains like `ecx.tcx.sess.parse_sess.dcx.emit_err()` to `ecx.emit_err()`.

This API duplication is ugly and has been bugging me for a while. And it's inconsistent: there's no real logic about which methods are duplicated, and the use of `#[rustc_lint_diagnostic]` and `#[track_caller]` attributes vary across the duplicates.

This PR removes the duplicated API methods and makes all diagnostic creation and emission go through `DiagCtxt`. It also adds `dcx` getter methods to several types to shorten chains. This approach scales *much* better than API duplication; indeed, the PR adds `dcx()` to numerous types that didn't have API duplication: `TyCtxt`, `LoweringCtxt`, `ConstCx`, `FnCtxt`, `TypeErrCtxt`, `InferCtxt`, `CrateLoader`, `CheckAttrVisitor`, and `Resolver`. These result in a lot of changes from `foo.tcx.sess.emit_err()` to `foo.dcx().emit_err()`. (You could do this with more types, but it gets into diminishing returns territory for types that don't emit many diagnostics.)

After all these changes, some call sites are more verbose, some are less verbose, and many are the same. The total number of lines is reduced, mostly because of the removed API duplication. And consistency is increased, because calls to `emit_err` and friends are always preceded with `.dcx()` or `.dcx`.

r? `@compiler-errors`
2023-12-26 02:24:39 +00:00
Michael Goulet
4ae024c754 Elide more lifetimes 2023-12-26 02:12:33 +00:00
Michael Goulet
ae40f6a7ff Clean up more lifetimes 2023-12-26 02:06:39 +00:00
Michael Goulet
b91a98ba10 Even more 2023-12-26 02:02:01 +00:00
Michael Goulet
eebb2abe0b Yeet some lifetimes 2023-12-26 01:59:18 +00:00
Guillaume Gomez
c2dcfc762d Update sysinfo sub-dependency version to 0.29.11 2023-12-25 22:45:38 +01:00
Guillaume Gomez
51dff45aa3 Update sysinfo version to 0.30.1 2023-12-25 22:44:49 +01:00
Michael Goulet
ba912855cc Flatten match 2023-12-25 21:13:41 +00:00
Michael Goulet
27dce304cb Fix clippy's usage of Body's coroutine_kind
Also fixes a bug where we weren't peeling blocks from async bodies
2023-12-25 21:13:41 +00:00
Michael Goulet
3320c09eab Only regular coroutines have movability 2023-12-25 21:13:41 +00:00
bors
e4c626dd9a Auto merge of #119261 - cjgillot:outlive-def-kind, r=compiler-errors
Do not fetch HIR in inferred_outlives_of.

Small simplification allowed by https://github.com/rust-lang/rust/pull/119248
2023-12-25 18:52:48 +00:00
Michael Goulet
909dd864f1 Make closures carry their own ClosureKind, rather than deducing what it is from movability 2023-12-25 16:29:15 +00:00
Michael Goulet
981fc6e174 Don't pass body into check_closure and child functions 2023-12-25 16:28:56 +00:00
Michael Goulet
bacfa976ca Remove unnecessary body_expr_count 2023-12-25 16:28:56 +00:00
bors
f8fe517144 Auto merge of #116274 - RalfJung:soft_unstable, r=cjgillot
make soft_unstable show up in future breakage reports

If we want to break these in the future, let's warn users of affected crates.
2023-12-25 16:26:15 +00:00
bors
71696e516d Auto merge of #119226 - Mark-Simulacrum:format-efficiency, r=TaKO8Ki
Improve coding efficiency for RawDefId

This copies the scheme already used for LazyArray, cutting a couple hundred kilobytes from libcore's metadata.
2023-12-25 14:28:00 +00:00
Camille GILLOT
8bb74c0187 Pass DeadItem and lint as consistent group in dead-code. 2023-12-25 13:15:28 +00:00
jyn
0e88874292 fix ./configure --set change-id 2023-12-25 08:04:00 -05:00
bors
13ea97cb14 Auto merge of #119292 - onur-ozkan:share-make-with-rustdoc, r=albertlarsan68
bootstrap: use same make flags with rustdoc

Keeping same `MAKEFLAGS` and `MFLAGS` for rustdoc should allow rustdoc to use the same jobserver.
2023-12-25 12:31:34 +00:00
onur-ozkan
c350d3c5dd bootstrap: use same make flags with rustdoc
Keeping same `MAKEFLAGS` and `MFLAGS` for rustdoc
should allow rustdoc to use the same jobserver.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-12-25 14:55:22 +03:00
bors
f2348fb29a Auto merge of #119122 - matthewjasper:if-let-guard-scoping, r=TaKO8Ki
Give temporaries in if let guards correct scopes

Temporaries in if-let guards have scopes that escape the match arm, this causes problems because the drops might be for temporaries that are not storage live. This PR changes the scope of temporaries in if-let guards to be limited to the arm:

```rust
_ if let Some(s) = std::convert::identity(&Some(String::new())) => {}
//                Temporary for Some(String::new()) is dropped here ^
```

We also now deduplicate temporaries between copies of the guard created for or-patterns:

```rust
// Only create a single Some(String::new()) temporary variable
_ | _ if let Some(s) = std::convert::identity(&Some(String::new())) => {}
```

This changes MIR building to pass around `ExprId`s rather than `Expr`s so that we have a way to index different expressions.

cc #51114
Closes #116079
2023-12-25 04:06:58 +00:00
bors
b87f649a5d Auto merge of #119283 - GuillaumeGomez:warning-block-pos, r=notriddle
Fix display of warning block if it is first element of the top doc block

It fixes the display of the warning block "i" element in case it is the first element:

![Screenshot from 2023-12-23 11-15-48](https://github.com/rust-lang/rust/assets/3050060/99b6796e-2a09-4053-813e-84288ce76c4c)

It now looks like this:

![image](https://github.com/rust-lang/rust/assets/3050060/306b4cf1-3a7d-4681-b0cf-3e721186bfe8)

The update for the `browser-ui-test` framework is because it didn't detect correctly pseudo elements if they ended with a digit or a dash.

r? `@notriddle`
2023-12-25 02:08:21 +00:00
AlexBuz
3896f0bb9b
Fix doc typo for read_exact_at 2023-12-24 19:28:03 -06:00
bors
471dcbdb09 Auto merge of #119274 - RalfJung:raw-ptr-pattern-ice, r=compiler-errors
fix ICE when using raw ptr in a pattern

Fixes https://github.com/rust-lang/rust/issues/119270
2023-12-25 00:03:59 +00:00
lch361
c082c1c4c3 Documented unsafe blocks 2023-12-25 01:59:37 +03:00