Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/rustc_hir_analysis/src/coherence/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,8 @@ pub(crate) fn reborrow_info<'tcx>(
)
.is_ok()
{
// Field implements Reborrow.
return Ok(());
// Field implements Reborrow, check remaining fields.
continue;
}

// Field does not implement Reborrow: it must be Copy.
Expand Down
15 changes: 15 additions & 0 deletions tests/ui/reborrow/reborrow_multi_field_validation.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#![feature(reborrow)]

use std::marker::Reborrow;

// Regression test: `reborrow_info` must validate ALL data fields,
// not just stop at the first Reborrow field.

struct Bad<'a> {
first: &'a mut i32,
second: String, //~ ERROR the trait bound `String: Copy` is not satisfied
Copy link
Copy Markdown
Contributor

@dingxiangfei2009 dingxiangfei2009 May 20, 2026

Choose a reason for hiding this comment

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

Let's ./x t tests/ui/reborrow/reborrow_multi_field_validation.rs --bless once.

View changes since the review

}

impl<'a> Reborrow for Bad<'a> {}

fn main() {}
Loading