Skip to content

Commit 3a70240

Browse files
committed
objects-coerce-freeze-borrored
1 parent 6dc2e62 commit 3a70240

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

tests/ui/traits/trait-object-method-receiver-rules.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
//! Method availability rules for trait objects depend on receiver type.
2+
13
trait Foo {
24
fn borrowed(&self);
35
fn borrowed_mut(&mut self);
4-
56
fn owned(self: Box<Self>);
67
}
78

@@ -20,7 +21,7 @@ fn borrowed_mut_receiver(x: &mut dyn Foo) {
2021
fn owned_receiver(x: Box<dyn Foo>) {
2122
x.borrowed();
2223
x.borrowed_mut(); // See [1]
23-
x.managed(); //~ ERROR no method named `managed` found
24+
x.managed(); //~ ERROR no method named `managed` found
2425
x.owned();
2526
}
2627

tests/ui/traits/trait-object-method-receiver-rules.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0599]: no method named `owned` found for reference `&dyn Foo` in the current scope
2-
--> $DIR/object-pointer-types.rs:11:7
2+
--> $DIR/trait-object-method-receiver-rules.rs:12:7
33
|
44
LL | fn owned(self: Box<Self>);
55
| --------- the method might not be found because of this arbitrary self type
@@ -13,7 +13,7 @@ LL | x.to_owned();
1313
| +++
1414

1515
error[E0599]: no method named `owned` found for mutable reference `&mut dyn Foo` in the current scope
16-
--> $DIR/object-pointer-types.rs:17:7
16+
--> $DIR/trait-object-method-receiver-rules.rs:18:7
1717
|
1818
LL | fn owned(self: Box<Self>);
1919
| --------- the method might not be found because of this arbitrary self type
@@ -22,7 +22,7 @@ LL | x.owned();
2222
| ^^^^^ method not found in `&mut dyn Foo`
2323

2424
error[E0599]: no method named `managed` found for struct `Box<(dyn Foo + 'static)>` in the current scope
25-
--> $DIR/object-pointer-types.rs:23:7
25+
--> $DIR/trait-object-method-receiver-rules.rs:24:7
2626
|
2727
LL | x.managed();
2828
| ^^^^^^^ method not found in `Box<(dyn Foo + 'static)>`

0 commit comments

Comments
 (0)