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

ices/101465.rs: fixed with errors #1416

Merged
merged 1 commit into from
Sep 13, 2022
Merged

ices/101465.rs: fixed with errors #1416

merged 1 commit into from
Sep 13, 2022

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#101465

#![feature(trait_alias)]

struct B;

struct C;

trait Tr2<S> = Into<S>;

fn foo2<T: Tr2<()>>() {}

fn foo() -> impl Sized {
    let x = foo2::<_>();

    match true {
        true => B,
        false => C,
    }
}

pub fn main() {}
=== stdout ===
=== stderr ===
error[E0308]: `match` arms have incompatible types
  --> /home/runner/work/glacier/glacier/ices/101465.rs:16:18
   |
14 | /     match true {
15 | |         true => B,
   | |                 - this is found to be of type `B`
16 | |         false => C,
   | |                  ^ expected struct `B`, found struct `C`
17 | |     }
   | |_____- `match` arms have incompatible types
   |
help: you could change the return type to be a boxed trait object
   |
11 | fn foo() -> Box<dyn Sized> {
   |             ~~~~~~~      +
help: if you change the return type to expect trait objects, box the returned expressions
   |
15 ~         true => Box::new(B),
16 ~         false => Box::new(C),
   |

error: aborting due to previous error

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

=== stdout ===
=== stderr ===
error[E0308]: `match` arms have incompatible types
  --> /home/runner/work/glacier/glacier/ices/101465.rs:16:18
   |
14 | /     match true {
15 | |         true => B,
   | |                 - this is found to be of type `B`
16 | |         false => C,
   | |                  ^ expected struct `B`, found struct `C`
17 | |     }
   | |_____- `match` arms have incompatible types
   |
help: you could change the return type to be a boxed trait object
   |
11 | fn foo() -> Box<dyn Sized> {
   |             ~~~~~~~      +
help: if you change the return type to expect trait objects, box the returned expressions
   |
15 ~         true => Box::new(B),
16 ~         false => Box::new(C),
   |

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
==============
@JohnTitor JohnTitor merged commit 07bac2c into master Sep 13, 2022
@JohnTitor JohnTitor deleted the autofix/ices/101465.rs branch September 13, 2022 09:28
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