Skip to content

use a default deny lint for preventing cycles #10837

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

Closed
thestinger opened this issue Dec 6, 2013 · 1 comment
Closed

use a default deny lint for preventing cycles #10837

thestinger opened this issue Dec 6, 2013 · 1 comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.

Comments

@thestinger
Copy link
Contributor

A type like MutexArc could be annotated with an attribute enabling a cycle detection lint:

#[cycle_check]
struct MutexArc<T> { ... }

The lint would do a walk of the type and check for a reference to itself. This isn't good enough for an immutable type like Rc because it only needs to warn if the type can contain itself and T is non-Freeze, but that's easy enough to solve. There's also the issue of how Rc cycles may interact with the current managed pointer annihilator and a future garbage collector.

@thestinger
Copy link
Contributor Author

This doesn't really work out very well thanks to trait objects and closures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.
Projects
None yet
Development

No branches or pull requests

1 participant