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

ices/53092.rs: fixed with errors #1256

Merged
merged 1 commit into from
May 14, 2022
Merged

ices/53092.rs: fixed with errors #1256

merged 1 commit into from
May 14, 2022

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#53092

#![feature(type_alias_impl_trait)]
#![allow(dead_code)]

type Bug<T, U> = impl Fn(T) -> U + Copy;

const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) };

fn make_bug<T, U: From<T>>() -> Bug<T, U> {
    |x| x.into()
}

fn main() {
    CONST_BUG(0);
}
=== stdout ===
=== stderr ===
error[E0277]: the trait bound `U: From<T>` is not satisfied
 --> /home/runner/work/glacier/glacier/ices/53092.rs:9:5
  |
9 |     |x| x.into()
  |     ^^^^^^^^^^^^ the trait `From<T>` is not implemented for `U`
  |
note: required by a bound in `make_bug`
 --> /home/runner/work/glacier/glacier/ices/53092.rs:8:19
  |
8 | fn make_bug<T, U: From<T>>() -> Bug<T, U> {
  |                   ^^^^^^^ required by this bound in `make_bug`
help: consider restricting type parameter `U`
  |
4 | type Bug<T, U: std::convert::From<T>> = impl Fn(T) -> U + Copy;
  |              +++++++++++++++++++++++

error: aborting due to previous error

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

=== stdout ===
=== stderr ===
error[E0277]: the trait bound `U: From<T>` is not satisfied
 --> /home/runner/work/glacier/glacier/ices/53092.rs:9:5
  |
9 |     |x| x.into()
  |     ^^^^^^^^^^^^ the trait `From<T>` is not implemented for `U`
  |
note: required by a bound in `make_bug`
 --> /home/runner/work/glacier/glacier/ices/53092.rs:8:19
  |
8 | fn make_bug<T, U: From<T>>() -> Bug<T, U> {
  |                   ^^^^^^^ required by this bound in `make_bug`
help: consider restricting type parameter `U`
  |
4 | type Bug<T, U: std::convert::From<T>> = impl Fn(T) -> U + Copy;
  |              +++++++++++++++++++++++

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
==============
@JohnTitor JohnTitor merged commit 4208d4c into master May 14, 2022
@JohnTitor JohnTitor deleted the autofix/ices/53092.rs branch May 14, 2022 12:34
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