Commit Graph

234496 Commits

Author SHA1 Message Date
bors
03c199af8e Auto merge of #116054 - matthiaskrgr:rollup-3pusno6, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #114379 (Command: also print removed env vars)
 - #116034 (add UI test for delimiter errors)
 - #116036 (tests/ui: Split large_moves.rs and move to lint/large_assignments)
 - #116038 (Fall back to _SC_NPROCESSORS_ONLN if sched_getaffinity returns an empty mask)
 - #116039 (Account for nested `impl Trait` in TAIT)
 - #116041 (Add note to `is_known_rigid`)
 - #116049 (give FutureIncompatibilityReason variants more explicit names)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-09-22 10:34:45 +00:00
Matthias Krüger
1a18ec0dcf
Rollup merge of #116049 - RalfJung:future-incompat, r=Nilstrieb
give FutureIncompatibilityReason variants more explicit names

Also make the `reason` field mandatory when declaring a lint, to make sure this is a deliberate decision.
2023-09-22 12:15:28 +02:00
Matthias Krüger
66f272d6ca
Rollup merge of #116041 - compiler-errors:rigid-note, r=RalfJung
Add note to `is_known_rigid`

Adds a note requested by `@RalfJung` in https://github.com/rust-lang/rust/pull/114941#discussion_r1329963704

Let me know if there are any other fns that need documentation, I could throw them into this PR too :)
2023-09-22 12:15:28 +02:00
Matthias Krüger
fc4cfe01f6
Rollup merge of #116039 - estebank:nested-tait, r=compiler-errors
Account for nested `impl Trait` in TAIT

Fix #116031.

r? `@compiler-errors`
2023-09-22 12:15:27 +02:00
Matthias Krüger
faf13dd112
Rollup merge of #116038 - the8472:panic-on-sched_getaffinity-bug, r=cuviper
Fall back to _SC_NPROCESSORS_ONLN if sched_getaffinity returns an empty mask

Followup to #115946
A gentler fix for #115868, one that doesn't panic, [suggested on zulip](https://rust-lang.zulipchat.com/#narrow/stream/259402-t-libs.2Fmeetings/topic/Meeting.202023-09-19/near/391942927)

In that situation - on the buggy kernel versions - a zero-mask means no affinities have been set so `_SC_NPROCESSORS_ONLN` provides the right value.
2023-09-22 12:15:27 +02:00
Matthias Krüger
06608c7860
Rollup merge of #116036 - Enselic:split-large_moves, r=oli-obk
tests/ui: Split large_moves.rs and move to lint/large_assignments

To make failing tests easier to debug with `--emit=mir`, etc.

Don't bother with `revisions: attribute option` for both tests though. Seems sufficient to just have that on one of the tests.

`git show -M --find-renames=40%` makes the diff easier to review. Or note that before this change we had one test with 4 errors, now we have 2 tests with 2 errors each.

r? `@oli-obk`

Part of https://github.com/rust-lang/rust/issues/83518
2023-09-22 12:15:26 +02:00
Matthias Krüger
d5e7df3dbf
Rollup merge of #116034 - chenyukang:yukang-98601-add-ui-testcase, r=estebank
add UI test for delimiter errors

Fixes #98601
from https://github.com/rust-lang/rust/issues/98601#issuecomment-1721515067
r? `@estebank`
2023-09-22 12:15:26 +02:00
Matthias Krüger
9887dfab2c
Rollup merge of #114379 - RalfJung:command-removed-env-vars, r=m-ou-se
Command: also print removed env vars

There is no real shell syntax for unsetting an env var so easily, so we have to make one up. But we already do that for showing the 'program' name so I hope that's okay here, too. No strong opinion on what that should look like, I went with `unset(VAR_NAME)` for now.
2023-09-22 12:15:25 +02:00
bors
5a4e47ebed Auto merge of #114780 - RalfJung:io-safety, r=Amanieu
add more explicit I/O safety documentation

Fixes https://github.com/rust-lang/unsafe-code-guidelines/issues/434
Cc https://github.com/rust-lang/rust/issues/114167
Cc `@Manishearth` `@sunfishcode` `@joshtriplett`
2023-09-22 08:47:51 +00:00
Ralf Jung
7abbb9a4ff hide rustc line numbers in test 2023-09-22 10:37:40 +02:00
bors
8759de0a49 Auto merge of #114776 - fee1-dead-contrib:enable-effects-in-libcore, r=oli-obk
Enable effects for libcore

~~r? `@oli-obk~~`

forgot you are on vacation, oops
2023-09-22 07:00:52 +00:00
Ralf Jung
5586c2a68f make the reason: field mandatory for @future_incompatible lints 2023-09-22 08:59:32 +02:00
Ralf Jung
e888d470e9 give FutureIncompatibilityReason variants more explicit names 2023-09-22 08:51:18 +02:00
bors
aace2dfa37 Auto merge of #115910 - eduardosm:lang-fns-target-features, r=cjgillot
Prevent using `#[target_feature]` on lang item functions

Fixes https://github.com/rust-lang/rust/issues/109411 and also prevents from using `#[target_feature]` on other `fn` lang items to mitigate the concerns from https://github.com/rust-lang/rust/issues/109411#issuecomment-1477030273.
2023-09-22 05:07:45 +00:00
Michael Goulet
7fc081b4d9 Add note to is_known_rigid 2023-09-22 01:02:38 +00:00
bors
b757318718 Auto merge of #115920 - Zoxc:depkind-u16, r=cjgillot
Move `DepKind` to `rustc_query_system` and define it as `u16`

This moves the `DepKind` type to `rustc_query_system` where it's defined with an inner `u16` field. This decouples it from `rustc_middle` and is a step towards letting other crates define dep kinds. It also allows some type parameters to be removed. The `DepKind` trait is replaced with a `Deps` trait. That's used when some operations or information about dep kinds which is unavailable in `rustc_query_system` are still needed.

r? `@cjgillot`
2023-09-22 00:46:13 +00:00
Deadbeef
ab168b6ef3 fix clippy errors (ignore effects in certainty) 2023-09-22 00:05:52 +00:00
bors
99b63d068b Auto merge of #115897 - eduardosm:check-fn-sig, r=compiler-errors
rustc_hir_analysis: add a helper to check function the signature mismatches

This function is now used to check `#[panic_handler]`, `start` lang item, `main`, `#[start]` and intrinsic functions.

The diagnosis produced are now closer to the ones produced by trait/impl method signature mismatch.

This is the first time I do anything with rustc_hir_analysis/rustc_hir_typeck, so comments and suggestions about things I did wrong or that could be improved will be appreciated.
2023-09-21 22:59:13 +00:00
bors
b3aa8e7168 Auto merge of #115864 - compiler-errors:rpitit-sugg, r=estebank
Suggest desugaring to return-position `impl Future` when an `async fn` in trait fails an auto trait bound

First commit allows us to store the span of the `async` keyword in HIR.

Second commit implements a suggestion to desugar an `async fn` to a return-position `impl Future` in trait to slightly improve the `Send` situation being discussed in #115822.

This suggestion is only made when `#![feature(return_type_notation)]` is not enabled -- if it is, we should instead suggest an appropriate where-clause bound.
2023-09-21 21:12:32 +00:00
bors
f73d376fb6 Auto merge of #115230 - Vtewari2311:mod-hurd-latest, r=b-naber
added support for GNU/Hurd

adding support for i686-unknown-hurd-gnu
2023-09-21 19:24:01 +00:00
Michael Goulet
9072415252 Suggest desugaring to RPITIT when AFIT is required to be an auto trait 2023-09-21 19:18:14 +00:00
Michael Goulet
087a571e70 Record asyncness span in HIR 2023-09-21 19:18:14 +00:00
Martin Nordholts
d016e9a686 tests/ui: Split large_moves.rs and move to lint/large_assignments
To make failing tests easier to debug with --emit=mir, etc.
2023-09-21 21:00:11 +02:00
The 8472
31cfa4a956 Fall back to _SC_NPROCESSORS_ONLN if sched_getaffinity returns an empty mask 2023-09-21 20:05:24 +02:00
Esteban Küber
f2ede49c2f Account for nested impl Trait in TAIT
Fix #116031.
2023-09-21 17:47:09 +00:00
bors
24b45c3bdc Auto merge of #114399 - Zalathar:no-renumber, r=jackh726
coverage: Don't bother renumbering expressions on the Rust side

The LLVM API that we use to encode coverage mappings already has its own code for removing unused coverage expressions and renumbering the rest.

This lets us get rid of our own complex renumbering code, making it easier to change our coverage code in other ways.

---

Now that we have tests for coverage mappings (#114843), I've been able to verify that this PR doesn't make the coverage mappings worse, thanks to an explicit simplification step.
2023-09-21 17:29:30 +00:00
Martin Nordholts
afdd468ab8 tests/ui: Fix large_moves attribute cfg
We only want the attribute for the attribute revision.
2023-09-21 18:38:24 +02:00
Samuel Thibault
dcea7709f2 added support for GNU/Hurd 2023-09-21 17:31:25 +02:00
yukang
f7cd892b5a add UI test for delimiter errors 2023-09-21 23:20:47 +08:00
John Kåre Alsaker
1806efe7f2 Move DepKind to rustc_query_system and define it as u16 2023-09-21 17:06:14 +02:00
bors
0fd7ce99b0 Auto merge of #116010 - RalfJung:more-typed-immediates, r=oli-obk
interpret: more consistently use ImmTy in operators and casts

The diff in src/tools/miri/src/shims/x86/sse2.rs should hopefully suffice to explain why this is nicer. :)
2023-09-21 14:02:55 +00:00
bors
66ab7e6883 Auto merge of #116027 - GuillaumeGomez:rollup-3zdi9lf, r=GuillaumeGomez
Rollup of 5 pull requests

Successful merges:

 - #115257 (Improve invalid UTF-8 lint by finding the expression initializer)
 - #115936 (Prevent promotion of const fn calls in inline consts)
 - #115972 (rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const)
 - #116007 (Call panic_display directly in const_panic_fmt.)
 - #116019 (Delete obsolete `--disable-per-crate-search` rustdoc flag)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-09-21 12:04:33 +00:00
Guillaume Gomez
e9aee820b3
Rollup merge of #116019 - dtolnay:percratesearch, r=GuillaumeGomez
Delete obsolete `--disable-per-crate-search` rustdoc flag

This unstable flag is unused by rustdoc since ef96d573bf.

We should avoid landing this until after https://github.com/rust-lang/docs.rs/pull/2225 is deployed to docs.rs.
2023-09-21 13:25:40 +02:00
Guillaume Gomez
0d2c603b12
Rollup merge of #116007 - m-ou-se:const-panic-fmt-panic-display, r=oli-obk
Call panic_display directly in const_panic_fmt.

`panic_str` just directly calls `panic_display`. The only reason `panic_str` exists, is for a lint to detect an expansion of `panic_2015!(expr)` (which expands to `panic_str`).

It is `panic_display` that is hooked by const-eval, which is the reason we call it here.

Part of https://github.com/rust-lang/rust/issues/116005

r? ``@oli-obk``
2023-09-21 13:25:40 +02:00
Guillaume Gomez
208f6ed95c
Rollup merge of #115972 - RalfJung:const-consistency, r=oli-obk
rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const

Also, be more consistent with the `to/eval_bits` methods... we had some that take a type and some that take a size, and then sometimes the one that takes a type is called `bits_for_ty`.

Turns out that `ty::Const`/`mir::ConstKind` carry their type with them, so we don't need to even pass the type to those `eval_bits` functions at all.

However this is not properly consistent yet: in `ty` we have most of the methods on `ty::Const`, but in `mir` we have them on `mir::ConstKind`. And indeed those two types are the ones that correspond to each other. So `mir::ConstantKind` should actually be renamed to `mir::Const`. But what to do with `mir::Constant`? It carries around a span, that's really more like a constant operand that appears as a MIR operand... it's more suited for `syntax.rs` than `consts.rs`, but the bigger question is, which name should it get if we want to align the `mir` and `ty` types? `ConstOperand`? `ConstOp`? `Literal`? It's not a literal but it has a field called `literal` so it would at least be consistently wrong-ish...

``@oli-obk`` any ideas?
2023-09-21 13:25:39 +02:00
Guillaume Gomez
d05c5fecde
Rollup merge of #115936 - oli-obk:inline_const_promotion, r=RalfJung
Prevent promotion of const fn calls in inline consts

We don't wanna make that mistake we did for statics and consts worse by letting more code use it.

r? ``@RalfJung``

cc https://github.com/rust-lang/rust/issues/76001
2023-09-21 13:25:38 +02:00
Guillaume Gomez
9ce64bae94
Rollup merge of #115257 - Urgau:invalid-utf8-walk-up-hir, r=Nilstrieb
Improve invalid UTF-8 lint by finding the expression initializer

This PR introduce a small mechanism to walk up the HIR through bindings, if/else, consts, ... when trying lint on invalid UTF-8.

Fixes https://github.com/rust-lang/rust/issues/115208
2023-09-21 13:25:38 +02:00
Oli Scherer
9c762b58ba Prevent promotion of const fn calls in inline consts 2023-09-21 09:00:22 +00:00
Oli Scherer
44e199bf30 Add regression test 2023-09-21 08:50:08 +00:00
Zalathar
041a232b62 coverage: Don't bother renumbering expressions on the Rust side
The LLVM API that we use to encode coverage mappings already has its own code
for removing unused coverage expressions and renumbering the rest.

This lets us get rid of our own complex renumbering code, making it easier to
change our coverage code in other ways.
2023-09-21 18:32:49 +10:00
Zalathar
527c629cd9 coverage: Explicitly simplify coverage expressions in codegen
After coverage instrumentation and MIR transformations, we can sometimes end up
with coverage expressions that always have a value of zero. Any expression
operand that refers to an always-zero expression can be replaced with a literal
`Operand::Zero`, making the emitted coverage mapping data smaller and simpler.

This simplification step is mostly redundant with the simplifications performed
inline in `expressions_with_regions`, except that it does a slightly more
thorough job in some cases (because it checks for always-zero expressions
*after* other simplifications).

However, adding this simplification step will then let us greatly simplify that
code, without affecting the quality of the emitted coverage maps.
2023-09-21 18:32:49 +10:00
Zalathar
659575aade coverage: Make the zero counter a constant 2023-09-21 18:32:49 +10:00
Urgau
f156d3bc57 Improve invalid UTF-8 lint by finding the expression initializer 2023-09-21 10:16:29 +02:00
bors
e4a361a48a Auto merge of #115996 - lcnr:intercrate_ambiguity_causes-uwu, r=compiler-errors
implement `intercrate_ambiguity_causes` in the new solver

I added some comments but this is still somewhat of a mess. I think we should for the most part be able to treat all of this as a black box, so I can accept that this code isn't too great.

I also believe that some of the weirdness here is unavoidable, as proof trees - and their visitor - hide semantically relevant information, so they cannot perfectly represent the actual solver behavior.

There are some known bugs here when testing with `./x.py test tests/ui --bless -- --target-rustcflags -Ztrait-solver=next-coherence`. While I haven't diagnosed them all in detail I believe we are able to handle them all separately

- `structurally_normalize` currently does not normalize opaque types, resulting in divergence between the solver internal `trait_ref_is_knowable` and the one when computing intercrate ambiguity causes.
- we don't add an `intercrate_ambiguity_cause` for reserved impls
- we should `deeply_normalize` the trait ref before printing it, that requires a "best effort" version of `deeply_normalize`

r? `@compiler-errors`
2023-09-21 07:58:28 +00:00
lcnr
614760f612 review 2023-09-21 08:57:47 +02:00
lcnr
8167a25e4e w 2023-09-21 08:44:12 +02:00
lcnr
8e139eefaf slight refactor, add comment 2023-09-21 08:40:36 +02:00
lcnr
8024c69c29 HACK: avoid hang in structurally_normalize 2023-09-21 08:17:58 +02:00
lcnr
8eade3aa71 update tests 2023-09-21 08:17:58 +02:00
lcnr
de53877f8b proof trees: use for intercrate_ambiguity_causes 2023-09-21 08:17:58 +02:00