Skip to content

Commit a3d0dac

Browse files
committed
tidy
1 parent 2209f3e commit a3d0dac

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,12 +1529,12 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
15291529
// Trait parameters are Invariant, the only part that actually has subtyping
15301530
// here is the lifetime bound of the dyn-type.
15311531
//
1532-
// For example in `dyn Trait<'a> + 'b <: dyn Trait<'c> + 'd` we would require
1532+
// For example in `dyn Trait<'a> + 'b <: dyn Trait<'c> + 'd` we would require
15331533
// that `'a == 'c` but only that `'b: 'd`.
15341534
//
15351535
// We must not allow freely casting lifetime bounds of dyn-types as it may allow
15361536
// for inaccessible VTable methods being callable: #136702
1537-
//
1537+
//
15381538
// We don't enforce this for casts of principal-less dyn types as their VTables do
15391539
// not contain any functions with `Self: 'a` bounds that could start holding after
15401540
// a pointer cast.

tests/ui/cast/ptr-to-trait-obj-ok.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ fn remove_auto<'a>(x: *mut (dyn Trait<'a> + Send)) -> *mut dyn Trait<'a> {
66
x as _
77
}
88

9-
fn cast_inherent_lt<'a: 'b, 'b>(x: *mut (dyn Trait<'static> + 'a)) -> *mut (dyn Trait<'static> + 'b) {
9+
fn cast_inherent_lt<'a: 'b, 'b>(
10+
x: *mut (dyn Trait<'static> + 'a)
11+
) -> *mut (dyn Trait<'static> + 'b) {
1012
x as _
1113
}
1214

0 commit comments

Comments
 (0)