Rollup merge of #133286 - jieyouxu:bug-ourselves, r=compiler-errors
Re-delay a resolve `bug` related to `Self`-ctor in patterns For the code pattern reported in <https://github.com/rust-lang/rust/issues/133272>, ```rs impl Foo { fn fun() { let S { ref Self } = todo!(); } } ``` <https://github.com/rust-lang/rust/pull/121208> converted this to a `span_bug` from a `span_delayed_bug` because this specific self-ctor code pattern lacked test coverage. It turns out this can be hit but we just lacked test coverage, so change it back to a `span_delayed_bug` and add a targeted test case. Follow-up to #121208, cc ``@nnethercote`` (very good exercise to expose our test coverage gaps). Fixes #133272.
This commit is contained in:
commit
4d9cd661c7
3 changed files with 39 additions and 3 deletions
|
@ -3940,12 +3940,12 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
|
|||
}
|
||||
Res::SelfCtor(_) => {
|
||||
// We resolve `Self` in pattern position as an ident sometimes during recovery,
|
||||
// so delay a bug instead of ICEing. (Note: is this no longer true? We now ICE. If
|
||||
// this triggers, please convert to a delayed bug and add a test.)
|
||||
self.r.dcx().span_bug(
|
||||
// so delay a bug instead of ICEing.
|
||||
self.r.dcx().span_delayed_bug(
|
||||
ident.span,
|
||||
"unexpected `SelfCtor` in pattern, expected identifier"
|
||||
);
|
||||
None
|
||||
}
|
||||
_ => span_bug!(
|
||||
ident.span,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue