Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 16ffeb2

Browse files
Rollup merge of #122304 - lukas-code:dyn-star-meta, r=compiler-errors
fix metadata for dyn-star in new solver The pointee metadata of `dyn* Trait` types is `()` and not a vtable.
2 parents 97f3b33 + e4bafa2 commit 16ffeb2

File tree

4 files changed

+41
-2
lines changed

4 files changed

+41
-2
lines changed

‎compiler/rustc_trait_selection/src/solve/normalizes_to/mod.rs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,13 +542,14 @@ impl<'tcx> assembly::GoalKind<'tcx> for NormalizesTo<'tcx> {
542542
| ty::Coroutine(..)
543543
| ty::CoroutineWitness(..)
544544
| ty::Never
545-
| ty::Foreign(..) => tcx.types.unit,
545+
| ty::Foreign(..)
546+
| ty::Dynamic(_, _, ty::DynStar) => tcx.types.unit,
546547

547548
ty::Error(e) => Ty::new_error(tcx, *e),
548549

549550
ty::Str | ty::Slice(_) => tcx.types.usize,
550551

551-
ty::Dynamic(_, _, _) => {
552+
ty::Dynamic(_, _, ty::Dyn) => {
552553
let dyn_metadata = tcx.require_lang_item(LangItem::DynMetadata, None);
553554
tcx.type_of(dyn_metadata)
554555
.instantiate(tcx, &[ty::GenericArg::from(goal.predicate.self_ty())])

‎tests/ui/dyn-star/thin.next.stderr‎

Lines changed: 11 additions & 0 deletions
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/thin.rs:6: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+

‎tests/ui/dyn-star/thin.old.stderr‎

Lines changed: 11 additions & 0 deletions
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/thin.rs:6: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+

‎tests/ui/dyn-star/thin.rs‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//@check-pass
2+
//@revisions: old next
3+
//@[next] compile-flags: -Znext-solver
4+
5+
#![feature(ptr_metadata)]
6+
#![feature(dyn_star)]
7+
//~^ WARN the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
8+
9+
use std::fmt::Debug;
10+
use std::ptr::Thin;
11+
12+
fn check_thin<T: ?Sized + Thin>() {}
13+
14+
fn main() {
15+
check_thin::<dyn* Debug>();
16+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /