Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

ices/110696.rs: fixed with errors #1654

Merged
merged 1 commit into from
Oct 15, 2023
Merged

ices/110696.rs: fixed with errors #1654

merged 1 commit into from
Oct 15, 2023

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#110696

#![feature(type_alias_impl_trait)]

use std::marker::PhantomData;


trait MyIndex<T> {
    type O;
    fn my_index(self) -> Self::O;
}
trait MyFrom<T>: Sized {
    type Error;
    fn my_from(value: T) -> Result<Self, Self::Error>;
}


trait F {}
impl F for () {}
type DummyT<T> = impl F;
fn _dummy_t<T>() -> DummyT<T> {}

struct Phantom1<T>(PhantomData<T>);
struct Phantom2<T>(PhantomData<T>);
struct Scope<T>(Phantom2<DummyT<T>>);

impl<T> Scope<T> {
    fn new() -> Self {
        unimplemented!()
    }
}

impl<T> MyFrom<Phantom2<T>> for Phantom1<T> {
    type Error = ();
    fn my_from(_: Phantom2<T>) -> Result<Self, Self::Error> {
        unimplemented!()
    }
}

impl<T: MyFrom<Phantom2<DummyT<U>>>, U> MyIndex<DummyT<T>> for Scope<U> {
    type O = T;
    fn my_index(self) -> Self::O {
        MyFrom::my_from(self.0).ok().unwrap()
    }
}

fn main() {
    let _pos: Phantom1<DummyT<()>> = Scope::new().my_index();
}
=== stdout ===
=== stderr ===
error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
  --> /home/runner/work/glacier/glacier/ices/110696.rs:38:6
   |
38 | impl<T: MyFrom<Phantom2<DummyT<U>>>, U> MyIndex<DummyT<T>> for Scope<U> {
   |      ^ unconstrained type parameter

error: aborting due to previous error

For more information about this error, try `rustc --explain E0207`.
==============

=== stdout ===
=== stderr ===
error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
  --> /home/runner/work/glacier/glacier/ices/110696.rs:38:6
   |
38 | impl<T: MyFrom<Phantom2<DummyT<U>>>, U> MyIndex<DummyT<T>> for Scope<U> {
   |      ^ unconstrained type parameter

error: aborting due to previous error

For more information about this error, try `rustc --explain E0207`.
==============
@JohnTitor JohnTitor merged commit ce9e6dc into master Oct 15, 2023
@JohnTitor JohnTitor deleted the autofix/ices/110696.rs branch October 15, 2023 03:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants