From e7d60c00c68e72fa954bcff311bc92e1c445823c Mon Sep 17 00:00:00 2001 From: Constantin Date: Tue, 3 Jan 2017 07:19:45 +0100 Subject: [PATCH 01/12] book: match enum warning removed Matching enums with named fields in the previous way yielded the "non_shorthand_field_patterns" warning. The new code shows the shorthand syntax as well as field renaming, so it should be exhaustive ;-) --- src/doc/book/match.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/book/match.md b/src/doc/book/match.md index d01a20083efb5..52d3c6ae9260c 100644 --- a/src/doc/book/match.md +++ b/src/doc/book/match.md @@ -82,7 +82,7 @@ fn process_message(msg: Message) { match msg { Message::Quit => quit(), Message::ChangeColor(r, g, b) => change_color(r, g, b), - Message::Move { x: x, y: y } => move_cursor(x, y), + Message::Move { x, y: new_name_for_y } => move_cursor(x, new_name_for_y), Message::Write(s) => println!("{}", s), }; } From 487ca5ccc52fe27b9352c2b467c91d231ecf9ae7 Mon Sep 17 00:00:00 2001 From: theduke Date: Tue, 10 Jan 2017 12:35:04 +0100 Subject: [PATCH 02/12] Update struct_expr grammar for field init shorthand. --- src/doc/grammar.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/doc/grammar.md b/src/doc/grammar.md index 690d44cc2cb7b..c81f2e2282b5e 100644 --- a/src/doc/grammar.md +++ b/src/doc/grammar.md @@ -510,8 +510,9 @@ unit_expr : "()" ; ### Structure expressions ```antlr -struct_expr : expr_path '{' ident ':' expr - [ ',' ident ':' expr ] * +struct_expr_field_init : ident | ident ':' expr ; +struct_expr : expr_path '{' struct_expr_field_init + [ ',' struct_expr_field_init ] * [ ".." expr ] '}' | expr_path '(' expr [ ',' expr ] * ')' | From 4093bafe636bb711228e76d780d520626df28921 Mon Sep 17 00:00:00 2001 From: krdln Date: Wed, 11 Jan 2017 15:56:06 +0100 Subject: [PATCH 03/12] Add `&mut expr` to syntax index --- src/doc/book/syntax-index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/book/syntax-index.md b/src/doc/book/syntax-index.md index 28403711cd701..5fa78001fad54 100644 --- a/src/doc/book/syntax-index.md +++ b/src/doc/book/syntax-index.md @@ -45,7 +45,7 @@ * `%` (`expr % expr`): arithmetic remainder. Overloadable (`Rem`). * `%=` (`var %= expr`): arithmetic remainder & assignment. Overloadable (`RemAssign`). * `&` (`expr & expr`): bitwise and. Overloadable (`BitAnd`). -* `&` (`&expr`): borrow. See [References and Borrowing]. +* `&` (`&expr`, `&mut expr`): borrow. See [References and Borrowing]. * `&` (`&type`, `&mut type`, `&'a type`, `&'a mut type`): borrowed pointer type. See [References and Borrowing]. * `&=` (`var &= expr`): bitwise and & assignment. Overloadable (`BitAndAssign`). * `&&` (`expr && expr`): logical and. From 465d24e1a03f21c1c7685f5105a32ffc52bdd68c Mon Sep 17 00:00:00 2001 From: Cesar Eduardo Barros Date: Thu, 19 Jan 2017 18:16:11 -0200 Subject: [PATCH 04/12] book: size and align in trait object vtables are used The book currently claims that the `size` and `align` fields in the trait object vtable are not used, but this is false. These two fields are used by the stable `mem::size_of_val` and `mem::align_of_val` functions. See the `ty::TyDynamic` case of the `glue::size_and_align_of_dst` function in librustc_trans, which is used to implement both intrinsics in the unsized case. --- src/doc/book/trait-objects.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/doc/book/trait-objects.md b/src/doc/book/trait-objects.md index a0396a75fa26e..71536f409e8f4 100644 --- a/src/doc/book/trait-objects.md +++ b/src/doc/book/trait-objects.md @@ -264,9 +264,7 @@ will free the memory. This is necessary for owning trait objects like `Box`, which need to clean-up both the `Box` allocation as well as the internal type when they go out of scope. The `size` and `align` fields store the size of the erased type, and its alignment requirements; these are -essentially unused at the moment since the information is embedded in the -destructor, but will be used in the future, as trait objects are progressively -made more flexible. +used by the `std::mem::size_of_val` and `std::mem::align_of_val` functions. Suppose we’ve got some values that implement `Foo`. The explicit form of construction and use of `Foo` trait objects might look a bit like (ignoring the From c7b092b47d8e50b58c975040af0a84a544f7fa7a Mon Sep 17 00:00:00 2001 From: Cesar Eduardo Barros Date: Thu, 19 Jan 2017 22:45:57 -0200 Subject: [PATCH 05/12] No need to mention how these fields are used --- src/doc/book/trait-objects.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/doc/book/trait-objects.md b/src/doc/book/trait-objects.md index 71536f409e8f4..00a841a75db86 100644 --- a/src/doc/book/trait-objects.md +++ b/src/doc/book/trait-objects.md @@ -263,8 +263,7 @@ any resources of the vtable’s type: for `u8` it is trivial, but for `String` i will free the memory. This is necessary for owning trait objects like `Box`, which need to clean-up both the `Box` allocation as well as the internal type when they go out of scope. The `size` and `align` fields store -the size of the erased type, and its alignment requirements; these are -used by the `std::mem::size_of_val` and `std::mem::align_of_val` functions. +the size of the erased type, and its alignment requirements. Suppose we’ve got some values that implement `Foo`. The explicit form of construction and use of `Foo` trait objects might look a bit like (ignoring the From b4192aa4dfe99c1fe605fd169d7cef4fd972bea9 Mon Sep 17 00:00:00 2001 From: Geoff Yoerger Date: Thu, 19 Jan 2017 20:38:26 -0600 Subject: [PATCH 06/12] Module level doc --- src/libcore/sync/atomic.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index 7520579447152..484e1181dd2ac 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -21,9 +21,10 @@ //! //! Each method takes an `Ordering` which represents the strength of //! the memory barrier for that operation. These orderings are the -//! same as [LLVM atomic orderings][1]. +//! same as [LLVM atomic orderings][1]. For more information see the [nomicon][2] //! //! [1]: http://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations +//! [2]: https://doc.rust-lang.org/nomicon/atomics.html //! //! Atomic variables are safe to share between threads (they implement `Sync`) //! but they do not themselves provide the mechanism for sharing and follow the From c4c9ff2f00975e00ba56c1b1d309ff1f278f3760 Mon Sep 17 00:00:00 2001 From: Geoff Yoerger Date: Thu, 19 Jan 2017 20:39:54 -0600 Subject: [PATCH 07/12] '.' --- src/libcore/sync/atomic.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index 484e1181dd2ac..ff7abb45d7bfe 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -21,7 +21,7 @@ //! //! Each method takes an `Ordering` which represents the strength of //! the memory barrier for that operation. These orderings are the -//! same as [LLVM atomic orderings][1]. For more information see the [nomicon][2] +//! same as [LLVM atomic orderings][1]. For more information see the [nomicon][2]. //! //! [1]: http://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations //! [2]: https://doc.rust-lang.org/nomicon/atomics.html From 02ead27c935887b148e58df999dbd8fb9be9d789 Mon Sep 17 00:00:00 2001 From: Geoff Yoerger Date: Thu, 19 Jan 2017 20:43:43 -0600 Subject: [PATCH 08/12] Into item level docs (enum Ordering) --- src/libcore/sync/atomic.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index ff7abb45d7bfe..bd1d00486ec7e 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -142,6 +142,8 @@ unsafe impl Sync for AtomicPtr {} /// /// Rust's memory orderings are [the same as /// LLVM's](http://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations). +/// +/// For more information see the [nomicon](https://doc.rust-lang.org/nomicon/atomics.html). #[stable(feature = "rust1", since = "1.0.0")] #[derive(Copy, Clone, Debug)] pub enum Ordering { From dfa9736e9f5b9e5650fea5faed6dc7d446772eb4 Mon Sep 17 00:00:00 2001 From: Geoff Yoerger Date: Thu, 19 Jan 2017 21:43:34 -0600 Subject: [PATCH 09/12] Clarify the `default` option to use --- src/libcore/sync/atomic.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index bd1d00486ec7e..3d274d17c7cc4 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -140,10 +140,15 @@ unsafe impl Sync for AtomicPtr {} /// to be moved either before or after the atomic operation; on the other end /// "relaxed" atomics allow all reorderings. /// +/// If you are confused or don't have enough time to research which ordering to use, use `SeqCst`. +/// Of all the options it has the most unsurpising effect (see the nomicon for details. [1]) +/// The downside is you miss out on several optimizations the other orderings offer. +/// /// Rust's memory orderings are [the same as /// LLVM's](http://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations). /// -/// For more information see the [nomicon](https://doc.rust-lang.org/nomicon/atomics.html). +/// For more information see the [nomicon][1]. +/// [1]: https://doc.rust-lang.org/nomicon/atomics.html #[stable(feature = "rust1", since = "1.0.0")] #[derive(Copy, Clone, Debug)] pub enum Ordering { From c0a5b99f01df01341500d4c23a724bddb029a9cb Mon Sep 17 00:00:00 2001 From: Geoff Yoerger Date: Fri, 20 Jan 2017 09:25:03 -0600 Subject: [PATCH 10/12] Revert previous commit --- src/libcore/sync/atomic.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index 3d274d17c7cc4..a3cb12844777b 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -140,10 +140,6 @@ unsafe impl Sync for AtomicPtr {} /// to be moved either before or after the atomic operation; on the other end /// "relaxed" atomics allow all reorderings. /// -/// If you are confused or don't have enough time to research which ordering to use, use `SeqCst`. -/// Of all the options it has the most unsurpising effect (see the nomicon for details. [1]) -/// The downside is you miss out on several optimizations the other orderings offer. -/// /// Rust's memory orderings are [the same as /// LLVM's](http://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations). /// From d896a0c271536dfa1168a2deddfd4ed1aa5b99d8 Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Sat, 21 Jan 2017 17:35:15 -0500 Subject: [PATCH 11/12] Add more references between lowercase/uppercase operations. --- src/libstd/ascii.rs | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index f5e9ec6d89d0f..b220504d2b4f5 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -66,6 +66,11 @@ pub trait AsciiExt { /// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z', /// but non-ASCII letters are unchanged. /// + /// To uppercase the string in-place, use [`make_ascii_uppercase`]. + /// + /// To uppercase ASCII characters in addition to non-ASCII characters, use + /// [`str::to_uppercase`]. + /// /// # Examples /// /// ``` @@ -77,6 +82,9 @@ pub trait AsciiExt { /// assert_eq!('A', ascii.to_ascii_uppercase()); /// assert_eq!('❤', utf8.to_ascii_uppercase()); /// ``` + /// + /// [`make_ascii_uppercase`]: #tymethod.make_ascii_uppercase + /// [`str::to_uppercase`]: ../primitive.str.html#method.to_uppercase #[stable(feature = "rust1", since = "1.0.0")] fn to_ascii_uppercase(&self) -> Self::Owned; @@ -85,6 +93,11 @@ pub trait AsciiExt { /// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z', /// but non-ASCII letters are unchanged. /// + /// To lowercase the string in-place, use [`make_ascii_lowercase`]. + /// + /// To lowercase ASCII characters in addition to non-ASCII characters, use + /// [`str::to_lowercase`]. + /// /// # Examples /// /// ``` @@ -96,6 +109,9 @@ pub trait AsciiExt { /// assert_eq!('a', ascii.to_ascii_lowercase()); /// assert_eq!('❤', utf8.to_ascii_lowercase()); /// ``` + /// + /// [`make_ascii_lowercase`]: #tymethod.make_ascii_lowercase + /// [`str::to_lowercase`]: ../primitive.str.html#method.to_lowercase #[stable(feature = "rust1", since = "1.0.0")] fn to_ascii_lowercase(&self) -> Self::Owned; @@ -123,7 +139,11 @@ pub trait AsciiExt { /// Converts this type to its ASCII upper case equivalent in-place. /// - /// See `to_ascii_uppercase` for more information. + /// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z', + /// but non-ASCII letters are unchanged. + /// + /// To return a new uppercased string without modifying the existing one, use + /// [`to_ascii_uppercase`]. /// /// # Examples /// @@ -136,12 +156,18 @@ pub trait AsciiExt { /// /// assert_eq!('A', ascii); /// ``` + /// + /// [`to_ascii_uppercase`]: #tymethod.to_ascii_uppercase #[stable(feature = "ascii", since = "1.9.0")] fn make_ascii_uppercase(&mut self); /// Converts this type to its ASCII lower case equivalent in-place. /// - /// See `to_ascii_lowercase` for more information. + /// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z', + /// but non-ASCII letters are unchanged. + /// + /// To return a new lowercased string without modifying the existing one, use + /// [`to_ascii_lowercase`]. /// /// # Examples /// @@ -154,6 +180,8 @@ pub trait AsciiExt { /// /// assert_eq!('a', ascii); /// ``` + /// + /// [`to_ascii_lowercase`]: #tymethod.to_ascii_lowercase #[stable(feature = "ascii", since = "1.9.0")] fn make_ascii_lowercase(&mut self); } From 4d8f1c91188775f9794fc73bd35e533133976e26 Mon Sep 17 00:00:00 2001 From: Jacob Wahlgren Date: Mon, 23 Jan 2017 19:56:48 +0100 Subject: [PATCH 12/12] build: Link to new build sys from Makefile.in --- Makefile.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile.in b/Makefile.in index 9e87ce1d9e69a..8dbe24213905a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -17,6 +17,10 @@ # most intimate workings of the compiler itself, you've come to the # right place. Let's see what's on the menu. # +# Please note that most of these options only work if configure was +# run with --disable-rustbuild. For documentation on the new build +# system, see CONTRIBUTING.md. +# # First, start with one of these build targets: # # * all - The default. Build a complete, bootstrapped compiler.