about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-08-13 10:22:45 +0000
committerbors <bors@rust-lang.org>2017-08-13 10:22:45 +0000
commita80a873209a79499290201f8657618703a51b73e (patch)
tree7cc9023e2d308290a6d242bd5a147e63111193c2 /src/libsyntax
parentd4fbc7a4e781a211b19fa2154184b37d3d53d32b (diff)
parenta7ead41aecfdd591bbb552eb007708be2c0919de (diff)
Auto merge of #43839 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 8 pull requests

- Successful merges: #43782, #43803, #43814, #43819, #43821, #43822, #43824, #43833
- Failed merges:
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs6
-rw-r--r--src/libsyntax/codemap.rs4
-rw-r--r--src/libsyntax/ext/source_util.rs11
-rw-r--r--src/libsyntax/parse/parser.rs2
4 files changed, 12 insertions, 11 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 857d9a753cc..38ef79822c7 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -563,8 +563,8 @@ pub enum PatKind {
     TupleStruct(Path, Vec<P<Pat>>, Option<usize>),
 
     /// A possibly qualified path pattern.
-    /// Unquailfied path patterns `A::B::C` can legally refer to variants, structs, constants
-    /// or associated constants. Quailfied path patterns `<A>::B::C`/`<A as Trait>::B::C` can
+    /// Unqualified path patterns `A::B::C` can legally refer to variants, structs, constants
+    /// or associated constants. Qualified path patterns `<A>::B::C`/`<A as Trait>::B::C` can
     /// only legally refer to associated constants.
     Path(Option<QSelf>, Path),
 
@@ -1838,7 +1838,7 @@ pub struct Item {
 
 #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
 pub enum ItemKind {
-    /// An`extern crate` item, with optional original crate name.
+    /// An `extern crate` item, with optional original crate name.
     ///
     /// E.g. `extern crate foo` or `extern crate foo_bar as foo`
     ExternCrate(Option<Name>),
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index bfdcae7641d..6c48b4cadd8 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -761,7 +761,7 @@ mod tests {
     }
 
     /// Given a string like " ~~~~~~~~~~~~ ", produces a span
-    /// coverting that range. The idea is that the string has the same
+    /// converting that range. The idea is that the string has the same
     /// length as the input, and we uncover the byte positions.  Note
     /// that this can span lines and so on.
     fn span_from_selection(input: &str, selection: &str) -> Span {
@@ -771,7 +771,7 @@ mod tests {
         Span { lo: BytePos(left_index), hi: BytePos(right_index + 1), ctxt: NO_EXPANSION }
     }
 
-    /// Test span_to_snippet and span_to_lines for a span coverting 3
+    /// Test span_to_snippet and span_to_lines for a span converting 3
     /// lines in the middle of a file.
     #[test]
     fn span_to_snippet_and_lines_spanning_multiple_lines() {
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs
index b293aa8de38..95fe41be122 100644
--- a/src/libsyntax/ext/source_util.rs
+++ b/src/libsyntax/ext/source_util.rs
@@ -193,13 +193,14 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::Toke
 // resolve a file-system path to an absolute file-system path (if it
 // isn't already)
 fn res_rel_file(cx: &mut ExtCtxt, sp: syntax_pos::Span, arg: &Path) -> PathBuf {
-    // NB: relative paths are resolved relative to the compilation unit
+    // Relative paths are resolved relative to the file in which they are found
+    // after macro expansion (that is, they are unhygienic).
     if !arg.is_absolute() {
         let callsite = sp.source_callsite();
-        let mut cu = PathBuf::from(&cx.codemap().span_to_filename(callsite));
-        cu.pop();
-        cu.push(arg);
-        cu
+        let mut path = PathBuf::from(&cx.codemap().span_to_filename(callsite));
+        path.pop();
+        path.push(arg);
+        path
     } else {
         arg.to_path_buf()
     }
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 7bf4c6799b3..15f05df58b5 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -3587,7 +3587,7 @@ impl<'a> Parser<'a> {
 
     /// Parse a local variable declaration
     fn parse_local(&mut self, attrs: ThinVec<Attribute>) -> PResult<'a, P<Local>> {
-        let lo = self.span;
+        let lo = self.prev_span;
         let pat = self.parse_pat()?;
 
         let ty = if self.eat(&token::Colon) {