rust/compiler/rustc_trait_selection/src/traits
Dylan DPC 15e2e5185a
Rollup merge of #100473 - compiler-errors:normalize-the-fn-def-sig-plz, r=lcnr
Attempt to normalize `FnDef` signature in `InferCtxt::cmp`

Stashes a normalization callback in `InferCtxt` so that the signature we get from `tcx.fn_sig(..).subst(..)` in `InferCtxt::cmp` can be properly normalized, since we cannot expect for it to have normalized types since it comes straight from astconv.

This is kind of a hack, but I will say that `@jyn514` found the fact that we present unnormalized types to be very confusing in real life code, and I agree with that feeling. Though altogether I am still a bit unsure about whether this PR is worth the effort, so I'm open to alternatives and/or just closing it outright.

On the other hand, this isn't a ridiculously heavy implementation anyways -- it's less than a hundred lines of changes, and half of that is just miscellaneous cleanup.

This is stacked onto #100471 which is basically unrelated, and it can be rebased off of that when that lands or if needed.

---

The code:
```rust
trait Foo { type Bar; }

impl<T> Foo for T {
    type Bar = i32;
}

fn foo<T>(_: <T as Foo>::Bar) {}

fn needs_i32_ref_fn(f: fn(&'static i32)) {}

fn main() {
    needs_i32_ref_fn(foo::<()>);
}
```

Before:
```
   = note: expected fn pointer `fn(&'static i32)`
                 found fn item `fn(<() as Foo>::Bar) {foo::<()>}`
```

After:
```
   = note: expected fn pointer `fn(&'static i32)`
                 found fn item `fn(i32) {foo::<()>}`
```
2022-08-30 16:56:08 +05:30
..
error_reporting Rollup merge of #100473 - compiler-errors:normalize-the-fn-def-sig-plz, r=lcnr 2022-08-30 16:56:08 +05:30
query Auto merge of #100315 - compiler-errors:norm-ct-in-proj, r=lcnr 2022-08-11 10:47:48 +00:00
select is_knowable use Result instead of Option 2022-08-17 10:17:54 +02:00
specialize Add traits::fully_solve_obligation that acts like traits::fully_normalize 2022-08-04 13:50:56 +00:00
auto_trait.rs avoid cloning and then iterating 2022-08-13 16:16:52 +02:00
chalk_fulfill.rs Update TypeVisitor paths 2022-07-06 06:41:53 +01:00
codegen.rs Rollup merge of #99746 - compiler-errors:more-trait-engine, r=jackh726 2022-08-03 22:29:27 +02:00
coherence.rs Use CRATE_HIR_ID and CRATE_DEF_ID for obligations from foreign crates 2022-08-23 09:08:30 -03:00
const_evaluatable.rs handle consts with param/infer in const_eval_resolve better 2022-07-25 23:41:13 +00:00
engine.rs Rollup merge of #100473 - compiler-errors:normalize-the-fn-def-sig-plz, r=lcnr 2022-08-30 16:56:08 +05:30
fulfill.rs never inline the only thing that calls a query, which could hit the instrument path 2022-07-29 15:41:15 +00:00
misc.rs Remove FulfillmentContext param from fully_normalize 2022-08-04 13:42:13 +00:00
mod.rs Auto merge of #100705 - compiler-errors:issue-100620, r=oli-obk 2022-08-26 06:05:06 +00:00
object_safety.rs Remove DefId from AssocItemContainer. 2022-08-01 21:38:45 +02:00
on_unimplemented.rs Always include a position span in rustc_parse_format::Argument 2022-07-31 15:11:33 +00:00
outlives_bounds.rs Move InferCtxtExt to rustc_trait_selection 2022-08-23 08:55:43 -03:00
project.rs Don't catch overflow when running with cargo doc 2022-08-26 21:02:35 +03:00
relationships.rs change map_bound(|_| x to rebind(x 2022-07-21 07:45:49 +00:00
structural_match.rs Rollup merge of #99746 - compiler-errors:more-trait-engine, r=jackh726 2022-08-03 22:29:27 +02:00
util.rs Rework point-at-arg 2022-08-21 02:34:52 +00:00
wf.rs Rework point-at-arg 2022-08-21 02:34:52 +00:00