Skip to content
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

fix for ICE issue #25180 #25209

Closed
wants to merge 8 commits into from
Closed

fix for ICE issue #25180 #25209

wants to merge 8 commits into from

Conversation

llogiq
Copy link
Contributor

@llogiq llogiq commented May 8, 2015

According to @eddyb – and my tests – the following gets rid of the ICE in issue #25180.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pnkfelix (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see CONTRIBUTING.md for more information.

@llogiq
Copy link
Contributor Author

llogiq commented May 8, 2015

I think what the PR lacks as of yet is a testcase to show that the fix actually quells the ICE. I just added it and will commit after I rebuild.

assert!(self.mode == Mode::Var);
let (old_mode, old_qualif) = (self.mode, self.qualif);
self.mode = Mode::Var;
self.qualif = ConstQualif::empty();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't have to copy with_mode, you can just call it (and replace self in the two original statements with v, or whatever you choose for the name of the closure argument).

@llogiq
Copy link
Contributor Author

llogiq commented May 8, 2015

Yep, you're right. I'll change it. Thank you for pointing that out.

… removed the with_mode copy, thanks to eddyb
assert!(self.mode == Mode::Var);
self.with_euv(Some(fn_id), |euv| euv.walk_fn(fd, b));
self.with_mode(Mode::Var, |v| v.with_euv(Some(fn_id),
|euv| euv.walk_fn(fd, b)));
visit::walk_fn(self, fk, fd, b, s);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

walk_fn has to be inside the with_mode call, too.

@llogiq
Copy link
Contributor Author

llogiq commented May 10, 2015

OK, but I'd like to understand why? Surely rustc compiles the code anyway – I even have a test case saying so. What are the implications of walking the fn in const mode?

@eddyb
Copy link
Member

eddyb commented May 10, 2015

If it's in const mode, you get the const rules. And maybe ICEs. Try calling a function and you'll see.

@llogiq
Copy link
Contributor Author

llogiq commented May 10, 2015

Ah, Ok. Should have run the extended test before I fixed the function.

Is this ready to merge now or do I need to do something else?


// pretty-expanded FIXME #25180

const x: &'static Fn() = &|| println!("ICE here");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do multiple statements, arguments and local variables work in these closures?

@llogiq
Copy link
Contributor Author

llogiq commented May 10, 2015

Yeah, it's a good idea to add some more tests. I'm on it. Edit: Just started make check.

@llogiq
Copy link
Contributor Author

llogiq commented May 10, 2015

So yes, it appears to work after I got the test code right.

@eddyb
Copy link
Member

eddyb commented May 10, 2015

r? @eddyb @bors r+ rollup

@bors
Copy link
Contributor

bors commented May 10, 2015

📌 Commit a18ce4d has been approved by eddyb

@rust-highfive rust-highfive assigned eddyb and unassigned pnkfelix May 10, 2015
steveklabnik added a commit to steveklabnik/rust that referenced this pull request May 10, 2015
According to @eddyb – and my tests – the following gets rid of the ICE in issue rust-lang#25180.
Manishearth added a commit to Manishearth/rust that referenced this pull request May 11, 2015
According to @eddyb – and my tests – the following gets rid of the ICE in issue rust-lang#25180.
@bors
Copy link
Contributor

bors commented May 11, 2015

⌛ Testing commit a18ce4d with merge b758a37...

bors added a commit that referenced this pull request May 11, 2015
According to @eddyb – and my tests – the following gets rid of the ICE in issue #25180.
@bors
Copy link
Contributor

bors commented May 11, 2015

💔 Test failed - auto-mac-64-opt

// option. This file may not be copied, modified, or distributed
// except according to those terms.

// pretty-expanded FIXME #25180
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The failure was in pretty tests, which I don't you can do if you're using macros like println! which use unstable items in their expansions.

steveklabnik added a commit to steveklabnik/rust that referenced this pull request May 11, 2015
According to @eddyb – and my tests – the following gets rid of the ICE in issue rust-lang#25180.
bors added a commit that referenced this pull request May 11, 2015
@steveklabnik
Copy link
Member

@bors: rollup-

@eddyb
Copy link
Member

eddyb commented May 12, 2015

@steveklabnik huh, shouldn't a test failure take it out of the queue automatically?

@steveklabnik
Copy link
Member

don't think so

@llogiq
Copy link
Contributor Author

llogiq commented May 12, 2015

@steveklabnik I'm sorry that I broke the rollup. Apparently my tests weren't sufficient. I've now removed the print! macro invocations and added a feature declaration (which was hinted in the error message).

Can someone tell me how I can reproduce the failing test?

@steveklabnik
Copy link
Member

It's all good :) everyone does it. I'm not 100% sure how to reproduce though

@llogiq
Copy link
Contributor Author

llogiq commented May 12, 2015

Thanks for the kind words. My first PR and manage to hit all available roadblocks at once.

But hey, I learn a lot there days. 😄


const EMPTY: &'static Fn() = &|| ();

const ONE_ARGUMENT: &'static Fn(u32) = &|y| assert!(y == 42);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert! still uses the formatting machinery. I'm curious if we prefer to disable pretty testing or just add feature gates. What do other tests do?

@llogiq
Copy link
Contributor Author

llogiq commented May 13, 2015

I see 783 instances of "feature" just in test/run-pass. So yes, it appears feature-gates are not that uncommon. I'm unsure if #![feature(std_misc)] will be enough to make it work.

@eddyb
Copy link
Member

eddyb commented May 13, 2015

@llogiq Running make check-stage1-rpass-pretty should answer that question.

@llogiq
Copy link
Contributor Author

llogiq commented May 13, 2015

@eddyb Thanks, but that only prints that my Makefile does not have this target. Perhaps I'm missing some required package?

@pnkfelix
Copy link
Member

@llogiq no I think @eddyb just mispoke. The target is (probably) make check-stage1-pretty-rpass.

(I always recommend GNU remake for debugging big makefile systems.)

@eddyb
Copy link
Member

eddyb commented May 13, 2015

@llogiq @pnkfelix My bad, I have both in my shell history and I pasted the bad one.

@llogiq
Copy link
Contributor Author

llogiq commented May 13, 2015

In that case, my previous two commits make the test pass on my machine. On the other hand, it doesn't even require the feature gate. So it appears I cannot reproduce the issue on my 64-bit intel / Linux machine (Though I'm not sure if this is really about darwin or if I missed something while building).

Can someone with a mac reproduce the problem?

@bors
Copy link
Contributor

bors commented May 24, 2015

☔ The latest upstream changes (presumably #25609) made this pull request unmergeable. Please resolve the merge conflicts.

@llogiq
Copy link
Contributor Author

llogiq commented Jun 4, 2015

I've just revisited the problem, and recent changes not only made my PR unmergeable, but also fixed the problem in a different way. Closing the PR is the sensible option here.

@llogiq llogiq closed this Jun 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants