mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 22:12:15 +00:00
Erase regions before uninhabited check
This commit is contained in:
parent
dc1d9d50fb
commit
2c23c7f0cd
@ -1484,7 +1484,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
None => {
|
||||
if !sig.output().is_privately_uninhabited(self.tcx(), self.param_env) {
|
||||
// The signature in this call can reference region variables,
|
||||
// so erase them before calling a query.
|
||||
let output_ty = self.tcx().erase_regions(sig.output());
|
||||
if !output_ty.is_privately_uninhabited(self.tcx(), self.param_env) {
|
||||
span_mirbug!(self, term, "call to converging function {:?} w/o dest", sig);
|
||||
}
|
||||
}
|
||||
|
18
tests/ui/uninhabited/issue-107505.rs
Normal file
18
tests/ui/uninhabited/issue-107505.rs
Normal file
@ -0,0 +1,18 @@
|
||||
// compile-flags: --crate-type=lib
|
||||
// check-pass
|
||||
|
||||
// Make sure we don't pass inference variables to uninhabitedness checks in borrowck
|
||||
|
||||
struct Command<'s> {
|
||||
session: &'s (),
|
||||
imp: std::convert::Infallible,
|
||||
}
|
||||
|
||||
fn command(_: &()) -> Command<'_> {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn with_session<'s>(a: &std::process::Command, b: &'s ()) -> Command<'s> {
|
||||
a.get_program();
|
||||
command(b)
|
||||
}
|
Loading…
Reference in New Issue
Block a user