Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monomorphize in check mode to report (almost) all PMEs #107510

Closed
wants to merge 1 commit into from

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jan 31, 2023

fixes #99682

see #104087 (comment) for discussion

r? @ghost

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 31, 2023
@oli-obk
Copy link
Contributor Author

oli-obk commented Jan 31, 2023

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 31, 2023
@bors
Copy link
Contributor

bors commented Jan 31, 2023

⌛ Trying commit b99639861e05bb61a3235429a82a8c232233c751 with merge f792b4425823c469a96cdaff35d25590fe0e5970...

@RalfJung
Copy link
Member

What's the "almost" about?

@oli-obk
Copy link
Contributor Author

oli-obk commented Jan 31, 2023

What's the "almost" about?

codegen backends can still bail out if they don't support something (like some huge array size limits that are very target dependent)

@RalfJung
Copy link
Member

We do check for "types can't be larger than 2^48" somewhere on the MIR level already -- so this is a separate check?

Anyway, would be good to have a concrete example and an issue tracking that, but doesn't sound high priority to fix.

@oli-obk
Copy link
Contributor Author

oli-obk commented Jan 31, 2023

We have tests for

  • broken inline assembly
  • [u8; usize::MAX] (seems to still be a build-fail test after this PR, will need to investigate)
  • duplicate symbols via #[export_name = "dup"] being used twice on different functions or statics
  • invalid uses of the unstable platform intrinsics 🤷
  • various invalid command line arguments
    • invalid -Cpasses
    • invalid -Clinker=asdflkjasdf
    • ...
  • mis-use of #[target_feature]

@RalfJung
Copy link
Member

And const-eval errors, I presume?

@oli-obk
Copy link
Contributor Author

oli-obk commented Jan 31, 2023

And const-eval errors, I presume?

those all get emitted in check mode now, so they are still PMEs, but don't require codegen anymore

@bors
Copy link
Contributor

bors commented Jan 31, 2023

☔ The latest upstream changes (presumably #100754) made this pull request unmergeable. Please resolve the merge conflicts.

@RalfJung
Copy link
Member

fixes #99682

Turns out we have some duplicates / closely related issues: #70923 #49292. Are they all fixed?

@rust-log-analyzer

This comment has been minimized.

@nbdd0121
Copy link
Contributor

I personally think whether optimised mir is used or for collection or not is orthogonal to whether instances are collected eagerly/lazily.

Also, wouldn't this approach cause cargo check to yield more errors than cargo build because the former use un-optimised MIR and collect items eagerly while the latter use optimised MIR and collect items lazily?

@rust-log-analyzer

This comment has been minimized.

@oli-obk
Copy link
Contributor Author

oli-obk commented Jan 31, 2023

cc @tmandry

@tmandry
Copy link
Member

tmandry commented Feb 3, 2023

Thanks for putting this up, I'm very curious to see the perf results!

I think the use of PME here is slightly confusing – if I understand correctly we would still have errors that depend on which generic parameters are used, like the example in #104087 (comment).

@oli-obk oli-obk changed the title Monomorphize in check mode to avoid almost all PMEs Monomorphize in check mode to report all PMEs Feb 3, 2023
@oli-obk oli-obk changed the title Monomorphize in check mode to report all PMEs Monomorphize in check mode to report (almost) all PMEs Feb 3, 2023
@JakobDegen
Copy link
Contributor

@oli-obk another implementation strategy that we should consider here is adding a new field to mir::Body that lists all the constants that were written into the body by the user. Then, when we monomorphize, we'll continue to do the normal thing, but additionally if the collection does not pick up any of these constants then we'll also mono them in a "const error only mode" (sort of like what you have here).

Part of the reason that I bring this up is because I knew the topic of this issue was a possibility, but thought it was a non-issue specifically because I was under the impression that the required_consts field on Body already did what I'm describing here. Faults on me for not actually checking that theory

@RalfJung
Copy link
Member

RalfJung commented Feb 3, 2023 via email

@JakobDegen
Copy link
Contributor

JakobDegen commented Feb 3, 2023

How is required_consts not already doing that?

Well, what I didn't realize was that required_consts only contains consts that are unevaluated by the time we do borrowck. What I thought happened is that all consts are put into there, specifically to ensure that things like this don't happen

Edit: Oh, I realize what the confusion might have been. I was implicitly assuming that if we put a FnDef-typed constant into the list of constants, that we'd then go and actually mono that function (at least enough to go set off any PMEs)

@RalfJung
Copy link
Member

RalfJung commented Feb 3, 2023

Edit: Oh, I realize what the confusion might have been. I was implicitly assuming that if we put a FnDef-typed constant into the list of constants, that we'd then go and actually mono that function (at least enough to go set off any PMEs)

Ah -- no, all we do with that list is evaluate constants, we don't monomorphize any further functions.

@nbdd0121
Copy link
Contributor

nbdd0121 commented Feb 3, 2023

If we want to make if const { xxx } not monomorphize it xxx evaluates to false (as suggested in #85836), then we actually would want some constants/functions to not show up in required_consts.

@RalfJung
Copy link
Member

RalfJung commented Feb 3, 2023

If we want to make if const { xxx } not monomorphize it xxx evaluates to false (as suggested in #85836), then we actually would want some constants/functions to not show up in required_consts.

That's quite a big new feature that requires an RFC IMO. I don't think there is currently a plan to implement this.

@JakobDegen
Copy link
Contributor

Yeah, agreed. That kind of feature would also definitely need explicit Mir support

@tmandry
Copy link
Member

tmandry commented Feb 17, 2023

There's a lang team meeting that will touch on this PR next week (Feb 22).

@oli-obk Do you think you could get it fixed up with a perf run by then? 🙏

@tmiasko
Copy link
Contributor

tmiasko commented Feb 17, 2023

The should_codegen check from should_encode_mir will probably have to go as well now.

@oli-obk
Copy link
Contributor Author

oli-obk commented Feb 17, 2023

The should_codegen check from should_encode_mir will probably have to go as well now.

I think we can avoid it. We only need to care about generic functions, and those have their MIR encoded no matter what should_codegen returns.

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Prepare all required actions
Getting action download info
Download action repository 'actions/checkout@v3' (SHA:ac593985615ec2ede58e132d2e21d2b1cbd6127c)
Download action repository 'rust-lang/simpleinfra@master' (SHA:75573f9759179a720f4c3af6c9fb518ac0061dca)
Complete job name: PR (x86_64-gnu-tools, false, ubuntu-20.04-xl)
git config --global core.autocrlf false
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  CI_JOB_NAME: x86_64-gnu-tools
---
failures:

---- compile_test stdout ----
normalized stderr:
thread 'rustc' panicked at 'attempted to read from stolen value: rustc_middle::mir::Body', compiler/rustc_monomorphize/src/collector.rs:1428:79

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.69 (9a274c72 2023-02-17)
query stack during panic:
query stack during panic:
#0 [collect_crate_mono_items_for_check] monomorphize the crate graph



The actual stderr differed from the expected stderr.
The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/author.stage-id.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args author.rs`

error: 1 errors occurred comparing output.
status: exit status: 101
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "tests/ui/author.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/author.stage-id" "-A" "unused" "--emit=metadata" "-Dwarnings" "-Zui-testing" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-7b5cc279bd04eca8.rlib" "--extern" "clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-504e25b9109e124f.rlib" "--extern" "clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-ff2c2aaa2e33fd1f.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-3d962e7e23a10c27.rlib" "--extern" "serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-f7c308c5f8e7b09c.so" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-e0524b7e2611e851.rlib" "--extern" "if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-03f75cdc6d4d3afc.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-7a940bbcc1286cdc.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-619ac20e364f2b2c.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-edad3f22f7291185.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-b6f83e8bf7b1d2e3.rlib" "--extern" "derive_new=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libderive_new-a2f771a227dafeba.so" "--extern" "rustc_semver=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/librustc_semver-963bbd3f89834643.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-e39b631048351f36.rlib" "--edition=2021" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/author.stage-id.aux"
------------------------------------------
------------------------------------------
if let StmtKind::Local(local) = stmt.kind
    && let Some(init) = local.init
    && let ExprKind::Cast(expr, cast_ty) = init.kind
    && let TyKind::Path(ref qpath) = cast_ty.kind
    && match_qpath(qpath, &["char"])
    && let ExprKind::Lit(ref lit) = expr.kind
    && let LitKind::Int(69, LitIntType::Unsuffixed) = lit.node
    && let PatKind::Binding(BindingAnnotation::NONE, _, name, None) = local.pat.kind
    && name.as_str() == "x"
    // report your lint here
}

------------------------------------------
------------------------------------------
stderr:
------------------------------------------
thread 'rustc' panicked at 'attempted to read from stolen value: rustc_middle::mir::Body', compiler/rustc_monomorphize/src/collector.rs:1428:79

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.69 (9a274c72 2023-02-17)
query stack during panic:
query stack during panic:
#0 [collect_crate_mono_items_for_check] monomorphize the crate graph

------------------------------------------

normalized stderr:
normalized stderr:
thread 'rustc' panicked at 'attempted to read from stolen value: rustc_middle::mir::Body', compiler/rustc_monomorphize/src/collector.rs:1428:79

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.69 (9a274c72 2023-02-17)
query stack during panic:
query stack during panic:
#0 [collect_crate_mono_items_for_check] monomorphize the crate graph



The actual stderr differed from the expected stderr.
The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/author/call.stage-id.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args author/call.rs`

error: 1 errors occurred comparing output.
status: exit status: 101
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "tests/ui/author/call.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/author/call.stage-id" "-A" "unused" "--emit=metadata" "-Dwarnings" "-Zui-testing" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-7b5cc279bd04eca8.rlib" "--extern" "clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-504e25b9109e124f.rlib" "--extern" "clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-ff2c2aaa2e33fd1f.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-3d962e7e23a10c27.rlib" "--extern" "serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-f7c308c5f8e7b09c.so" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-e0524b7e2611e851.rlib" "--extern" "if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-03f75cdc6d4d3afc.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-7a940bbcc1286cdc.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-619ac20e364f2b2c.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-edad3f22f7291185.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-b6f83e8bf7b1d2e3.rlib" "--extern" "derive_new=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libderive_new-a2f771a227dafeba.so" "--extern" "rustc_semver=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/librustc_semver-963bbd3f89834643.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-e39b631048351f36.rlib" "--edition=2021" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/author/call.stage-id.aux"
------------------------------------------
------------------------------------------
if let StmtKind::Local(local) = stmt.kind
    && let Some(init) = local.init
    && let ExprKind::Call(func, args) = init.kind
    && let ExprKind::Path(ref qpath) = func.kind
    && match_qpath(qpath, &["{{root}}", "std", "cmp", "min"])
    && args.len() == 2
    && let ExprKind::Lit(ref lit) = args[0].kind
    && let LitKind::Int(3, LitIntType::Unsuffixed) = lit.node
    && let ExprKind::Lit(ref lit1) = args[1].kind
    && let LitKind::Int(4, LitIntType::Unsuffixed) = lit1.node
    && let PatKind::Wild = local.pat.kind
    // report your lint here
}

------------------------------------------
------------------------------------------
stderr:
------------------------------------------
thread 'rustc' panicked at 'attempted to read from stolen value: rustc_middle::mir::Body', compiler/rustc_monomorphize/src/collector.rs:1428:79

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.69 (9a274c72 2023-02-17)
query stack during panic:
query stack during panic:
#0 [collect_crate_mono_items_for_check] monomorphize the crate graph

------------------------------------------



error: failed to compile fixed code
status: exit status: 101
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "tests/ui/as_underscore.fixed" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/as_underscore.stage-id" "--emit=metadata" "-Dwarnings" "-Zui-testing" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-7b5cc279bd04eca8.rlib" "--extern" "clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-504e25b9109e124f.rlib" "--extern" "clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-ff2c2aaa2e33fd1f.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-3d962e7e23a10c27.rlib" "--extern" "serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-f7c308c5f8e7b09c.so" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-e0524b7e2611e851.rlib" "--extern" "if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-03f75cdc6d4d3afc.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-7a940bbcc1286cdc.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-619ac20e364f2b2c.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-edad3f22f7291185.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-b6f83e8bf7b1d2e3.rlib" "--extern" "derive_new=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libderive_new-a2f771a227dafeba.so" "--extern" "rustc_semver=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/librustc_semver-963bbd3f89834643.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-e39b631048351f36.rlib" "--edition=2021" "--crate-name=fixed" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/as_underscore.stage-id.aux"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
thread 'rustc' panicked at 'attempted to read from stolen value: rustc_middle::mir::Body', compiler/rustc_monomorphize/src/collector.rs:1428:79

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.69 (9a274c72 2023-02-17)
query stack during panic:
query stack during panic:
#0 [collect_crate_mono_items_for_check] monomorphize the crate graph
end of query stack
thread 'rustc' panicked at 'attempted to read from stolen value: rustc_middle::mir::Body', compiler/rustc_monomorphize/src/collector.rs:1428:79
error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.


note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.69 (9a274c72 2023-02-17)
query stack during panic:
query stack during panic:
#0 [collect_crate_mono_items_for_check] monomorphize the crate graph

------------------------------------------

normalized stderr:
normalized stderr:
thread 'rustc' panicked at 'attempted to read from stolen value: rustc_middle::mir::Body', compiler/rustc_monomorphize/src/collector.rs:1428:79

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.69 (9a274c72 2023-02-17)
query stack during panic:
query stack during panic:
#0 [collect_crate_mono_items_for_check] monomorphize the crate graph



The actual stderr differed from the expected stderr.
The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/author/issue_3849.stage-id.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args author/issue_3849.rs`

error: 1 errors occurred comparing output.
status: exit status: 101
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "tests/ui/author/issue_3849.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/author/issue_3849.stage-id" "-A" "unused" "--emit=metadata" "-Dwarnings" "-Zui-testing" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-7b5cc279bd04eca8.rlib" "--extern" "clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-504e25b9109e124f.rlib" "--extern" "clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-ff2c2aaa2e33fd1f.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-3d962e7e23a10c27.rlib" "--extern" "serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-f7c308c5f8e7b09c.so" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-e0524b7e2611e851.rlib" "--extern" "if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-03f75cdc6d4d3afc.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-7a940bbcc1286cdc.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-619ac20e364f2b2c.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-edad3f22f7291185.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-b6f83e8bf7b1d2e3.rlib" "--extern" "derive_new=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libderive_new-a2f771a227dafeba.so" "--extern" "rustc_semver=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/librustc_semver-963bbd3f89834643.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-e39b631048351f36.rlib" "--edition=2021" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/author/issue_3849.stage-id.aux"
------------------------------------------
------------------------------------------
if let StmtKind::Local(local) = stmt.kind
    && let Some(init) = local.init
    && let ExprKind::Call(func, args) = init.kind
    && let ExprKind::Path(ref qpath) = func.kind
    && match_qpath(qpath, &["std", "mem", "transmute"])
    && args.len() == 1
    && let ExprKind::Path(ref qpath1) = args[0].kind
    && match_qpath(qpath1, &["ZPTR"])
    && let PatKind::Wild = local.pat.kind
    // report your lint here
}

------------------------------------------
------------------------------------------
stderr:
------------------------------------------
thread 'rustc' panicked at 'attempted to read from stolen value: rustc_middle::mir::Body', compiler/rustc_monomorphize/src/collector.rs:1428:79

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.69 (9a274c72 2023-02-17)
query stack during panic:
query stack during panic:
#0 [collect_crate_mono_items_for_check] monomorphize the crate graph

------------------------------------------

normalized stderr:
normalized stderr:
thread 'rustc' panicked at 'attempted to read from stolen value: rustc_middle::mir::Body', compiler/rustc_monomorphize/src/collector.rs:1428:79

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.69 (9a274c72 2023-02-17)
query stack during panic:
query stack during panic:
#0 [collect_crate_mono_items_for_check] monomorphize the crate graph



The actual stderr differed from the expected stderr.
The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/author/blocks.stage-id.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args author/blocks.rs`

error: 1 errors occurred comparing output.
status: exit status: 101
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "tests/ui/author/blocks.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/author/blocks.stage-id" "-A" "unused" "--emit=metadata" "-Dwarnings" "-Zui-testing" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-7b5cc279bd04eca8.rlib" "--extern" "clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-504e25b9109e124f.rlib" "--extern" "clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-ff2c2aaa2e33fd1f.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-3d962e7e23a10c27.rlib" "--extern" "serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-f7c308c5f8e7b09c.so" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-e0524b7e2611e851.rlib" "--extern" "if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-03f75cdc6d4d3afc.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-7a940bbcc1286cdc.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-619ac20e364f2b2c.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-edad3f22f7291185.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-b6f83e8bf7b1d2e3.rlib" "--extern" "derive_new=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libderive_new-a2f771a227dafeba.so" "--extern" "rustc_semver=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/librustc_semver-963bbd3f89834643.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-e39b631048351f36.rlib" "--edition=2018" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/author/blocks.stage-id.aux"
------------------------------------------
------------------------------------------
if let ExprKind::Block(block, None) = expr.kind
    && block.stmts.len() == 3
    && let StmtKind::Local(local) = block.stmts[0].kind
    && let Some(init) = local.init
    && let ExprKind::Lit(ref lit) = init.kind
    && let LitKind::Int(42, LitIntType::Signed(IntTy::I32)) = lit.node
    && let PatKind::Binding(BindingAnnotation::NONE, _, name, None) = local.pat.kind
    && name.as_str() == "x"
    && let StmtKind::Local(local1) = block.stmts[1].kind
    && let Some(init1) = local1.init
    && let ExprKind::Lit(ref lit1) = init1.kind
    && let LitKind::Float(_, LitFloatType::Suffixed(FloatTy::F32)) = lit1.node
    && let PatKind::Binding(BindingAnnotation::NONE, _, name1, None) = local1.pat.kind
    && name1.as_str() == "_t"
    && let StmtKind::Semi(e) = block.stmts[2].kind
    && let ExprKind::Unary(UnOp::Neg, inner) = e.kind
    && let ExprKind::Path(ref qpath) = inner.kind
    && match_qpath(qpath, &["x"])
    && block.expr.is_none()
    // report your lint here
}
}
if let ExprKind::Block(block, None) = expr.kind
    && block.stmts.len() == 1
    && let StmtKind::Local(local) = block.stmts[0].kind
    && let Some(init) = local.init
    && let ExprKind::Call(func, args) = init.kind
    && let ExprKind::Path(ref qpath) = func.kind
    && match_qpath(qpath, &["String", "new"])
    && args.is_empty()
    && let PatKind::Binding(BindingAnnotation::NONE, _, name, None) = local.pat.kind
    && name.as_str() == "expr"
    && let Some(trailing_expr) = block.expr
    && let ExprKind::Call(func1, args1) = trailing_expr.kind
    && let ExprKind::Path(ref qpath1) = func1.kind
    && match_qpath(qpath1, &["drop"])
    && args1.len() == 1
    && let ExprKind::Path(ref qpath2) = args1[0].kind
    && match_qpath(qpath2, &["expr"])
    // report your lint here
}
}
if let ExprKind::Closure(CaptureBy::Value, fn_decl, body_id, _, None) = expr.kind
    && let FnRetTy::DefaultReturn(_) = fn_decl.output
    && expr1 = &cx.tcx.hir().body(body_id).value
    && let ExprKind::Call(func, args) = expr1.kind
    && let ExprKind::Path(ref qpath) = func.kind
    && matches!(qpath, QPath::LangItem(LangItem::IdentityFuture, _))
    && args.len() == 1
    && let ExprKind::Closure(CaptureBy::Value, fn_decl1, body_id1, _, Some(Movability::Static)) = args[0].kind
    && let FnRetTy::DefaultReturn(_) = fn_decl1.output
    && expr2 = &cx.tcx.hir().body(body_id1).value
    && let ExprKind::Block(block, None) = expr2.kind
    && block.stmts.is_empty()
    && block.expr.is_none()
    // report your lint here
}

------------------------------------------
------------------------------------------
stderr:
------------------------------------------
thread 'rustc' panicked at 'attempted to read from stolen value: rustc_middle::mir::Body', compiler/rustc_monomorphize/src/collector.rs:1428:79

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.69 (9a274c72 2023-02-17)
query stack during panic:
query stack during panic:
#0 [collect_crate_mono_items_for_check] monomorphize the crate graph

------------------------------------------

normalized stderr:
normalized stderr:
thread 'rustc' panicked at 'attempted to read from stolen value: rustc_middle::mir::Body', compiler/rustc_monomorphize/src/collector.rs:1428:79

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.69 (9a274c72 2023-02-17)
query stack during panic:
query stack during panic:
#0 [collect_crate_mono_items_for_check] monomorphize the crate graph



The actual stderr differed from the expected stderr.
The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/author/if.stage-id.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args author/if.rs`

error: 1 errors occurred comparing output.
status: exit status: 101
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "tests/ui/author/if.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/author/if.stage-id" "-A" "unused" "--emit=metadata" "-Dwarnings" "-Zui-testing" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-7b5cc279bd04eca8.rlib" "--extern" "clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-504e25b9109e124f.rlib" "--extern" "clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-ff2c2aaa2e33fd1f.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-3d962e7e23a10c27.rlib" "--extern" "serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-f7c308c5f8e7b09c.so" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-e0524b7e2611e851.rlib" "--extern" "if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-03f75cdc6d4d3afc.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-7a940bbcc1286cdc.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-619ac20e364f2b2c.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-edad3f22f7291185.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-b6f83e8bf7b1d2e3.rlib" "--extern" "derive_new=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libderive_new-a2f771a227dafeba.so" "--extern" "rustc_semver=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/librustc_semver-963bbd3f89834643.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-e39b631048351f36.rlib" "--edition=2021" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/author/if.stage-id.aux"
------------------------------------------
------------------------------------------
if let StmtKind::Local(local) = stmt.kind
    && let Some(init) = local.init
    && let ExprKind::If(cond, then, Some(else_expr)) = init.kind
    && let ExprKind::DropTemps(expr) = cond.kind
    && let ExprKind::Lit(ref lit) = expr.kind
    && let LitKind::Bool(true) = lit.node
    && let ExprKind::Block(block, None) = then.kind
    && block.stmts.len() == 1
    && let StmtKind::Semi(e) = block.stmts[0].kind
    && let ExprKind::Binary(op, left, right) = e.kind
    && BinOpKind::Eq == op.node
    && let ExprKind::Lit(ref lit1) = left.kind
    && let LitKind::Int(1, LitIntType::Unsuffixed) = lit1.node
    && let ExprKind::Lit(ref lit2) = right.kind
    && let LitKind::Int(1, LitIntType::Unsuffixed) = lit2.node
    && block.expr.is_none()
    && let ExprKind::Block(block1, None) = else_expr.kind
    && block1.stmts.len() == 1
    && let StmtKind::Semi(e1) = block1.stmts[0].kind
    && let ExprKind::Binary(op1, left1, right1) = e1.kind
    && BinOpKind::Eq == op1.node
    && let ExprKind::Lit(ref lit3) = left1.kind
    && let LitKind::Int(2, LitIntType::Unsuffixed) = lit3.node
    && let ExprKind::Lit(ref lit4) = right1.kind
    && let LitKind::Int(2, LitIntType::Unsuffixed) = lit4.node
    && block1.expr.is_none()
    && let PatKind::Wild = local.pat.kind
    // report your lint here
}
}
if let ExprKind::If(cond, then, Some(else_expr)) = expr.kind
    && let ExprKind::Let(let_expr) = cond.kind
    && let PatKind::Lit(lit_expr) = let_expr.pat.kind
    && let ExprKind::Lit(ref lit) = lit_expr.kind
    && let LitKind::Bool(true) = lit.node
    && let ExprKind::Path(ref qpath) = let_expr.init.kind
    && match_qpath(qpath, &["a"])
    && let ExprKind::Block(block, None) = then.kind
    && block.stmts.is_empty()
    && block.expr.is_none()
    && let ExprKind::Block(block1, None) = else_expr.kind
    && block1.stmts.is_empty()
    && block1.expr.is_none()
    // report your lint here
}

------------------------------------------
------------------------------------------
stderr:
------------------------------------------
thread 'rustc' panicked at 'attempted to read from stolen value: rustc_middle::mir::Body', compiler/rustc_monomorphize/src/collector.rs:1428:79

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.69 (9a274c72 2023-02-17)
query stack during panic:
query stack during panic:
#0 [collect_crate_mono_items_for_check] monomorphize the crate graph

------------------------------------------

normalized stderr:
normalized stderr:
thread 'rustc' panicked at 'attempted to read from stolen value: rustc_middle::mir::Body', compiler/rustc_monomorphize/src/collector.rs:1428:79

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.
note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.69 (9a274c72 2023-02-17)
query stack during panic:
query stack during panic:
#0 [collect_crate_mono_items_for_check] monomorphize the crate graph



The actual stderr differed from the expected stderr.
The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/author/matches.stage-id.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args author/matches.rs`

error: 1 errors occurred comparing output.
status: exit status: 101
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "tests/ui/author/matches.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/author/matches.stage-id" "-A" "unused" "--emit=metadata" "-Dwarnings" "-Zui-testing" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-7b5cc279bd04eca8.rlib" "--extern" "clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-504e25b9109e124f.rlib" "--extern" "clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-ff2c2aaa2e33fd1f.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-3d962e7e23a10c27.rlib" "--extern" "serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-f7c308c5f8e7b09c.so" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-e0524b7e2611e851.rlib" "--extern" "if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-03f75cdc6d4d3afc.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-7a940bbcc1286cdc.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-619ac20e364f2b2c.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-edad3f22f7291185.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-b6f83e8bf7b1d2e3.rlib" "--extern" "derive_new=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libderive_new-a2f771a227dafeba.so" "--extern" "rustc_semver=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/librustc_semver-963bbd3f89834643.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-e39b631048351f36.rlib" "--edition=2021" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/author/matches.stage-id.aux"
------------------------------------------
------------------------------------------
if let StmtKind::Local(local) = stmt.kind
    && let Some(init) = local.init
    && let ExprKind::Match(scrutinee, arms, MatchSource::Normal) = init.kind
    && let ExprKind::Lit(ref lit) = scrutinee.kind
    && let LitKind::Int(42, LitIntType::Unsuffixed) = lit.node
    && arms.len() == 3
    && let PatKind::Lit(lit_expr) = arms[0].pat.kind
    && let ExprKind::Lit(ref lit1) = lit_expr.kind
    && let LitKind::Int(16, LitIntType::Unsuffixed) = lit1.node
    && arms[0].guard.is_none()
    && let ExprKind::Lit(ref lit2) = arms[0].body.kind
    && let LitKind::Int(5, LitIntType::Unsuffixed) = lit2.node
    && let PatKind::Lit(lit_expr1) = arms[1].pat.kind
    && let ExprKind::Lit(ref lit3) = lit_expr1.kind
    && let LitKind::Int(17, LitIntType::Unsuffixed) = lit3.node
    && arms[1].guard.is_none()
    && let ExprKind::Block(block, None) = arms[1].body.kind
    && block.stmts.len() == 1
    && let StmtKind::Local(local1) = block.stmts[0].kind
    && let Some(init1) = local1.init
    && let ExprKind::Lit(ref lit4) = init1.kind
    && let LitKind::Int(3, LitIntType::Unsuffixed) = lit4.node
    && let PatKind::Binding(BindingAnnotation::NONE, _, name, None) = local1.pat.kind
    && name.as_str() == "x"
    && let Some(trailing_expr) = block.expr
    && let ExprKind::Path(ref qpath) = trailing_expr.kind
    && match_qpath(qpath, &["x"])
    && let PatKind::Wild = arms[2].pat.kind
    && arms[2].guard.is_none()
    && let ExprKind::Lit(ref lit5) = arms[2].body.kind
    && let LitKind::Int(1, LitIntType::Unsuffixed) = lit5.node
    && let PatKind::Binding(BindingAnnotation::NONE, _, name1, None) = local.pat.kind
    && name1.as_str() == "a"
    // report your lint here
}

------------------------------------------
------------------------------------------
stderr:
------------------------------------------
thread 'rustc' panicked at 'attempted to read from stolen value: rustc_middle::mir::Body', compiler/rustc_monomorphize/src/collector.rs:1428:79

pub enum MonoItemCollectionMode {
Eager,
Eager {
/// Whether to use optimized mir for collection or just analyis MIR.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Whether to use optimized mir for collection or just analyis MIR.
/// Whether to use optimized mir for collection or just analysis MIR.

@bors
Copy link
Contributor

bors commented Mar 13, 2023

☔ The latest upstream changes (presumably #108872) made this pull request unmergeable. Please resolve the merge conflicts.

@Dylan-DPC Dylan-DPC added S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 19, 2023
@Dylan-DPC
Copy link
Member

Closing this as it was an experiment

@Dylan-DPC Dylan-DPC closed this Aug 3, 2023
@Dylan-DPC Dylan-DPC removed the S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. label Aug 3, 2023
@RalfJung
Copy link
Member

This never got far enough to get a perf result, did it? Would have been nice to get some numbers, though I think they'd be devastating.^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-perf Status: Waiting on a perf run to be completed. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'cargo check' passes but 'cargo build' fails when there are errors during monomorphization