Skip to content

Commit 25715cc

Browse files
committed
auto merge of #20190 : cmr/rust/gate-macro-args, r=alexcrichton
Uses the same approach as rust-lang/rust#17286 (and subsequent changes making it more correct), where the visitor will skip any pieces of the AST that are from "foreign code", where the spans don't line up, indicating that that piece of code is due to a macro expansion. If this breaks your code, read the error message to determine which feature gate you should add to your crate. Closes #18102 [breaking-change]
2 parents c14a290 + 68f41ee commit 25715cc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ pub trait Rng {
271271
/// let choices = [1i, 2, 4, 8, 16, 32];
272272
/// let mut rng = thread_rng();
273273
/// println!("{}", rng.choose(&choices));
274-
/// assert_eq!(rng.choose(choices[..0]), None);
274+
/// # // replace with slicing syntax when it's stable!
275+
/// assert_eq!(rng.choose(choices.slice_to(0)), None);
275276
/// ```
276277
fn choose<'a, T>(&mut self, values: &'a [T]) -> Option<&'a T> {
277278
if values.is_empty() {

0 commit comments

Comments
 (0)