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

ices/109281.rs: fixed with errors #1646

Merged
merged 1 commit into from
Oct 15, 2023
Merged

ices/109281.rs: fixed with errors #1646

merged 1 commit into from
Oct 15, 2023

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Aug 7, 2023

Issue: rust-lang/rust#109281

#![feature(type_alias_impl_trait)]
struct S;
type ReturnType<'a> = impl Eq + 'a;
impl std::ops::Deref for S {
    type Target = dyn Fn(&()) -> ReturnType;
    fn deref() -> &'static Self::Target {}
}

fn main() {}
=== stdout ===
=== stderr ===
error[E0308]: mismatched types
 --> /home/runner/work/glacier/glacier/ices/109281.rs:6:19
  |
3 | type ReturnType<'a> = impl Eq + 'a;
  |                       ------------ the expected opaque type
...
6 |     fn deref() -> &'static Self::Target {}
  |        -----      ^^^^^^^^^^^^^^^^^^^^^ expected `&dyn Fn(&()) -> ReturnType<'_>`, found `()`
  |        |
  |        implicitly returns `()` as its body has no tail or `return` expression
  |
  = note: expected reference `&'static (dyn for<'a> Fn(&'a ()) -> ReturnType<'_> + 'static)`
             found unit type `()`

error[E0186]: method `deref` has a `&self` declaration in the trait, but not in the impl
 --> /home/runner/work/glacier/glacier/ices/109281.rs:6:5
  |
6 |     fn deref() -> &'static Self::Target {}
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&self` in impl
  |
  = note: `deref` from trait: `fn(&Self) -> &<Self as Deref>::Target`

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0186, E0308.
For more information about an error, try `rustc --explain E0186`.
==============

=== stdout ===
=== stderr ===
error[E0308]: mismatched types
 --> /home/runner/work/glacier/glacier/ices/109281.rs:6:19
  |
3 | type ReturnType<'a> = impl Eq + 'a;
  |                       ------------ the expected opaque type
...
6 |     fn deref() -> &'static Self::Target {}
  |        -----      ^^^^^^^^^^^^^^^^^^^^^ expected `&dyn Fn(&()) -> ReturnType<'_>`, found `()`
  |        |
  |        implicitly returns `()` as its body has no tail or `return` expression
  |
  = note: expected reference `&'static (dyn for<'a> Fn(&'a ()) -> ReturnType<'_> + 'static)`
             found unit type `()`

error[E0186]: method `deref` has a `&self` declaration in the trait, but not in the impl
 --> /home/runner/work/glacier/glacier/ices/109281.rs:6:5
  |
6 |     fn deref() -> &'static Self::Target {}
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&self` in impl
  |
  = note: `deref` from trait: `fn(&Self) -> &<Self as Deref>::Target`

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0186, E0308.
For more information about an error, try `rustc --explain E0186`.
==============
@JohnTitor JohnTitor merged commit 571629d into master Oct 15, 2023
@JohnTitor JohnTitor deleted the autofix/ices/109281.rs branch October 15, 2023 03:08
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