Auto merge of #44784 - frewsxcv:rollup, r=frewsxcv

Rollup of 14 pull requests

- Successful merges: #44554, #44648, #44658, #44712, #44717, #44726, #44745, #44746, #44749, #44759, #44770, #44773, #44776, #44778
- Failed merges:
This commit is contained in:
bors 2017-09-23 05:10:53 +00:00
commit 85a5d3ffa4
19 changed files with 309 additions and 58 deletions

View file

@ -13,6 +13,7 @@
#![allow(unused_features)]
#![feature(box_syntax)]
use std::cell::RefCell;
use std::fmt::{self, Write};
use std::usize;
@ -240,6 +241,8 @@ pub fn main() {
// test that trailing commas are acceptable
format!("{}", "test",);
format!("{foo}", foo="test",);
test_refcell();
}
// Basic test to make sure that we can invoke the `write!` macro with an
@ -319,3 +322,12 @@ fn test_once() {
assert_eq!(format!("{0} {0} {0} {a} {a} {a}", foo(), a=foo()),
"1 1 1 2 2 2".to_string());
}
fn test_refcell() {
let refcell = RefCell::new(5);
assert_eq!(format!("{:?}", refcell), "RefCell { value: 5 }");
let borrow = refcell.borrow_mut();
assert_eq!(format!("{:?}", refcell), "RefCell { value: <borrowed> }");
drop(borrow);
assert_eq!(format!("{:?}", refcell), "RefCell { value: 5 }");
}

View file

@ -0,0 +1,24 @@
// Copyright 2017 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.
//! dox
#![deny(missing_docs)]
macro_rules! doc {
($e:expr) => (
#[doc = $e]
pub struct Foo;
)
}
doc!("a");
fn main() {}

View file

@ -0,0 +1,31 @@
// Copyright 2017 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.
// ignore-tidy-linelength
// compile-flags: --no-defaults --passes collapse-docs --passes unindent-comments --passes strip-priv-imports
#![crate_name = "foo"]
// @has foo/fn.bar.html
// @has - '//*[@class="rust fn"]' 'pub fn bar() -> '
/// foo
pub fn bar() -> usize {
2
}
// @has foo/struct.Foo.html
// @has - '//*[@class="method"]' 'pub fn new()'
// @has - '//*[@class="method"]' 'fn not_pub()'
pub struct Foo(usize);
impl Foo {
pub fn new() -> Foo { Foo(0) }
fn not_pub() {}
}