Auto merge of #145701 - jhpratt:rollup-a0kg33p, r=jhpratt
Rollup of 19 pull requests Successful merges: - rust-lang/rust#143383 (stabilize `const_array_each_ref`) - rust-lang/rust#144758 ([Doc] Add links to the various collections) - rust-lang/rust#144915 (Defer tail call ret ty equality to check_tail_calls) - rust-lang/rust#145256 (Add new `--test-codegen-backend` bootstrap option) - rust-lang/rust#145297 (fix(debuginfo): handle false positives in overflow check) - rust-lang/rust#145390 (Shorten some dependency chains in the compiler) - rust-lang/rust#145415 (std_detect: RISC-V: implement implication to "C") - rust-lang/rust#145525 (stdlib: Replace typedef -> type alias in doc comment) - rust-lang/rust#145590 (Prevent impossible combinations in `ast::ModKind`.) - rust-lang/rust#145593 (UnsafePinned::raw_get: sync signature with get) - rust-lang/rust#145621 (Fix some doc typos) - rust-lang/rust#145627 (Unconditionally-const supertraits are considered not dyn compatible) - rust-lang/rust#145642 (Do not use effective_visibilities query for Adt types of a local trait while proving a where-clause) - rust-lang/rust#145650 (Fix JS search scripts path) - rust-lang/rust#145654 (Download CI GCC into the correct directory) - rust-lang/rust#145662 (Enforce correct number of arguments for `"x86-interrupt"` functions) - rust-lang/rust#145673 (Add flock support for cygwin) - rust-lang/rust#145674 (Enable triagebot `[review-changes-since]` feature) - rust-lang/rust#145678 (Fix typo in docstring) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
@@ -2878,7 +2878,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
||||
// we check if `TraitB` can be reachable from `S`
|
||||
// to determine whether to note `TraitA` is sealed trait.
|
||||
if let ty::Adt(adt, _) = ty.kind() {
|
||||
let visibilities = tcx.effective_visibilities(());
|
||||
let visibilities = &tcx.resolutions(()).effective_visibilities;
|
||||
visibilities.effective_vis(local).is_none_or(|v| {
|
||||
v.at_level(Level::Reexported)
|
||||
.is_accessible_from(adt.did(), tcx)
|
||||
|
||||
@@ -106,6 +106,10 @@ fn dyn_compatibility_violations_for_trait(
|
||||
if !spans.is_empty() {
|
||||
violations.push(DynCompatibilityViolation::SupertraitNonLifetimeBinder(spans));
|
||||
}
|
||||
let spans = super_predicates_are_unconditionally_const(tcx, trait_def_id);
|
||||
if !spans.is_empty() {
|
||||
violations.push(DynCompatibilityViolation::SupertraitConst(spans));
|
||||
}
|
||||
|
||||
violations
|
||||
}
|
||||
@@ -247,16 +251,31 @@ fn super_predicates_have_non_lifetime_binders(
|
||||
tcx: TyCtxt<'_>,
|
||||
trait_def_id: DefId,
|
||||
) -> SmallVec<[Span; 1]> {
|
||||
// If non_lifetime_binders is disabled, then exit early
|
||||
if !tcx.features().non_lifetime_binders() {
|
||||
return SmallVec::new();
|
||||
}
|
||||
tcx.explicit_super_predicates_of(trait_def_id)
|
||||
.iter_identity_copied()
|
||||
.filter_map(|(pred, span)| pred.has_non_region_bound_vars().then_some(span))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Checks for `const Trait` supertraits. We're okay with `[const] Trait`,
|
||||
/// supertraits since for a non-const instantiation of that trait, the
|
||||
/// conditionally-const supertrait is also not required to be const.
|
||||
fn super_predicates_are_unconditionally_const(
|
||||
tcx: TyCtxt<'_>,
|
||||
trait_def_id: DefId,
|
||||
) -> SmallVec<[Span; 1]> {
|
||||
tcx.explicit_super_predicates_of(trait_def_id)
|
||||
.iter_identity_copied()
|
||||
.filter_map(|(pred, span)| {
|
||||
if let ty::ClauseKind::HostEffect(_) = pred.kind().skip_binder() {
|
||||
Some(span)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn trait_has_sized_self(tcx: TyCtxt<'_>, trait_def_id: DefId) -> bool {
|
||||
tcx.generics_require_sized_self(trait_def_id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user