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

Check for <&NotClone as Clone>::clone() calls and suggest to add Clone trait appropriately #112995

Merged
merged 1 commit into from Jul 26, 2023

Conversation

strottos
Copy link
Contributor

Added recursive checking back up the HIR to see if a Clone suggestion would be helpful.

Addresses #112857

Largely based on: #112977

@rustbot
Copy link
Collaborator

rustbot commented Jun 24, 2023

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @fee1-dead (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@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 Jun 24, 2023
@strottos
Copy link
Contributor Author

@estebank Forgive if this is stealing thunder as I wouldn't have done this so quickly without your work here, please feel free to pull this into your branch or whatever works best for protocol.

This covers more cases as per the tests though there are still potentially further improvements I may look into at some point as I notice this issue is probably in the same area: #76643

I think this is OK, but there is a danger of heavy recursion in big code bases but I think they'll always terminate fairly quickly or get caught by stack limits (which are probably quite high in compiler world having said that). Would welcome your thoughts on this one?

@fee1-dead
Copy link
Member

fee1-dead commented Jun 26, 2023

Note that there is already the noop_method_call lint, which is being made warn by default in #111916. There is also an MCP for running lints even if errors have occured at compiler-team#633. If both of these were to be merged then I don't think this change would be necessary?

@strottos
Copy link
Contributor Author

strottos commented Jun 27, 2023

@fee1-dead Seems fair, the only thing would be this would put it inline with the error itself making it clear this fixes the error where the other would put out a seemingly unrelated warning the user would have to link together, could even get lost in lots of other warnings. At least that's my understanding of it.

This would potentially be helpful to beginners and the like, more so than experienced Rust devs certainly.

But yeah, if we decide to not go with this for that reason that's cool. I'm happy to close if so.

@estebank
Copy link
Contributor

If both of these were to be merged then I don't think this change would be necessary?

The issue with lints is that they don't trigger if other errors are present, which is why I find it reasonable to have some duplication between targeted lints and suggestions in errors, to reduce the number of back and forth that users have when fixing an issue.

@fee1-dead
Copy link
Member

Setting to waiting on author per my review.

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 4, 2023
@bors
Copy link
Contributor

bors commented Jul 13, 2023

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

@strottos
Copy link
Contributor Author

Pushed some more changes, there's still some patterns not covered but it's more inclusive as can be seen from the new tests.

Examples of a pattern not covered is the following, this seems harder:

fn clone_thing(nc: &NotClone) -> Box<NotClone> {
    let ret = Box::new(nc.clone());
    ret
}

where conversely this is covered:

fn clone_thing(nc: &NotClone) -> Box<NotClone> {
    let ret: Box<NotClone> = Box::new(nc.clone());
    ret
}

Not opposed to looking at the above, but I suspect this will take longer, would be interested in what people thought for feedback as to whether the above is worth it @fee1-dead @estebank ?

@strottos
Copy link
Contributor Author

I do think it's an improvement from what it was but I think to cover every pattern will be a lot of work and not sure how much value.

@strottos
Copy link
Contributor Author

@rustbot review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 18, 2023
@estebank
Copy link
Contributor

Examples of a pattern not covered is the following, this seems harder:

fn clone_thing(nc: &NotClone) -> Box<NotClone> {
    let ret = Box::new(nc.clone());
    ret
}

It is fine to not support every case, particularly when there are generics in place. I think we could eventually look for any arguments in an fn expression for .clone() calls, recursively, but I'd be very concerned with false positives. Maybe if we found all .clone() calls in sub expressions of the pointed to expression, changed their type from borrow to owned and re-ran inference on the whole expression to see if that would fix the issue, but that's more complex than what we set out to do here.

I do think it's an improvement from what it was but I think to cover every pattern will be a lot of work and not sure how much value.

I am of the position of "handle 80% of the cases with 20% of the effort". If we can expand on the coverage after the fact, that's fine.

@strottos
Copy link
Contributor Author

strottos commented Jul 19, 2023

That was the conclusion I came to as well, I did try exactly that funny enough using the (walk|visit)_<foo> methods but I managed to trigger false positives myself pretty easily that were harder to get rid of than just keep exhaustively check like we've ended up with.

@strottos strottos requested a review from fee1-dead July 20, 2023 17:08
compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs Outdated Show resolved Hide resolved
Comment on lines 1546 to 1569
hir::PatKind::Tuple(pats, ..) => match init.kind {
ExprKind::Tup(init_tup) => {
for (pat, init) in zip(pats.iter(), init_tup.iter()) {
if pat.hir_id == *hir_id {
return self.note_type_is_not_clone(
diag,
expected_ty,
found_ty,
init,
);
}
}
}
ExprKind::Block(
hir::Block {
expr:
Some(Expr {
kind: ExprKind::Tup(init_block_expr_tup), ..
}),
..
},
_,
) => {
for (pat, init) in zip(pats.iter(), init_block_expr_tup.iter())
Copy link
Member

Choose a reason for hiding this comment

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

there's a lot of rightward drift here. Perhaps you could add a method to ExprKind that either returns the original expression or the trailing expr of the innermost block? It could be named as something like trailing_expr or innermost_expr. if you add documentation to that it should be fine

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree the right drift isn't great. Not sure I see how this will help at the moment unfortunately though, maybe there's a pattern I'm not seeing, however I can't return an original expression in an ExprKind as it's not an Expr. Plus I'd need to somehow interject that into this match statement.

I'll try and have another look next week to see if I can see a way of taming the right drift.

Copy link
Contributor Author

@strottos strottos Jul 21, 2023

Choose a reason for hiding this comment

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

Yeah I think this is tricky, I think I see what you're saying but if I do something like this it's no good for the case below as I need the expr:

impl<'hir> ExprKind<'hir> {
    pub fn innermost_exprkind(&'hir self) -> &'hir ExprKind<'hir> {
        match self {
            ExprKind::Block(Block { expr: Some(Expr { kind, .. }), .. }, _) => kind,
            _ => self,
        }
    }
}

On the other hand if I make it return an Expr to be useful then I can't just return self as it's the wrong type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Think I've managed to tame the right drift now anyway without this. Have a look at the latest when you've a second and see if it's any better. Happy to look again if further improvements can be made.

Comment on lines 1589 to 1597
// If we're a closure recurse back into that closure
hir::ExprKind::Closure(hir::Closure { body: body_id, .. }) => {
let hir::Body { value: body_expr, .. } = self.tcx.hir().body(*body_id);
return self.note_type_is_not_clone(diag, expected_ty, found_ty, body_expr);
}
// Similarly recurse into a block
hir::ExprKind::Block(hir::Block { expr: Some(block_expr), .. }, _) => {
return self.note_type_is_not_clone(diag, expected_ty, found_ty, block_expr);
}
Copy link
Member

Choose a reason for hiding this comment

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

with the trailing_expr abstraction suggested above these duplication wouldn't be necessary i think.

@strottos strottos requested a review from fee1-dead July 22, 2023 00:28
Copy link
Member

@fee1-dead fee1-dead left a comment

Choose a reason for hiding this comment

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

Had a few nits. After addressing those this should be good to go

compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs Outdated Show resolved Hide resolved
compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs Outdated Show resolved Hide resolved
compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs Outdated Show resolved Hide resolved
Comment on lines 1584 to 1588
match expr.kind {
hir::ExprKind::Path(hir::QPath::Resolved(
None,
hir::Path { segments: [_], res: crate::Res::Local(binding), .. },
)) => {
Copy link
Member

Choose a reason for hiding this comment

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

All the other arms of this match block return. Therefore you can extract the binding like so:

let binding = match expr.kind {
    hir::ExprKind::Path(hir::QPath::Resolved(
        None,
        hir::Path { segments: [_], res: crate::Res::Local(binding), .. },
    )) => {
        binding
    }
    /* other arms return */
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion but it’s no longer true that all the other branches return now we’re not returning an Option. I think this is clearer as is personally, but happy to change if you still think.

@rust-log-analyzer

This comment has been minimized.

@strottos
Copy link
Contributor Author

Thanks @fee1-dead , think I’ve addressed all but the last one which I don’t think is relevant any more. Thanks for your time.

@strottos strottos requested a review from fee1-dead July 23, 2023 10:49
Copy link
Member

@fee1-dead fee1-dead left a comment

Choose a reason for hiding this comment

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

Just had a few final nits. Sorry for this back and forth!

Comment on lines 1613 to 1622
match init.kind {
ExprKind::Tup(init_tup) => {
if let Some(init) = find_init(init_tup) {
self.note_type_is_not_clone_inner_expr(init)
} else {
expr
}
}
ExprKind::Block(_, _) => {
let block_expr = init.peel_blocks();
Copy link
Member

@fee1-dead fee1-dead Jul 23, 2023

Choose a reason for hiding this comment

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

I meant you call peel_blocks and just do if let ExprKind::Tup(init_tup) = &init.peel_blocks().kind. That way you don't have to worry about matching the block case at all. With that you don't need to have duplicate arms or a closure either. Sorry for not being clear about this.

self.note_type_is_not_clone_inner_expr(block_expr)
}
hir::ExprKind::Call(Expr { kind: call_expr_kind, .. }, _) => {
if let hir::ExprKind::Path(hir::QPath::Resolved( None, call_expr_path,)) = call_expr_kind
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
if let hir::ExprKind::Path(hir::QPath::Resolved( None, call_expr_path,)) = call_expr_kind
if let hir::ExprKind::Path(hir::QPath::Resolved(None, call_expr_path)) = call_expr_kind

Comment on lines 1650 to 1653
&& let Some(closure) = self.tcx.hir().find(self.tcx.hir().parent_id(*hir_id))
&& let hir::Node::Local(hir::Local { init: Some(init), .. }) = closure
{
self.note_type_is_not_clone_inner_expr(init)
Copy link
Member

Choose a reason for hiding this comment

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

this seems to be specific to the clone_thing9 test case? If this is so and this is either a closure or something else that we don't care about, I'd prefer this to extract the closure body here instead of in a match case above. Therefore you should remove that match arm and move that here.

Also, could you add some comments on this if let chain, to explain what we are trying to do here (lookup the source of a closure call)?

Comment on lines 1642 to 1645
// Similarly recurse into a block
hir::ExprKind::Block(hir::Block { expr: Some(block_expr), .. }, _) => {
self.note_type_is_not_clone_inner_expr(block_expr)
}
Copy link
Member

Choose a reason for hiding this comment

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

similar to the peel_blocks use above it would be nice if expr.peel_blocks() is used for this match also. Then we'd avoid the unnecessary recursion and reduce the noise from handling not very relevant cases.

Copy link
Member

@fee1-dead fee1-dead left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@fee1-dead
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jul 25, 2023

📌 Commit 25db1fa has been approved by fee1-dead

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 25, 2023
@strottos
Copy link
Contributor Author

LGTM, thanks!

Thanks for your time again and no need to apologise, learned loads from doing this and been a great experience 😀

@bors
Copy link
Contributor

bors commented Jul 25, 2023

⌛ Testing commit 25db1fa with merge 0c0090f59cc47c8c6b954e1eed5cdacc28ca53da...

@rust-log-analyzer
Copy link
Collaborator

The job i686-mingw failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
To only update this specific test, also pass `--test-args panics\default-backtrace-ice.rs`

error: 1 errors occurred comparing output.
status: exit code: 101
command: PATH="C:\a\rust\rust\build\i686-pc-windows-gnu\stage2\bin;C:\a\rust\rust\build\i686-pc-windows-gnu\stage0-bootstrap-tools\i686-pc-windows-gnu\release\deps;C:\a\rust\rust\build\i686-pc-windows-gnu\stage0\bin;C:\a\rust\rust\ninja;C:\a\rust\rust\mingw32\bin;C:\hostedtoolcache\windows\Python\3.11.4\x64\Scripts;C:\hostedtoolcache\windows\Python\3.11.4\x64;C:\msys64\usr\bin;C:\a\rust\rust\sccache;C:\Program Files\MongoDB\Server\5.0\bin;C:\aliyun-cli;C:\vcpkg;C:\cf-cli;C:\Program Files (x86)\NSIS;C:\tools\zstd;C:\Program Files\Mercurial;C:\hostedtoolcache\windows\stack\2.11.1\x64;C:\cabal\bin;C:\ghcup\bin;C:\Program Files\dotnet;C:\mysql\bin;C:\Program Files\R\R-4.3.1\bin\x64;C:\SeleniumWebDrivers\GeckoDriver;C:\Program Files (x86)\sbt\bin;C:\Program Files (x86)\GitHub CLI;C:\Program Files\Git\bin;C:\Program Files (x86)\pipx_bin;C:\npm\prefix;C:\hostedtoolcache\windows\go\1.20.6\x64\bin;C:\hostedtoolcache\windows\Python\3.7.9\x64\Scripts;C:\hostedtoolcache\windows\Python\3.7.9\x64;C:\hostedtoolcache\windows\Ruby\2.5.9\x64\bin;C:\Program Files\OpenSSL\bin;C:\tools\kotlinc\bin;C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\8.0.372-7\x64\bin;C:\Program Files\ImageMagick-7.1.1-Q16-HDRI;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\ProgramData\kind;C:\Program Files\Eclipse Foundation\jdk-8.0.302.8-hotspot\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\ProgramData\Chocolatey\bin;C:\Program Files\PowerShell\7;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\160\DTS\Binn;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\ProgramData\chocolatey\lib\pulumi\tools\Pulumi\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\CMake\bin;C:\ProgramData\chocolatey\lib\maven\apache-maven-3.8.7\bin;C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code;C:\Program Files\Microsoft SDKs\Service Fabric\Tools\ServiceFabricLocalClusterManager;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\GitHub CLI;C:\tools\php;C:\Program Files (x86)\sbt\bin;C:\SeleniumWebDrivers\ChromeDriver;C:\SeleniumWebDrivers\EdgeDriver;C:\Program Files\Amazon\AWSCLIV2;C:\Program Files\Amazon\SessionManagerPlugin\bin;C:\Program Files\Amazon\AWSSAMCLI\bin;C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin;C:\Program Files (x86)\Microsoft BizTalk Server;C:\Program Files\LLVM\bin;C:\Users\runneradmin\.dotnet\tools;C:\Users\runneradmin\.cargo\bin;C:\Users\runneradmin\AppData\Local\Microsoft\WindowsApps" "C:\\a\\rust\\rust\\build\\i686-pc-windows-gnu\\stage2\\bin\\rustc.exe" "C:\\a\\rust\\rust\\tests\\ui\\panics\\default-backtrace-ice.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "--sysroot" "C:\\a\\rust\\rust\\build\\i686-pc-windows-gnu\\stage2" "--target=i686-pc-windows-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Cstrip=debuginfo" "--remap-path-prefix=C:\\a\\rust\\rust\\tests\\ui=fake-test-src-base" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "C:\\a\\rust\\rust\\build\\i686-pc-windows-gnu\\test\\ui\\panics\\default-backtrace-ice" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Lnative=C:\\a\\rust\\rust\\build\\i686-pc-windows-gnu\\native\\rust-test-helpers" "-L" "C:\\a\\rust\\rust\\build\\i686-pc-windows-gnu\\test\\ui\\panics\\default-backtrace-ice\\auxiliary" "-Z" "treat-err-as-bug=1"
stdout: none
error[E0425]: cannot find value `missing_ident` in this scope
error[E0425]: cannot find value `missing_ident` in this scope
##[error]  --> fake-test-src-base\panics\default-backtrace-ice.rs:21:13
   |
LL | fn main() { missing_ident; }


thread 'rustc' panicked at 'aborting due to `-Z treat-err-as-bug=1`', compiler\rustc_errors\src\lib.rs:1737:30
   0: 0x662c2d42 - core::fmt::write::h1147d65d38424eec
   1: 0x66256614 - std::io::Write::write_fmt::hb78e5874c67659c6
   2: 0x662603c0 - std::sys_common::backtrace::print::hd10d5c20761406e1
   2: 0x662603c0 - std::sys_common::backtrace::print::hd10d5c20761406e1
   3: 0x662636cd - std::panicking::panic_hook_with_disk_dump::{{closure}}::h00d490f5d4e50606
   4: 0x662634b3 - std::panicking::panic_hook_with_disk_dump::hebe5fc45befd04f3
   5: 0x66d1f227 - rustc_driver_impl[a5419d7a2f24870a]::install_ice_hook::{closure#0}
   7: 0x66263cc8 - std::panicking::begin_panic_handler::{{closure}}::haf05a0f3d7198621
   8: 0x66261158 - std::sys_common::backtrace::__rust_end_short_backtrace::ha215c523c59793aa
   9: 0x66263a55 - _rust_begin_unwind
  10: 0x662bea6d - core::panicking::panic_fmt::hff163fd7d423cd54
  10: 0x662bea6d - core::panicking::panic_fmt::hff163fd7d423cd54
  11: 0x69d40fc7 - <rustc_errors[37c6311b894514b8]::HandlerInner>::panic_if_treat_err_as_bug
  12: 0x69d40126 - <rustc_errors[37c6311b894514b8]::HandlerInner>::emit_diagnostic::{closure#2}
  13: 0x66f6bf79 - rustc_interface[90485b44df649e4f]::callbacks::track_diagnostic
  14: 0x69d3f48f - <rustc_errors[37c6311b894514b8]::HandlerInner>::emit_diagnostic
  15: 0x69d8a538 - <rustc_span[816e203749c7a62]::ErrorGuaranteed as rustc_errors[37c6311b894514b8]::diagnostic_builder::EmissionGuarantee>::diagnostic_builder_emit_producing_guarantee
  16: 0x67edbf3f - <rustc_resolve[9998538d989d25aa]::Resolver>::report_errors
  17: 0x67fe959a - <rustc_session[7093658e48485c60]::session::Session>::time::<(), <rustc_resolve[9998538d989d25aa]::Resolver>::resolve_crate::{closure#0}>
  19:    0x3d4d0 - <unknown>

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


note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.73.0-nightly (0c0090f59 2023-07-25) running on i686-pc-windows-gnu

note: compiler flags: -Z threads=1 -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -C codegen-units=1 -Z ui-testing -Z deduplicate-diagnostics=no -C strip=debuginfo -C prefer-dynamic -C rpath -C debuginfo=0 -Z treat-err-as-bug=1
query stack during panic:
#0 [resolver_for_lowering] getting the resolver for lowering
end of query stack
------------------------------------------

@bors
Copy link
Contributor

bors commented Jul 25, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 25, 2023
@strottos
Copy link
Contributor Author

Had a quick look and looks kind of like a spurious failure. It failed because the backtrack on a Windows PC stopped spitting out function names and just wrote out {unknown} in place. Currently unsure why this would happen but my guess is a retry would work. Certainly this isn’t an area I’ve directly touched:

2023-07-25T11:57:15.0014906Z stack backtrace:
2023-07-25T11:57:15.0015160Z    0: 0x662c2d42 - core::fmt::write::h1147d65d38424eec
2023-07-25T11:57:15.0015437Z    1: 0x66256614 - std::io::Write::write_fmt::hb78e5874c67659c6
2023-07-25T11:57:15.0015721Z    2: 0x662603c0 - std::sys_common::backtrace::print::hd10d5c20761406e1
2023-07-25T11:57:15.0016060Z    3: 0x662636cd - std::panicking::panic_hook_with_disk_dump::{{closure}}::h00d490f5d4e50606
2023-07-25T11:57:15.0016511Z    4: 0x662634b3 - std::panicking::panic_hook_with_disk_dump::hebe5fc45befd04f3
2023-07-25T11:57:15.0016828Z    5: 0x66d1f227 - rustc_driver_impl[a5419d7a2f24870a]::install_ice_hook::{closure#0}
2023-07-25T11:57:15.0017144Z    6: 0x66263f19 - std::panicking::rust_panic_with_hook::h4ff6de34a70869f0
2023-07-25T11:57:15.0017457Z    7: 0x66263cc8 - std::panicking::begin_panic_handler::{{closure}}::haf05a0f3d7198621
2023-07-25T11:57:15.0017837Z    8: 0x66261158 - std::sys_common::backtrace::__rust_end_short_backtrace::ha215c523c59793aa
2023-07-25T11:57:15.0018107Z    9: 0x66263a55 - _rust_begin_unwind
2023-07-25T11:57:15.0018363Z   10: 0x662bea6d - core::panicking::panic_fmt::hff163fd7d423cd54
2023-07-25T11:57:15.0018675Z   11: 0x69d40fc7 - <rustc_errors[37c6311b894514b8]::HandlerInner>::panic_if_treat_err_as_bug
2023-07-25T11:57:15.0019003Z   12: 0x69d40126 - <rustc_errors[37c6311b894514b8]::HandlerInner>::emit_diagnostic::{closure#2}
2023-07-25T11:57:15.0019318Z   13: 0x66f6bf79 - rustc_interface[90485b44df649e4f]::callbacks::track_diagnostic
2023-07-25T11:57:15.0019626Z   14: 0x69d3f48f - <rustc_errors[37c6311b894514b8]::HandlerInner>::emit_diagnostic
2023-07-25T11:57:15.0020027Z   15: 0x69d8a538 - <rustc_span[816e203749c7a62]::ErrorGuaranteed as rustc_errors[37c6311b894514b8]::diagnostic_builder::EmissionGuarantee>::diagnostic_builder_emit_producing_guarantee
2023-07-25T11:57:15.0020428Z   16: 0x67edbf3f - <rustc_resolve[9998538d989d25aa]::Resolver>::report_errors
2023-07-25T11:57:15.0020785Z   17: 0x67fe959a - <rustc_session[7093658e48485c60]::session::Session>::time::<(), <rustc_resolve[9998538d989d25aa]::Resolver>::resolve_crate::{closure#0}>
2023-07-25T11:57:15.0021070Z   18:    0x3d4d0 - <unknown>
2023-07-25T11:57:15.0021258Z   19:    0x3d4d0 - <unknown>
2023-07-25T11:57:15.0021371Z 
2023-07-25T11:57:15.0021541Z error: the compiler unexpectedly panicked. this is a bug

When tested on a Linux PC (all I have access to right now, tomorrow can try on a Windows PC tomorrow evening) we get much more output than this that would match the test. Is there a way we can queue a retry @fee1-dead ? No stress on this one, it’s not a biggie.

Would be curious to know under what circumstances we get this… could be some obscure Windows internals maybe but would need to look how backtrack gets this detail but it’s bound to be a Windows syscall equivalent (forget the name).

@strottos
Copy link
Contributor Author

strottos commented Jul 25, 2023

Ran that test 1k times on my Linux box and 1k correct outputs. Wonder if the same will be true on the Windows box tomorrow evening. Either way whatever happens to this I’ll look into that again there tomorrow so even if it is something I’ve done hopefully I’ll be able to see what (though I can’t think what that could have been at present).

@fee1-dead
Copy link
Member

Let's just retry and see what happens.

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 25, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 25, 2023
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#112995 (Check for `<&NotClone as Clone>::clone()` calls and suggest to add Clone trait appropriately)
 - rust-lang#113578 (Don't say that a type is uncallable if its fn signature has errors in it)
 - rust-lang#113661 (Double check that hidden types match the expected hidden type)
 - rust-lang#114044 (factor out more stable impls)
 - rust-lang#114062 (CI: split nested GHA groups instead of panicking)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit c5c0aa1 into rust-lang:master Jul 26, 2023
11 of 12 checks passed
@rustbot rustbot added this to the 1.73.0 milestone Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

None yet

6 participants