Auto merge of #123240 - compiler-errors:assert-args-compat, r=fmease
Assert that args are actually compatible with their generics, rather than just their count Right now we just check that the number of args is right, rather than actually checking the kinds. Uplift a helper fn that I wrote from trait selection to do just that. Found a couple bugs along the way. r? `@lcnr` or `@fmease` (or anyone really lol)
This commit is contained in:
commit
b4acbe4233
10 changed files with 151 additions and 114 deletions
|
@ -7,7 +7,6 @@ use rustc_middle::ty::util::{CheckRegions, NotUniqueParam};
|
|||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_middle::ty::{TypeSuperVisitable, TypeVisitable, TypeVisitor};
|
||||
use rustc_span::Span;
|
||||
use rustc_trait_selection::traits::check_args_compatible;
|
||||
|
||||
use crate::errors::{DuplicateArg, NotParam};
|
||||
|
||||
|
@ -250,7 +249,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for OpaqueTypeCollector<'tcx> {
|
|||
ty::GenericArgs::identity_for_item(self.tcx, parent),
|
||||
);
|
||||
|
||||
if check_args_compatible(self.tcx, assoc, impl_args) {
|
||||
if self.tcx.check_args_compatible(assoc.def_id, impl_args) {
|
||||
self.tcx
|
||||
.type_of(assoc.def_id)
|
||||
.instantiate(self.tcx, impl_args)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue