]> git.lizzy.rs Git - rust.git/blob - src/test/ui/illegal-sized-bound/regular.rs
Rollup merge of #105694 - ouz-a:issue_105689, r=estebank
[rust.git] / src / test / ui / illegal-sized-bound / regular.rs
1 struct MutType;
2
3 pub trait MutTrait {
4     fn function(&mut self)
5     where
6         Self: Sized;
7     //~^ this has a `Sized` requirement
8 }
9
10 impl MutTrait for MutType {
11     fn function(&mut self) {}
12 }
13
14 struct Type;
15
16 pub trait Trait {
17     fn function(&self)
18     where
19         Self: Sized;
20     //~^ this has a `Sized` requirement
21 }
22
23 impl Trait for Type {
24     fn function(&self) {}
25 }
26
27 fn main() {
28     (&mut MutType as &mut dyn MutTrait).function();
29     //~^ ERROR the `function` method cannot be invoked on a trait object
30     (&Type as &dyn Trait).function();
31     //~^ ERROR the `function` method cannot be invoked on a trait object
32 }