Skip to content

Rollup of 13 pull requests #35826

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

Closed
wants to merge 26 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
95c53b1
accumulate vector and assert for RangeFrom and RangeInclusive examples
matthew-piziak Aug 17, 2016
dcee93a
replace Add example with something more evocative of addition
matthew-piziak Aug 16, 2016
0dc13ee
updated E0395 to new error format
clementmiao Aug 18, 2016
dae1406
updated E0396 to new error format
clementmiao Aug 18, 2016
6976991
Fix tiny spelling mistake in book
ErikUggeldahl Aug 18, 2016
c2b6f72
Add a few doc examples for `std::ffi::OsStr`.
frewsxcv Aug 18, 2016
06302cb
Fix minor typo
cantino Aug 18, 2016
96bd6cf
demonstrate `RHS != Self` use cases for `Add` and `Sub`
matthew-piziak Aug 18, 2016
161cb36
Update error message for E0084
pliniker Aug 18, 2016
a516dbb
note that calling drop() explicitly is a compiler error
matthew-piziak Aug 16, 2016
6c66eaa
replace `AddAssign` example with something more evocative of addition
matthew-piziak Aug 18, 2016
39f318b
Update error format for E0232
mlayne Aug 18, 2016
2128d31
Fix label messages for E0133
wdv4758h Aug 19, 2016
39501e9
Rollup merge of #35709 - matthew-piziak:add-trait-example, r=Guillaum…
Aug 19, 2016
bb03ef1
Rollup merge of #35710 - matthew-piziak:explicit-drop, r=steveklabnik
Aug 19, 2016
2f9ae0d
Rollup merge of #35758 - matthew-piziak:vec-assert-over-println-remai…
Aug 19, 2016
8075826
Rollup merge of #35775 - frewsxcv:os-str-doc-examples, r=GuillaumeGomez
Aug 19, 2016
e38299d
Rollup merge of #35778 - clementmiao:E0395_new_error_format, r=jonath…
Aug 19, 2016
8c74eb6
Rollup merge of #35780 - clementmiao:E0396_new_err_format, r=jonathan…
Aug 19, 2016
46f1733
Rollup merge of #35781 - ErikUggeldahl:spellingfix, r=apasel422
Aug 19, 2016
f60bf45
Rollup merge of #35793 - matthew-piziak:add-rhs-example, r=steveklabnik
Aug 19, 2016
eb0250a
Rollup merge of #35794 - cantino:fix-typo, r=apasel422
Aug 19, 2016
20b4b99
Rollup merge of #35804 - pliniker:master, r=jonathandturner
Aug 19, 2016
16ce5dc
Rollup merge of #35806 - matthew-piziak:addassign-example, r=stevekla…
Aug 19, 2016
5d18992
Rollup merge of #35812 - mlayne:E0232, r=jonathandturner
Aug 19, 2016
d2e1502
Rollup merge of #35818 - wdv4758h:E0133-label, r=Aatch
Aug 19, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
demonstrate RHS != Self use cases for Add and Sub
  • Loading branch information
matthew-piziak committed Aug 18, 2016
commit 96bd6cfcb045b962ab77c826618b56eec011f99f
12 changes: 12 additions & 0 deletions src/libcore/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ macro_rules! forward_ref_binop {
/// Foo + Foo;
/// }
/// ```
///
/// Note that `RHS = Self` by default, but this is not mandatory. For example,
/// [std::time::SystemTime] implements `Add<Duration>`, which permits
/// operations of the form `SystemTime = SystemTime + Duration`.
///
/// [std::time::SystemTime]: ../../time/struct.SystemTime.html
#[lang = "add"]
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Add<RHS=Self> {
Expand Down Expand Up @@ -241,6 +247,12 @@ add_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
/// Foo - Foo;
/// }
/// ```
///
/// Note that `RHS = Self` by default, but this is not mandatory. For example,
/// [std::time::SystemTime] implements `Sub<Duration>`, which permits
/// operations of the form `SystemTime = SystemTime - Duration`.
///
/// [std::time::SystemTime]: ../../time/struct.SystemTime.html
#[lang = "sub"]
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Sub<RHS=Self> {
Expand Down