Skip to content

Conversation

wesleywiser
Copy link
Member

Fixes #3796

@rust-highfive
Copy link

r? @matklad

(rust_highfive has picked a reviewer for you, use r? to override)

if f == feat {
bail!("Cyclic feature dependency: feature `{}` depends \
on itself", feat);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This forbids direct dependency of feature on itself, right? Let's add a test case for this then?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes that's correct. There was an existing test for this cyclic_feature() so I left it as-is.

@@ -907,15 +907,22 @@ fn build_features<'a>(s: &'a Summary, method: &'a Method)
}
None => {
let feat = feat_or_package;

//if this feature has already been added, then just return Ok
if !visited.insert(feat) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There's visited.remove(feat) down the line, and it seems suspicious to me.

Can it lead to visiting and walking the same feature more then once? Does anything break if we just remove the .remove? I would think it was needed for better error reporting only.

Copy link
Member Author

Choose a reason for hiding this comment

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

I will look into that later today.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree. It makes sense to remove it. I've pushed a fix for that.

@wesleywiser
Copy link
Member Author

Pinging @matklad in case they didn't see the updated commit.

@matklad
Copy link
Contributor

matklad commented Sep 8, 2017

Thanks for the poke @wesleywiser !

@bors r+

@bors
Copy link
Contributor

bors commented Sep 8, 2017

📌 Commit 3d966d3 has been approved by matklad

@wesleywiser
Copy link
Member Author

No problem @matklad. Thanks for the review!

@bors
Copy link
Contributor

bors commented Sep 9, 2017

⌛ Testing commit 3d966d3 with merge 053b634...

bors added a commit that referenced this pull request Sep 9, 2017
@bors
Copy link
Contributor

bors commented Sep 9, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: matklad
Pushing 053b634 to master...

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.

Cargo doesn't allow cyclic features
5 participants