]> git.lizzy.rs Git - rust.git/blob - tests/ui/auto-ref-slice-plus-ref.rs
Auto merge of #107529 - Zoxc:inline-tweak-profile, r=cjgillot
[rust.git] / tests / ui / auto-ref-slice-plus-ref.rs
1 fn main() {
2
3     // Testing that method lookup does not automatically borrow
4     // vectors to slices then automatically create a self reference.
5
6     let mut a = vec![0];
7     a.test_mut(); //~ ERROR no method named `test_mut` found
8     a.test(); //~ ERROR no method named `test` found
9
10     ([1]).test(); //~ ERROR no method named `test` found
11     (&[1]).test(); //~ ERROR no method named `test` found
12 }
13
14 trait MyIter {
15     fn test_mut(&mut self);
16     fn test(&self);
17 }
18
19 impl<'a> MyIter for &'a [isize] {
20     fn test_mut(&mut self) { }
21     fn test(&self) { }
22 }
23
24 impl<'a> MyIter for &'a str {
25     fn test_mut(&mut self) { }
26     fn test(&self) { }
27 }