Skip to content

Commit 5df259b

Browse files
committed
Auto merge of #27098 - Manishearth:rollup, r=Manishearth
- Successful merges: #26777, #27067, #27071, #27081, #27091, #27094, #27095 - Failed merges:
2 parents e05ac39 + 8638dc7 commit 5df259b

File tree

9 files changed

+107
-11
lines changed

9 files changed

+107
-11
lines changed

src/doc/trpl/testing.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,10 @@ that our tests are entirely left out of a normal build.
250250

251251
The second change is the `use` declaration. Because we're in an inner module,
252252
we need to bring our test function into scope. This can be annoying if you have
253-
a large module, and so this is a common use of the `glob` feature. Let's change
254-
our `src/lib.rs` to make use of it:
253+
a large module, and so this is a common use of globs. Let's change our
254+
`src/lib.rs` to make use of it:
255255

256256
```rust,ignore
257-
258257
pub fn add_two(a: i32) -> i32 {
259258
a + 2
260259
}

src/libcollections/vec.rs

+1
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ impl<T> Vec<T> {
231231
///
232232
/// * `ptr` needs to have been previously allocated via `String`/`Vec<T>`
233233
/// (at least, it's highly likely to be incorrect if it wasn't).
234+
/// * `length` needs to be the length that less than or equal to `capacity`.
234235
/// * `capacity` needs to be the capacity that the pointer was allocated with.
235236
///
236237
/// Violating these may cause problems like corrupting the allocator's

src/libcollections/vec_deque.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ impl<T> VecDeque<T> {
946946
/// let mut buf = VecDeque::new();
947947
/// buf.push_back(10);
948948
/// buf.push_back(12);
949-
/// buf.insert(1,11);
949+
/// buf.insert(1, 11);
950950
/// assert_eq!(Some(&11), buf.get(1));
951951
/// ```
952952
pub fn insert(&mut self, i: usize, t: T) {

src/librustc_resolve/diagnostics.rs

+58-2
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,64 @@ See the Types section of the reference for more information about the primitive
197197
types:
198198
199199
http://doc.rust-lang.org/reference.html#types
200+
"##,
201+
202+
E0364: r##"
203+
Private items cannot be publicly re-exported. This error indicates that
204+
you attempted to `pub use` a type or value that was not itself public.
205+
206+
Here is an example that demonstrates the error:
207+
208+
```
209+
mod foo {
210+
const X: u32 = 1;
211+
}
212+
pub use foo::X;
213+
```
214+
215+
The solution to this problem is to ensure that the items that you are
216+
re-exporting are themselves marked with `pub`:
217+
218+
```
219+
mod foo {
220+
pub const X: u32 = 1;
221+
}
222+
pub use foo::X;
223+
```
224+
225+
See the 'Use Declarations' section of the reference for more information
226+
on this topic:
227+
228+
http://doc.rust-lang.org/reference.html#use-declarations
229+
"##,
230+
231+
E0365: r##"
232+
Private modules cannot be publicly re-exported. This error indicates
233+
that you attempted to `pub use` a module that was not itself public.
234+
235+
Here is an example that demonstrates the error:
236+
237+
```
238+
mod foo {
239+
pub const X: u32 = 1;
240+
}
241+
pub use foo as foo2;
242+
243+
```
244+
The solution to this problem is to ensure that the module that you are
245+
re-exporting is itself marked with `pub`:
246+
247+
```
248+
pub mod foo {
249+
pub const X: u32 = 1;
250+
}
251+
pub use foo as foo2;
252+
```
253+
254+
See the 'Use Declarations' section of the reference for more information
255+
on this topic:
256+
257+
http://doc.rust-lang.org/reference.html#use-declarations
200258
"##
201259

202260
}
@@ -208,8 +266,6 @@ register_diagnostics! {
208266
E0254, // import conflicts with imported crate in this module
209267
E0257,
210268
E0258,
211-
E0364, // item is private
212-
E0365, // item is private
213269
E0401, // can't use type parameters from outer function
214270
E0402, // cannot use an outer type parameter in this context
215271
E0403, // the name `{}` is already used

src/librustc_resolve/resolve_imports.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,13 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
434434
value_result = BoundResult(target_module.clone(),
435435
(*child_name_bindings).clone());
436436
if directive.is_public && !child_name_bindings.is_public(ValueNS) {
437-
let msg = format!("`{}` is private", source);
437+
let msg = format!("`{}` is private, and cannot be reexported",
438+
token::get_name(source));
439+
let note_msg =
440+
format!("Consider marking `{}` as `pub` in the imported module",
441+
token::get_name(source));
438442
span_err!(self.resolver.session, directive.span, E0364, "{}", &msg);
443+
self.resolver.session.span_note(directive.span, &note_msg);
439444
pub_err = true;
440445
}
441446
}
@@ -444,8 +449,12 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
444449
type_result = BoundResult(target_module.clone(),
445450
(*child_name_bindings).clone());
446451
if !pub_err && directive.is_public && !child_name_bindings.is_public(TypeNS) {
447-
let msg = format!("`{}` is private", source);
452+
let msg = format!("`{}` is private, and cannot be reexported",
453+
token::get_name(source));
454+
let note_msg = format!("Consider declaring module `{}` as a `pub mod`",
455+
token::get_name(source));
448456
span_err!(self.resolver.session, directive.span, E0365, "{}", &msg);
457+
self.resolver.session.span_note(directive.span, &note_msg);
449458
}
450459
}
451460
}

src/librustdoc/html/static/main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
case "s":
116116
case "S":
117117
ev.preventDefault();
118-
$(".search-input").focus();
118+
focusSearchBar()
119119
break;
120120

121121
case "?":
@@ -960,5 +960,5 @@
960960

961961
// Sets the focus on the search bar at the top of the page
962962
function focusSearchBar() {
963-
document.getElementsByName('search')[0].focus();
963+
$('.search-input').focus();
964964
}

src/libsyntax/ast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ impl TokenTree {
11041104
tts: vec![TtToken(sp, token::Ident(token::str_to_ident("doc"),
11051105
token::Plain)),
11061106
TtToken(sp, token::Eq),
1107-
TtToken(sp, token::Literal(token::Str_(name), None))],
1107+
TtToken(sp, token::Literal(token::StrRaw(name, 0), None))],
11081108
close_span: sp,
11091109
}))
11101110
}

src/libsyntax/diagnostics/macros.rs

+6
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,18 @@ macro_rules! fileline_help {
6363
macro_rules! register_diagnostics {
6464
($($code:tt),*) => (
6565
$(register_diagnostic! { $code })*
66+
);
67+
($($code:tt),*,) => (
68+
$(register_diagnostic! { $code })*
6669
)
6770
}
6871

6972
#[macro_export]
7073
macro_rules! register_long_diagnostics {
7174
($($code:tt: $description:tt),*) => (
7275
$(register_diagnostic! { $code, $description })*
76+
);
77+
($($code:tt: $description:tt),*,) => (
78+
$(register_diagnostic! { $code, $description })*
7379
)
7480
}
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2015 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+
// When expanding a macro, documentation attributes (including documentation comments) must be
12+
// passed "as is" without being parsed. Otherwise, some text will be incorrectly interpreted as
13+
// escape sequences, leading to an ICE.
14+
//
15+
// Related issues: #25929, #25943
16+
17+
macro_rules! homura {
18+
(#[$x:meta]) => ()
19+
}
20+
21+
homura! {
22+
/// \madoka \x41
23+
}
24+
25+
fn main() { }

0 commit comments

Comments
 (0)