summaryrefslogtreecommitdiffstats
path: root/vendor/rls-span
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/rls-span')
-rw-r--r--vendor/rls-span/.cargo-checksum.json1
-rw-r--r--vendor/rls-span/Cargo.toml33
-rw-r--r--vendor/rls-span/src/compiler.rs78
-rw-r--r--vendor/rls-span/src/lib.rs383
4 files changed, 0 insertions, 495 deletions
diff --git a/vendor/rls-span/.cargo-checksum.json b/vendor/rls-span/.cargo-checksum.json
deleted file mode 100644
index c19eba924..000000000
--- a/vendor/rls-span/.cargo-checksum.json
+++ /dev/null
@@ -1 +0,0 @@
-{"files":{"Cargo.toml":"cf0c687986a67306e3bd71081f7386b15a92b9902683d387aa44cce8e4dc61ac","src/compiler.rs":"b313cdc064a940a5abc452ec0b92833b150ff9b4da9fb68e0c9900fea1d97cfc","src/lib.rs":"cbfe46ec5c42dfeb28fca214b26e034cb01e5f5b644abad68c838af7c7209d12"},"package":"f0eea58478fc06e15f71b03236612173a1b81e9770314edecfa664375e3e4c86"} \ No newline at end of file
diff --git a/vendor/rls-span/Cargo.toml b/vendor/rls-span/Cargo.toml
deleted file mode 100644
index ad48306e7..000000000
--- a/vendor/rls-span/Cargo.toml
+++ /dev/null
@@ -1,33 +0,0 @@
-# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
-#
-# When uploading crates to the registry Cargo will automatically
-# "normalize" Cargo.toml files for maximal compatibility
-# with all versions of Cargo and also rewrite `path` dependencies
-# to registry (e.g., crates.io) dependencies
-#
-# If you believe there's an error in this file please file an
-# issue against the rust-lang/cargo repository. If you're
-# editing this file be aware that the upstream Cargo.toml
-# will likely look very different (and much more reasonable)
-
-[package]
-edition = "2018"
-name = "rls-span"
-version = "0.5.3"
-authors = ["Nick Cameron <ncameron@mozilla.com>"]
-description = "Types for identifying code spans/ranges"
-categories = ["development-tools"]
-license = "Apache-2.0/MIT"
-repository = "https://github.com/rust-lang/rls"
-[dependencies.rustc-serialize]
-version = "0.3.24"
-optional = true
-
-[dependencies.serde]
-version = "1.0"
-
-[features]
-default = []
-derive = ["serde/derive"]
-nightly = []
-serialize-rustc = ["rustc-serialize"]
diff --git a/vendor/rls-span/src/compiler.rs b/vendor/rls-span/src/compiler.rs
deleted file mode 100644
index 60151a561..000000000
--- a/vendor/rls-span/src/compiler.rs
+++ /dev/null
@@ -1,78 +0,0 @@
-///! These are the structures emitted by the compiler as part of JSON errors.
-///! The original source can be found at
-///! https://github.com/rust-lang/rust/blob/master/src/librustc_errors/json.rs
-use std::path::PathBuf;
-
-#[cfg(feature = "derive")]
-use serde::Deserialize;
-
-use crate::{Column, OneIndexed, Row, Span};
-
-#[cfg_attr(feature = "derive", derive(Deserialize))]
-#[cfg_attr(feature = "serialize-rustc", derive(RustcDecodable))]
-#[derive(Debug, Clone)]
-pub struct DiagnosticSpan {
- pub file_name: String,
- pub byte_start: u32,
- pub byte_end: u32,
- /// 1-based.
- pub line_start: usize,
- pub line_end: usize,
- /// 1-based, character offset.
- pub column_start: usize,
- pub column_end: usize,
- /// Is this a "primary" span -- meaning the point, or one of the points,
- /// where the error occurred?
- pub is_primary: bool,
- /// Source text from the start of line_start to the end of line_end.
- pub text: Vec<DiagnosticSpanLine>,
- /// Label that should be placed at this location (if any)
- pub label: Option<String>,
- /// If we are suggesting a replacement, this will contain text
- /// that should be sliced in atop this span. You may prefer to
- /// load the fully rendered version from the parent `Diagnostic`,
- /// however.
- pub suggested_replacement: Option<String>,
- /// Macro invocations that created the code at this span, if any.
- pub expansion: Option<Box<DiagnosticSpanMacroExpansion>>,
-}
-
-impl DiagnosticSpan {
- pub fn rls_span(&self) -> Span<OneIndexed> {
- Span::new(
- Row::new(self.line_start as u32),
- Row::new(self.line_end as u32),
- Column::new(self.column_start as u32),
- Column::new(self.column_end as u32),
- PathBuf::from(&self.file_name),
- )
- }
-}
-
-#[cfg_attr(feature = "derive", derive(Deserialize))]
-#[cfg_attr(feature = "serialize-rustc", derive(RustcDecodable))]
-#[derive(Debug, Clone)]
-pub struct DiagnosticSpanLine {
- pub text: String,
-
- /// 1-based, character offset in self.text.
- pub highlight_start: usize,
-
- pub highlight_end: usize,
-}
-
-#[cfg_attr(feature = "derive", derive(Deserialize))]
-#[cfg_attr(feature = "serialize-rustc", derive(RustcDecodable))]
-#[derive(Debug, Clone)]
-pub struct DiagnosticSpanMacroExpansion {
- /// span where macro was applied to generate this code; note that
- /// this may itself derive from a macro (if
- /// `span.expansion.is_some()`)
- pub span: DiagnosticSpan,
-
- /// name of macro that was applied (e.g., "foo!" or "#[derive(Eq)]")
- pub macro_decl_name: String,
-
- /// span where macro was defined (if known)
- pub def_site_span: Option<DiagnosticSpan>,
-}
diff --git a/vendor/rls-span/src/lib.rs b/vendor/rls-span/src/lib.rs
deleted file mode 100644
index 1d997f605..000000000
--- a/vendor/rls-span/src/lib.rs
+++ /dev/null
@@ -1,383 +0,0 @@
-#![cfg_attr(feature = "nightly", feature(step_trait, step_trait_ext))]
-
-use std::marker::PhantomData;
-use std::path::PathBuf;
-
-#[cfg(feature = "nightly")]
-use std::iter::Step;
-
-use serde::{Deserialize, Serialize};
-
-pub mod compiler;
-
-#[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
-pub struct Column<I: Indexed>(pub u32, PhantomData<I>);
-
-impl<I: Indexed> Column<I> {
- fn new(c: u32) -> Column<I> {
- Column(c, PhantomData)
- }
-}
-
-impl<I: Indexed> Clone for Column<I> {
- fn clone(&self) -> Column<I> {
- *self
- }
-}
-
-impl<I: Indexed> Copy for Column<I> {}
-
-impl<I: Indexed> Serialize for Column<I> {
- fn serialize<S: serde::Serializer>(
- &self,
- s: S,
- ) -> Result<<S as serde::Serializer>::Ok, <S as serde::Serializer>::Error> {
- s.serialize_u32(self.0)
- }
-}
-
-impl<'dt, I: Indexed> Deserialize<'dt> for Column<I> {
- fn deserialize<D: serde::Deserializer<'dt>>(
- d: D,
- ) -> std::result::Result<Self, <D as serde::Deserializer<'dt>>::Error> {
- <u32 as Deserialize>::deserialize(d).map(Column::new)
- }
-}
-
-#[cfg(feature = "serialize-rustc")]
-impl<I: Indexed> rustc_serialize::Decodable for Column<I> {
- fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<Column<I>, D::Error> {
- d.read_u32().map(Column::new)
- }
-}
-
-#[cfg(feature = "serialize-rustc")]
-impl<I: Indexed> rustc_serialize::Encodable for Column<I> {
- fn encode<S: rustc_serialize::Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
- s.emit_u32(self.0)
- }
-}
-
-impl Column<OneIndexed> {
- pub fn new_one_indexed(c: u32) -> Column<OneIndexed> {
- Column(c, PhantomData)
- }
-
- pub fn zero_indexed(self) -> Column<ZeroIndexed> {
- Column(self.0 - 1, PhantomData)
- }
-}
-
-impl Column<ZeroIndexed> {
- pub fn new_zero_indexed(c: u32) -> Column<ZeroIndexed> {
- Column(c, PhantomData)
- }
-
- pub fn one_indexed(self) -> Column<OneIndexed> {
- Column(self.0 + 1, PhantomData)
- }
-}
-
-#[cfg(feature = "nightly")]
-macro_rules! impl_step {
- ($target: ty) => {
- unsafe impl Step for $target {
- fn steps_between(start: &Self, end: &Self) -> Option<usize> {
- Step::steps_between(&start.0, &end.0)
- }
- fn forward_checked(arg: Self, count: usize) -> Option<Self> {
- Step::forward_checked(arg.0, count).map(|x| Self(x, PhantomData))
- }
- fn backward_checked(arg: Self, count: usize) -> Option<Self> {
- Step::backward_checked(arg.0, count).map(|x| Self(x, PhantomData))
- }
- }
- };
-}
-
-#[cfg(feature = "nightly")]
-impl_step!(Column<ZeroIndexed>);
-#[cfg(feature = "nightly")]
-impl_step!(Column<OneIndexed>);
-#[cfg(feature = "nightly")]
-impl_step!(Row<ZeroIndexed>);
-#[cfg(feature = "nightly")]
-impl_step!(Row<OneIndexed>);
-
-#[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
-pub struct Row<I: Indexed>(pub u32, PhantomData<I>);
-
-impl<I: Indexed> Row<I> {
- fn new(c: u32) -> Row<I> {
- Row(c, PhantomData)
- }
-}
-
-impl<I: Indexed> Clone for Row<I> {
- fn clone(&self) -> Row<I> {
- *self
- }
-}
-
-impl<I: Indexed> Copy for Row<I> {}
-
-impl<I: Indexed> serde::Serialize for Row<I> {
- fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
- s.serialize_u32(self.0)
- }
-}
-
-impl<'dt, I: Indexed> serde::Deserialize<'dt> for Row<I> {
- fn deserialize<D: serde::Deserializer<'dt>>(d: D) -> std::result::Result<Self, D::Error> {
- <u32 as Deserialize>::deserialize(d).map(Row::new)
- }
-}
-
-#[cfg(feature = "serialize-rustc")]
-impl<I: Indexed> rustc_serialize::Decodable for Row<I> {
- fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<Row<I>, D::Error> {
- d.read_u32().map(Row::new)
- }
-}
-
-#[cfg(feature = "serialize-rustc")]
-impl<I: Indexed> rustc_serialize::Encodable for Row<I> {
- fn encode<S: rustc_serialize::Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
- s.emit_u32(self.0)
- }
-}
-
-impl Row<OneIndexed> {
- pub fn new_one_indexed(c: u32) -> Row<OneIndexed> {
- Row(c, PhantomData)
- }
-
- pub fn zero_indexed(self) -> Row<ZeroIndexed> {
- Row(self.0 - 1, PhantomData)
- }
-}
-
-impl Row<ZeroIndexed> {
- pub fn new_zero_indexed(c: u32) -> Row<ZeroIndexed> {
- Row(c, PhantomData)
- }
-
- pub fn one_indexed(self) -> Row<OneIndexed> {
- Row(self.0 + 1, PhantomData)
- }
-}
-
-#[cfg_attr(feature = "derive", derive(Serialize, Deserialize))]
-#[cfg_attr(feature = "serialize-rustc", derive(RustcDecodable, RustcEncodable))]
-#[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
-pub struct Position<I: Indexed> {
- pub row: Row<I>,
- pub col: Column<I>,
-}
-
-impl<I: Indexed> Position<I> {
- pub fn new(row: Row<I>, col: Column<I>) -> Position<I> {
- Position { row, col }
- }
-}
-
-impl<I: Indexed> Clone for Position<I> {
- fn clone(&self) -> Position<I> {
- *self
- }
-}
-
-impl<I: Indexed> Copy for Position<I> {}
-
-impl Position<OneIndexed> {
- pub fn zero_indexed(self) -> Position<ZeroIndexed> {
- Position { row: self.row.zero_indexed(), col: self.col.zero_indexed() }
- }
-}
-
-impl Position<ZeroIndexed> {
- pub fn one_indexed(self) -> Position<OneIndexed> {
- Position { row: self.row.one_indexed(), col: self.col.one_indexed() }
- }
-}
-
-#[cfg_attr(feature = "derive", derive(Serialize, Deserialize))]
-#[cfg_attr(feature = "serialize-rustc", derive(RustcDecodable, RustcEncodable))]
-#[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
-pub struct Range<I: Indexed> {
- pub row_start: Row<I>,
- pub row_end: Row<I>,
- pub col_start: Column<I>,
- pub col_end: Column<I>,
-}
-
-impl<I: Indexed> Range<I> {
- pub fn new(
- row_start: Row<I>,
- row_end: Row<I>,
- col_start: Column<I>,
- col_end: Column<I>,
- ) -> Range<I> {
- Range { row_start, row_end, col_start, col_end }
- }
-
- pub fn from_positions(start: Position<I>, end: Position<I>) -> Range<I> {
- Range { row_start: start.row, row_end: end.row, col_start: start.col, col_end: end.col }
- }
-
- pub fn start(self) -> Position<I> {
- Position { row: self.row_start, col: self.col_start }
- }
-
- pub fn end(self) -> Position<I> {
- Position { row: self.row_end, col: self.col_end }
- }
-}
-
-impl<I: Indexed> Clone for Range<I> {
- fn clone(&self) -> Range<I> {
- *self
- }
-}
-
-impl<I: Indexed> Copy for Range<I> {}
-
-impl Range<OneIndexed> {
- pub fn zero_indexed(self) -> Range<ZeroIndexed> {
- Range {
- row_start: self.row_start.zero_indexed(),
- row_end: self.row_end.zero_indexed(),
- col_start: self.col_start.zero_indexed(),
- col_end: self.col_end.zero_indexed(),
- }
- }
-}
-
-impl Range<ZeroIndexed> {
- pub fn one_indexed(self) -> Range<OneIndexed> {
- Range {
- row_start: self.row_start.one_indexed(),
- row_end: self.row_end.one_indexed(),
- col_start: self.col_start.one_indexed(),
- col_end: self.col_end.one_indexed(),
- }
- }
-}
-
-#[cfg_attr(feature = "derive", derive(Serialize, Deserialize))]
-#[cfg_attr(feature = "serialize-rustc", derive(RustcDecodable, RustcEncodable))]
-#[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
-pub struct Location<I: Indexed> {
- pub file: PathBuf,
- pub position: Position<I>,
-}
-
-impl<I: Indexed> Location<I> {
- pub fn new<F: Into<PathBuf>>(row: Row<I>, col: Column<I>, file: F) -> Location<I> {
- Location { position: Position { row, col }, file: file.into() }
- }
-
- pub fn from_position<F: Into<PathBuf>>(position: Position<I>, file: F) -> Location<I> {
- Location { position, file: file.into() }
- }
-}
-
-impl<I: Indexed> Clone for Location<I> {
- fn clone(&self) -> Location<I> {
- Location { position: self.position, file: self.file.clone() }
- }
-}
-
-impl Location<OneIndexed> {
- pub fn zero_indexed(&self) -> Location<ZeroIndexed> {
- Location { position: self.position.zero_indexed(), file: self.file.clone() }
- }
-}
-
-impl Location<ZeroIndexed> {
- pub fn one_indexed(&self) -> Location<OneIndexed> {
- Location { position: self.position.one_indexed(), file: self.file.clone() }
- }
-}
-
-#[cfg_attr(feature = "derive", derive(Serialize, Deserialize))]
-#[cfg_attr(feature = "serialize-rustc", derive(RustcDecodable, RustcEncodable))]
-#[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
-pub struct Span<I: Indexed> {
- pub file: PathBuf,
- pub range: Range<I>,
-}
-
-impl<I: Indexed> Span<I> {
- pub fn new<F: Into<PathBuf>>(
- row_start: Row<I>,
- row_end: Row<I>,
- col_start: Column<I>,
- col_end: Column<I>,
- file: F,
- ) -> Span<I> {
- Span { range: Range { row_start, row_end, col_start, col_end }, file: file.into() }
- }
-
- pub fn from_range<F: Into<PathBuf>>(range: Range<I>, file: F) -> Span<I> {
- Span { range, file: file.into() }
- }
-
- pub fn from_positions<F: Into<PathBuf>>(
- start: Position<I>,
- end: Position<I>,
- file: F,
- ) -> Span<I> {
- Span { range: Range::from_positions(start, end), file: file.into() }
- }
-}
-
-impl<I: Indexed> Clone for Span<I> {
- fn clone(&self) -> Span<I> {
- Span { range: self.range, file: self.file.clone() }
- }
-}
-
-impl Span<OneIndexed> {
- pub fn zero_indexed(&self) -> Span<ZeroIndexed> {
- Span { range: self.range.zero_indexed(), file: self.file.clone() }
- }
-}
-
-impl Span<ZeroIndexed> {
- pub fn one_indexed(&self) -> Span<OneIndexed> {
- Span { range: self.range.one_indexed(), file: self.file.clone() }
- }
-}
-
-pub trait Indexed {}
-
-#[cfg_attr(feature = "derive", derive(Serialize, Deserialize))]
-#[cfg_attr(feature = "serialize-rustc", derive(RustcDecodable, RustcEncodable))]
-#[derive(Hash, PartialEq, Eq, Debug, PartialOrd, Ord)]
-pub struct ZeroIndexed;
-impl Indexed for ZeroIndexed {}
-
-#[cfg_attr(feature = "derive", derive(Serialize, Deserialize))]
-#[cfg_attr(feature = "serialize-rustc", derive(RustcDecodable, RustcEncodable))]
-#[derive(Hash, PartialEq, Eq, Debug, PartialOrd, Ord)]
-pub struct OneIndexed;
-impl Indexed for OneIndexed {}
-
-#[cfg(feature = "nightly")]
-#[cfg(test)]
-mod test {
- use super::*;
-
- #[test]
- fn iter_row() {
- assert_eq!((Row::new_one_indexed(4)..Row::new_one_indexed(8)).count(), 4);
- assert_eq!(
- &*(Row::new_zero_indexed(0)..=Row::new_zero_indexed(8))
- .filter(|r| r.0 < 3)
- .map(|r| r.0)
- .collect::<Vec<_>>(),
- &[0, 1, 2],
- );
- }
-}