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

ices/85113.rs: fixed with errors #822

Merged
merged 1 commit into from
Jun 10, 2021
Merged

ices/85113.rs: fixed with errors #822

merged 1 commit into from
Jun 10, 2021

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#85113

#![feature(min_type_alias_impl_trait)]
#![feature(impl_trait_in_bindings)]

type OpaqueOutputImpl<'a> = impl Output<'a> + 'a;

trait Output<'a> {}

impl<'a> Output<'a> for &'a str {}

fn cool_fn<'a>(arg: &'a str) -> OpaqueOutputImpl<'a> {
    let out: OpaqueOutputImpl<'a> = arg;
    arg // This was supposed to be `out`
}

fn main() {
    let s = String::from("wassup");
    cool_fn(&s);
}
=== stdout ===
=== stderr ===
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /home/runner/work/glacier/glacier/ices/85113.rs:2:12
  |
2 | #![feature(impl_trait_in_bindings)]
  |            ^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information

error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
 --> /home/runner/work/glacier/glacier/ices/85113.rs:4:29
  |
4 | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a;
  |                             ^^^^^^^^^^^^^^^^^^^^
  |
note: hidden type `&'<empty> str` captures lifetime smaller than the function body
 --> /home/runner/work/glacier/glacier/ices/85113.rs:4:29
  |
4 | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a;
  |                             ^^^^^^^^^^^^^^^^^^^^

error[E0477]: the type `&'<empty> str` does not fulfill the required lifetime
 --> /home/runner/work/glacier/glacier/ices/85113.rs:4:29
  |
4 | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a;
  |                             ^^^^^^^^^^^^^^^^^^^^
  |
note: type must outlive the lifetime `'a` as defined on the item at 4:23
 --> /home/runner/work/glacier/glacier/ices/85113.rs:4:23
  |
4 | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a;
  |                       ^^

error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
 --> /home/runner/work/glacier/glacier/ices/85113.rs:4:29
  |
4 | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a;
  |                             ^^^^^^^^^^^^^^^^^^^^
  |
  = note: first, the lifetime cannot outlive the empty lifetime...
note: ...but the lifetime must also be valid for the lifetime `'a` as defined on the item at 4:23...
 --> /home/runner/work/glacier/glacier/ices/85113.rs:4:23
  |
4 | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a;
  |                       ^^
note: ...so that the types are compatible
 --> /home/runner/work/glacier/glacier/ices/85113.rs:4:29
  |
4 | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a;
  |                             ^^^^^^^^^^^^^^^^^^^^
  = note: expected `Output<'a>`
             found `Output<'_>`

error: aborting due to 3 previous errors; 1 warning emitted

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

=== stdout ===
=== stderr ===
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /home/runner/work/glacier/glacier/ices/85113.rs:2:12
  |
2 | #![feature(impl_trait_in_bindings)]
  |            ^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #63065 <rust-lang/rust#63065> for more information

error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
 --> /home/runner/work/glacier/glacier/ices/85113.rs:4:29
  |
4 | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a;
  |                             ^^^^^^^^^^^^^^^^^^^^
  |
note: hidden type `&'<empty> str` captures lifetime smaller than the function body
 --> /home/runner/work/glacier/glacier/ices/85113.rs:4:29
  |
4 | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a;
  |                             ^^^^^^^^^^^^^^^^^^^^

error[E0477]: the type `&'<empty> str` does not fulfill the required lifetime
 --> /home/runner/work/glacier/glacier/ices/85113.rs:4:29
  |
4 | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a;
  |                             ^^^^^^^^^^^^^^^^^^^^
  |
note: type must outlive the lifetime `'a` as defined on the item at 4:23
 --> /home/runner/work/glacier/glacier/ices/85113.rs:4:23
  |
4 | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a;
  |                       ^^

error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
 --> /home/runner/work/glacier/glacier/ices/85113.rs:4:29
  |
4 | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a;
  |                             ^^^^^^^^^^^^^^^^^^^^
  |
  = note: first, the lifetime cannot outlive the empty lifetime...
note: ...but the lifetime must also be valid for the lifetime `'a` as defined on the item at 4:23...
 --> /home/runner/work/glacier/glacier/ices/85113.rs:4:23
  |
4 | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a;
  |                       ^^
note: ...so that the types are compatible
 --> /home/runner/work/glacier/glacier/ices/85113.rs:4:29
  |
4 | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a;
  |                             ^^^^^^^^^^^^^^^^^^^^
  = note: expected `Output<'a>`
             found `Output<'_>`

error: aborting due to 3 previous errors; 1 warning emitted

Some errors have detailed explanations: E0477, E0495, E0700.
For more information about an error, try `rustc --explain E0477`.
==============
Copy link
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented on the issue.

@JohnTitor JohnTitor merged commit b48896d into master Jun 10, 2021
@JohnTitor JohnTitor deleted the autofix/ices/85113.rs branch June 10, 2021 16:29
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