From 7120279b8323275fa7cc921332e034fc0328c52b Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Tue, 9 May 2017 08:41:38 +1200 Subject: [PATCH] Remove unstable features from rustc_errors --- src/Cargo.lock | 1 + src/librustc_errors/Cargo.toml | 1 + src/librustc_errors/emitter.rs | 8 ++++++-- src/librustc_errors/lib.rs | 3 --- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Cargo.lock b/src/Cargo.lock index 0b21ec9865021..4f83bff8ed847 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -572,6 +572,7 @@ dependencies = [ name = "rustc_errors" version = "0.0.0" dependencies = [ + "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "serialize 0.0.0", "syntax_pos 0.0.0", ] diff --git a/src/librustc_errors/Cargo.toml b/src/librustc_errors/Cargo.toml index 78ff52b4b2371..2d9491f21d640 100644 --- a/src/librustc_errors/Cargo.toml +++ b/src/librustc_errors/Cargo.toml @@ -11,3 +11,4 @@ crate-type = ["dylib"] [dependencies] serialize = { path = "../libserialize" } syntax_pos = { path = "../libsyntax_pos" } +libc = "0.2" diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 53999eb9138b6..777a1c890735c 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -1200,8 +1200,12 @@ fn num_overlap(a_start: usize, a_end: usize, b_start: usize, b_end:usize, inclus } else { 0 }; - (b_start..b_end + extra).contains(a_start) || - (a_start..a_end + extra).contains(b_start) + return range_contains(b_start..b_end + extra, a_start) || + range_contains(a_start..a_end + extra, b_start); + + fn range_contains(range: ::std::ops::Range, item: T) -> bool { + (range.start <= item) && (item < range.end) + } } fn overlaps(a1: &Annotation, a2: &Annotation, padding: usize) -> bool { num_overlap(a1.start_col, a1.end_col + padding, a2.start_col, a2.end_col, false) diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 02d8297dd4614..628070c4f75b1 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -17,12 +17,9 @@ html_root_url = "https://doc.rust-lang.org/nightly/")] #![deny(warnings)] -#![feature(custom_attribute)] #![allow(unused_attributes)] #![feature(rustc_private)] #![feature(staged_api)] -#![feature(range_contains)] -#![feature(libc)] extern crate term; extern crate libc;