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

ices/74816.rs: fixed with errors #500

Merged
merged 1 commit into from
Oct 7, 2020
Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Oct 7, 2020

Issue: rust-lang/rust#74816

#![feature(associated_type_defaults)]
#![feature(generic_associated_types)]
#![allow(incomplete_features)]

trait Trait1 {
    fn foo();
}

trait Trait2 {
    type Associated: Trait1 = Self;
}

impl Trait2 for () {}

fn call_foo<T: Trait2>() {
    T::Associated::foo()
}

fn main() {
    call_foo::<()>()
}
=== stdout ===
=== stderr ===
error[E0277]: the trait bound `Self: Trait1` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/74816.rs:10:5
   |
10 |     type Associated: Trait1 = Self;
   |     ^^^^^^^^^^^^^^^^^------^^^^^^^^
   |     |                |
   |     |                required by this bound in `Trait2::Associated`
   |     the trait `Trait1` is not implemented for `Self`
   |
help: consider further restricting `Self`
   |
9  | trait Trait2: Trait1 {
   |             ^^^^^^^^

error[E0277]: the size for values of type `Self` cannot be known at compilation time
  --> /home/runner/work/glacier/glacier/ices/74816.rs:10:5
   |
10 |     type Associated: Trait1 = Self;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |     |
   |     doesn't have a size known at compile-time
   |     required by this bound in `Trait2::Associated`
   |
help: consider further restricting `Self`
   |
9  | trait Trait2: Sized {
   |             ^^^^^^^

error: aborting due to 2 previous errors

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

=== stdout ===
=== stderr ===
error[E0277]: the trait bound `Self: Trait1` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/74816.rs:10:5
   |
10 |     type Associated: Trait1 = Self;
   |     ^^^^^^^^^^^^^^^^^------^^^^^^^^
   |     |                |
   |     |                required by this bound in `Trait2::Associated`
   |     the trait `Trait1` is not implemented for `Self`
   |
help: consider further restricting `Self`
   |
9  | trait Trait2: Trait1 {
   |             ^^^^^^^^

error[E0277]: the size for values of type `Self` cannot be known at compilation time
  --> /home/runner/work/glacier/glacier/ices/74816.rs:10:5
   |
10 |     type Associated: Trait1 = Self;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |     |
   |     doesn't have a size known at compile-time
   |     required by this bound in `Trait2::Associated`
   |
help: consider further restricting `Self`
   |
9  | trait Trait2: Sized {
   |             ^^^^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.
==============
@JohnTitor JohnTitor merged commit 4666f9d into master Oct 7, 2020
@JohnTitor JohnTitor deleted the autofix/ices/74816.rs branch October 7, 2020 13:07
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