summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/issue-94675.rs
blob: 0604aab3bcd2cfcda041008fa606bcc9dcff6c71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#![feature(const_trait_impl, const_mut_refs)]

struct Foo<'a> {
    bar: &'a mut Vec<usize>,
}

impl<'a> Foo<'a> {
    const fn spam(&mut self, baz: &mut Vec<u32>) {
        self.bar[0] = baz.len();
        //~^ ERROR cannot call non-const fn `Vec::<u32>::len` in constant functions
        //~| ERROR the trait bound `Vec<usize>: ~const IndexMut<usize>` is not satisfied
        //~| ERROR cannot call non-const operator in constant functions
    }
}

fn main() {}