Skip to content

Commit 421b595

Browse files
authored
Auto merge of #37450 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 5 pull requests - Successful merges: #36206, #37343, #37430, #37436, #37441 - Failed merges:
2 parents 36d7467 + 61e765a commit 421b595

File tree

10 files changed

+58
-5
lines changed

10 files changed

+58
-5
lines changed

src/doc/reference.md

+6
Original file line numberDiff line numberDiff line change
@@ -4078,6 +4078,12 @@ be ignored in favor of only building the artifacts specified by command line.
40784078
Rust code into an existing non-Rust application because it will not have
40794079
dynamic dependencies on other Rust code.
40804080

4081+
* `--crate-type=cdylib`, `#[crate_type = "cdylib"]` - A dynamic system
4082+
library will be produced. This is used when compiling Rust code as
4083+
a dynamic library to be loaded from another language. This output type will
4084+
create `*.so` files on Linux, `*.dylib` files on OSX, and `*.dll` files on
4085+
Windows.
4086+
40814087
* `--crate-type=rlib`, `#[crate_type = "rlib"]` - A "Rust library" file will be
40824088
produced. This is used as an intermediate artifact and can be thought of as a
40834089
"static Rust library". These `rlib` files, unlike `staticlib` files, are

src/librustc_resolve/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1401,7 +1401,7 @@ impl<'a> Resolver<'a> {
14011401

14021402
format!("Did you mean `{}{}`?", prefix, path_str)
14031403
}
1404-
None => format!("Maybe a missing `extern crate {}`?", segment_name),
1404+
None => format!("Maybe a missing `extern crate {};`?", segment_name),
14051405
}
14061406
} else {
14071407
format!("Could not find `{}` in `{}`", segment_name, module_name)

src/librustc_save_analysis/dump_visitor.rs

+1
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
166166
loc.file.name,
167167
loc.line);
168168
}
169+
error!(" master span: {:?}: `{}`", path.span, self.span.snippet(path.span));
169170
return vec!();
170171
}
171172

src/libstd/io/impls.rs

+11
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ impl<B: BufRead + ?Sized> BufRead for Box<B> {
147147
// =============================================================================
148148
// In-memory buffer implementations
149149

150+
/// Read is implemented for `&[u8]` by copying from the slice.
151+
///
152+
/// Note that reading updates the slice to point to the yet unread part.
153+
/// The slice will be empty when EOF is reached.
150154
#[stable(feature = "rust1", since = "1.0.0")]
151155
impl<'a> Read for &'a [u8] {
152156
#[inline]
@@ -180,6 +184,11 @@ impl<'a> BufRead for &'a [u8] {
180184
fn consume(&mut self, amt: usize) { *self = &self[amt..]; }
181185
}
182186

187+
/// Write is implemented for `&mut [u8]` by copying into the slice, overwriting
188+
/// its data.
189+
///
190+
/// Note that writing updates the slice to point to the yet unwritten part.
191+
/// The slice will be empty when it has been completely overwritten.
183192
#[stable(feature = "rust1", since = "1.0.0")]
184193
impl<'a> Write for &'a mut [u8] {
185194
#[inline]
@@ -204,6 +213,8 @@ impl<'a> Write for &'a mut [u8] {
204213
fn flush(&mut self) -> io::Result<()> { Ok(()) }
205214
}
206215

216+
/// Write is implemented for `Vec<u8>` by appending to the vector.
217+
/// The vector will grow as needed.
207218
#[stable(feature = "rust1", since = "1.0.0")]
208219
impl Write for Vec<u8> {
209220
#[inline]

src/libsyntax/parse/parser.rs

+11
Original file line numberDiff line numberDiff line change
@@ -1757,6 +1757,17 @@ impl<'a> Parser<'a> {
17571757
// First, parse an identifier.
17581758
let identifier = self.parse_path_segment_ident()?;
17591759

1760+
if self.check(&token::ModSep) && self.look_ahead(1, |t| *t == token::Lt) {
1761+
self.bump();
1762+
let prev_span = self.prev_span;
1763+
1764+
let mut err = self.diagnostic().struct_span_err(prev_span,
1765+
"unexpected token: `::`");
1766+
err.help(
1767+
"use `<...>` instead of `::<...>` if you meant to specify type arguments");
1768+
err.emit();
1769+
}
1770+
17601771
// Parse types, optionally.
17611772
let parameters = if self.eat_lt() {
17621773
let (lifetimes, types, bindings) = self.parse_generic_values_after_lt()?;

src/libsyntax_ext/deriving/generic/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1460,8 +1460,9 @@ impl<'a> MethodDef<'a> {
14601460
.iter()
14611461
.map(|v| {
14621462
let ident = v.node.name;
1463+
let sp = Span { expn_id: trait_.span.expn_id, ..v.span };
14631464
let summary = trait_.summarise_struct(cx, &v.node.data);
1464-
(ident, v.span, summary)
1465+
(ident, sp, summary)
14651466
})
14661467
.collect();
14671468
self.call_substructure_method(cx,

src/test/compile-fail/issue-12612.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use foo::bar;
1616

1717
mod test {
1818
use bar::foo; //~ ERROR unresolved import `bar::foo` [E0432]
19-
//~^ Maybe a missing `extern crate bar`?
19+
//~^ Maybe a missing `extern crate bar;`?
2020
}
2121

2222
fn main() {}

src/test/compile-fail/issue-1697.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
// Testing that we don't fail abnormally after hitting the errors
1212

1313
use unresolved::*; //~ ERROR unresolved import `unresolved::*` [E0432]
14-
//~^ Maybe a missing `extern crate unresolved`?
14+
//~^ Maybe a missing `extern crate unresolved;`?
1515

1616
fn main() {}

src/test/compile-fail/issue-36116.rs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
struct Foo<T> {
12+
_a: T,
13+
}
14+
15+
fn main() {
16+
let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>);
17+
//~^ ERROR unexpected token: `::`
18+
//~| HELP use `<...>` instead of `::<...>` if you meant to specify type arguments
19+
20+
let g: Foo::<i32> = Foo { _a: 42 };
21+
//~^ ERROR unexpected token: `::`
22+
//~| HELP use `<...>` instead of `::<...>` if you meant to specify type arguments
23+
}

src/test/compile-fail/unresolved-import.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// ignore-tidy-linelength
1212

1313
use foo::bar; //~ ERROR unresolved import `foo::bar` [E0432]
14-
//~^ Maybe a missing `extern crate foo`?
14+
//~^ Maybe a missing `extern crate foo;`?
1515

1616
use bar::Baz as x; //~ ERROR unresolved import `bar::Baz` [E0432]
1717
//~^ no `Baz` in `bar`. Did you mean to use `Bar`?

0 commit comments

Comments
 (0)