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

ices/65774.rs: fixed with errors #296

Merged
merged 1 commit into from
Feb 27, 2020
Merged

ices/65774.rs: fixed with errors #296

merged 1 commit into from
Feb 27, 2020

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#65774

#![feature(associated_type_defaults)]

trait MyDisplay { fn method(&self) { } }

impl<'a, T: MyDisplay> MyDisplay for &'a mut T { }

struct T;

trait MPU {
    type MpuConfig: MyDisplay = T;
}

struct S;

impl MPU for S { }

trait MyWrite {
    fn my_write(&self, _: &dyn MyDisplay) { }
}

trait ProcessType {
    fn process_detail_fmt(&self, _: &mut dyn MyWrite);
}

struct Process;

impl ProcessType for Process {
    fn process_detail_fmt(&self, writer: &mut dyn MyWrite)
    {

        let mut val: Option<<S as MPU>::MpuConfig> = None;
        let valref: &mut <S as MPU>::MpuConfig = val.as_mut().unwrap();

        // // This causes a different ICE (but its similar if you squint right):
        // //
        // // `Unimplemented` selecting `Binder(<T as MyDisplay>)` during codegen
        //
        // writer.my_write(valref)

        // This one causes the ICE:
        // FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<T as MyDisplay>)), depth=1),Unimplemented)
        let closure = |config: &mut <S as MPU>::MpuConfig| writer.my_write(&config);
        closure(valref);
    }
}

fn create() -> &'static dyn ProcessType {
    let input: Option<&mut Process> = None;
    let process: &mut Process = input.unwrap();
    process
}

pub fn main() {
    create();
}
=== stdout ===
=== stderr ===
error[E0277]: the trait bound `T: MyDisplay` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/65774.rs:10:21
   |
9  | trait MPU {
   | --------- required by `MPU`
10 |     type MpuConfig: MyDisplay = T;
   |                     ^^^^^^^^^ the trait `MyDisplay` is not implemented for `T`

error[E0277]: the trait bound `T: MyDisplay` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/65774.rs:15:6
   |
15 | impl MPU for S { }
   |      ^^^ the trait `MyDisplay` is not implemented for `T`

error: aborting due to 2 previous errors

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

=== stdout ===
=== stderr ===
error[E0277]: the trait bound `T: MyDisplay` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/65774.rs:10:21
   |
9  | trait MPU {
   | --------- required by `MPU`
10 |     type MpuConfig: MyDisplay = T;
   |                     ^^^^^^^^^ the trait `MyDisplay` is not implemented for `T`

error[E0277]: the trait bound `T: MyDisplay` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/65774.rs:15:6
   |
15 | impl MPU for S { }
   |      ^^^ the trait `MyDisplay` is not implemented for `T`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.
==============
@JohnTitor JohnTitor merged commit c6c23a2 into master Feb 27, 2020
@JohnTitor JohnTitor deleted the autofix/ices/65774.rs branch February 27, 2020 12:44
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