Rollup merge of #75928 - JulianKnodt:non_utf8, r=estebank
Remove trait_selection error message in specific case In the case that a trait is not implemented for an ADT with type errors, cancel the error. Fixes #75627
This commit is contained in:
commit
5fa978fa1b
3 changed files with 20 additions and 0 deletions
|
@ -1907,6 +1907,11 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
ObligationCauseCode::BuiltinDerivedObligation(ref data) => {
|
ObligationCauseCode::BuiltinDerivedObligation(ref data) => {
|
||||||
let parent_trait_ref = self.resolve_vars_if_possible(&data.parent_trait_ref);
|
let parent_trait_ref = self.resolve_vars_if_possible(&data.parent_trait_ref);
|
||||||
let ty = parent_trait_ref.skip_binder().self_ty();
|
let ty = parent_trait_ref.skip_binder().self_ty();
|
||||||
|
if parent_trait_ref.references_error() {
|
||||||
|
err.cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
err.note(&format!("required because it appears within the type `{}`", ty));
|
err.note(&format!("required because it appears within the type `{}`", ty));
|
||||||
obligated_types.push(ty);
|
obligated_types.push(ty);
|
||||||
|
|
||||||
|
|
6
src/test/ui/traits/issue-75627.rs
Normal file
6
src/test/ui/traits/issue-75627.rs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
struct Foo<T>(T, *const ());
|
||||||
|
|
||||||
|
unsafe impl Send for Foo<T> {}
|
||||||
|
//~^ ERROR cannot find type
|
||||||
|
|
||||||
|
fn main() {}
|
9
src/test/ui/traits/issue-75627.stderr
Normal file
9
src/test/ui/traits/issue-75627.stderr
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
error[E0412]: cannot find type `T` in this scope
|
||||||
|
--> $DIR/issue-75627.rs:3:26
|
||||||
|
|
|
||||||
|
LL | unsafe impl Send for Foo<T> {}
|
||||||
|
| ^ not found in this scope
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0412`.
|
Loading…
Add table
Add a link
Reference in a new issue