Skip to content

Commit f84233e

Browse files
committed
reviews
1 parent ee48e3f commit f84233e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

tests/ui/cast/ptr-to-ptr-indirect-different-regions.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// We want to forbid extending lifetimes on object types behind ptrs
2+
// as it may allow for uncallable VTable methods to become accessible.
3+
14
trait Trait {
25
fn foo(&self) {}
36
}

tests/ui/cast/ptr-to-ptr-indirect-different-regions.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: lifetime may not live long enough
2-
--> $DIR/ptr-to-ptr-indirect-different-regions.rs:8:5
2+
--> $DIR/ptr-to-ptr-indirect-different-regions.rs:11:5
33
|
44
LL | fn bar<'a>(a: *mut MyWrap<(dyn Trait + 'a)>) -> *mut MyWrap<(dyn Trait + 'static)> {
55
| -- lifetime `'a` defined here
@@ -10,7 +10,7 @@ LL | a as _
1010
= note: mutable pointers are invariant over their type parameter
1111
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
1212
note: raw pointer casts of trait objects cannot extend lifetimes
13-
--> $DIR/ptr-to-ptr-indirect-different-regions.rs:8:5
13+
--> $DIR/ptr-to-ptr-indirect-different-regions.rs:11:5
1414
|
1515
LL | a as _
1616
| ^^^^^^

0 commit comments

Comments
 (0)