Skip to content

Rollup of 10 pull requests #139525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Apr 8, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
fdefffe
compiler: report error when trait object type param reference self
xtexx Mar 30, 2025
6966416
Update to new rinja version (askama)
GuillaumeGomez Apr 3, 2025
f343b9d
Don't construct preds w escaping bound vars in diagnostic_hir_wf_check
compiler-errors Apr 4, 2025
86a7ee6
create new option `build.compiletest-use-stage0-libtest`
onur-ozkan Apr 4, 2025
17fad21
utilize `compiletest_use_stage0_libtest` option
onur-ozkan Apr 4, 2025
afe3834
add change-entry
onur-ozkan Apr 4, 2025
45afefa
Fix trait upcasting to dyn type with no principal when there are proj…
compiler-errors Apr 5, 2025
a6b7a26
Update rinja version in `generate-copyright`
GuillaumeGomez Apr 4, 2025
d37bd4d
Update proc-macro deps list
GuillaumeGomez Apr 3, 2025
1f06a6a
Tell LLVM about impossible niche tags
scottmcm Mar 29, 2025
51e67e2
LLVM18 compatibility fixes in the tests
scottmcm Mar 29, 2025
c830665
enable in-tree std on some runners
onur-ozkan Apr 5, 2025
cae28b5
implement `check` step for `compiletest` separately
onur-ozkan Apr 7, 2025
e1a69da
unstable-book/intrinsics: wordsmith MIR-lowering intrinsic docs
RalfJung Apr 7, 2025
a7400a8
update intrinsics/mod.rs comment about const intrinsics
RalfJung Apr 7, 2025
250b848
Make error message for missing fields with .. and without .. more con…
compiler-errors Mar 27, 2025
268c56e
Implement overflow for infinite implied lifetime bounds
compiler-errors Apr 7, 2025
502f7f9
Address PR feedback
scottmcm Apr 8, 2025
eb5d892
Allow for missing invisible close delim when reparsing an expression.
nnethercote Apr 3, 2025
e177921
Allow for reparsing failure when reparsing a pasted metavar.
nnethercote Apr 7, 2025
742b378
make hover_feature test less fragile
RalfJung Apr 8, 2025
2b1afcb
Rollup merge of #138676 - compiler-errors:overflow-implied-bounds, r=…
Zalathar Apr 8, 2025
6257825
Rollup merge of #139024 - compiler-errors:tweak-default-value-err, r=…
Zalathar Apr 8, 2025
7ffa56c
Rollup merge of #139098 - scottmcm:assert-impossible-tags, r=WaffleLa…
Zalathar Apr 8, 2025
5913c52
Rollup merge of #139124 - xtexx:gh-139082, r=compiler-errors
Zalathar Apr 8, 2025
dd682f7
Rollup merge of #139321 - GuillaumeGomez:update-rinja, r=notriddle,lo…
Zalathar Apr 8, 2025
133cec7
Rollup merge of #139346 - compiler-errors:non-lifetime-binder-diag-hi…
Zalathar Apr 8, 2025
ab80f57
Rollup merge of #139386 - onur-ozkan:configurable-compiletest-libtest…
Zalathar Apr 8, 2025
056756c
Rollup merge of #139421 - compiler-errors:upcast-no-principal-with-pr…
Zalathar Apr 8, 2025
24369ad
Rollup merge of #139464 - nnethercote:fix-139248-AND-fix-139445, r=pe…
Zalathar Apr 8, 2025
42fdd7d
Rollup merge of #139490 - RalfJung:unstable-intrinsics-docs, r=oli-obk
Zalathar Apr 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix trait upcasting to dyn type with no principal when there are proj…
…ections
  • Loading branch information
compiler-errors committed Apr 5, 2025
commit 45afefa7c025f3847439822b053edf76ae62e561
38 changes: 24 additions & 14 deletions compiler/rustc_trait_selection/src/traits/select/confirmation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1090,26 +1090,36 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
{
// See `assemble_candidates_for_unsizing` for more info.
// We already checked the compatibility of auto traits within `assemble_candidates_for_unsizing`.
let iter = data_a
.principal()
.filter(|_| {
// optionally drop the principal, if we're unsizing to no principal
data_b.principal().is_some()
})
.map(|b| b.map_bound(ty::ExistentialPredicate::Trait))
.into_iter()
.chain(
let existential_predicates = if data_b.principal().is_some() {
tcx.mk_poly_existential_predicates_from_iter(
data_a
.projection_bounds()
.map(|b| b.map_bound(ty::ExistentialPredicate::Projection)),
.principal()
.map(|b| b.map_bound(ty::ExistentialPredicate::Trait))
.into_iter()
.chain(
data_a
.projection_bounds()
.map(|b| b.map_bound(ty::ExistentialPredicate::Projection)),
)
.chain(
data_b
.auto_traits()
.map(ty::ExistentialPredicate::AutoTrait)
.map(ty::Binder::dummy),
),
)
.chain(
} else {
// If we're unsizing to a dyn type that has no principal, then drop
// the principal and projections from the type. We use the auto traits
// from the RHS type since as we noted that we've checked for auto
// trait compatibility during unsizing.
tcx.mk_poly_existential_predicates_from_iter(
data_b
.auto_traits()
.map(ty::ExistentialPredicate::AutoTrait)
.map(ty::Binder::dummy),
);
let existential_predicates = tcx.mk_poly_existential_predicates_from_iter(iter);
)
};
let source_trait = Ty::new_dynamic(tcx, existential_predicates, r_b, dyn_a);

// Require that the traits involved in this upcast are **equal**;
Expand Down
13 changes: 13 additions & 0 deletions tests/ui/traits/dyn-drop-principal-with-projections.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//@ check-pass

trait Tr {
type Assoc;
}

impl Tr for () {
type Assoc = ();
}

fn main() {
let x = &() as &(dyn Tr<Assoc = ()> + Send) as &dyn Send;
}
Loading