1
Fork 0

Rollup merge of #133751 - lcnr:no-trait-solving-on-type, r=compiler-errors

remove `Ty::is_copy_modulo_regions`

Using these functions is likely incorrect if an `InferCtxt` is available, I moved this function to `TyCtxt` (and added it to `LateContext`) and added a note to the documentation that one should prefer `Infer::type_is_copy_modulo_regions` instead.

I didn't yet move `is_sized` and `is_freeze`, though I think we should move these as well.

r? `@compiler-errors` cc #132279
This commit is contained in:
Guillaume Gomez 2024-12-02 17:36:11 +01:00 committed by GitHub
commit 4c68112df1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 40 additions and 40 deletions

View file

@ -103,7 +103,7 @@ fn allowed_union_or_unsafe_field<'tcx>(
// Fallback case: allow `ManuallyDrop` and things that are `Copy`,
// also no need to report an error if the type is unresolved.
ty.ty_adt_def().is_some_and(|adt_def| adt_def.is_manually_drop())
|| ty.is_copy_modulo_regions(tcx, typing_env)
|| tcx.type_is_copy_modulo_regions(typing_env, ty)
|| ty.references_error()
}
};

View file

@ -178,7 +178,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
// Check that the type implements Copy. The only case where this can
// possibly fail is for SIMD types which don't #[derive(Copy)].
if !ty.is_copy_modulo_regions(self.tcx, self.typing_env) {
if !self.tcx.type_is_copy_modulo_regions(self.typing_env, ty) {
let msg = "arguments for inline assembly must be copyable";
self.tcx
.dcx()