Use the opaque_types_defined_by query to cheaply check for whether a hidden type may be registered for an opaque type

This commit is contained in:
Oli Scherer 2023-04-25 08:07:44 +00:00
parent 6ae803eedf
commit 4e92f761fe
17 changed files with 368 additions and 162 deletions

View file

@ -1,7 +1,7 @@
//! Errors emitted by ty_utils
use rustc_macros::{Diagnostic, Subdiagnostic};
use rustc_middle::ty::Ty;
use rustc_middle::ty::{GenericArg, Ty};
use rustc_span::Span;
#[derive(Diagnostic)]
@ -100,3 +100,25 @@ pub struct NonPrimitiveSimdType<'tcx> {
pub ty: Ty<'tcx>,
pub e_ty: Ty<'tcx>,
}
#[derive(Diagnostic)]
#[diag(ty_utils_impl_trait_duplicate_arg)]
pub struct DuplicateArg<'tcx> {
pub arg: GenericArg<'tcx>,
#[primary_span]
#[label]
pub span: Span,
#[note]
pub opaque_span: Span,
}
#[derive(Diagnostic)]
#[diag(ty_utils_impl_trait_not_param)]
pub struct NotParam<'tcx> {
pub arg: GenericArg<'tcx>,
#[primary_span]
#[label]
pub span: Span,
#[note]
pub opaque_span: Span,
}