Auto merge of #27098 - Manishearth:rollup, r=Manishearth
- Successful merges: #26777, #27067, #27071, #27081, #27091, #27094, #27095 - Failed merges:
This commit is contained in:
commit
5df259b9da
9 changed files with 107 additions and 11 deletions
|
@ -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,
|
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
|
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
|
a large module, and so this is a common use of globs. Let's change our
|
||||||
our `src/lib.rs` to make use of it:
|
`src/lib.rs` to make use of it:
|
||||||
|
|
||||||
```rust,ignore
|
```rust,ignore
|
||||||
|
|
||||||
pub fn add_two(a: i32) -> i32 {
|
pub fn add_two(a: i32) -> i32 {
|
||||||
a + 2
|
a + 2
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,6 +231,7 @@ impl<T> Vec<T> {
|
||||||
///
|
///
|
||||||
/// * `ptr` needs to have been previously allocated via `String`/`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).
|
/// (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.
|
/// * `capacity` needs to be the capacity that the pointer was allocated with.
|
||||||
///
|
///
|
||||||
/// Violating these may cause problems like corrupting the allocator's
|
/// Violating these may cause problems like corrupting the allocator's
|
||||||
|
|
|
@ -946,7 +946,7 @@ impl<T> VecDeque<T> {
|
||||||
/// let mut buf = VecDeque::new();
|
/// let mut buf = VecDeque::new();
|
||||||
/// buf.push_back(10);
|
/// buf.push_back(10);
|
||||||
/// buf.push_back(12);
|
/// buf.push_back(12);
|
||||||
/// buf.insert(1,11);
|
/// buf.insert(1, 11);
|
||||||
/// assert_eq!(Some(&11), buf.get(1));
|
/// assert_eq!(Some(&11), buf.get(1));
|
||||||
/// ```
|
/// ```
|
||||||
pub fn insert(&mut self, i: usize, t: T) {
|
pub fn insert(&mut self, i: usize, t: T) {
|
||||||
|
|
|
@ -197,6 +197,64 @@ See the Types section of the reference for more information about the primitive
|
||||||
types:
|
types:
|
||||||
|
|
||||||
http://doc.rust-lang.org/reference.html#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
|
E0254, // import conflicts with imported crate in this module
|
||||||
E0257,
|
E0257,
|
||||||
E0258,
|
E0258,
|
||||||
E0364, // item is private
|
|
||||||
E0365, // item is private
|
|
||||||
E0401, // can't use type parameters from outer function
|
E0401, // can't use type parameters from outer function
|
||||||
E0402, // cannot use an outer type parameter in this context
|
E0402, // cannot use an outer type parameter in this context
|
||||||
E0403, // the name `{}` is already used
|
E0403, // the name `{}` is already used
|
||||||
|
|
|
@ -434,8 +434,13 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
|
||||||
value_result = BoundResult(target_module.clone(),
|
value_result = BoundResult(target_module.clone(),
|
||||||
(*child_name_bindings).clone());
|
(*child_name_bindings).clone());
|
||||||
if directive.is_public && !child_name_bindings.is_public(ValueNS) {
|
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);
|
span_err!(self.resolver.session, directive.span, E0364, "{}", &msg);
|
||||||
|
self.resolver.session.span_note(directive.span, ¬e_msg);
|
||||||
pub_err = true;
|
pub_err = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -444,8 +449,12 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
|
||||||
type_result = BoundResult(target_module.clone(),
|
type_result = BoundResult(target_module.clone(),
|
||||||
(*child_name_bindings).clone());
|
(*child_name_bindings).clone());
|
||||||
if !pub_err && directive.is_public && !child_name_bindings.is_public(TypeNS) {
|
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);
|
span_err!(self.resolver.session, directive.span, E0365, "{}", &msg);
|
||||||
|
self.resolver.session.span_note(directive.span, ¬e_msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@
|
||||||
case "s":
|
case "s":
|
||||||
case "S":
|
case "S":
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
$(".search-input").focus();
|
focusSearchBar()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "?":
|
case "?":
|
||||||
|
@ -960,5 +960,5 @@
|
||||||
|
|
||||||
// Sets the focus on the search bar at the top of the page
|
// Sets the focus on the search bar at the top of the page
|
||||||
function focusSearchBar() {
|
function focusSearchBar() {
|
||||||
document.getElementsByName('search')[0].focus();
|
$('.search-input').focus();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1104,7 +1104,7 @@ impl TokenTree {
|
||||||
tts: vec![TtToken(sp, token::Ident(token::str_to_ident("doc"),
|
tts: vec![TtToken(sp, token::Ident(token::str_to_ident("doc"),
|
||||||
token::Plain)),
|
token::Plain)),
|
||||||
TtToken(sp, token::Eq),
|
TtToken(sp, token::Eq),
|
||||||
TtToken(sp, token::Literal(token::Str_(name), None))],
|
TtToken(sp, token::Literal(token::StrRaw(name, 0), None))],
|
||||||
close_span: sp,
|
close_span: sp,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,9 @@ macro_rules! fileline_help {
|
||||||
macro_rules! register_diagnostics {
|
macro_rules! register_diagnostics {
|
||||||
($($code:tt),*) => (
|
($($code:tt),*) => (
|
||||||
$(register_diagnostic! { $code })*
|
$(register_diagnostic! { $code })*
|
||||||
|
);
|
||||||
|
($($code:tt),*,) => (
|
||||||
|
$(register_diagnostic! { $code })*
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,5 +73,8 @@ macro_rules! register_diagnostics {
|
||||||
macro_rules! register_long_diagnostics {
|
macro_rules! register_long_diagnostics {
|
||||||
($($code:tt: $description:tt),*) => (
|
($($code:tt: $description:tt),*) => (
|
||||||
$(register_diagnostic! { $code, $description })*
|
$(register_diagnostic! { $code, $description })*
|
||||||
|
);
|
||||||
|
($($code:tt: $description:tt),*,) => (
|
||||||
|
$(register_diagnostic! { $code, $description })*
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
25
src/test/run-pass/macro-doc-escapes.rs
Normal file
25
src/test/run-pass/macro-doc-escapes.rs
Normal 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() { }
|
Loading…
Reference in a new issue