From 344ad9d8fc72292420aff59c5ae24d1c3546b4fa Mon Sep 17 00:00:00 2001 From: Josef Brandl Date: Tue, 28 Feb 2017 10:58:13 +0100 Subject: [PATCH 1/5] Structs doc: Change "pointers" to "references" --- src/doc/book/src/structs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/book/src/structs.md b/src/doc/book/src/structs.md index 6b2a145c85e51..71db2b4e3ea69 100644 --- a/src/doc/book/src/structs.md +++ b/src/doc/book/src/structs.md @@ -88,7 +88,7 @@ fn main() { } ``` -Your structure can still contain `&mut` pointers, which will let +Your structure can still contain `&mut` references, which will let you do some kinds of mutation: ```rust From 3c5001f0dd14c3d0afa539eaed9c9109de2aae59 Mon Sep 17 00:00:00 2001 From: Josef Brandl Date: Tue, 28 Feb 2017 11:28:54 +0100 Subject: [PATCH 2/5] Unit-like structs doc: Improve code sample --- src/doc/book/src/structs.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/doc/book/src/structs.md b/src/doc/book/src/structs.md index 6b2a145c85e51..b5fe99d04868a 100644 --- a/src/doc/book/src/structs.md +++ b/src/doc/book/src/structs.md @@ -259,9 +259,10 @@ You can define a `struct` with no members at all: struct Electron {} // Use empty braces... struct Proton; // ...or just a semicolon. -// Whether you declared the struct with braces or not, do the same when creating one. +// Use the same notation when creating an instance. let x = Electron {}; let y = Proton; +let z = Electron; // Error ``` Such a `struct` is called ‘unit-like’ because it resembles the empty From 3bffc9e1508387f4042cd3d0fef594817dada70f Mon Sep 17 00:00:00 2001 From: topecongiro Date: Tue, 28 Feb 2017 19:35:04 +0900 Subject: [PATCH 3/5] Add compile test for cfg_target_has_atomic --- .../feature-gate-cfg-target-has-atomic.rs | 86 +++++++++++++++++++ src/tools/tidy/src/features.rs | 1 - 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 src/test/compile-fail/feature-gate-cfg-target-has-atomic.rs diff --git a/src/test/compile-fail/feature-gate-cfg-target-has-atomic.rs b/src/test/compile-fail/feature-gate-cfg-target-has-atomic.rs new file mode 100644 index 0000000000000..aa27f8922c005 --- /dev/null +++ b/src/test/compile-fail/feature-gate-cfg-target-has-atomic.rs @@ -0,0 +1,86 @@ +// Copyright 2016 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="rlib"] +#![no_core] + +extern "rust-intrinsic" { + fn atomic_xadd(dst: *mut T, src: T) -> T; +} + +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} + +#[cfg(target_has_atomic = "8")] +//~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) +pub unsafe fn atomic_u8(x: *mut u8) { + atomic_xadd(x, 1); + atomic_xadd(x, 1); +} +#[cfg(target_has_atomic = "8")] +//~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) +pub unsafe fn atomic_i8(x: *mut i8) { + atomic_xadd(x, 1); +} +#[cfg(target_has_atomic = "16")] +//~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) +pub unsafe fn atomic_u16(x: *mut u16) { + atomic_xadd(x, 1); +} +#[cfg(target_has_atomic = "16")] +//~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) +pub unsafe fn atomic_i16(x: *mut i16) { + atomic_xadd(x, 1); +} +#[cfg(target_has_atomic = "32")] +//~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) +pub unsafe fn atomic_u32(x: *mut u32) { + atomic_xadd(x, 1); +} +#[cfg(target_has_atomic = "32")] +//~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) +pub unsafe fn atomic_i32(x: *mut i32) { + atomic_xadd(x, 1); +} +#[cfg(target_has_atomic = "64")] +//~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) +pub unsafe fn atomic_u64(x: *mut u64) { + atomic_xadd(x, 1); +} +#[cfg(target_has_atomic = "64")] +//~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) +pub unsafe fn atomic_i64(x: *mut i64) { + atomic_xadd(x, 1); +} +#[cfg(target_has_atomic = "ptr")] +//~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) +pub unsafe fn atomic_usize(x: *mut usize) { + atomic_xadd(x, 1); +} +#[cfg(target_has_atomic = "ptr")] +//~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) +pub unsafe fn atomic_isize(x: *mut isize) { + atomic_xadd(x, 1); +} + +fn main() { + cfg!(target_has_atomic = "8"); + //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) + cfg!(target_has_atomic = "16"); + //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) + cfg!(target_has_atomic = "32"); + //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) + cfg!(target_has_atomic = "64"); + //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) + cfg!(target_has_atomic = "ptr"); + //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) +} diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index c84fefd872e47..8025477684931 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -168,7 +168,6 @@ pub fn check(path: &Path, bad: &mut bool) { // FIXME get this whitelist empty. let whitelist = vec![ "abi_ptx", "simd", - "cfg_target_has_atomic", "stmt_expr_attributes", "cfg_target_thread_local", "unwind_attributes", ]; From d076e840bcc8b8b8d1625d8fce81c8116354dce0 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Tue, 28 Feb 2017 12:32:32 -0500 Subject: [PATCH 4/5] update mdbook version This contains two important bugfixes --- src/Cargo.lock | 6 +++--- src/tools/rustbook/Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Cargo.lock b/src/Cargo.lock index f17095f960920..a18d0a29e9c7d 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -270,7 +270,7 @@ source = "registry+/~https://github.com/rust-lang/crates.io-index" [[package]] name = "mdbook" -version = "0.0.16" +version = "0.0.17" source = "registry+/~https://github.com/rust-lang/crates.io-index" dependencies = [ "clap 2.20.5 (registry+/~https://github.com/rust-lang/crates.io-index)", @@ -401,7 +401,7 @@ name = "rustbook" version = "0.1.0" dependencies = [ "clap 2.20.5 (registry+/~https://github.com/rust-lang/crates.io-index)", - "mdbook 0.0.16 (registry+/~https://github.com/rust-lang/crates.io-index)", + "mdbook 0.0.17 (registry+/~https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -991,7 +991,7 @@ source = "registry+/~https://github.com/rust-lang/crates.io-index" "checksum lazy_static 0.2.2 (registry+/~https://github.com/rust-lang/crates.io-index)" = "6abe0ee2e758cd6bc8a2cd56726359007748fbf4128da998b65d0b70f881e19b" "checksum libc 0.2.20 (registry+/~https://github.com/rust-lang/crates.io-index)" = "684f330624d8c3784fb9558ca46c4ce488073a8d22450415c5eb4f4cfb0d11b5" "checksum log 0.3.6 (registry+/~https://github.com/rust-lang/crates.io-index)" = "ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054" -"checksum mdbook 0.0.16 (registry+/~https://github.com/rust-lang/crates.io-index)" = "14e8a6aca534ac51bad1c1886b10f6d6948a14fa70b1b20a1e41c9e5c0fe3019" +"checksum mdbook 0.0.17 (registry+/~https://github.com/rust-lang/crates.io-index)" = "dbba458ca886cb082d026afd704eeeeb0531f7e4ffd6c619f72dc309c1c18fe4" "checksum memchr 1.0.1 (registry+/~https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4" "checksum num-traits 0.1.36 (registry+/~https://github.com/rust-lang/crates.io-index)" = "a16a42856a256b39c6d3484f097f6713e14feacd9bfb02290917904fae46c81c" "checksum num_cpus 0.2.13 (registry+/~https://github.com/rust-lang/crates.io-index)" = "cee7e88156f3f9e19bdd598f8d6c9db7bf4078f99f8381f43a55b09648d1a6e3" diff --git a/src/tools/rustbook/Cargo.toml b/src/tools/rustbook/Cargo.toml index f7a452d9f7bd7..40318141e04fa 100644 --- a/src/tools/rustbook/Cargo.toml +++ b/src/tools/rustbook/Cargo.toml @@ -8,5 +8,5 @@ license = "MIT/Apache-2.0" clap = "2.19.3" [dependencies.mdbook] -version = "0.0.16" +version = "0.0.17" default-features = false From 3a0437d448a951f04138a328fac283aad755c25e Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Tue, 28 Feb 2017 14:06:05 -0500 Subject: [PATCH 5/5] sort unstable book alphabetically I made these the same order as they were in the compiler, but for no good reason. Much easier to find out what you need when they're sorted alphabetically --- src/doc/unstable-book/src/SUMMARY.md | 150 +++++++++++++-------------- 1 file changed, 75 insertions(+), 75 deletions(-) diff --git a/src/doc/unstable-book/src/SUMMARY.md b/src/doc/unstable-book/src/SUMMARY.md index ee8ae9a9839e9..e876b4aac0dfa 100644 --- a/src/doc/unstable-book/src/SUMMARY.md +++ b/src/doc/unstable-book/src/SUMMARY.md @@ -1,94 +1,94 @@ [The Unstable Book](the-unstable-book.md) -- [asm](asm.md) -- [alloc_system](alloc-system.md) +- [abi_msp430_interrupt](abi-msp430-interrupt.md) +- [abi_ptx](abi-ptx.md) +- [abi_sysv64](abi-sysv64.md) +- [abi_unadjusted](abi-unadjusted.md) +- [abi_vectorcall](abi-vectorcall.md) +- [advanced_slice_patterns](advanced-slice-patterns.md) - [alloc_jemalloc](alloc-jemalloc.md) -- [test](test.md) +- [alloc_system](alloc-system.md) +- [allocator](allocator.md) +- [allow_internal_unstable](allow-internal-unstable.md) +- [asm](asm.md) +- [associated_consts](associated-consts.md) +- [associated_type_defaults](associated-type-defaults.md) +- [attr_literals](attr-literals.md) +- [box_patterns](box-patterns.md) +- [box_syntax](box-syntax.md) +- [cfg_target_feature](cfg-target-feature.md) +- [cfg_target_has_atomic](cfg-target-has-atomic.md) +- [cfg_target_thread_local](cfg-target-thread-local.md) +- [cfg_target_vendor](cfg-target-vendor.md) +- [compiler_builtins](compiler-builtins.md) - [concat_idents](concat-idents.md) -- [link_args](link-args.md) -- [log_syntax](log-syntax.md) -- [non_ascii_idents](non-ascii-idents.md) -- [plugin_registrar](plugin-registrar.md) -- [thread_local](thread-local.md) -- [trace_macros](trace-macros.md) +- [conservative_impl_trait](conservative-impl-trait.md) +- [const_fn](const-fn.md) +- [const_indexing](const-indexing.md) +- [custom_attribute](custom-attribute.md) +- [custom_derive](custom-derive.md) +- [default_type_parameter_fallback](default-type-parameter-fallback.md) +- [drop_types_in_const](drop-types-in-const.md) +- [dropck_eyepatch](dropck-eyepatch.md) +- [dropck_parametricity](dropck-parametricity.md) +- [exclusive_range_pattern](exclusive-range-pattern.md) +- [field_init_shorthand](field-init-shorthand.md) +- [fundamental](fundamental.md) +- [generic_param_attrs](generic-param-attrs.md) +- [i128_type](i128-type.md) +- [inclusive_range_syntax](inclusive-range-syntax.md) - [intrinsics](intrinsics.md) - [lang_items](lang-items.md) +- [link_args](link-args.md) +- [link_cfg](link-cfg.md) - [link_llvm_intrinsics](link-llvm-intrinsics.md) - [linkage](linkage.md) -- [quote](quote.md) -- [simd](simd.md) -- [rustc_diagnostic_macros](rustc-diagnostic-macros.md) -- [advanced_slice_patterns](advanced-slice-patterns.md) -- [box_syntax](box-syntax.md) -- [placement_in_syntax](placement-in-syntax.md) -- [unboxed_closures](unboxed-closures.md) -- [allocator](allocator.md) -- [fundamental](fundamental.md) +- [log_syntax](log-syntax.md) +- [loop_break_value](loop-break-value.md) +- [macro_reexport](macro-reexport.md) - [main](main.md) +- [naked_functions](naked-functions.md) - [needs_allocator](needs-allocator.md) -- [on_unimplemented](on-unimplemented.md) -- [plugin](plugin.md) -- [simd_ffi](simd-ffi.md) -- [start](start.md) -- [structural_match](structural-match.md) -- [panic_runtime](panic-runtime.md) - [needs_panic_runtime](needs-panic-runtime.md) -- [optin_builtin_traits](optin-builtin-traits.md) -- [macro_reexport](macro-reexport.md) -- [staged_api](staged-api.md) +- [never_type](never-type.md) - [no_core](no-core.md) -- [box_patterns](box-patterns.md) -- [dropck_parametricity](dropck-parametricity.md) -- [dropck_eyepatch](dropck-eyepatch.md) -- [custom_attribute](custom-attribute.md) -- [custom_derive](custom-derive.md) +- [no_debug](no-debug.md) +- [non_ascii_idents](non-ascii-idents.md) +- [omit_gdb_pretty_printer_section](omit-gdb-pretty-printer-section.md) +- [on_unimplemented](on-unimplemented.md) +- [optin_builtin_traits](optin-builtin-traits.md) +- [panic_runtime](panic-runtime.md) +- [placement_in_syntax](placement-in-syntax.md) +- [platform_intrinsics](platform-intrinsics.md) +- [plugin](plugin.md) +- [plugin_registrar](plugin-registrar.md) +- [prelude_import](prelude-import.md) +- [proc_macro](proc-macro.md) +- [pub_restricted](pub-restricted.md) +- [quote](quote.md) +- [relaxed_adts](relaxed-adts.md) +- [repr_simd](repr-simd.md) - [rustc_attrs](rustc-attrs.md) -- [allow_internal_unstable](allow-internal-unstable.md) +- [rustc_diagnostic_macros](rustc-diagnostic-macros.md) +- [sanitizer_runtime](sanitizer-runtime.md) +- [simd](simd.md) +- [simd_ffi](simd-ffi.md) - [slice_patterns](slice-patterns.md) -- [associated_consts](associated-consts.md) -- [const_fn](const-fn.md) -- [const_indexing](const-indexing.md) -- [prelude_import](prelude-import.md) +- [specialization](specialization.md) +- [staged_api](staged-api.md) +- [start](start.md) +- [static_nobundle](static-nobundle.md) - [static_recursion](static-recursion.md) -- [default_type_parameter_fallback](default-type-parameter-fallback.md) -- [associated_type_defaults](associated-type-defaults.md) -- [repr_simd](repr-simd.md) -- [cfg_target_feature](cfg-target-feature.md) -- [platform_intrinsics](platform-intrinsics.md) -- [unwind_attributes](unwind-attributes.md) -- [naked_functions](naked-functions.md) -- [no_debug](no-debug.md) -- [omit_gdb_pretty_printer_section](omit-gdb-pretty-printer-section.md) -- [cfg_target_vendor](cfg-target-vendor.md) - [stmt_expr_attributes](stmt-expr-attributes.md) +- [struct_field_attributes](struct-field-attributes.md) +- [structural_match](structural-match.md) +- [target_feature](target-feature.md) +- [test](test.md) +- [thread_local](thread-local.md) +- [trace_macros](trace-macros.md) - [type_ascription](type-ascription.md) -- [cfg_target_thread_local](cfg-target-thread-local.md) -- [abi_vectorcall](abi-vectorcall.md) -- [inclusive_range_syntax](inclusive-range-syntax.md) -- [exclusive_range_pattern](exclusive-range-pattern.md) -- [specialization](specialization.md) -- [pub_restricted](pub-restricted.md) -- [drop_types_in_const](drop-types-in-const.md) -- [cfg_target_has_atomic](cfg-target-has-atomic.md) -- [conservative_impl_trait](conservative-impl-trait.md) -- [relaxed_adts](relaxed-adts.md) -- [never_type](never-type.md) -- [attr_literals](attr-literals.md) -- [abi_sysv64](abi-sysv64.md) +- [unboxed_closures](unboxed-closures.md) - [untagged_unions](untagged-unions.md) -- [compiler_builtins](compiler-builtins.md) -- [generic_param_attrs](generic-param-attrs.md) -- [field_init_shorthand](field-init-shorthand.md) -- [windows_subsystem](windows-subsystem.md) -- [link_cfg](link-cfg.md) +- [unwind_attributes](unwind-attributes.md) - [use_extern_macros](use-extern-macros.md) -- [loop_break_value](loop-break-value.md) -- [target_feature](target-feature.md) -- [abi_ptx](abi-ptx.md) -- [i128_type](i128-type.md) -- [abi_unadjusted](abi-unadjusted.md) -- [proc_macro](proc-macro.md) -- [struct_field_attributes](struct-field-attributes.md) -- [static_nobundle](static-nobundle.md) -- [abi_msp430_interrupt](abi-msp430-interrupt.md) -- [sanitizer_runtime](sanitizer-runtime.md) +- [windows_subsystem](windows-subsystem.md)