Auto merge of #37450 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 5 pull requests

- Successful merges: #36206, #37343, #37430, #37436, #37441
- Failed merges:
This commit is contained in:
bors 2016-10-28 10:20:55 -07:00 committed by GitHub
commit 421b595f25
10 changed files with 58 additions and 5 deletions

View file

@ -4078,6 +4078,12 @@ be ignored in favor of only building the artifacts specified by command line.
Rust code into an existing non-Rust application because it will not have
dynamic dependencies on other Rust code.
* `--crate-type=cdylib`, `#[crate_type = "cdylib"]` - A dynamic system
library will be produced. This is used when compiling Rust code as
a dynamic library to be loaded from another language. This output type will
create `*.so` files on Linux, `*.dylib` files on OSX, and `*.dll` files on
Windows.
* `--crate-type=rlib`, `#[crate_type = "rlib"]` - A "Rust library" file will be
produced. This is used as an intermediate artifact and can be thought of as a
"static Rust library". These `rlib` files, unlike `staticlib` files, are

View file

@ -1401,7 +1401,7 @@ fn search_parent_externals<'a>(this: &mut Resolver<'a>, needle: Name, module: Mo
format!("Did you mean `{}{}`?", prefix, path_str)
}
None => format!("Maybe a missing `extern crate {}`?", segment_name),
None => format!("Maybe a missing `extern crate {};`?", segment_name),
}
} else {
format!("Could not find `{}` in `{}`", segment_name, module_name)

View file

@ -166,6 +166,7 @@ fn process_path_prefixes(&self, path: &ast::Path) -> Vec<(Span, String)> {
loc.file.name,
loc.line);
}
error!(" master span: {:?}: `{}`", path.span, self.span.snippet(path.span));
return vec!();
}

View file

@ -147,6 +147,10 @@ fn read_line(&mut self, buf: &mut String) -> io::Result<usize> {
// =============================================================================
// In-memory buffer implementations
/// Read is implemented for `&[u8]` by copying from the slice.
///
/// Note that reading updates the slice to point to the yet unread part.
/// The slice will be empty when EOF is reached.
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Read for &'a [u8] {
#[inline]
@ -180,6 +184,11 @@ fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(*self) }
fn consume(&mut self, amt: usize) { *self = &self[amt..]; }
}
/// Write is implemented for `&mut [u8]` by copying into the slice, overwriting
/// its data.
///
/// Note that writing updates the slice to point to the yet unwritten part.
/// The slice will be empty when it has been completely overwritten.
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Write for &'a mut [u8] {
#[inline]
@ -204,6 +213,8 @@ fn write_all(&mut self, data: &[u8]) -> io::Result<()> {
fn flush(&mut self) -> io::Result<()> { Ok(()) }
}
/// Write is implemented for `Vec<u8>` by appending to the vector.
/// The vector will grow as needed.
#[stable(feature = "rust1", since = "1.0.0")]
impl Write for Vec<u8> {
#[inline]

View file

@ -1757,6 +1757,17 @@ pub fn parse_path_segments_without_colons(&mut self) -> PResult<'a, Vec<ast::Pat
// First, parse an identifier.
let identifier = self.parse_path_segment_ident()?;
if self.check(&token::ModSep) && self.look_ahead(1, |t| *t == token::Lt) {
self.bump();
let prev_span = self.prev_span;
let mut err = self.diagnostic().struct_span_err(prev_span,
"unexpected token: `::`");
err.help(
"use `<...>` instead of `::<...>` if you meant to specify type arguments");
err.emit();
}
// Parse types, optionally.
let parameters = if self.eat_lt() {
let (lifetimes, types, bindings) = self.parse_generic_values_after_lt()?;

View file

@ -1460,8 +1460,9 @@ fn expand_static_enum_method_body(&self,
.iter()
.map(|v| {
let ident = v.node.name;
let sp = Span { expn_id: trait_.span.expn_id, ..v.span };
let summary = trait_.summarise_struct(cx, &v.node.data);
(ident, v.span, summary)
(ident, sp, summary)
})
.collect();
self.call_substructure_method(cx,

View file

@ -16,7 +16,7 @@
mod test {
use bar::foo; //~ ERROR unresolved import `bar::foo` [E0432]
//~^ Maybe a missing `extern crate bar`?
//~^ Maybe a missing `extern crate bar;`?
}
fn main() {}

View file

@ -11,6 +11,6 @@
// Testing that we don't fail abnormally after hitting the errors
use unresolved::*; //~ ERROR unresolved import `unresolved::*` [E0432]
//~^ Maybe a missing `extern crate unresolved`?
//~^ Maybe a missing `extern crate unresolved;`?
fn main() {}

View file

@ -0,0 +1,23 @@
// Copyright 2016 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.
struct Foo<T> {
_a: T,
}
fn main() {
let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>);
//~^ ERROR unexpected token: `::`
//~| HELP use `<...>` instead of `::<...>` if you meant to specify type arguments
let g: Foo::<i32> = Foo { _a: 42 };
//~^ ERROR unexpected token: `::`
//~| HELP use `<...>` instead of `::<...>` if you meant to specify type arguments
}

View file

@ -11,7 +11,7 @@
// ignore-tidy-linelength
use foo::bar; //~ ERROR unresolved import `foo::bar` [E0432]
//~^ Maybe a missing `extern crate foo`?
//~^ Maybe a missing `extern crate foo;`?
use bar::Baz as x; //~ ERROR unresolved import `bar::Baz` [E0432]
//~^ no `Baz` in `bar`. Did you mean to use `Bar`?