Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -1906,6 +1906,11 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
ObligationCauseCode::BuiltinDerivedObligation(ref data) => {
let parent_trait_ref = self.resolve_vars_if_possible(&data.parent_trait_ref);
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));
obligated_types.push(ty);

Expand Down
6 changes: 6 additions & 0 deletions src/test/ui/traits/issue-75627.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
struct Foo<T>(T, *const ());

unsafe impl Send for Foo<T> {}
//~^ ERROR cannot find type

fn main() {}
9 changes: 9 additions & 0 deletions src/test/ui/traits/issue-75627.stderr
Original file line number Diff line number Diff line change
@@ -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`.