diff options
Diffstat (limited to 'src/test/ui/consts/issue-94675.rs')
-rw-r--r-- | src/test/ui/consts/issue-94675.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/ui/consts/issue-94675.rs b/src/test/ui/consts/issue-94675.rs new file mode 100644 index 000000000..0604aab3b --- /dev/null +++ b/src/test/ui/consts/issue-94675.rs @@ -0,0 +1,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() {} |