-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Tweak region inference to ignore constraints like 'a <= 'static
#13975
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
Tweak region inference to ignore constraints like 'a <= 'static
#13975
Conversation
r? @pnkfelix |
@@ -299,6 +299,9 @@ impl<'a> RegionVarBindings<'a> { | |||
sub.repr(self.tcx), | |||
sup.repr(self.tcx))); | |||
} | |||
(_, ReStatic) => { | |||
// all regions are subreigons of static, so we can ignore this |
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.
typo: "subreigons"
It might be good to put together a compile fail test for the other direction on |
@pnkfelix good idea. In fact, this may have exposed a bug ;) |
@pnkfelix never mind, test was buggy |
actually, I remember now that my thought was that there are already tests covering the other direction. Still, doesn't hurt. |
@nikomatsakis (copied from IRC) : the earlier version of this PR had a run-pass test. It seems that in adding the compile-fail test, you removed the run-pass test from the PR. Do I misunderstand your intent here? |
@pnkfelix I moved it from run-pass to compile-fail since I added some calls that are expected to yield type errors |
@nikomatsakis i see; i usually try to factor such things into the run-pass part and the compile-fail part, just to try to make sure that a supposedly working test actually works, but I see your philosophy here. |
(also, that travis failure does look suspiciously related to this change...) |
Pushed new commit that should address travis failure. |
Looks like there's still an error :( |
…e they have no value. This also ensures that we can handle some obscure cases of fn subtyping with bound regions that we didn't used to handle correctly. Fixes rust-lang#13974.
OK, it oughta' work now gosh darn it. |
ping @pnkfelix |
oh does it work now? Thanks for the ping, will review tomorrow morning. :) |
…-static, r=pnkfelix Tweak region inference to ignore constraints like `'a <= 'static`, since they have no value. This also ensures that we can handle some obscure cases of fn subtyping with bound regions that we didn't used to handle correctly. Fixes #13974.
…, r=DropDemBits fix: Suppress extra indent after the end of field and function chains (spurred on by <rust-lang/rust-analyzer#4182 (comment)>) Caveat that this doesn't work for after tail expressions, although there shouldn't be anything after those anyways. This also complicates when to reload the language configuration by nature of now always having a language configuration applicable. Examples of indentation fixes: ```rs fn main() { println!("Hello!"); // < enter here! // ... indents down here fs::read_to_string("soup") // < enter here! // ... still indents down here :( .map(|_| ()) .map(|_| ()) // < enter here! // ... still indents down here :D .map_err(|_| ()) .unwrap(); // < enter here! // ... indents down here :D // ... and subsequent enters stay at the same indent 0.0f64 .to_radians() .to_radians() .to_radians() // force semi on a new line ; // < enter here! // ... indents down here :D } fn tail_end() -> i32 { 0i32.wrapping_abs() .wrapping_abs() .wrapping_abs() .wrapping_abs() // < enter here! // ... still indents here 🤷 } ```
Tweak region inference to ignore constraints like
'a <= 'static
, since theyhave no value. This also ensures that we can handle some obscure cases of fn
subtyping with bound regions that we didn't used to handle correctly.
Fixes #13974.