Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! regression test for <https://github.com/rust-lang/rust/issues/3874>
//@ build-pass
#![allow(dead_code)]

Expand Down

@lokirithm lokirithm Apr 10, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

View changes since the review

A more minimal version for the second test could be, in my opinion:

trait MyTrait {
    fn dummy(&self) {}
}

struct TraitWrapper(Box<dyn MyTrait + 'static>);

fn get_tw_map(tw: &TraitWrapper) -> &dyn MyTrait {
    match *tw {
        TraitWrapper(box ref map) => map,
    }
}

pub fn main() {}

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! regression test for <https://github.com/rust-lang/rust/issues/4972>
#![feature(box_patterns)]

trait MyTrait {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0033]: type `Box<(dyn MyTrait + 'static)>` cannot be dereferenced
--> $DIR/issue-4972.rs:13:25
--> $DIR/deref-borrowed-trait-object-in-box.rs:14:25
|
LL | TraitWrapper::A(box ref map) => map,
| ^^^^^^^^^^^ type `Box<(dyn MyTrait + 'static)>` cannot be dereferenced
Expand Down
Loading