提交 def3269a 编写于 作者: B bors

Auto merge of #47870 - kennytm:rollup, r=kennytm

Rollup of 12 pull requests

- Successful merges: #47515, #47603, #47718, #47732, #47760, #47780, #47822, #47826, #47836, #47839, #47853, #47855
- Failed merges:
......@@ -469,6 +469,18 @@ pub fn cargo(&self,
stage = compiler.stage;
}
let mut extra_args = env::var(&format!("RUSTFLAGS_STAGE_{}", stage)).unwrap_or_default();
if stage != 0 {
let s = env::var("RUSTFLAGS_STAGE_NOT_0").unwrap_or_default();
extra_args.push_str(" ");
extra_args.push_str(&s);
}
if !extra_args.is_empty() {
cargo.env("RUSTFLAGS",
format!("{} {}", env::var("RUSTFLAGS").unwrap_or_default(), extra_args));
}
// Customize the compiler we're running. Specify the compiler to cargo
// as our shim and then pass it some various options used to configure
// how the actual compiler itself is called.
......
......@@ -139,11 +139,11 @@ closure-like semantics. Namely:
types and such.
* Traits like `Send` and `Sync` are automatically implemented for a `Generator`
depending on the captured variables of the environment. Unlike closures though
depending on the captured variables of the environment. Unlike closures,
generators also depend on variables live across suspension points. This means
that although the ambient environment may be `Send` or `Sync`, the generator
itself may not be due to internal variables live across `yield` points being
not-`Send` or not-`Sync`. Note, though, that generators, like closures, do
not-`Send` or not-`Sync`. Note that generators, like closures, do
not implement traits like `Copy` or `Clone` automatically.
* Whenever a generator is dropped it will drop all captured environment
......@@ -155,7 +155,7 @@ lifted at a future date, the design is ongoing!
### Generators as state machines
In the compiler generators are currently compiled as state machines. Each
In the compiler, generators are currently compiled as state machines. Each
`yield` expression will correspond to a different state that stores all live
variables over that suspension point. Resumption of a generator will dispatch on
the current state and then execute internally until a `yield` is reached, at
......
......@@ -1748,6 +1748,11 @@ impl<'a, K: Ord, Q: ?Sized, V> Index<&'a Q> for BTreeMap<K, V>
{
type Output = V;
/// Returns a reference to the value corresponding to the supplied key.
///
/// # Panics
///
/// Panics if the key is not present in the `BTreeMap`.
#[inline]
fn index(&self, key: &Q) -> &V {
self.get(key).expect("no entry found for key")
......
......@@ -1014,8 +1014,21 @@ fn emit_message_default(&mut self,
// Then, the secondary file indicator
buffer.prepend(buffer_msg_line_offset + 1, "::: ", Style::LineNumber);
let loc = if let Some(first_line) = annotated_file.lines.first() {
let col = if let Some(first_annotation) = first_line.annotations.first() {
format!(":{}", first_annotation.start_col + 1)
} else {
"".to_string()
};
format!("{}:{}{}",
annotated_file.file.name,
cm.doctest_offset_line(first_line.line_index),
col)
} else {
annotated_file.file.name.to_string()
};
buffer.append(buffer_msg_line_offset + 1,
&annotated_file.file.name.to_string(),
&loc,
Style::LineAndColumn);
for _ in 0..max_line_num_len {
buffer.prepend(buffer_msg_line_offset + 1, " ", Style::NoStyle);
......
......@@ -27,7 +27,8 @@ pub struct FileInfo {
/// The "primary file", if any, gets a `-->` marker instead of
/// `>>>`, and has a line-number/column printed and not just a
/// filename. It appears first in the listing. It is known to
/// filename (other files are not guaranteed to have line numbers
/// or columns). It appears first in the listing. It is known to
/// contain at least one primary span, though primary spans (which
/// are designated with `^^^`) may also occur in other files.
primary_span: Option<Span>,
......
......@@ -79,16 +79,16 @@ unsafe fn configure_llvm(sess: &Session) {
// detection code will walk past the end of the feature array,
// leading to crashes.
const ARM_WHITELIST: &'static [&'static str] = &["neon\0", "vfp2\0", "vfp3\0", "vfp4\0"];
const ARM_WHITELIST: &'static [&'static str] = &["neon\0", "v7\0", "vfp2\0", "vfp3\0", "vfp4\0"];
const AARCH64_WHITELIST: &'static [&'static str] = &["neon\0"];
const AARCH64_WHITELIST: &'static [&'static str] = &["neon\0", "v7\0"];
const X86_WHITELIST: &'static [&'static str] = &["avx\0", "avx2\0", "bmi\0", "bmi2\0", "sse\0",
"sse2\0", "sse3\0", "sse4.1\0", "sse4.2\0",
"ssse3\0", "tbm\0", "lzcnt\0", "popcnt\0",
"sse4a\0", "rdrnd\0", "rdseed\0", "fma\0",
"xsave\0", "xsaveopt\0", "xsavec\0",
"xsaves\0",
"xsaves\0", "aes\0",
"avx512bw\0", "avx512cd\0",
"avx512dq\0", "avx512er\0",
"avx512f\0", "avx512ifma\0",
......
......@@ -872,7 +872,7 @@ fn escape_href(ob: &mut String, s: &str) {
let link_out = format!("<a href=\"{link}\"{title}>{content}</a>",
link = link_buf,
title = title.map_or(String::new(),
|t| format!(" title=\"{}\"", t)),
|t| format!(" title=\"{}\"", Escape(&t))),
content = content.unwrap_or(String::new()));
unsafe { hoedown_buffer_put(ob, link_out.as_ptr(), link_out.len()); }
......
......@@ -1384,9 +1384,14 @@ impl<'a, K, Q: ?Sized, V, S> Index<&'a Q> for HashMap<K, V, S>
{
type Output = V;
/// Returns a reference to the value corresponding to the supplied key.
///
/// # Panics
///
/// Panics if the key is not present in the `HashMap`.
#[inline]
fn index(&self, index: &Q) -> &V {
self.get(index).expect("no entry found for key")
fn index(&self, key: &Q) -> &V {
self.get(key).expect("no entry found for key")
}
}
......
......@@ -1843,4 +1843,10 @@ fn ContinueDebugEvent(dwProcessId: DWORD, dwThreadId: DWORD,
}
assert!(events > 0);
}
#[test]
fn test_command_implements_send() {
fn take_send_type<T: Send>(_: T) {}
take_send_type(Command::new(""))
}
}
......@@ -45,7 +45,7 @@ pub struct Command {
// other keys.
program: CString,
args: Vec<CString>,
argv: Vec<*const c_char>,
argv: Argv,
env: CommandEnv<DefaultEnvKey>,
cwd: Option<CString>,
......@@ -58,6 +58,12 @@ pub struct Command {
stderr: Option<Stdio>,
}
// Create a new type for argv, so that we can make it `Send`
struct Argv(Vec<*const c_char>);
// It is safe to make Argv Send, because it contains pointers to memory owned by `Command.args`
unsafe impl Send for Argv {}
// passed back to std::process with the pipes connected to the child, if any
// were requested
pub struct StdioPipes {
......@@ -92,7 +98,7 @@ pub fn new(program: &OsStr) -> Command {
let mut saw_nul = false;
let program = os2c(program, &mut saw_nul);
Command {
argv: vec![program.as_ptr(), ptr::null()],
argv: Argv(vec![program.as_ptr(), ptr::null()]),
program,
args: Vec::new(),
env: Default::default(),
......@@ -111,8 +117,8 @@ pub fn arg(&mut self, arg: &OsStr) {
// Overwrite the trailing NULL pointer in `argv` and then add a new null
// pointer.
let arg = os2c(arg, &mut self.saw_nul);
self.argv[self.args.len() + 1] = arg.as_ptr();
self.argv.push(ptr::null());
self.argv.0[self.args.len() + 1] = arg.as_ptr();
self.argv.0.push(ptr::null());
// Also make sure we keep track of the owned value to schedule a
// destructor for this memory.
......@@ -133,7 +139,7 @@ pub fn saw_nul(&self) -> bool {
self.saw_nul
}
pub fn get_argv(&self) -> &Vec<*const c_char> {
&self.argv
&self.argv.0
}
#[allow(dead_code)]
......
......@@ -10,14 +10,16 @@
use ast;
use ext::tt::macro_parser;
use parse::{ParseSess, token};
use parse::{token, ParseSess};
use print::pprust;
use symbol::keywords;
use syntax_pos::{DUMMY_SP, Span, BytePos};
use syntax_pos::{BytePos, Span, DUMMY_SP};
use tokenstream;
use std::rc::Rc;
/// Contains the sub-token-trees of a "delimited" token tree, such as the contents of `(`. Note
/// that the delimiter itself might be `NoDelim`.
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub struct Delimited {
pub delim: token::DelimToken,
......@@ -25,14 +27,17 @@ pub struct Delimited {
}
impl Delimited {
/// Return the opening delimiter (possibly `NoDelim`).
pub fn open_token(&self) -> token::Token {
token::OpenDelim(self.delim)
}
/// Return the closing delimiter (possibly `NoDelim`).
pub fn close_token(&self) -> token::Token {
token::CloseDelim(self.delim)
}
/// Return a `self::TokenTree` with a `Span` corresponding to the opening delimiter.
pub fn open_tt(&self, span: Span) -> TokenTree {
let open_span = if span == DUMMY_SP {
DUMMY_SP
......@@ -42,6 +47,7 @@ pub fn open_tt(&self, span: Span) -> TokenTree {
TokenTree::Token(open_span, self.open_token())
}
/// Return a `self::TokenTree` with a `Span` corresponding to the closing delimiter.
pub fn close_tt(&self, span: Span) -> TokenTree {
let close_span = if span == DUMMY_SP {
DUMMY_SP
......@@ -68,12 +74,14 @@ pub struct SequenceRepetition {
/// for token sequences.
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
pub enum KleeneOp {
/// Kleene star (`*`) for zero or more repetitions
ZeroOrMore,
/// Kleene plus (`+`) for one or more repetitions
OneOrMore,
}
/// Similar to `tokenstream::TokenTree`, except that `$i`, `$i:ident`, and `$(...)`
/// are "first-class" token trees.
/// are "first-class" token trees. Useful for parsing macros.
#[derive(Debug, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)]
pub enum TokenTree {
Token(Span, token::Token),
......@@ -83,10 +91,15 @@ pub enum TokenTree {
/// E.g. `$var`
MetaVar(Span, ast::Ident),
/// E.g. `$var:expr`. This is only used in the left hand side of MBE macros.
MetaVarDecl(Span, ast::Ident /* name to bind */, ast::Ident /* kind of nonterminal */),
MetaVarDecl(
Span,
ast::Ident, /* name to bind */
ast::Ident, /* kind of nonterminal */
),
}
impl TokenTree {
/// Return the number of tokens in the tree.
pub fn len(&self) -> usize {
match *self {
TokenTree::Delimited(_, ref delimed) => match delimed.delim {
......@@ -98,6 +111,8 @@ pub fn len(&self) -> usize {
}
}
/// Returns true if the given token tree contains no other tokens. This is vacuously true for
/// single tokens or metavar/decls, but may be false for delimited trees or sequences.
pub fn is_empty(&self) -> bool {
match *self {
TokenTree::Delimited(_, ref delimed) => match delimed.delim {
......@@ -109,6 +124,7 @@ pub fn is_empty(&self) -> bool {
}
}
/// Get the `index`-th sub-token-tree. This only makes sense for delimited trees and sequences.
pub fn get_tt(&self, index: usize) -> TokenTree {
match (self, index) {
(&TokenTree::Delimited(_, ref delimed), _) if delimed.delim == token::NoDelim => {
......@@ -131,21 +147,48 @@ pub fn get_tt(&self, index: usize) -> TokenTree {
/// Retrieve the `TokenTree`'s span.
pub fn span(&self) -> Span {
match *self {
TokenTree::Token(sp, _) |
TokenTree::MetaVar(sp, _) |
TokenTree::MetaVarDecl(sp, _, _) |
TokenTree::Delimited(sp, _) |
TokenTree::Sequence(sp, _) => sp,
TokenTree::Token(sp, _)
| TokenTree::MetaVar(sp, _)
| TokenTree::MetaVarDecl(sp, _, _)
| TokenTree::Delimited(sp, _)
| TokenTree::Sequence(sp, _) => sp,
}
}
}
pub fn parse(input: tokenstream::TokenStream, expect_matchers: bool, sess: &ParseSess)
-> Vec<TokenTree> {
/// Takes a `tokenstream::TokenStream` and returns a `Vec<self::TokenTree>`. Specifically, this
/// takes a generic `TokenStream`, such as is used in the rest of the compiler, and returns a
/// collection of `TokenTree` for use in parsing a macro.
///
/// # Parameters
///
/// - `input`: a token stream to read from, the contents of which we are parsing.
/// - `expect_matchers`: `parse` can be used to parse either the "patterns" or the "body" of a
/// macro. Both take roughly the same form _except_ that in a pattern, metavars are declared with
/// their "matcher" type. For example `$var:expr` or `$id:ident`. In this example, `expr` and
/// `ident` are "matchers". They are not present in the body of a macro rule -- just in the
/// pattern, so we pass a parameter to indicate whether to expect them or not.
/// - `sess`: the parsing session. Any errors will be emitted to this session.
///
/// # Returns
///
/// A collection of `self::TokenTree`. There may also be some errors emitted to `sess`.
pub fn parse(
input: tokenstream::TokenStream,
expect_matchers: bool,
sess: &ParseSess,
) -> Vec<TokenTree> {
// Will contain the final collection of `self::TokenTree`
let mut result = Vec::new();
// For each token tree in `input`, parse the token into a `self::TokenTree`, consuming
// additional trees if need be.
let mut trees = input.trees();
while let Some(tree) = trees.next() {
let tree = parse_tree(tree, &mut trees, expect_matchers, sess);
// Given the parsed tree, if there is a metavar and we are expecting matchers, actually
// parse out the matcher (i.e. in `$id:ident` this would parse the `:` and `ident`).
match tree {
TokenTree::MetaVar(start_sp, ident) if expect_matchers => {
let span = match trees.next() {
......@@ -154,78 +197,149 @@ pub fn parse(input: tokenstream::TokenStream, expect_matchers: bool, sess: &Pars
Some(kind) => {
let span = end_sp.with_lo(start_sp.lo());
result.push(TokenTree::MetaVarDecl(span, ident, kind));
continue
continue;
}
_ => end_sp,
},
tree => tree.as_ref().map(tokenstream::TokenTree::span).unwrap_or(span),
tree => tree.as_ref()
.map(tokenstream::TokenTree::span)
.unwrap_or(span),
},
tree => tree.as_ref().map(tokenstream::TokenTree::span).unwrap_or(start_sp),
tree => tree.as_ref()
.map(tokenstream::TokenTree::span)
.unwrap_or(start_sp),
};
sess.missing_fragment_specifiers.borrow_mut().insert(span);
result.push(TokenTree::MetaVarDecl(span, ident, keywords::Invalid.ident()));
result.push(TokenTree::MetaVarDecl(
span,
ident,
keywords::Invalid.ident(),
));
}
// Not a metavar or no matchers allowed, so just return the tree
_ => result.push(tree),
}
}
result
}
fn parse_tree<I>(tree: tokenstream::TokenTree,
trees: &mut I,
expect_matchers: bool,
sess: &ParseSess)
-> TokenTree
where I: Iterator<Item = tokenstream::TokenTree>,
/// Takes a `tokenstream::TokenTree` and returns a `self::TokenTree`. Specifically, this takes a
/// generic `TokenTree`, such as is used in the rest of the compiler, and returns a `TokenTree`
/// for use in parsing a macro.
///
/// Converting the given tree may involve reading more tokens.
///
/// # Parameters
///
/// - `tree`: the tree we wish to convert.
/// - `trees`: an iterator over trees. We may need to read more tokens from it in order to finish
/// converting `tree`
/// - `expect_matchers`: same as for `parse` (see above).
/// - `sess`: the parsing session. Any errors will be emitted to this session.
fn parse_tree<I>(
tree: tokenstream::TokenTree,
trees: &mut I,
expect_matchers: bool,
sess: &ParseSess,
) -> TokenTree
where
I: Iterator<Item = tokenstream::TokenTree>,
{
// Depending on what `tree` is, we could be parsing different parts of a macro
match tree {
// `tree` is a `$` token. Look at the next token in `trees`
tokenstream::TokenTree::Token(span, token::Dollar) => match trees.next() {
// `tree` is followed by a delimited set of token trees. This indicates the beginning
// of a repetition sequence in the macro (e.g. `$(pat)*`).
Some(tokenstream::TokenTree::Delimited(span, delimited)) => {
// Must have `(` not `{` or `[`
if delimited.delim != token::Paren {
let tok = pprust::token_to_string(&token::OpenDelim(delimited.delim));
let msg = format!("expected `(`, found `{}`", tok);
sess.span_diagnostic.span_err(span, &msg);
}
// Parse the contents of the sequence itself
let sequence = parse(delimited.tts.into(), expect_matchers, sess);
// Get the Kleene operator and optional separator
let (separator, op) = parse_sep_and_kleene_op(trees, span, sess);
// Count the number of captured "names" (i.e. named metavars)
let name_captures = macro_parser::count_names(&sequence);
TokenTree::Sequence(span, Rc::new(SequenceRepetition {
tts: sequence,
separator,
op,
num_captures: name_captures,
}))
TokenTree::Sequence(
span,
Rc::new(SequenceRepetition {
tts: sequence,
separator,
op,
num_captures: name_captures,
}),
)
}
// `tree` is followed by an `ident`. This could be `$meta_var` or the `$crate` special
// metavariable that names the crate of the invokation.
Some(tokenstream::TokenTree::Token(ident_span, ref token)) if token.is_ident() => {
let ident = token.ident().unwrap();
let span = ident_span.with_lo(span.lo());
if ident.name == keywords::Crate.name() {
let ident = ast::Ident { name: keywords::DollarCrate.name(), ..ident };
let ident = ast::Ident {
name: keywords::DollarCrate.name(),
..ident
};
TokenTree::Token(span, token::Ident(ident))
} else {
TokenTree::MetaVar(span, ident)
}
}
// `tree` is followed by a random token. This is an error.
Some(tokenstream::TokenTree::Token(span, tok)) => {
let msg = format!("expected identifier, found `{}`", pprust::token_to_string(&tok));
let msg = format!(
"expected identifier, found `{}`",
pprust::token_to_string(&tok)
);
sess.span_diagnostic.span_err(span, &msg);
TokenTree::MetaVar(span, keywords::Invalid.ident())
}
// There are no more tokens. Just return the `$` we already have.
None => TokenTree::Token(span, token::Dollar),
},
// `tree` is an arbitrary token. Keep it.
tokenstream::TokenTree::Token(span, tok) => TokenTree::Token(span, tok),
tokenstream::TokenTree::Delimited(span, delimited) => {
TokenTree::Delimited(span, Rc::new(Delimited {
// `tree` is the beginning of a delimited set of tokens (e.g. `(` or `{`). We need to
// descend into the delimited set and further parse it.
tokenstream::TokenTree::Delimited(span, delimited) => TokenTree::Delimited(
span,
Rc::new(Delimited {
delim: delimited.delim,
tts: parse(delimited.tts.into(), expect_matchers, sess),
}))
}
}),
),
}
}
fn parse_sep_and_kleene_op<I>(input: &mut I, span: Span, sess: &ParseSess)
-> (Option<token::Token>, KleeneOp)
where I: Iterator<Item = tokenstream::TokenTree>,
/// Attempt to parse a single Kleene star, possibly with a separator.
///
/// For example, in a pattern such as `$(a),*`, `a` is the pattern to be repeated, `,` is the
/// separator, and `*` is the Kleene operator. This function is specifically concerned with parsing
/// the last two tokens of such a pattern: namely, the optional separator and the Kleene operator
/// itself. Note that here we are parsing the _macro_ itself, rather than trying to match some
/// stream of tokens in an invocation of a macro.
///
/// This function will take some input iterator `input` corresponding to `span` and a parsing
/// session `sess`. If the next one (or possibly two) tokens in `input` correspond to a Kleene
/// operator and separator, then a tuple with `(separator, KleeneOp)` is returned. Otherwise, an
/// error with the appropriate span is emitted to `sess` and a dummy value is returned.
fn parse_sep_and_kleene_op<I>(
input: &mut I,
span: Span,
sess: &ParseSess,
) -> (Option<token::Token>, KleeneOp)
where
I: Iterator<Item = tokenstream::TokenTree>,
{
fn kleene_op(token: &token::Token) -> Option<KleeneOp> {
match *token {
......@@ -235,20 +349,40 @@ fn kleene_op(token: &token::Token) -> Option<KleeneOp> {
}
}
// We attempt to look at the next two token trees in `input`. I will call the first #1 and the
// second #2. If #1 and #2 don't match a valid KleeneOp with/without separator, that is an
// error, and we should emit an error on the most specific span possible.
let span = match input.next() {
// #1 is a token
Some(tokenstream::TokenTree::Token(span, tok)) => match kleene_op(&tok) {
// #1 is a KleeneOp with no separator
Some(op) => return (None, op),
// #1 is not a KleeneOp, but may be a separator... need to look at #2
None => match input.next() {
// #2 is a token
Some(tokenstream::TokenTree::Token(span, tok2)) => match kleene_op(&tok2) {
// #2 is a KleeneOp, so #1 must be a separator
Some(op) => return (Some(tok), op),
// #2 is not a KleeneOp... error
None => span,
},
tree => tree.as_ref().map(tokenstream::TokenTree::span).unwrap_or(span),
}
// #2 is not a token at all... error
tree => tree.as_ref()
.map(tokenstream::TokenTree::span)
.unwrap_or(span),
},
},
tree => tree.as_ref().map(tokenstream::TokenTree::span).unwrap_or(span),
// #1 is not a token at all... error
tree => tree.as_ref()
.map(tokenstream::TokenTree::span)
.unwrap_or(span),
};
// Error...
sess.span_diagnostic.span_err(span, "expected `*` or `+`");
(None, KleeneOp::ZeroOrMore)
}
......@@ -27,7 +27,10 @@ fn main() {
if cfg!(target_os = "android") {
assert!(home_dir().is_none());
} else {
assert!(home_dir().is_some());
// When HOME is not set, some platforms return `None`,
// but others return `Some` with a default.
// Just check that it is not "/home/MountainView".
assert_ne!(home_dir(), Some(PathBuf::from("/home/MountainView")));
}
}
......
......@@ -24,12 +24,19 @@ pub enum I {}
}
}
// Test every possible part of the syntax
use a::{B, d::{self, *, g::H}};
// Test a more common use case
use std::sync::{Arc, atomic::{AtomicBool, Ordering}};
fn main() {
let _: B;
let _: E;
let _: F;
let _: H;
let _: d::g::I;
let _: Arc<AtomicBool>;
let _: Ordering;
}
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags: -Z unstable-options --disable-commonmark
#![crate_name = "foo"]
//! hello [foo]
//!
//! [foo]: url 'title & <stuff> & "things"'
// @has 'foo/index.html' 'title &amp; &lt;stuff&gt; &amp; &quot;things&quot;'
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_use]
mod underscore;
fn main() {
underscore!();
}
error: expected expression, found `_`
--> $DIR/underscore.rs:18:9
|
18 | _
| ^
|
::: $DIR/main.rs:15:5
|
15 | underscore!();
| -------------- in this macro invocation
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// We want this file only so we can test cross-file error
// messages, but we don't want it in an external crate.
// ignore-test
#![crate_type = "lib"]
macro_rules! underscore {
() => (
_
)
}
......@@ -22,7 +22,7 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found
27 | ping!();
| -------- in this macro invocation
|
::: <ping macros>
::: <ping macros>:1:1
|
1 | ( ) => { pong ! ( ) ; }
| -------------------------
......@@ -42,7 +42,7 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found
28 | deep!();
| -------- in this macro invocation (#1)
|
::: <deep macros>
::: <deep macros>:1:1
|
1 | ( ) => { foo ! ( ) ; }
| ------------------------
......@@ -50,7 +50,7 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found
| | in this macro invocation (#2)
| in this expansion of `deep!` (#1)
|
::: <foo macros>
::: <foo macros>:1:1
|
1 | ( ) => { bar ! ( ) ; }
| ------------------------
......@@ -58,7 +58,7 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found
| | in this macro invocation (#3)
| in this expansion of `foo!` (#2)
|
::: <bar macros>
::: <bar macros>:1:1
|
1 | ( ) => { ping ! ( ) ; }
| -------------------------
......@@ -66,7 +66,7 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found
| | in this macro invocation (#4)
| in this expansion of `bar!` (#3)
|
::: <ping macros>
::: <ping macros>:1:1
|
1 | ( ) => { pong ! ( ) ; }
| -------------------------
......
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(use_nested_groups)]
mod a {
pub mod b1 {
pub enum C2 {}
}
pub enum B2 {}
}
use a::{b1::{C1, C2}, B2};
//~^ ERROR unresolved import `a::b1::C1`
fn main() {
let _: C2;
let _: B2;
}
error[E0432]: unresolved import `a::b1::C1`
--> $DIR/use-nested-groups-error.rs:21:14
|
21 | use a::{b1::{C1, C2}, B2};
| ^^ no `C1` in `a::b1`. Did you mean to use `C2`?
error: aborting due to previous error
......@@ -1402,7 +1402,7 @@ fn exec_compiled_test(&self) -> ProcRes {
}
/// For each `aux-build: foo/bar` annotation, we check to find the
/// file in a `aux` directory relative to the test itself.
/// file in a `auxiliary` directory relative to the test itself.
fn compute_aux_test_paths(&self, rel_ab: &str) -> TestPaths {
let test_ab = self.testpaths
.file
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册