Auto merge of #54270 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 5 pull requests

Successful merges:

 - #53941 (rustdoc: Sort implementors)
 - #54181 (Suggest && and || instead of 'and' and 'or')
 - #54209 (Partially revert 674a5db "Fix undesirable fallout [from macro modularization]")
 - #54213 (De-overlap the lifetimes of `flow_inits` and `flow_{un,ever_}inits`.)
 - #54244 (Add a small search box to seach Rust's standary library)

Failed merges:

r? @ghost
This commit is contained in:
bors 2018-09-16 15:42:02 +00:00
commit d3cba9b4b4
8 changed files with 285 additions and 73 deletions

View file

@ -0,0 +1,30 @@
// Copyright 2018 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.
pub trait MyIterator {
}
pub struct MyStruct<T>(T);
macro_rules! array_impls {
($($N:expr)+) => {
$(
impl<'a, T> MyIterator for &'a MyStruct<[T; $N]> {
}
)+
}
}
// @has issue_53812/trait.MyIterator.html '//*[@id="implementors-list"]//h3[1]' 'MyStruct<[T; 0]>'
// @has - '//*[@id="implementors-list"]//h3[2]' 'MyStruct<[T; 1]>'
// @has - '//*[@id="implementors-list"]//h3[3]' 'MyStruct<[T; 2]>'
// @has - '//*[@id="implementors-list"]//h3[4]' 'MyStruct<[T; 3]>'
// @has - '//*[@id="implementors-list"]//h3[5]' 'MyStruct<[T; 10]>'
array_impls! { 10 3 2 1 0 }

View file

@ -0,0 +1,66 @@
// Copyright 2018 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.
fn test_and() {
let a = true;
let b = false;
if a and b {
//~^ ERROR expected `{`, found `and`
println!("both");
}
}
fn test_or() {
let a = true;
let b = false;
if a or b {
//~^ ERROR expected `{`, found `or`
println!("both");
}
}
fn test_and_par() {
let a = true;
let b = false;
if (a and b) {
//~^ ERROR expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `and`
println!("both");
}
}
fn test_or_par() {
let a = true;
let b = false;
if (a or b) {
//~^ ERROR expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `or`
println!("both");
}
}
fn test_while_and() {
let a = true;
let b = false;
while a and b {
//~^ ERROR expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `and`
println!("both");
}
}
fn test_while_or() {
let a = true;
let b = false;
while a or b {
//~^ ERROR expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `or`
println!("both");
}
}
fn main() {
}

View file

@ -0,0 +1,54 @@
error: expected `{`, found `and`
--> $DIR/issue-54109-and_instead_of_ampersands.rs:14:10
|
LL | if a and b {
| -- ^^^ help: use `&&` instead of `and` for the boolean operator
| |
| this `if` statement has a condition, but no block
error: expected `{`, found `or`
--> $DIR/issue-54109-and_instead_of_ampersands.rs:23:10
|
LL | if a or b {
| -- ^^ help: use `||` instead of `or` for the boolean operator
| |
| this `if` statement has a condition, but no block
error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `and`
--> $DIR/issue-54109-and_instead_of_ampersands.rs:32:11
|
LL | if (a and b) {
| ^^^
| |
| expected one of 8 possible tokens here
| help: use `&&` instead of `and` for the boolean operator
error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `or`
--> $DIR/issue-54109-and_instead_of_ampersands.rs:41:11
|
LL | if (a or b) {
| ^^
| |
| expected one of 8 possible tokens here
| help: use `||` instead of `or` for the boolean operator
error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `and`
--> $DIR/issue-54109-and_instead_of_ampersands.rs:50:13
|
LL | while a and b {
| ^^^
| |
| expected one of `!`, `.`, `::`, `?`, `{`, or an operator here
| help: use `&&` instead of `and` for the boolean operator
error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `or`
--> $DIR/issue-54109-and_instead_of_ampersands.rs:59:13
|
LL | while a or b {
| ^^
| |
| expected one of `!`, `.`, `::`, `?`, `{`, or an operator here
| help: use `||` instead of `or` for the boolean operator
error: aborting due to 6 previous errors

View file

@ -62,30 +62,30 @@ fn assert_ne() {
#[test]
fn cfg() {
cfg!(pants);
cfg!(pants,);
cfg!(pants = "pants");
cfg!(pants = "pants",);
cfg!(all(pants));
cfg!(all(pants),);
cfg!(all(pants,));
cfg!(all(pants,),);
let _ = cfg!(pants);
let _ = cfg!(pants,);
let _ = cfg!(pants = "pants");
let _ = cfg!(pants = "pants",);
let _ = cfg!(all(pants));
let _ = cfg!(all(pants),);
let _ = cfg!(all(pants,));
let _ = cfg!(all(pants,),);
}
#[test]
fn column() {
column!();
let _ = column!();
}
// compile_error! is in a companion to this test in compile-fail
#[test]
fn concat() {
concat!();
concat!("hello");
concat!("hello",);
concat!("hello", " world");
concat!("hello", " world",);
let _ = concat!();
let _ = concat!("hello");
let _ = concat!("hello",);
let _ = concat!("hello", " world");
let _ = concat!("hello", " world",);
}
#[test]
@ -131,10 +131,10 @@ fn debug_assert_ne() {
#[test]
fn env() {
env!("PATH");
env!("PATH",);
env!("PATH", "not found");
env!("PATH", "not found",);
let _ = env!("PATH");
let _ = env!("PATH",);
let _ = env!("PATH", "not found");
let _ = env!("PATH", "not found",);
}
#[cfg(std)]
@ -158,58 +158,58 @@ fn eprintln() {
#[test]
fn file() {
file!();
let _ = file!();
}
#[cfg(std)]
#[test]
fn format() {
format!("hello");
format!("hello",);
format!("hello {}", "world");
format!("hello {}", "world",);
let _ = format!("hello");
let _ = format!("hello",);
let _ = format!("hello {}", "world");
let _ = format!("hello {}", "world",);
}
#[test]
fn format_args() {
format_args!("hello");
format_args!("hello",);
format_args!("hello {}", "world");
format_args!("hello {}", "world",);
let _ = format_args!("hello");
let _ = format_args!("hello",);
let _ = format_args!("hello {}", "world");
let _ = format_args!("hello {}", "world",);
}
#[test]
fn include() {
include!("auxiliary/macro-comma-support.rs");
include!("auxiliary/macro-comma-support.rs",);
let _ = include!("auxiliary/macro-comma-support.rs");
let _ = include!("auxiliary/macro-comma-support.rs",);
}
#[test]
fn include_bytes() {
include_bytes!("auxiliary/macro-comma-support.rs");
include_bytes!("auxiliary/macro-comma-support.rs",);
let _ = include_bytes!("auxiliary/macro-comma-support.rs");
let _ = include_bytes!("auxiliary/macro-comma-support.rs",);
}
#[test]
fn include_str() {
include_str!("auxiliary/macro-comma-support.rs");
include_str!("auxiliary/macro-comma-support.rs",);
let _ = include_str!("auxiliary/macro-comma-support.rs");
let _ = include_str!("auxiliary/macro-comma-support.rs",);
}
#[test]
fn line() {
line!();
let _ = line!();
}
#[test]
fn module_path() {
module_path!();
let _ = module_path!();
}
#[test]
fn option_env() {
option_env!("PATH");
option_env!("PATH",);
let _ = option_env!("PATH");
let _ = option_env!("PATH",);
}
#[test]
@ -309,10 +309,10 @@ fn unreachable() {
#[test]
fn vec() {
let _: Vec<()> = vec![];
vec![0];
vec![0,];
vec![0, 1];
vec![0, 1,];
let _ = vec![0];
let _ = vec![0,];
let _ = vec![0, 1];
let _ = vec![0, 1,];
}
// give a test body access to a fmt::Formatter, which seems
@ -340,21 +340,21 @@ macro_rules! test_with_formatter {
test_with_formatter! {
#[test]
fn write(f: &mut fmt::Formatter) {
write!(f, "hello");
write!(f, "hello",);
write!(f, "hello {}", "world");
write!(f, "hello {}", "world",);
let _ = write!(f, "hello");
let _ = write!(f, "hello",);
let _ = write!(f, "hello {}", "world");
let _ = write!(f, "hello {}", "world",);
}
}
test_with_formatter! {
#[test]
fn writeln(f: &mut fmt::Formatter) {
writeln!(f);
writeln!(f,);
writeln!(f, "hello");
writeln!(f, "hello",);
writeln!(f, "hello {}", "world");
writeln!(f, "hello {}", "world",);
let _ = writeln!(f);
let _ = writeln!(f,);
let _ = writeln!(f, "hello");
let _ = writeln!(f, "hello",);
let _ = writeln!(f, "hello {}", "world");
let _ = writeln!(f, "hello {}", "world",);
}
}