Skip to content

Cargo Build gets stuck compiling my code #135050

Description

@drewcassidy

While writing some code I wanted to see if it compiled, and instead cargo build just hung, either forever or longer than I was willing to late. It's a bug either way. I think I got it stuck in an infinite loop resolving traits

Code is here. I was editing mask.rs when I encountered the issue.

I think the problem code is

pub trait Maskable<T>: Copy {
    type Mask: Mask;

    fn set_masked<R: Splat<Self>>(&mut self, mask: Self::Mask, value: R);
}

impl<T, const N: usize> Maskable<T> for Col<T, N>
where
    T: Copy,
{
    type Mask = Col<bool, N>;

    fn set_masked<R: Splat<Self>>(&mut self, mask: Self::Mask, value: R) {
        let value: Self = value.splat();
        for (i, &m) in mask.iter().enumerate() {
            if m {
                self[i] = value[i]
            }
        }
    }
}

impl<S: Copy, T: Copy, const H: usize, const W: usize> Maskable<T> for Mat<S, W, H>
where
    Col<S, W>: Copy + Maskable<T>,
{
    type Mask = Col<Col<S, W>::Mask, H>;

    fn set_masked<R: Splat<Self>>(&mut self, mask: Self::Mask, value: R) {
        let value: Self = value.splat();
        for (i, &m) in mask.iter().enumerate() {
            self[i].set_masked(m, value[i]);
        }
    }
}

(this code is bad and wrong but it probably shouldn't do this)

I cant include a backtrace because Cargo never terminates

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

    C-bugCategory: This is a bug.I-hangIssue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.S-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions