-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Cyclic traits allow arbitrary traits to be synthesized #29859
Comments
triage: P-high |
Update: unrelated, my mistake. This is #29861. |
cc @james-darkfox (who tripped on this and #29861 in his lense crate) |
Another simple example as follows: Magic treats anything as trait Magic: Copy {}
impl<T: Magic> Magic for T {}
fn copy<T: Magic>(x: T) -> (T, T) { (x, x) }
#[derive(Debug)]
struct NoClone;
fn main() {
let (a, b) = copy(NoClone);
println!("{:?} {:?}", a, b);
} |
@nikomatsakis Earlier I decided to create a "safe" hexdump using this concept. :-) https://play.rust-lang.org/?gist=0832c0210daba58942c0&version=nightly |
This is a big issue. I think a fix needs to be put out for 1.4.0+ as soon as possible. |
Related, what's our policy on nominating soundness fixes for backporting to beta? |
In my understanding of the system, the impl was supposed to cause a WF error (why do we think that |
The supertrait version looks more dangerous. |
Eh I got it - wfcheck checks |
As a fix, maybe not elaborate supertraits when checking WF? That would have an ugly annotation burden, but I am not sure how bad would it be. |
This seems like a great candidate for a stable version bug fix release. According to play, hexdump works in 1.4. Is it in any older versions? If so, should we backport a fix to them? |
The "supertrait" variant exists at least since multidispatch. The "associated type" variant is a problem with wf checking, but wf checking didn't really work before 1.5. |
@bstrie We mark with @erickt I suspect this goes all the way back to 1.0; it's not just an implementation issue, but may point to some deeper conceptual issues with how the trait system works. Before we talk about backporting in too much detail, we need to figure out how we want to address the problem (and see the code impact for doing so). |
Let's first decide on what we want the fix to be before we discuss whether @arielb1 I am not sure yet where I think the error should occur. My first
I don't particularly like this division though. But I think that just On Thu, Nov 19, 2015 at 10:22 AM, arielb1 notifications@github.com wrote:
|
I wrote this:
in response to @arielb1's comment here:
But I realize now I'm not 100% sure what he meant, so I potentially take it back. 😄 In any case, I'm stepping out the door just now (leaving on a trip for the next few days), but I'll definitely be pondering this. It may be that we can change something about how (*) A caveat, that example just happens to be one representative tab I have lying around open, it may have some small flaw that is orthogonal to this bug that's making it not work for all I know. But the main point is, it'd be interesting to try and pin down precisely why so many similar examples seem to not work, and make sure we have a fix that applies universally. |
triage: P-high I think the best fix for this in short term is to make non-structural-traits be inductive. I have a patch underway for this. But I'd like to think more about the longer term fix. |
I don't have serious objections to making non-structural-trait matching inductive, except that it would be a big scary breaking-change. |
|
lol. Such recursive trait impl. are an illogical paradox and should not be On Sunday, December 6, 2015, angelsl notifications@github.com wrote:
Sent from Gmail Mobile |
@brson but I'm not sure what you mean when you say "still P-high". I guess you mean "would this warrant dropping everything and fixing this second"... if that's the question, the answer is clearly no. I guess what I'm saying is that I still feel like we never rejiggered our triage system to my satisfaction so I'm not entirely sure what the set of labels are :) |
@nikomatsakis I am trying to steer |
@brson And |
@aturon That's the intent yeah. We should probably discuss more offline about our goals for process tracking though. |
@arielb1 says he is planning to discuss this with @nikomatsakis . I-unsound already expresses the unsoundness aspect of the bug. We're going to demote this to P-medium, but if ariel or niko plan to address this in this cycle, they can promote it back to P-high. |
triage: P-medium |
Fix soundness bug described in #29859 This is an attempt at fixing the problems described in #29859 based on an IRC conversation between @nikomatsakis and I today. I'm waiting on a full build to come back, otherwise both tests trigger the correct error.
Fix soundness bug described in #29859 This is an attempt at fixing the problems described in #29859 based on an IRC conversation between @nikomatsakis and I today. I'm waiting on a full build to come back, otherwise both tests trigger the correct error.
This issue is partially fixed through the introduction of the "obligation jungle" but we still want to impose a limitation that auto traits cannot have supertraits (for now, no supertraits at all seems easiest). This would close the remaining soundness hole described here.
This is, I believe, an unintended outcome of some caching I put in. The problem is that this test compiles fine -- I believe the expected outcome was an internal stack overflow. My preferred fix is to refactor the fulfillment context to track trees in more detail, which is something that we've started but the branch has since bitrotted. This makes me want to get back to that more urgently.The text was updated successfully, but these errors were encountered: