-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't ICE when RPITIT captures more method args than trait definition #130412
Conversation
@@ -899,7 +904,7 @@ impl<'tcx> ty::FallibleTypeFolder<TyCtxt<'tcx>> for RemapHiddenTyRegions<'tcx> { | |||
); | |||
} | |||
} else { | |||
let guar = match region.opt_param_def_id(self.tcx, self.tcx.parent(self.def_id)) { | |||
let guar = match region.opt_param_def_id(self.tcx, self.impl_m_def_id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This used the def id of the trait, rather than the def id of the impl method. The def id of the impl method is needed here because we're remapping args from the impl method's signature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@bors r+ rollup |
…, r=jieyouxu Don't ICE when RPITIT captures more method args than trait definition Make sure we don't ICE when an RPITIT captures more method args than the trait definition, which is not allowed. This was because we were using the wrong def id for error reporting. Due to the default lifetime capture rules of RPITITs (capturing everything in scope), this is only doable if we use precise capturing, which isn't currently allowed for RPITITs anyways but we still end up reaching the relevant codepaths. Fixes rust-lang#129850
This comment has been minimized.
This comment has been minimized.
b53f5ce
to
1e9fa7e
Compare
@bors r=jieyouxu |
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#123436 (linker: Allow MSVC to use import libraries following the Meson/MinGW convention) - rust-lang#130410 (Don't ICE when generating `Fn` shim for async closure with borrowck error) - rust-lang#130412 (Don't ICE when RPITIT captures more method args than trait definition) - rust-lang#130436 (Ignore reduce-fadd-unordered on SGX platform) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#130412 - compiler-errors:rpitit-overcapture, r=jieyouxu Don't ICE when RPITIT captures more method args than trait definition Make sure we don't ICE when an RPITIT captures more method args than the trait definition, which is not allowed. This was because we were using the wrong def id for error reporting. Due to the default lifetime capture rules of RPITITs (capturing everything in scope), this is only doable if we use precise capturing, which isn't currently allowed for RPITITs anyways but we still end up reaching the relevant codepaths. Fixes rust-lang#129850
Make sure we don't ICE when an RPITIT captures more method args than the trait definition, which is not allowed. This was because we were using the wrong def id for error reporting.
Due to the default lifetime capture rules of RPITITs (capturing everything in scope), this is only doable if we use precise capturing, which isn't currently allowed for RPITITs anyways but we still end up reaching the relevant codepaths.
Fixes #129850