Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 16 pull requests #36126

Merged
merged 38 commits into from
Aug 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
2659198
show how iterating over `RangeTo` and `RangeToInclusive` fails
matthew-piziak Aug 17, 2016
e4dd785
Correct formatting docs: fmt::Result != io::Result<()>
Stebalien Aug 20, 2016
f2655e2
Note that formatters should not return spurious errors.
Stebalien Aug 20, 2016
c7d5f7e
Rust has type aliases, not typedefs.
Stebalien Aug 23, 2016
67b9cd3
improve documentation for `Fn*` traits
matthew-piziak Aug 18, 2016
ff3a761
add more-evocative examples for `Shl` and `Shr`
matthew-piziak Aug 20, 2016
bf22a7a
Updated code sample in chapter on syntax extensions.
regexident Aug 24, 2016
905644d
Rename {uint,int} methods to {usize,isize}.
frewsxcv Aug 24, 2016
cf8e1fe
add a simple example for `thread::current()`
matthew-piziak Aug 25, 2016
f4c55dd
Fix documentation in cell mod
F001 Aug 22, 2016
e2d9974
improve `BitAnd` trait documentation
matthew-piziak Aug 25, 2016
eea03f5
Fixes #35280 to update E0194 to support new error message format. Par…
leikahing Aug 27, 2016
a068fc7
Doc: explain why Box/Rc/Arc methods do not take self
birkenfeld Aug 6, 2016
9c256ec
Add test for #35423
apasel422 Aug 28, 2016
46fc80c
update error E0451 to new format
mikhail-m1 Aug 27, 2016
d6fc2ba
Update E0260 to new error format
0xmohit Aug 29, 2016
58ced16
Update E0463 error message to new format
paulfanelli Aug 28, 2016
01083ba
Update E0089 to new error format
zjhmale Aug 29, 2016
6355528
E0164 Update error format #35269
gavinb Aug 29, 2016
28c5edb
E0165 Update error format #35270
gavinb Aug 29, 2016
2967dcc
E0184 Update error format #35275
gavinb Aug 29, 2016
f60cb17
Rollup merge of #35418 - birkenfeld:patch-1, r=aturon
GuillaumeGomez Aug 30, 2016
ff45e61
Rollup merge of #35771 - matthew-piziak:range-inclusive-example-error…
GuillaumeGomez Aug 30, 2016
aa3ee1d
Rollup merge of #35810 - matthew-piziak:fn-trait-example, r=steveklabnik
GuillaumeGomez Aug 30, 2016
d33e191
Rollup merge of #35862 - Stebalien:fmt-docs, r=steveklabnik
GuillaumeGomez Aug 30, 2016
b4a6b6b
Rollup merge of #35863 - matthew-piziak:shl-example, r=steveklabnik
GuillaumeGomez Aug 30, 2016
325b711
Rollup merge of #35895 - F001:patch-1, r=steveklabnik
GuillaumeGomez Aug 30, 2016
8d808a2
Rollup merge of #35962 - regexident:compiler-plugin-docs, r=steveklabnik
GuillaumeGomez Aug 30, 2016
67949a3
Rollup merge of #35977 - frewsxcv:usize-isize, r=eddyb
GuillaumeGomez Aug 30, 2016
0c33197
Rollup merge of #35993 - matthew-piziak:bitwise-and-redux, r=Guillaum…
GuillaumeGomez Aug 30, 2016
23f7698
Rollup merge of #35997 - matthew-piziak:thread-current-example, r=Gui…
GuillaumeGomez Aug 30, 2016
5185bd0
Rollup merge of #36054 - mikhail-m1:master2, r=jonathandturner
GuillaumeGomez Aug 30, 2016
751e4db
Rollup merge of #36056 - birryree:E0194_new_error_format, r=jonathand…
GuillaumeGomez Aug 30, 2016
3ee2c9d
Rollup merge of #36060 - paulfanelli:update-e0463-error-msg, r=jonath…
GuillaumeGomez Aug 30, 2016
ab84997
Rollup merge of #36086 - apasel422:issue-35423, r=alexcrichton
GuillaumeGomez Aug 30, 2016
eb33044
Rollup merge of #36100 - 0xmohit:pr/error-code-E0260, r=jonathandturner
GuillaumeGomez Aug 30, 2016
9a3cfe9
Rollup merge of #36103 - zjhmale:fix-E0089, r=jonathandturner
GuillaumeGomez Aug 30, 2016
1d2308f
Rollup merge of #36125 - gavinb:error_msgs_p1, r=jonathandturner
GuillaumeGomez Aug 30, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/doc/book/compiler-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ extern crate rustc;
extern crate rustc_plugin;

use syntax::parse::token;
use syntax::ast::TokenTree;
use syntax::tokenstream::TokenTree;
use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacEager};
use syntax::ext::build::AstBuilder; // trait for expr_usize
use syntax_pos::Span;
use syntax::ext::quote::rt::Span;
use rustc_plugin::Registry;

fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
Expand All @@ -69,7 +69,7 @@ fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
}

let text = match args[0] {
TokenTree::Token(_, token::Ident(s, _)) => s.to_string(),
TokenTree::Token(_, token::Ident(s)) => s.to_string(),
_ => {
cx.span_err(sp, "argument should be a single identifier");
return DummyResult::any(sp);
Expand Down
6 changes: 6 additions & 0 deletions src/liballoc/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize;
/// does not use atomics, making it both thread-unsafe as well as significantly
/// faster when updating the reference count.
///
/// Note: the inherent methods defined on `Arc<T>` are all associated functions,
/// which means that you have to call them as e.g. `Arc::get_mut(&value)`
/// instead of `value.get_mut()`. This is so that there are no conflicts with
/// methods on the inner type `T`, which are what you want to call in the
/// majority of cases.
///
/// # Examples
///
/// In this example, a large vector of data will be shared by several threads. First we
Expand Down
4 changes: 4 additions & 0 deletions src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ impl<T: ?Sized> Box<T> {
/// proper way to do so is to convert the raw pointer back into a
/// `Box` with the `Box::from_raw` function.
///
/// Note: this is an associated function, which means that you have
/// to call it as `Box::into_raw(b)` instead of `b.into_raw()`. This
/// is so that there is no conflict with a method on the inner type.
///
/// # Examples
///
/// ```
Expand Down
6 changes: 6 additions & 0 deletions src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ struct RcBox<T: ?Sized> {
/// A reference-counted pointer type over an immutable value.
///
/// See the [module level documentation](./index.html) for more details.
///
/// Note: the inherent methods defined on `Rc<T>` are all associated functions,
/// which means that you have to call them as e.g. `Rc::get_mut(&value)` instead
/// of `value.get_mut()`. This is so that there are no conflicts with methods
/// on the inner type `T`, which are what you want to call in the majority of
/// cases.
#[cfg_attr(stage0, unsafe_no_drop_flag)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Rc<T: ?Sized> {
Expand Down
12 changes: 9 additions & 3 deletions src/libcollections/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,15 @@
//! provides some helper methods.
//!
//! Additionally, the return value of this function is `fmt::Result` which is a
//! typedef to `Result<(), std::io::Error>` (also known as `std::io::Result<()>`).
//! Formatting implementations should ensure that they return errors from `write!`
//! correctly (propagating errors upward).
//! type alias of `Result<(), std::fmt::Error>`. Formatting implementations
//! should ensure that they propagate errors from the `Formatter` (e.g., when
//! calling `write!`) however, they should never return errors spuriously. That
//! is, a formatting implementation must and may only return an error if the
//! passed-in `Formatter` returns an error. This is because, contrary to what
//! the function signature might suggest, string formatting is an infallible
//! operation. This function only returns a result because writing to the
//! underlying stream might fail and it must provide a way to propagate the fact
//! that an error has occurred back up the stack.
//!
//! An example of implementing the formatting traits would look
//! like:
Expand Down
49 changes: 39 additions & 10 deletions src/libcore/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,26 +119,55 @@
//! `Cell<T>`.
//!
//! ```
//! #![feature(core_intrinsics)]
//! #![feature(shared)]
//! use std::cell::Cell;
//! use std::ptr::Shared;
//! use std::intrinsics::abort;
//! use std::intrinsics::assume;
//!
//! struct Rc<T> {
//! ptr: *mut RcBox<T>
//! struct Rc<T: ?Sized> {
//! ptr: Shared<RcBox<T>>
//! }
//!
//! struct RcBox<T> {
//! # #[allow(dead_code)]
//! struct RcBox<T: ?Sized> {
//! strong: Cell<usize>,
//! refcount: Cell<usize>,
//! value: T,
//! refcount: Cell<usize>
//! }
//!
//! impl<T> Clone for Rc<T> {
//! impl<T: ?Sized> Clone for Rc<T> {
//! fn clone(&self) -> Rc<T> {
//! unsafe {
//! (*self.ptr).refcount.set((*self.ptr).refcount.get() + 1);
//! Rc { ptr: self.ptr }
//! }
//! self.inc_strong();
//! Rc { ptr: self.ptr }
//! }
//! }
//!
//! trait RcBoxPtr<T: ?Sized> {
//!
//! fn inner(&self) -> &RcBox<T>;
//!
//! fn strong(&self) -> usize {
//! self.inner().strong.get()
//! }
//!
//! fn inc_strong(&self) {
//! self.inner()
//! .strong
//! .set(self.strong()
//! .checked_add(1)
//! .unwrap_or_else(|| unsafe { abort() }));
//! }
//! }
//!
//! impl<T: ?Sized> RcBoxPtr<T> for Rc<T> {
//! fn inner(&self) -> &RcBox<T> {
//! unsafe {
//! assume(!(*(&self.ptr as *const _ as *const *const ())).is_null());
//! &(**self.ptr)
//! }
//! }
//! }
//! ```
//!

Expand Down