Skip to content

matching against an associated constant gives type error #57280

Closed
@nikomatsakis

Description

@nikomatsakis

Ever since #55937, the following program (playground) gives an unexpected error from NLL:

#![feature(nll)]

trait Foo {
    const Blah: &'static str;
}

struct Placeholder;

impl Foo for Placeholder {
    const Blah: &'static str = "hi";
}

fn foo(x: &str) {
    match x {
        <Placeholder as Foo>::Blah => { }
        _ => { }
    }
}

First reported by @Xanewok in this comment, because this broke the RLS.

cc @davidtwco

Metadata

Metadata

Labels

A-NLLArea: Non-lexical lifetimes (NLL)P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions