Skip to content

invalid(..) type description in diagnostic #1367

Description

@sbillig
struct Slice {
    source: ref [u256; 8],  // reference to the original array
    start: usize,
    len: usize,
}

impl Slice {
    fn new(source: ref [u256; 8], start: usize, len: usize) -> Slice {
        Slice { source, start, len }
    }
}

impl Seq for Slice {
    type Item = u256
    
    fn len(self) -> usize {
        self.len
    }
    
    fn get(ref self, i: usize) -> ref Item {
        self.source[self.start + I] // ERROR: expected `ref invalid(PathResolutionFailed(Item))`, but `u256` is given
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions