Auto merge of #27098 - Manishearth:rollup, r=Manishearth

- Successful merges: #26777, #27067, #27071, #27081, #27091, #27094, #27095
- Failed merges:
This commit is contained in:
bors 2015-07-17 22:27:37 +00:00
commit 5df259b9da
9 changed files with 107 additions and 11 deletions

View file

@ -250,11 +250,10 @@ that our tests are entirely left out of a normal build.
The second change is the `use` declaration. Because we're in an inner module,
we need to bring our test function into scope. This can be annoying if you have
a large module, and so this is a common use of the `glob` feature. Let's change
our `src/lib.rs` to make use of it:
a large module, and so this is a common use of globs. Let's change our
`src/lib.rs` to make use of it:
```rust,ignore
pub fn add_two(a: i32) -> i32 {
a + 2
}

View file

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

View file

@ -197,6 +197,64 @@ See the Types section of the reference for more information about the primitive
types:
http://doc.rust-lang.org/reference.html#types
"##,
E0364: r##"
Private items cannot be publicly re-exported. This error indicates that
you attempted to `pub use` a type or value that was not itself public.
Here is an example that demonstrates the error:
```
mod foo {
const X: u32 = 1;
}
pub use foo::X;
```
The solution to this problem is to ensure that the items that you are
re-exporting are themselves marked with `pub`:
```
mod foo {
pub const X: u32 = 1;
}
pub use foo::X;
```
See the 'Use Declarations' section of the reference for more information
on this topic:
http://doc.rust-lang.org/reference.html#use-declarations
"##,
E0365: r##"
Private modules cannot be publicly re-exported. This error indicates
that you attempted to `pub use` a module that was not itself public.
Here is an example that demonstrates the error:
```
mod foo {
pub const X: u32 = 1;
}
pub use foo as foo2;
```
The solution to this problem is to ensure that the module that you are
re-exporting is itself marked with `pub`:
```
pub mod foo {
pub const X: u32 = 1;
}
pub use foo as foo2;
```
See the 'Use Declarations' section of the reference for more information
on this topic:
http://doc.rust-lang.org/reference.html#use-declarations
"##
}
@ -208,8 +266,6 @@ register_diagnostics! {
E0254, // import conflicts with imported crate in this module
E0257,
E0258,
E0364, // item is private
E0365, // item is private
E0401, // can't use type parameters from outer function
E0402, // cannot use an outer type parameter in this context
E0403, // the name `{}` is already used

View file

@ -434,8 +434,13 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
value_result = BoundResult(target_module.clone(),
(*child_name_bindings).clone());
if directive.is_public && !child_name_bindings.is_public(ValueNS) {
let msg = format!("`{}` is private", source);
let msg = format!("`{}` is private, and cannot be reexported",
token::get_name(source));
let note_msg =
format!("Consider marking `{}` as `pub` in the imported module",
token::get_name(source));
span_err!(self.resolver.session, directive.span, E0364, "{}", &msg);
self.resolver.session.span_note(directive.span, &note_msg);
pub_err = true;
}
}
@ -444,8 +449,12 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
type_result = BoundResult(target_module.clone(),
(*child_name_bindings).clone());
if !pub_err && directive.is_public && !child_name_bindings.is_public(TypeNS) {
let msg = format!("`{}` is private", source);
let msg = format!("`{}` is private, and cannot be reexported",
token::get_name(source));
let note_msg = format!("Consider declaring module `{}` as a `pub mod`",
token::get_name(source));
span_err!(self.resolver.session, directive.span, E0365, "{}", &msg);
self.resolver.session.span_note(directive.span, &note_msg);
}
}
}

View file

@ -115,7 +115,7 @@
case "s":
case "S":
ev.preventDefault();
$(".search-input").focus();
focusSearchBar()
break;
case "?":
@ -960,5 +960,5 @@
// Sets the focus on the search bar at the top of the page
function focusSearchBar() {
document.getElementsByName('search')[0].focus();
$('.search-input').focus();
}

View file

@ -1104,7 +1104,7 @@ impl TokenTree {
tts: vec![TtToken(sp, token::Ident(token::str_to_ident("doc"),
token::Plain)),
TtToken(sp, token::Eq),
TtToken(sp, token::Literal(token::Str_(name), None))],
TtToken(sp, token::Literal(token::StrRaw(name, 0), None))],
close_span: sp,
}))
}

View file

@ -63,6 +63,9 @@ macro_rules! fileline_help {
macro_rules! register_diagnostics {
($($code:tt),*) => (
$(register_diagnostic! { $code })*
);
($($code:tt),*,) => (
$(register_diagnostic! { $code })*
)
}
@ -70,5 +73,8 @@ macro_rules! register_diagnostics {
macro_rules! register_long_diagnostics {
($($code:tt: $description:tt),*) => (
$(register_diagnostic! { $code, $description })*
);
($($code:tt: $description:tt),*,) => (
$(register_diagnostic! { $code, $description })*
)
}

View file

@ -0,0 +1,25 @@
// Copyright 2015 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.
// When expanding a macro, documentation attributes (including documentation comments) must be
// passed "as is" without being parsed. Otherwise, some text will be incorrectly interpreted as
// escape sequences, leading to an ICE.
//
// Related issues: #25929, #25943
macro_rules! homura {
(#[$x:meta]) => ()
}
homura! {
/// \madoka \x41
}
fn main() { }