-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
adding move_iter() function to collections::treemap::TreeSet #14122
Conversation
fn size_hint(&self) -> (uint, Option<uint>) { | ||
self.iter.size_hint() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be expressible as an iter::Map
iterator (one fewer struct!)
pub type MoveSetItems<T> = iter::Map<'static, (T, ()), T>;
(or something like that)
Hi Alex, I did as you suggested with a couple caveats:
Thanks. |
It may be better to have |
Done. |
Looks good to me, thanks! Could you squash the commits into one? Other than that, I think this is good to go! |
Done. |
It seems that a merge commit may have snuck in, perhaps a rebase gone awry? |
Aha. There it is. Sorry about that. |
This is my first patch and hopefully nothing controversial: just a straightforward forwarding of TreeMap::move_iter() as TreeSet::move_iter().
…verflow, r=Veykril fix: Don't expand macros in the same expansion tree after overflow This patch fixes 2 bugs: - In `Expander::enter_expand_id()` (and in code paths it's called), we never check whether we've reached the recursion limit. Although it hasn't been reported as far as I'm aware, this may cause hangs or stack overflows if some malformed attribute macro is used on associated items. - We keep expansion even when recursion limit is reached. Take the following for example: ```rust macro_rules! foo { () => {{ foo!(); foo!(); }} } fn main() { foo!(); } ``` We keep expanding the first `foo!()` in each expansion and would reach the limit at some point, *after which* we would try expanding the second `foo!()` in each expansion until it hits the limit again. This will (by default) lead to ~2^128 expansions. This is essentially what's happening in rust-lang#14074. Unlike rustc, we don't just stop expanding macros when we fail as long as it produces some tokens so that we can provide completions and other services in incomplete macro calls. This patch provides a method that takes care of recursion depths (`Expander::within_limit()`) and stops macro expansions in the whole macro expansion tree once it detects recursion depth overflow. To be honest, I'm not really satisfied with this fix because it can still be used in unintended ways to bypass overflow checks, and I'm still seeking ways such that misuses are caught by the compiler by leveraging types or something. Fixes rust-lang#14074
changelog: [`cmp_null`]: add autofix
This is my first patch and hopefully nothing controversial: just a straightforward forwarding of TreeMap::move_iter() as TreeSet::move_iter().