-
Notifications
You must be signed in to change notification settings - Fork 13.4k
nll: respect user type annotations with constants in patterns #55511
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
triage: Either this is something that we're planning to implement and backport to the beta channel... or its something that is not that high priority. Given that this is an NLL-sound issue, I'm going to assume that it is indeed high priority and belongs on the Release milestone. Thus, tagging as P-high |
Just a quick note: this variant of the description's second example is rejected by NLL (play): #![feature(nll)]
use std::cell::Cell;
trait Foo<'a> {
const C: Option<Cell<&'a u32>>;
}
impl<'a, T> Foo<'a> for T {
const C: Option<Cell<&'a u32>> = None;
}
fn foo<'a>(r: &'a i32) {
let b = Some(Cell::new(r));
match b {
<() as Foo<'static>>::C => { }
_ => { }
}
}
fn main() {
} From looking at the MIR generated for the description's second example, perhaps the problem stems from this ?
(I got the |
triage: assigning to self |
didn't get a chance to look into this further today. Unassigning self (I'll be back from leave in ~2 weeks, but I want to make sure other people know that this is available to hack on in the meantime). |
Removing from milestone — sufficiently obscure that it need not be a release blocker |
NLL: User type annotations refactor, associated constant patterns and ref bindings. Fixes #55511 and Fixes #55401. Contributes to #54943. This PR performs a large refactoring on user type annotations, checks user type annotations for associated constants in patterns and that user type annotations for `ref` bindings are respected. r? @nikomatsakis
Breaking off from #47184 -- we need to respect user type annotations in patterns. Here are some examples:
Compiles without NLL (playground):
Errors without NLL (playground):
The text was updated successfully, but these errors were encountered: