about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src/errors.rs
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-04-14 21:55:38 +0200
committerGitHub <noreply@github.com>2025-04-14 21:55:38 +0200
commitbf247c70863cc938819d36731eee79d58c25ffd5 (patch)
treed8a7194a9fc292cae7eef276b1d9c0603d9a0af7 /compiler/rustc_pattern_analysis/src/errors.rs
parent9b564dfc1df52e12876a6a00c4efcece058b688c (diff)
parent6a8718cab772ecfbce3de7a701e9abf8e476bc37 (diff)
downloadrust-bf247c70863cc938819d36731eee79d58c25ffd5.tar.gz
rust-bf247c70863cc938819d36731eee79d58c25ffd5.zip
Rollup merge of #139778 - reddevilmidzy:add-success-test, r=lcnr
Add test for issue 34834

closes: #34834

This PR adds a UI test for a case where a trait with an associated type using a higher-ranked trait bound (HRTB) failed to compile in Rust 1.55.0 but succeeded starting from 1.56.0.

```rust
pub trait Provides<'a> {
    type Item;
}

pub trait Selector: for<'a> Provides<'a> {
    type Namespace: PartialEq + for<'a> PartialEq<<Self as Provides<'a>>::Item>;

    fn get_namespace(&self) -> <Self as Provides>::Item;
}

pub struct MySelector;

impl<'a> Provides<'a> for MySelector {
    type Item = &'a str;
}

impl Selector for MySelector {
    type Namespace = String;

    fn get_namespace(&self) -> &str {
        unimplemented!()
    }
}

fn main() {}
```

* ❌ [compile fail (rustc: 1.55.0)](https://godbolt.org/z/T1jY1Ebo6)
* ⭕ [compile pass (rustc: 1.56.0)](https://godbolt.org/z/e4jo11Ma7)
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/errors.rs')
0 files changed, 0 insertions, 0 deletions