Commit Graph

243346 Commits

Author SHA1 Message Date
Michael Woerister ac58f9ae03 Update measureme crate to version 11 2024-01-13 16:32:03 +01:00
bors 284cb714d2 Auto merge of #119871 - nnethercote:overhaul-treat-err-as-bug, r=compiler-errors
Overhaul `-Ztreat-err-as-bug`

It's current behaviour is surprising, in a bad way. This also makes the implementation more complex than it needs to be.

r? `@oli-obk`
2024-01-13 08:15:52 +00:00
bors 7585c62658 Auto merge of #119473 - Urgau:check-cfg-explicit-none, r=petrochenkov
Add explicit `none()` value variant in check-cfg

This PR adds an explicit none value variant in check-cfg values: `values(none())`.

Currently the only way to define the none variant is with an empty `values()` which means that if someone has a cfg that takes none and strings they need to use two invocations: `--check-cfg=cfg(foo) --check-cfg=cfg(foo, values("bar"))`.
Which would now be `--check-cfg=cfg(foo, values(none(),"bar"))`, this is simpler and easier to understand.

`--check-cfg=cfg(foo)`, `--check-cfg=cfg(foo, values())` and `--check-cfg=cfg(foo, values(none()))` would be equivalent.

*Another motivation for doing this is to make empty `values()` actually means no-values, but this is orthogonal to this PR and adding `none()` is sufficient in it-self.*

`@rustbot` label +F-check-cfg
r? `@petrochenkov`
2024-01-13 06:17:46 +00:00
bors 89110dafe7 Auto merge of #118947 - Bryanskiy:delegStep1, r=petrochenkov,lcnr
Delegation implementation: step 1

See https://github.com/rust-lang/rust/issues/118212 for more details.

r? `@petrochenkov`
2024-01-13 04:19:17 +00:00
bors f1f8687b06 Auto merge of #118924 - Urgau:check-cfg-exclude-well-known-from-diag, r=petrochenkov
Exclude well known names from showing a suggestion in check-cfg

This PR adds an exclusion for well known names from showing in suggestions of check-cfg/`unexpected_cfgs`.

Follow-up to https://github.com/rust-lang/rust/pull/118213 and fixes https://github.com/rust-lang/rust/pull/118213#issuecomment-1854189934.

r? `@petrochenkov`
2024-01-13 02:13:20 +00:00
bors 182537456b Auto merge of #119909 - weihanglo:update-cargo, r=weihanglo
Update cargo

8 commits in 3e428a38a34e820a461d2cc082e726d3bda71bcb..84976cd699f4aea56cb3a90ce3eedeed9e20d5a5
2024-01-09 20:46:36 +0000 to 2024-01-12 15:55:43 +0000
- fix(resolver): do not panic when sorting empty summaries (rust-lang/cargo#13287)
- Implementation of shallow libgit2 fetches behind an unstable flag (rust-lang/cargo#13252)
- Add documentation entry for unstable `--output-format` flag (rust-lang/cargo#13284)
- doc: add `public` info in `cargo-add` man page. (rust-lang/cargo#13272)
- More docs on prerelease compat (rust-lang/cargo#13286)
- Add unstable `--output-format` option to  `cargo rustdoc` (rust-lang/cargo#12252)
- feat: Add `rustc` style errors for manifest parsing (rust-lang/cargo#13172)
- Document why `du` function uses mutex (rust-lang/cargo#13273)

r? ghost
2024-01-13 00:14:45 +00:00
Nicholas Nethercote f1ac54123f Don't consider delayed bugs for `-Ztreat-err-as-bug`.
`-Ztreat-err-as-bug` treats normal errors and delayed bugs equally,
which can lead to some really surprising results.

This commit changes `-Ztreat-err-as-bug` so it ignores delayed bugs,
unless they get promoted to proper bugs and are printed.

This feels to me much simpler and more logical. And it simplifies the
implementation:
- The `-Ztreat-err-as-bug` check is removed from in
  `DiagCtxt::{delayed_bug,span_delayed_bug}`.
- `treat_err_as_bug` doesn't need to count delayed bugs.
- The `-Ztreat-err-as-bug` panic message is simpler, because it doesn't
  have to mention delayed bugs.

Output of delayed bugs is now more consistent. They're always printed
the same way. Previously when they triggered `-Ztreat-err-as-bug` they
would be printed slightly differently, via `span_bug` in
`span_delayed_bug` or `delayed_bug`.

A minor behaviour change: the "no errors encountered even though
`span_delayed_bug` issued" printed before delayed bugs is now a note
rather than a bug. This is done so it doesn't get counted as an error
that might trigger `-Ztreat-err-as-bug`, which would be silly.
This means that if you use `-Ztreat-err-as-bug=1` and there are no
normal errors but there are delayed bugs, the first delayed bug will be
shown (and the panic will happen after it's printed).

Also, I have added a second note saying "those delayed bugs will now be
shown as internal compiler errors". I think this makes it clearer what
is happening, because the whole concept of delayed bugs is non-obvious.

There are some test changes.
- equality-in-canonical-query.rs: Minor output changes, and the error
  count reduces by one because the "no errors encountered even though
  `span_delayed_bug` issued" message is no longer counted as an error.
- rpit_tait_equality_in_canonical_query.rs: Ditto.
- storage-live.rs: The query stack disappears because these delayed bugs
  are now printed at the end, rather than when they are created.
- storage-return.rs, span_delayed_bug.rs: now need
  `-Zeagerly-emit-delayed-bugs` because they need the delayed bugs
  emitted immediately to preserve behaviour.
2024-01-13 09:59:56 +11:00
bors 3071aefdb2 Auto merge of #117321 - chenyukang:yukang-fix-117142, r=petrochenkov
Fix unused_parens issue when cast is followed LT

Fixes #117142

The original check only checks `a as (i32) < 0`, this fix extends it to handle `b + a as (i32) < 0`.

A better way is maybe we suggest `(a as i32) < 0` instead of suppressing the warning, maybe following PR could improve it.
2024-01-12 22:15:55 +00:00
Weihang Lo 1641d31ab2
Update cargo 2024-01-12 16:30:47 -05:00
bors 2319be8e26 Auto merge of #119452 - AngelicosPhosphoros:make_nonzeroint_get_assume_nonzero, r=scottmcm
Add assume into `NonZeroIntX::get`

LLVM currently don't support range metadata for function arguments so it fails to optimize non zero integers using their invariant if they are provided using by-value function arguments.

Related to https://github.com/rust-lang/rust/issues/119422
Related to https://github.com/llvm/llvm-project/issues/76628
Related to https://github.com/rust-lang/rust/issues/49572
2024-01-12 20:18:04 +00:00
Urgau 29afbbd5a9 Exclude well known names from showing a suggestion in check-cfg 2024-01-12 18:47:05 +01:00
bors ce1f2ccf5a Auto merge of #119889 - GuillaumeGomez:rollup-ah3dhya, r=GuillaumeGomez
Rollup of 6 pull requests

Successful merges:

 - #119817 (Remove special-casing around `AliasKind::Opaque` when structurally resolving in new solver)
 - #119819 (Check rust lints when an unknown lint is detected)
 - #119872 (Give me a way to emit all the delayed bugs as errors (add `-Zeagerly-emit-delayed-bugs`))
 - #119877 (Add more information to `visit_projection_elem`)
 - #119884 (Rename `--env` option flag to `--env-set`)
 - #119885 (Revert #113923)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-01-12 17:44:53 +00:00
Guillaume Gomez dafbe17a02
Rollup merge of #119885 - DianQK:revert-pr-113923, r=petrochenkov
Revert #113923

Per [#t-compiler/meetings > [weekly] 2024-01-11](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202024-01-11) discussion, revert #113923. Also revert associated #118568.

The PR #113923 causes the regression issue #118609. We need more time to find a proper solution.

Discussions start at [412365838](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202024-01-11/near/412365838) and continue to [412369643](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202024-01-11/near/412369643).

Fixes #118609.

r? compiler
2024-01-12 15:16:58 +01:00
Guillaume Gomez c997b29a3a
Rollup merge of #119884 - GuillaumeGomez:rename-env-opt, r=davidtwco
Rename `--env` option flag to `--env-set`

As discussed [on zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Stabilizing.20.60--env.60.20option.20flag.3F). We rename `--env` to not conflicting names with the [RFC](https://github.com/rust-lang/rfcs/pull/2794).

r? `@davidtwco`
2024-01-12 15:16:58 +01:00
Guillaume Gomez 4d12817716
Rollup merge of #119877 - celinval:smir-visit-projection, r=oli-obk
Add more information to `visit_projection_elem`

Without the starting place, it's hard to retrieve any useful information from visiting a projection.

Note: I still need to add a test.
2024-01-12 15:16:57 +01:00
Guillaume Gomez 504794b908
Rollup merge of #119872 - compiler-errors:eagerly-emit-delayed-bugs, r=oli-obk,nnethercote
Give me a way to emit all the delayed bugs as errors (add `-Zeagerly-emit-delayed-bugs`)

This is probably a *better* way to inspect all the delayed bugs in a program that what exists currently (and therefore makes it very easy to choose the right number `N` with `-Zemit-err-as-bug=N`, though I guess the naming is a bit ironic when you pair both of the flags together, but that feels like naming bikeshed more than anything).

This pacifies my only concern with https://github.com/rust-lang/rust/pull/119871#issuecomment-1888170259, because (afaict?) that PR doesn't allow you to intercept a delayed bug's stack trace anymore, which as someone who debugs the compiler a lot, is something that I can *promise* that I do.

r? `@nnethercote` or `@oli-obk`
2024-01-12 15:16:57 +01:00
Guillaume Gomez 737452a824
Rollup merge of #119819 - chenyukang:yukang-fix-118183-lint, r=davidtwco
Check rust lints when an unknown lint is detected

Fixes #118183
2024-01-12 15:16:56 +01:00
Guillaume Gomez 46c3c014eb
Rollup merge of #119817 - compiler-errors:normalize-opaques, r=lcnr
Remove special-casing around `AliasKind::Opaque` when structurally resolving in new solver

This fixes a few inconsistencies around where we don't eagerly resolve opaques to their (locally-defined) hidden types in the new solver. It essentially allows this code to work:
```rust
fn main() {
    type Tait = impl Sized;
    struct S {
        i: i32,
    }
    let x: Tait = S { i: 0 };
    println!("{}", x.i);
}
```

Since `Tait` is defined in `main`, we are able to poke through the type of `x` with deref.

r? lcnr
2024-01-12 15:16:56 +01:00
bors 174e73a3f6 Auto merge of #119396 - Nadrieril:intersection-tracking, r=WaffleLapkin
Exhaustiveness: track overlapping ranges precisely

The `overlapping_range_endpoints` lint has false positives, e.g. https://github.com/rust-lang/rust/issues/117648. I expected that removing these false positives would have too much of a perf impact but never measured it. This PR is an experiment to see if the perf loss is manageable.

r? `@ghost`
2024-01-12 11:29:06 +00:00
Bryanskiy d69cd6473c Delegation implementation: step 1 2024-01-12 14:11:16 +03:00
yukang ca421fe1d3 check rust lints when an unknown lint is detected 2024-01-12 18:50:36 +08:00
DianQK aa874c5513
Revert "Auto merge of #113923 - DianQK:restore-no-builtins-lto, r=pnkfelix"
This reverts commit 8c2b577217, reversing
changes made to 9cf18e98f8.
2024-01-12 18:23:04 +08:00
DianQK 6d29eac04b
Revert "Auto merge of #118568 - DianQK:no-builtins-symbols, r=pnkfelix"
This reverts commit 503e129328, reversing
changes made to 0e7f91b75e.
2024-01-12 18:22:39 +08:00
Guillaume Gomez 462bcac629 Rename `--env` option flag to `--env-set` 2024-01-12 11:02:57 +01:00
bors bfd799f1a5 Auto merge of #119879 - matthiaskrgr:rollup-y710der, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #119781 (fix typo)
 - #119865 (Set `c_str_literals` stabilization version back to `CURRENT_RUSTC_VERSION`)
 - #119866 (Convert `effects` description to doc comment)
 - #119868 (Register even erroneous impls)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-01-12 09:11:57 +00:00
Matthias Krüger d7a720a863
Rollup merge of #119868 - oli-obk:unknown_lifetime_ice, r=compiler-errors
Register even erroneous impls

Otherwise the specialization graph fails to pick it up, even though other code assumes that all impl blocks have an entry in the specialization graph.

also includes an unrelated cleanup of the specialization graph query

fixes  #119827
2024-01-12 08:23:59 +01:00
Matthias Krüger d61ac868f7
Rollup merge of #119866 - smoelius:patch-2, r=compiler-errors
Convert `effects` description to doc comment

So that it is visible here: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_feature/unstable/struct.Features.html#structfield.effects

r? `@fee1-dead`
2024-01-12 08:23:59 +01:00
Matthias Krüger c738e54f8f
Rollup merge of #119865 - eduardosm:bump-version-c_str_literals, r=Nilstrieb
Set `c_str_literals` stabilization version back to `CURRENT_RUSTC_VERSION`

 `c_str_literals`'s stabilization has been delayed to 1.77 (https://github.com/rust-lang/rust/pull/119528).
2024-01-12 08:23:58 +01:00
Matthias Krüger 5bef2e739f
Rollup merge of #119781 - Kleinmarb:master, r=Nilstrieb
fix typo
2024-01-12 08:23:58 +01:00
bors 2b1365b34f Auto merge of #119735 - lcnr:provisional-cache-readd, r=compiler-errors
next solver: provisional cache

this adds the cache removed in #115843. However, it should now correctly track whether a provisional result depends on an inductive or coinductive stack.

While working on this, I was using the following doc: https://hackmd.io/VsQPjW3wSTGUSlmgwrDKOA. I don't think it's too helpful to understanding this, but am somewhat hopeful that the inline comments are more useful.

There are quite a few future perf improvements here. Given that this is already very involved I don't believe it is worth it (for now). While working on this PR one of my few attempts to significantly improve perf ended up being unsound again because I was not careful enough 

r? `@compiler-errors`
2024-01-12 07:04:42 +00:00
bors 5431404b87 Auto merge of #118548 - Enselic:bench-padding, r=thomcc,ChrisDenton
libtest: Fix padding of benchmarks run as tests

### Summary

The first commit adds regression tests for libtest padding.

The second commit fixes padding for benches run as tests and updates the blessed output of the regression tests to make it clear what effect the fix has on padding.

Closes #104092 which is **E-help-wanted** and **regression-from-stable-to-stable**

### More details

Before this fix we applied padding _before_ manually doing what `convert_benchmarks_to_tests()` does which affects padding calculations. Instead use `convert_benchmarks_to_tests()` first if applicable and then apply padding afterwards so it becomes correct.

Benches should only be padded when run as benches to make it easy to compare the benchmark numbers. Not when run as tests.

r? `@ghost` until CI passes.
2024-01-12 05:06:03 +00:00
Michael Goulet 7df43d3c81 Give me a way to emit all the delayed bugs 2024-01-12 03:30:17 +00:00
Michael Goulet eb79bc0470 Good path bugs are just a flavor of delayed bug 2024-01-12 03:29:59 +00:00
bors 6029085a6f Auto merge of #119430 - NCGThompson:int-pow-bench, r=cuviper
Add Benchmarks for int_pow Methods.

There is quite a bit of room for improvement in performance of the `int_pow` family of methods. I added benchmarks for those functions. In particular, there are benchmarks for small compile-time bases to measure the effect of  #114390. ~~I added a lot (245), but all but 22 of them are marked with `#[ignore]`. There are a lot of macros, and I would appreciate feedback on how to simplify them.~~

~~To run benches relevant to #114390, use `./x bench core --stage 1 -- pow_base_const --include-ignored`.~~
2024-01-12 03:04:45 +00:00
Celina G. Val efab0dcb25 Add more information to `visit_projection_elem`
Without the starting place, it's hard to retrieve any useful information
from visiting a projection.
2024-01-11 17:15:21 -08:00
Nicholas Nethercote 3330940f7f Avoid repetition in `flush_delayed` calls.
There are two places that handle normal delayed bugs. This commit
factors out some repeated code.

Also, we can use `std::mem::take` instead of `std::mem::replace`.
2024-01-12 10:25:22 +11:00
Oli Scherer 6679e2c2f2 Register even erroneous impls
Otherwise the specialization graph fails to pick it up, even though other code assumes that all impl blocks have an entry in the specialization graph.
2024-01-11 20:34:59 +00:00
Oli Scherer 5461836281 `specialization_graph_of`'s `errored` field is used in the only call site, and used to immediately throw away the rest of the value. Let's use `Result` to statically signal that this is happening 2024-01-11 20:34:59 +00:00
bors 62d7ed4a67 Auto merge of #119864 - matthiaskrgr:rollup-mc2qz13, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #119448 (annotate-snippets: update to 0.10)
 - #119813 (Silence some follow-up errors [2/x])
 - #119836 (chore: remove unnecessary blank line)
 - #119841 (Remove `DiagnosticBuilder::buffer`)
 - #119842 (coverage: Add enums to accommodate other kinds of coverage mappings)
 - #119845 (rint: further doc tweaks)
 - #119852 (give const-err4 a more descriptive name)
 - #119853 (rustfmt.toml: don't ignore just any tests path, only root one)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-01-11 20:01:01 +00:00
Eduardo Sánchez Muñoz c03808f53b Set `c_str_literals` stabilization version back to `CURRENT_RUSTC_VERSION`
`c_str_literals`'s stabilization has been delayed to 1.77 (https://github.com/rust-lang/rust/pull/119528).
2024-01-11 20:46:02 +01:00
Nicholas Thompson c65c35b3ef Reduced amount of int_pow benches
Also simplified the macros
2024-01-11 14:00:01 -05:00
Samuel Moelius 7aec5def5a
Convert `effects` description to doc comment
So that it is visible here: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_feature/unstable/struct.Features.html#structfield.effects
2024-01-11 13:51:36 -05:00
Matthias Krüger b3d15ebb08
Rollup merge of #119853 - klensy:rustfmt-ignore, r=cuviper
rustfmt.toml: don't ignore just any tests path, only root one

Previously ignored any `tests` path, now only /tests at repo root.

For reference, https://git-scm.com/docs/gitignore#_pattern_format
2024-01-11 19:42:53 +01:00
Matthias Krüger ca17ce4558
Rollup merge of #119852 - RalfJung:const-err4, r=compiler-errors
give const-err4 a more descriptive name

Also, doesn't look like this still needs to be per-bitwidth

r? ``@oli-obk``
2024-01-11 19:42:52 +01:00
Matthias Krüger 1a4d3c9c47
Rollup merge of #119845 - RalfJung:rint, r=nagisa
rint: further doc tweaks

r? ``@nagisa``
2024-01-11 19:42:52 +01:00
Matthias Krüger 8294356a5d
Rollup merge of #119842 - Zalathar:kind, r=oli-obk
coverage: Add enums to accommodate other kinds of coverage mappings

Extracted from  #118305.

LLVM supports several different kinds of coverage mapping regions, but currently we only ever emit ordinary “code” regions.  This PR performs the plumbing required to add other kinds of regions as enum variants, but does not add any specific variants other than `Code`.

The main motivation for this change is branch coverage, but it will also allow separate experimentation with gap regions and skipped regions, which might help in producing more accurate and useful coverage reports.

---

``@rustbot`` label +A-code-coverage
2024-01-11 19:42:51 +01:00
Matthias Krüger f5387a1c38
Rollup merge of #119841 - nnethercote:rm-DiagnosticBuilder-buffer, r=oli-obk
Remove `DiagnosticBuilder::buffer`

`DiagnosticBuilder::buffer` doesn't do much, and part of what it does (for `-Ztreat-err-as-bug`) it shouldn't.

This PR strips it back, replaces its uses, and finally removes it, making a few cleanups in the vicinity along the way.

r? ``@oli-obk``
2024-01-11 19:42:51 +01:00
Matthias Krüger 6beb676990
Rollup merge of #119836 - hi-rustin:rustin-patch-docs-blank-line, r=ChrisDenton
chore: remove unnecessary blank line

It seems no need to add an unnecessary line here.
2024-01-11 19:42:50 +01:00
Matthias Krüger bd61caf58b
Rollup merge of #119813 - oli-obk:even_more_follow_up_errors2, r=estebank
Silence some follow-up errors [2/x]

this is one piece of the requested cleanups from https://github.com/rust-lang/rust/pull/117449

the `type_of` query frequently uses astconv to convert a `hir::Ty` to a `ty::Ty`. This process is infallible, but may produce errors as it goes. All the error reporting sites that had access to the `ItemCtxt` are now tainting it, causing `type_of` to return a `ty::Error` instead of anything else.
2024-01-11 19:42:49 +01:00
Matthias Krüger fe97e93166
Rollup merge of #119448 - klensy:annotate-snippets-0.10, r=davidtwco
annotate-snippets: update to 0.10

Ports `annotate-snippets` to 0.10, temporary dupes versions; other crates left that depends on 0.9 is `ui_test` and `rustfmt`.
2024-01-11 19:42:49 +01:00