save-analysis: Nest typeck tables when processing functions/methods
Fixes an issue where we did not nest tables correctly when resolving
associated types in formal argument/return type positions.
This was the minimized reproduction case that I tested the fix on:
```rust
pub trait Trait {
type Assoc;
}
pub struct A;
pub fn func() {
fn _inner1<U: Trait>(_: U::Assoc) {}
fn _inner2<U: Trait>() -> U::Assoc { unimplemented!() }
impl A {
fn _inner1<U: Trait>(self, _: U::Assoc) {}
fn _inner2<U: Trait>(self) -> U::Assoc { unimplemented!() }
}
}
```
using `debug_assertions`-enabled rustc and by additionally passing `-Zsave-analysis`.
Unfortunately the original assertion fired is a *debug* one and from what I can tell we don't run the tests with these on, so I'm not adding a test here. If I missed it and there is a way to run tests with these on, I'd love to add a test case for this.
Closes #63663
Closes #50328
Closes #43982
|
||
|---|---|---|
| .. | ||
| benches | ||
| dep_graph | ||
| hir | ||
| ich | ||
| infer | ||
| lint | ||
| middle | ||
| mir | ||
| query | ||
| session | ||
| traits | ||
| ty | ||
| util | ||
| arena.rs | ||
| build.rs | ||
| Cargo.toml | ||
| error_codes.rs | ||
| lib.rs | ||
| macros.rs | ||
| README.md | ||
| tests.rs | ||
For more information about how rustc works, see the rustc guide.