Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 5 pull requests #37450

Merged
merged 10 commits into from
Oct 28, 2016
6 changes: 6 additions & 0 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
@@ -1401,7 +1401,7 @@ impl<'a> Resolver<'a> {

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)
1 change: 1 addition & 0 deletions src/librustc_save_analysis/dump_visitor.rs
Original file line number Diff line number Diff line change
@@ -166,6 +166,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
loc.file.name,
loc.line);
}
error!(" master span: {:?}: `{}`", path.span, self.span.snippet(path.span));
return vec!();
}

11 changes: 11 additions & 0 deletions src/libstd/io/impls.rs
Original file line number Diff line number Diff line change
@@ -147,6 +147,10 @@ impl<B: BufRead + ?Sized> BufRead for Box<B> {
// =============================================================================
// 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 @@ impl<'a> BufRead for &'a [u8] {
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 @@ impl<'a> Write for &'a mut [u8] {
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]
11 changes: 11 additions & 0 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
@@ -1757,6 +1757,17 @@ impl<'a> Parser<'a> {
// 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()?;
3 changes: 2 additions & 1 deletion src/libsyntax_ext/deriving/generic/mod.rs
Original file line number Diff line number Diff line change
@@ -1460,8 +1460,9 @@ impl<'a> MethodDef<'a> {
.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,
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-12612.rs
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ use foo::bar;

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() {}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-1697.rs
Original file line number Diff line number Diff line change
@@ -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() {}
23 changes: 23 additions & 0 deletions src/test/compile-fail/issue-36116.rs
Original file line number Diff line number Diff line change
@@ -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
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/unresolved-import.rs
Original file line number Diff line number Diff line change
@@ -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`?