-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Matching Box(<pattern>) against Box<T> should give privacy error, not type mismatch #22207
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
Comments
Other than the rather strange error message, this isn't a bug (at least, there's no reason it should work). The struct Box<T>(Unique<T>); so a It should be failing with a privacy error, like: pub mod foo {
pub struct Bar(i32);
impl Bar {
pub fn new(x: i32) -> Bar { Bar(x) }
}
}
use foo::Bar;
fn main() {
let x = Bar::new(1);
let Bar(y) = x;
}
|
See also #22045, which argues that we might want to be able to put a separate But yeah, I wouldn't be at all surprised if this were a consequence of the current special treatment of |
FWIW, I work around this by using
compiles just fine. |
Triage: still giveing the original error, rather than a privacy error. |
This now gives a privacy error; I don't think we really need a test here. Closing. |
While looking at #22205, I tried this as a workaround:
However, this has the error:
The text was updated successfully, but these errors were encountered: