Skip to content

Commit 170e942

Browse files
Allow codegen to unsize dyn* to dyn
1 parent 388538f commit 170e942

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

compiler/rustc_codegen_ssa/src/base.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,7 @@ pub fn unsized_info<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
152152
(
153153
&ty::Dynamic(ref data_a, _, src_dyn_kind),
154154
&ty::Dynamic(ref data_b, _, target_dyn_kind),
155-
) => {
156-
assert_eq!(src_dyn_kind, target_dyn_kind);
157-
155+
) if src_dyn_kind == target_dyn_kind => {
158156
let old_info =
159157
old_info.expect("unsized_info: missing old info for trait upcasting coercion");
160158
if data_a.principal_def_id() == data_b.principal_def_id() {
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// build-pass
2+
3+
#![feature(dyn_star)]
4+
//~^ WARN the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
5+
6+
fn main() {
7+
let x: dyn* Send = &();
8+
let x = Box::new(x) as Box<dyn Send>;
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/dyn-star-to-dyn.rs:3:12
3+
|
4+
LL | #![feature(dyn_star)]
5+
| ^^^^^^^^
6+
|
7+
= note: see issue #102425 <https://github.com/rust-lang/rust/issues/102425> for more information
8+
= note: `#[warn(incomplete_features)]` on by default
9+
10+
warning: 1 warning emitted
11+

0 commit comments

Comments
 (0)