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

ices/96223.rs: fixed with errors #1239

Merged
merged 1 commit into from
May 10, 2022
Merged

ices/96223.rs: fixed with errors #1239

merged 1 commit into from
May 10, 2022

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented May 5, 2022

Issue: rust-lang/rust#96223

use std::marker::PhantomData;

pub trait Deserialize<'de>: Sized {
    // fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    // where
    //     D: Deserializer<'de>;
}

pub trait Yokeable<'a>: 'static {
    type Output: 'a;
}

pub trait DataMarker {
    type Yokeable: for<'a> Yokeable<'a>;
}

pub struct YokeTraitHack<T>(pub T);

impl<'de, T> Deserialize<'de> for YokeTraitHack<T>
where
    T: Deserialize<'de> {}

struct FsDataProvider;

impl<M> DynProvider<M> for FsDataProvider
where
    M: DataMarker,
    for<'de> YokeTraitHack<<M::Yokeable as Yokeable<'de>>::Output>: Deserialize<'de> {

}
// pub struct DataPayload<M: DataMarker>(<M::Yokeable as Yokeable<'static>>::Output);

pub trait DynProvider<M> 
where
    M: DataMarker, 
{
    // fn load_payload(
    //     &self,
    //     key: &str
    // ) -> DataPayload<M>;
}


pub struct CodePointSet<'a>(&'a [u8]);

impl<'a> Yokeable<'a> for CodePointSet<'static> {
    type Output = CodePointSet<'a>;
}

pub struct CodePointSetMarker;

impl DataMarker for CodePointSetMarker {
    type Yokeable = CodePointSet<'static>;
}
fn icey_bounds<D: DynProvider<CodePointSetMarker>>(p: &D) {
    // let ascii_hex_digit = get_ascii_hex_digit(p).expect("hi");
}

fn trigger_ice() {
    let p = FsDataProvider;
    icey_bounds(&p);
}

fn main() {}
=== stdout ===
=== stderr ===
warning: unused import: `std::marker::PhantomData`
 --> /home/runner/work/glacier/glacier/ices/96223.rs:1:5
  |
1 | use std::marker::PhantomData;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error[E0277]: the trait bound `for<'de> CodePointSet<'de>: Deserialize<'_>` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/96223.rs:61:17
   |
61 |     icey_bounds(&p);
   |     ----------- ^^ the trait `for<'de> Deserialize<'_>` is not implemented for `CodePointSet<'de>`
   |     |
   |     required by a bound introduced by this call
   |
   = help: the trait `Deserialize<'de>` is implemented for `YokeTraitHack<T>`
note: required because of the requirements on the impl of `for<'de> Deserialize<'de>` for `YokeTraitHack<CodePointSet<'de>>`
  --> /home/runner/work/glacier/glacier/ices/96223.rs:19:14
   |
19 | impl<'de, T> Deserialize<'de> for YokeTraitHack<T>
   |              ^^^^^^^^^^^^^^^^     ^^^^^^^^^^^^^^^^
note: required because of the requirements on the impl of `DynProvider<CodePointSetMarker>` for `FsDataProvider`
  --> /home/runner/work/glacier/glacier/ices/96223.rs:25:9
   |
25 | impl<M> DynProvider<M> for FsDataProvider
   |         ^^^^^^^^^^^^^^     ^^^^^^^^^^^^^^
note: required by a bound in `icey_bounds`
  --> /home/runner/work/glacier/glacier/ices/96223.rs:55:19
   |
55 | fn icey_bounds<D: DynProvider<CodePointSetMarker>>(p: &D) {
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `icey_bounds`

error: aborting due to previous error; 1 warning emitted

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

=== stdout ===
=== stderr ===
warning: unused import: `std::marker::PhantomData`
 --> /home/runner/work/glacier/glacier/ices/96223.rs:1:5
  |
1 | use std::marker::PhantomData;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error[E0277]: the trait bound `for<'de> CodePointSet<'de>: Deserialize<'_>` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/96223.rs:61:17
   |
61 |     icey_bounds(&p);
   |     ----------- ^^ the trait `for<'de> Deserialize<'_>` is not implemented for `CodePointSet<'de>`
   |     |
   |     required by a bound introduced by this call
   |
   = help: the trait `Deserialize<'de>` is implemented for `YokeTraitHack<T>`
note: required because of the requirements on the impl of `for<'de> Deserialize<'de>` for `YokeTraitHack<CodePointSet<'de>>`
  --> /home/runner/work/glacier/glacier/ices/96223.rs:19:14
   |
19 | impl<'de, T> Deserialize<'de> for YokeTraitHack<T>
   |              ^^^^^^^^^^^^^^^^     ^^^^^^^^^^^^^^^^
note: required because of the requirements on the impl of `DynProvider<CodePointSetMarker>` for `FsDataProvider`
  --> /home/runner/work/glacier/glacier/ices/96223.rs:25:9
   |
25 | impl<M> DynProvider<M> for FsDataProvider
   |         ^^^^^^^^^^^^^^     ^^^^^^^^^^^^^^
note: required by a bound in `icey_bounds`
  --> /home/runner/work/glacier/glacier/ices/96223.rs:55:19
   |
55 | fn icey_bounds<D: DynProvider<CodePointSetMarker>>(p: &D) {
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `icey_bounds`

error: aborting due to previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0277`.
==============
@Alexendoo Alexendoo merged commit 1348652 into master May 10, 2022
@Alexendoo Alexendoo deleted the autofix/ices/96223.rs branch May 10, 2022 13:19
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