Skip to content

Commit 68f41ee

Browse files
committed
Feature gate macro arguments
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, and bask in the knowledge that your code won't mysteriously break should you try to use the 1.0 release. Closes #18102 [breaking-change]
1 parent a53586f commit 68f41ee

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib.rs

Lines changed: 2 additions & 1 deletion
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)