Repository: pest-parser/pest (language: rust)

Issue:
compile error[E0658]: access to extern crates through prelude is experimental
When I try to do a  "cargo build" of the latest `pest`  (#8e58e02) with stock Rust 1.28.0 from Ubuntu 16.04 userland I get:

     ~/src/pest$ cargo build
        Compiling pest v2.0.2 (file:///home/john/src/pest/pest)
        Compiling pest_meta v2.0.3
        Compiling quote v0.6.10
        Compiling digest v0.7.6
        Compiling sha-1 v0.7.0
     error[E0658]: access to extern crates through prelude is experimental (see issue #44660)
         --> pest/src/parser_state.rs:1101:71
          |
     1101 | fn constrain_idxs(start: i32, end: Option<i32>, len: usize) -> Option<std::ops::Range<usize>> {
          |                                                                       ^^^
     
        Compiling pest_meta v2.0.3 (file:///home/john/src/pest/meta)
        Compiling syn v0.15.22
     error: aborting due to previous error

     For more information about this error, try `rustc --explain E0658`.
     error: Could not compile `pest`.
     warning: build failed, waiting for other jobs to finish...



Discussion / hints:
Nice find! Thanks for reporting this.
Also occurs with stock Ubuntu 18.04 (again rust 1.28.0). Does not occur with 1.31-beta.

Fix patch:
diff --git a/pest/src/parser_state.rs b/pest/src/parser_state.rs
index 96f87c80..54cfa92b 100644
--- a/pest/src/parser_state.rs
+++ b/pest/src/parser_state.rs
@@ -1098,7 +1098,7 @@ impl<'i, R: RuleType> ParserState<'i, R> {
     }
 }
 
-fn constrain_idxs(start: i32, end: Option<i32>, len: usize) -> Option<std::ops::Range<usize>> {
+fn constrain_idxs(start: i32, end: Option<i32>, len: usize) -> Option<Range<usize>> {
     let start_norm = normalize_index(start, len)?;
     let end_norm = end.map_or(Some(len), |e| normalize_index(e, len))?;
     Some(start_norm..end_norm)


Test patch: