Commit graph

241529 commits

Author SHA1 Message Date
Matthew Jasper d437a111f5 Give temporaries in if let guards correct scopes
- Make temporaries in if-let guards be the same variable in MIR when
  the guard is duplicated due to or-patterns.
- Change the "destruction scope" for match arms to be the arm scope rather
  than the arm body scope.
- Add tests.
2023-12-21 13:35:56 +00:00
Matthew Jasper 68d684cbff Pass THIR ExprIds in MIR building 2023-12-18 16:54:58 +00:00
bors e004adb556 Auto merge of #119069 - matthiaskrgr:rollup-xxk4m30, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #118852 (coverage: Skip instrumenting a function if no spans were extracted from MIR)
 - #118905 ([AIX] Fix XCOFF metadata)
 - #118967 (Add better ICE messages for some undescriptive panics)
 - #119051 (Replace `FileAllocationInfo` with `FileEndOfFileInfo`)
 - #119059 (Deny `~const` trait bounds in inherent impl headers)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-12-18 08:03:22 +00:00
Matthias Krüger c088f6af8f
Rollup merge of #119059 - fmease:no-tilde-const-in-inh-impl-headers, r=fee1-dead
Deny `~const` trait bounds in inherent impl headers

Follow-up to #117817.
Implements https://github.com/rust-lang/rust/pull/117817#discussion_r1416213747.

Fixes #117004.

r? fee1-dead or compiler
2023-12-18 08:08:24 +01:00
Matthias Krüger 10ad10ee2a
Rollup merge of #119051 - ChrisDenton:wine, r=workingjubilee
Replace `FileAllocationInfo` with `FileEndOfFileInfo`

This fixes WINE support
2023-12-18 08:08:24 +01:00
Matthias Krüger 578a7dd35e
Rollup merge of #118967 - RossSmyth:panic-messages, r=TaKO8Ki
Add better ICE messages for some undescriptive panics

Add some better messages at some panics

re: #118955

I took a look at some others but either was not able to figure out what they did, or it was unclear what they should say instead. For example in the query system whether each time a poisoned value is matched upon if they should all just call `FatalError.raise()`
2023-12-18 08:08:23 +01:00
Matthias Krüger 18294d6e1d
Rollup merge of #118905 - bzEq:revert-u64-on-xcoff, r=WaffleLapkin
[AIX] Fix XCOFF metadata

#118344  accidentally changed the way to get metadata from XCOFF file and broken our internal CI.

This PR reverts part of #118344 .
2023-12-18 08:08:23 +01:00
Matthias Krüger 418ae3e9a0
Rollup merge of #118852 - Zalathar:no-spans, r=cjgillot
coverage: Skip instrumenting a function if no spans were extracted from MIR

The immediate symptoms of #118643 were fixed by #118666, but some users reported that their builds now encounter another coverage-related ICE:

```
error: internal compiler error: compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs:98:17: A used function should have had coverage mapping data but did not: (...)
```

I was able to reproduce at least one cause of this error: if no relevant spans could be extracted from a function, but the function contains `CoverageKind::SpanMarker` statements, then codegen still thinks the function is instrumented and complains about the fact that it has no coverage spans.

This PR prevents that from happening in two ways:
- If we didn't extract any relevant spans from MIR, skip instrumenting the entire function and don't create a `FunctionCoverateInfo` for it.
- If coverage codegen sees a `CoverageKind::SpanMarker` statement, skip it early and avoid creating `func_coverage`.

---

Fixes #118850.
2023-12-18 08:08:22 +01:00
bors cda4736f1e Auto merge of #119063 - nnethercote:dcx, r=compiler-errors
Consistent `Handler` naming

This PR implements the renaming described in https://github.com/rust-lang/compiler-team/issues/699.

r? `@compiler-errors`
2023-12-18 06:03:53 +00:00
Nicholas Nethercote 1e831e38ce Fix up some ui-fulldeps tests. 2023-12-18 16:06:22 +11:00
Nicholas Nethercote f6aa418c9f Rename many DiagCtxt and EarlyDiagCtxt locals. 2023-12-18 16:06:22 +11:00
Nicholas Nethercote d58e372853 Rename many EarlyDiagCtxt arguments. 2023-12-18 16:06:22 +11:00
Nicholas Nethercote f422dca3ae Rename many DiagCtxt arguments. 2023-12-18 16:06:22 +11:00
Nicholas Nethercote 4dc7fab56f Rename __diagnostic_handler_sess as _sess. 2023-12-18 16:06:22 +11:00
Nicholas Nethercote e97d353359 Rename default_handler as default_dcx. 2023-12-18 16:06:22 +11:00
Nicholas Nethercote e13b5c8efb Rename new_handler as new_dcx. 2023-12-18 16:06:22 +11:00
Nicholas Nethercote 7b8644e5cf Rename DiagnosticDeriveKind::Diagnostic::handler as DiagnosticDeriveKind::Diagnostic::dcx. 2023-12-18 16:06:22 +11:00
Nicholas Nethercote f7125f1f66 Rename CollectProcMacros::handler as CollectProcMacros::dcx. 2023-12-18 16:06:22 +11:00
Nicholas Nethercote b107ab81ad Rename EarlyDiagCtxt::handler as EarlyDiagCtxt::dcx. 2023-12-18 16:06:22 +11:00
Nicholas Nethercote 20cb12ede1 Rename SilentEmitter::fatal_handler as SilentEmitter::fatal_dcx. 2023-12-18 16:06:22 +11:00
Nicholas Nethercote 55bafab566 Rename UnstableOptions::diagnostic_handler_flags as UnstableOptions::dcx_flags. 2023-12-18 16:06:21 +11:00
Nicholas Nethercote 7c656bc05b Rename CodegenContext::create_diag_handler as CodegenContext::create_dcx. 2023-12-18 16:06:21 +11:00
Nicholas Nethercote dea752e53d Rename ShowSpanVisitor::span_diagnostic as ShowSpanVisitor::dcx. 2023-12-18 16:06:21 +11:00
Nicholas Nethercote 5ad7144d1b Rename AstValidator::err_handler as AstValidator::dcx. 2023-12-18 16:06:21 +11:00
Nicholas Nethercote 9f3f1ca8c4 Rename DiagnosticBuilder::handler as DiagnosticBuilder::dcx. 2023-12-18 16:06:21 +11:00
Nicholas Nethercote d1d0896c40 Rename ParseSess::with_span_handler as ParseSess::with_dcx. 2023-12-18 16:06:21 +11:00
Nicholas Nethercote 73bac456d4 Rename Parser::span_diagnostic as Parser::dcx. 2023-12-18 16:06:21 +11:00
Nicholas Nethercote 09af8a667c Rename Session::span_diagnostic as Session::dcx. 2023-12-18 16:06:21 +11:00
Nicholas Nethercote 9df1576e1d Rename ParseSess::span_diagnostic as ParseSess::dcx. 2023-12-18 16:06:21 +11:00
Nicholas Nethercote 9b1f87c7e8 Rename HandlerFlags as DiagCtxtFlags. 2023-12-18 16:06:21 +11:00
Nicholas Nethercote cce1701c4c Rename EarlyErrorHandler as EarlyDiagCtxt. 2023-12-18 16:06:21 +11:00
Nicholas Nethercote 45f347681d Rename HandlerInner as DiagCtxtInner. 2023-12-18 16:06:21 +11:00
Nicholas Nethercote cde19c016e Rename Handler as DiagCtxt. 2023-12-18 16:06:19 +11:00
bors 8681e077b8 Auto merge of #119007 - weihanglo:update-cargo, r=weihanglo
Update cargo

11 commits in 1aa9df1a5be205cce621f0bc0ea6062a5e22a98c..1a2666ddd14cf0a255d4ddb61c63531c259a7b39
2023-12-12 14:52:31 +0000 to 2023-12-17 17:53:53 +0000
- chore: downgrade to openssl v1.1.1 (rust-lang/cargo#13179)
- docs(home): prepare the changelog for 0.5.9 (rust-lang/cargo#13177)
- refactor: Pull name validation into `util_schemas` (rust-lang/cargo#13166)
- chore(deps): bump zerocopy from 0.7.29 to 0.7.31 (rust-lang/cargo#13174)
- Replace SHGetFolderPathW with SHGetKnownFolderPath (rust-lang/cargo#13173)
- chore(bump-check): dont check `home` against beta/stable branches (rust-lang/cargo#13167)
- fix: Fill in more empty name holes (rust-lang/cargo#13164)
- Do not allow empty name in package ID spec (rust-lang/cargo#13152)
- chore(deps): update rust crate openssl to 0.10.61 (rust-lang/cargo#13159)
- `all-static` feature should include `vendored-libgit2` (rust-lang/cargo#13134)
- doc/registry-web-api: Adjust success response code documentation (rust-lang/cargo#13160)

r? ghost
2023-12-18 04:04:55 +00:00
bors 321b6565a5 Auto merge of #118657 - petrochenkov:feedvis, r=cjgillot
resolve: Replace visibility table in resolver outputs with query feeding

Also feed missing visibilities for import stems and trait impl items, which were previously evaluated lazily.

I suspect that in general this approach should work for queries that are 1) executed for most keys and 2) have results that are cheap to hash (do not have spans, in particular).
Visibility query matches that description.
2023-12-18 02:06:02 +00:00
Kai Luo a8e1da3171 Address comment 2023-12-18 09:41:36 +08:00
León Orell Valerian Liehr 4a5dd169f7
Deny ~const trait bounds in inherent impl headers 2023-12-18 01:48:49 +01:00
Vadim Petrochenkov be321aa473 resolve: Replace visibility table in resolver outputs with query feeding
Also feed missing visibilities for import stems and trait impl items, which were previously evaluated lazily.
2023-12-18 02:26:55 +03:00
bors 43dcc9b786 Auto merge of #114962 - darklyspaced:debug, r=est31
adds a column number to `dbg!()`

this would be very nice to have for a few reasons:
1. the rfc, when deciding not to add column numbers to macro, failed to acknowledge any potential ambiguous cases -- such as the one provided in #114910 -- which do exist
2. would be able to consistently and easily jump directly to the `dbg!()` regardless of the sutation
3. takes up, at a maximum, 3 characters of _horizontal_ screen space

fixes #114910
2023-12-17 23:01:18 +00:00
Weihang Lo 8ed5b293f4
Update cargo 2023-12-17 17:58:57 -05:00
bors 6a62871320 Auto merge of #119053 - matthiaskrgr:rollup-hky3ld3, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #118880 (More expressions correctly are marked to end with curly braces)
 - #118928 (fix: Overlapping spans in delimited meta-vars)
 - #119022 (Remove unnecessary constness from ProjectionCandidate)
 - #119052 (Avoid overflow in GVN constant indexing.)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-12-17 20:57:02 +00:00
Matthias Krüger 39fe059a35
Rollup merge of #119052 - cjgillot:gvn-index-overflow, r=compiler-errors
Avoid overflow in GVN constant indexing.

Fixes https://github.com/rust-lang/rust/issues/118992
Fixes https://github.com/rust-lang/rust/issues/119008
2023-12-17 21:30:00 +01:00
Matthias Krüger 677bb6cd60
Rollup merge of #119022 - compiler-errors:no-constness, r=fee1-dead
Remove unnecessary constness from ProjectionCandidate

Constness in an item bound will be represented by an effect param, so no need to record constness here.

r? fee1-dead
2023-12-17 21:30:00 +01:00
Matthias Krüger 93d3a4231e
Rollup merge of #118928 - EliseZeroTwo:EliseZeroTwo/fix-issue-118786, r=cjgillot
fix: Overlapping spans in delimited meta-vars

Closes #118786

Delimited meta-vars inside of MBE's spans were set to have the same opening and closing position resulting in an ICE when debug assertions were enabled and an error was present in the templated code.

This ensures that the spans do not overlap, whilst still having the spans point at the usage of the meta-var inside the macro definition.

It includes a regression test.

🖤
2023-12-17 21:29:59 +01:00
Matthias Krüger 6269bf1a3a
Rollup merge of #118880 - GearsDatapacks:issue-118859-fix, r=compiler-errors
More expressions correctly are marked to end with curly braces

Fixes #118859, and replaces the mentioned match statement with an exhaustive list, so that this code doesn't get overlooked in the future
2023-12-17 21:29:59 +01:00
Camille GILLOT 8022057ebb Avoid overflow in GVN constant indexing. 2023-12-17 19:50:38 +00:00
bors 4283aeaca5 Auto merge of #119048 - aliemjay:perf-register-pred, r=compiler-errors
don't fold ParamEnv in register_predicate_obligation

\>5% perf gain for diesel!
2023-12-17 18:27:09 +00:00
Chris Denton e585b0ed58
Use FileEndOfFileInfo, not FileAllocationInfo
This fixes WINE support
2023-12-17 17:57:33 +00:00
Ali MJ Al-Nasrawy e0df93b07e don't fold ParamEnv in register_predicate_obligation 2023-12-17 17:24:04 +00:00
bors d14e52b47a Auto merge of #117884 - bvanjoi:fix-117794, r=compiler-errors
skip rpit constraint checker if borrowck return type error

Fixes #117794
Fixes #117886
Fixes #119025

Prior to change #117418, the value of `concrete_opaque_types` for `mir_borrock(T:🅰️:opaque)` was `None`. However, due to modifications in `body.local_decls`, the return value had been changed.

The changed of `body.local_decls` has let to the addition of `ty:Error` to `infcx.opaque_type_storage.opaque_types` during `TypeChecker::equate_inputs_and_outputs`. This is due to it utilizing the output of a function signature that was appended during `construct_error`(which previously only appended a `ty::Error`) and then execute `TypeChecker::Related_types`.

Therefore, in this PR, I've implemented a condition to bypass the rpit check when an error is encountered.

r? `@compiler-errors`
2023-12-17 16:28:37 +00:00