Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upRemove contraction from region inference #29188
Conversation
rust-highfive
assigned
pnkfelix
Oct 20, 2015
arielb1
reviewed
Oct 20, 2015
| } | ||
| Ok(()) | ||
| })); | ||
| if self.is_local() { // (1) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
nikomatsakis
Oct 23, 2015
Author
Contributor
Does this fix RUST_LOG=rustc::middle::traits?
Yes, I expect so. I think I was having problems with RUST_LOG=rustc_typeck, but I suspect it's the same issue. And yes, a fallible version of item_path_str would be better.
This comment has been minimized.
This comment has been minimized.
|
Interestingly, this PR fixes a bug that @dherman was encountered in his nanny project. I need to investigate that a bit more deeply though. |
This comment has been minimized.
This comment has been minimized.
|
I looked into @dherman's case. It comes down to a trait method defined like this: fn foo<'root, T:Trait<'root>>(t: T) -> &i32the point being that |
This comment has been minimized.
This comment has been minimized.
yes, done. |
This comment has been minimized.
This comment has been minimized.
|
I am unable to reproduce @dherman's case, but its not like putting a restriction on |
This comment has been minimized.
This comment has been minimized.
|
@arielb1 what do you mean by "lifetime truncation"? |
This comment has been minimized.
This comment has been minimized.
|
The fact that you can substitute an fn with some lifetime parameters that don't appear in the signature and then call it after these lifetime parameters are dead. A reasonable argument for the soundness of this is that, because lifetime bounds in Rust are never strict, if you LUB all the lifetimes in a validate predicate with some lifetime you still get something valid - this is basically the reason lifetime erasure works (and therefore I call it "truncation"). For example, in your code: trait Trait<'root> {}
impl<'a,'root> Trait<'root> for &'a i32 where 'a: 'root {}
fn foo<'root, T:Trait<'root>>(t: T) -> i32 {
/* ... - your original signature doesn't specify the return type's lifetime */
}
fn main() {
'v: {
let v = &2;
('t: { foo::<'t, &'v i32> })(&v);
}
}
This, of course, breaks horribly if we have types that can't be bought fresh to some lifetime - e.g. unloadable code, but we already know that. |
This comment has been minimized.
This comment has been minimized.
|
OK, yes. This is what I was saying I would potentially like to fix, though On Fri, Oct 23, 2015 at 1:55 PM, arielb1 notifications@github.com wrote:
|
arielb1
referenced this pull request
Oct 25, 2015
Closed
Rustc confuses lifetimes of different unrelated variables of type &'static str when implementing a trait for &'a str #26448
This comment has been minimized.
This comment has been minimized.
|
@pnkfelix would you be able to review this sooner rather than later? It does fix |
nikomatsakis
referenced this pull request
Oct 26, 2015
Closed
Nightly regression around HRTBs, likely connected to wf changes #28934
nikomatsakis
added
the
beta-nominated
label
Oct 28, 2015
This comment has been minimized.
This comment has been minimized.
|
okay it took me a little bit longer than I expected to wrap my head around this. You left in the It seems like the code is just calling out for a simplification pass; e.g. the factoring of In addition, it would be nice if the README were updated, removing the discussion of processing the Contracting nodes. But there's no reason to hold up this PR for those kinds of changes. |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis r=me once you've addressed the travis failure in some reasonable manner. |
This comment has been minimized.
This comment has been minimized.
Yes, I agree, I was just being hasty. I will try to clean it up a bit.
agreed |
This comment has been minimized.
This comment has been minimized.
|
|
nikomatsakis
added some commits
Oct 17, 2015
nikomatsakis
force-pushed the
nikomatsakis:remove-contraction
branch
from
1ccd800
to
c2277de
Oct 28, 2015
This comment has been minimized.
This comment has been minimized.
|
@bors r=pnkfelix |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Oct 29, 2015
This comment has been minimized.
This comment has been minimized.
bors
merged commit c2277de
into
rust-lang:master
Oct 29, 2015
This comment has been minimized.
This comment has been minimized.
|
Does the beta-nominated tag mean this PR is to be backported to 1.5? I’d appreciate this: at the moment I have code that compiles on stable and nightly, but not 1.5.0-beta.2: https://travis-ci.org/servo/rust-cssparser/builds/88377023 |
SimonSapin
referenced this pull request
Oct 30, 2015
Merged
Treat url(<string>) as a normal functions, per spec change. #90
This comment has been minimized.
This comment has been minimized.
|
@SimonSapin yeah if accepted this'll be backported to 1.5 |
pnkfelix
added
the
T-compiler
label
Oct 31, 2015
This comment has been minimized.
This comment has been minimized.
|
@rust-lang/lang @SimonSapin wants this backported soon. Can you review? |
This comment has been minimized.
This comment has been minimized.
|
@brson I think this is really a @rust-lang/compiler issue. But I'm inclined to accept it this for beta backport. |
This comment has been minimized.
This comment has been minimized.
|
+1 to backport |
This comment has been minimized.
This comment has been minimized.
|
Backport PR is up when you are ready. |
nikomatsakis
added
beta-accepted
and removed
beta-nominated
labels
Nov 5, 2015
This comment has been minimized.
This comment has been minimized.
|
Accepting for beta. |
nikomatsakis commentedOct 20, 2015
This fixes #29048 (though I think adding better transactional support would be a better fix for that issue, but that is more difficult). It also simplifies region inference and changes the model to a pure data flow one, as discussed in this internals thread. I am not 100% sure though if this PR is the right thing to do -- or at least maybe not at this moment, so thoughts on that would be appreciated.
r? @pnkfelix
cc @arielb1