Rollup merge of #105349 - compiler-errors:point-at-assoc-ct-fn-ptr-arg, r=cjgillot

Point at args in associated const fn pointers

Tiny follow-up to #105201, not so sure it's worth it but 🤷

The UI test example is a bit more compelling when it's `GlUniformScalar::FACTORY`

r? `@cjgillot`
This commit is contained in:
Matthias Krüger 2022-12-06 16:54:56 +01:00 committed by GitHub
commit 4f919e4628
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 9 deletions

View file

@ -1918,15 +1918,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
receiver: Option<&'tcx hir::Expr<'tcx>>, receiver: Option<&'tcx hir::Expr<'tcx>>,
args: &'tcx [hir::Expr<'tcx>], args: &'tcx [hir::Expr<'tcx>],
) -> bool { ) -> bool {
// Do not call `fn_sig` on non-functions. let ty = self.tcx.type_of(def_id);
if !matches!( if !ty.is_fn() {
self.tcx.def_kind(def_id),
DefKind::Fn | DefKind::AssocFn | DefKind::Variant | DefKind::Ctor(..)
) {
return false; return false;
} }
let sig = ty.fn_sig(self.tcx).skip_binder();
let sig = self.tcx.fn_sig(def_id).skip_binder();
let args_referencing_param: Vec<_> = sig let args_referencing_param: Vec<_> = sig
.inputs() .inputs()
.iter() .iter()

View file

@ -1,8 +1,10 @@
error[E0277]: the trait bound `T: GlUniformScalar` is not satisfied error[E0277]: the trait bound `T: GlUniformScalar` is not satisfied
--> $DIR/assoc-const-as-fn.rs:14:5 --> $DIR/assoc-const-as-fn.rs:14:40
| |
LL | <T as GlUniformScalar>::FACTORY(1, value); LL | <T as GlUniformScalar>::FACTORY(1, value);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `GlUniformScalar` is not implemented for `T` | ------------------------------- ^^^^^ the trait `GlUniformScalar` is not implemented for `T`
| |
| required by a bound introduced by this call
| |
help: consider further restricting this bound help: consider further restricting this bound
| |