Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
0dc48b47
R
Rust
项目概览
int
/
Rust
接近 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0dc48b47
编写于
1月 07, 2015
作者:
A
Alex Crichton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Test fixes and rebase conflicts
上级
11e265c2
变更
194
展开全部
隐藏空白更改
内联
并排
Showing
194 changed file
with
386 addition
and
309 deletion
+386
-309
src/doc/guide-error-handling.md
src/doc/guide-error-handling.md
+2
-2
src/doc/guide-ffi.md
src/doc/guide-ffi.md
+2
-1
src/doc/guide-ownership.md
src/doc/guide-ownership.md
+14
-10
src/doc/guide-pointers.md
src/doc/guide-pointers.md
+28
-27
src/doc/guide-unsafe.md
src/doc/guide-unsafe.md
+3
-2
src/doc/guide.md
src/doc/guide.md
+10
-6
src/doc/reference.md
src/doc/reference.md
+40
-26
src/liballoc/boxed.rs
src/liballoc/boxed.rs
+6
-4
src/liballoc/heap.rs
src/liballoc/heap.rs
+1
-1
src/libarena/lib.rs
src/libarena/lib.rs
+2
-0
src/libcollections/macros.rs
src/libcollections/macros.rs
+1
-1
src/libcollections/slice.rs
src/libcollections/slice.rs
+3
-3
src/libcore/intrinsics.rs
src/libcore/intrinsics.rs
+1
-0
src/libcore/iter.rs
src/libcore/iter.rs
+1
-1
src/libcore/lib.rs
src/libcore/lib.rs
+1
-0
src/libcore/num/isize.rs
src/libcore/num/isize.rs
+6
-2
src/libcore/option.rs
src/libcore/option.rs
+2
-2
src/libcore/ptr.rs
src/libcore/ptr.rs
+3
-2
src/libcoretest/hash/mod.rs
src/libcoretest/hash/mod.rs
+0
-1
src/libcoretest/lib.rs
src/libcoretest/lib.rs
+3
-1
src/libcoretest/result.rs
src/libcoretest/result.rs
+0
-2
src/librand/lib.rs
src/librand/lib.rs
+3
-3
src/librustc/lint/builtin.rs
src/librustc/lint/builtin.rs
+1
-1
src/librustc/lint/context.rs
src/librustc/lint/context.rs
+1
-1
src/librustc/session/config.rs
src/librustc/session/config.rs
+1
-1
src/librustc_back/lib.rs
src/librustc_back/lib.rs
+2
-1
src/librustc_driver/test.rs
src/librustc_driver/test.rs
+1
-1
src/librustc_trans/trans/adt.rs
src/librustc_trans/trans/adt.rs
+1
-1
src/librustc_trans/trans/expr.rs
src/librustc_trans/trans/expr.rs
+1
-1
src/librustc_typeck/coherence/mod.rs
src/librustc_typeck/coherence/mod.rs
+5
-1
src/librustdoc/clean/mod.rs
src/librustdoc/clean/mod.rs
+1
-1
src/libserialize/collection_impls.rs
src/libserialize/collection_impls.rs
+2
-2
src/libstd/fmt.rs
src/libstd/fmt.rs
+1
-1
src/libstd/io/mod.rs
src/libstd/io/mod.rs
+1
-1
src/libstd/rand/mod.rs
src/libstd/rand/mod.rs
+1
-1
src/libstd/sys/windows/fs.rs
src/libstd/sys/windows/fs.rs
+1
-1
src/libsyntax/ast.rs
src/libsyntax/ast.rs
+0
-3
src/libsyntax/ext/expand.rs
src/libsyntax/ext/expand.rs
+2
-18
src/libsyntax/std_inject.rs
src/libsyntax/std_inject.rs
+0
-13
src/test/auxiliary/lint_group_plugin_test.rs
src/test/auxiliary/lint_group_plugin_test.rs
+1
-0
src/test/auxiliary/lint_plugin_test.rs
src/test/auxiliary/lint_plugin_test.rs
+1
-0
src/test/auxiliary/macro_crate_test.rs
src/test/auxiliary/macro_crate_test.rs
+1
-0
src/test/auxiliary/plugin_args.rs
src/test/auxiliary/plugin_args.rs
+1
-0
src/test/auxiliary/plugin_crate_outlive_expansion_phase.rs
src/test/auxiliary/plugin_crate_outlive_expansion_phase.rs
+1
-0
src/test/bench/msgsend-pipes-shared.rs
src/test/bench/msgsend-pipes-shared.rs
+1
-1
src/test/bench/msgsend-pipes.rs
src/test/bench/msgsend-pipes.rs
+1
-1
src/test/bench/shootout-k-nucleotide-pipes.rs
src/test/bench/shootout-k-nucleotide-pipes.rs
+6
-4
src/test/bench/shootout-k-nucleotide.rs
src/test/bench/shootout-k-nucleotide.rs
+2
-0
src/test/bench/shootout-regex-dna.rs
src/test/bench/shootout-regex-dna.rs
+2
-0
src/test/bench/sudoku.rs
src/test/bench/sudoku.rs
+1
-0
src/test/bench/task-perf-alloc-unwind.rs
src/test/bench/task-perf-alloc-unwind.rs
+1
-1
src/test/compile-fail/borrowck-bad-nested-calls-free.rs
src/test/compile-fail/borrowck-bad-nested-calls-free.rs
+1
-0
src/test/compile-fail/borrowck-bad-nested-calls-move.rs
src/test/compile-fail/borrowck-bad-nested-calls-move.rs
+1
-0
src/test/compile-fail/borrowck-borrow-immut-deref-of-box-as-mut.rs
...compile-fail/borrowck-borrow-immut-deref-of-box-as-mut.rs
+2
-0
src/test/compile-fail/borrowck-borrowed-uniq-rvalue.rs
src/test/compile-fail/borrowck-borrowed-uniq-rvalue.rs
+2
-0
src/test/compile-fail/borrowck-box-insensitivity.rs
src/test/compile-fail/borrowck-box-insensitivity.rs
+2
-0
src/test/compile-fail/borrowck-call-is-borrow-issue-12224.rs
src/test/compile-fail/borrowck-call-is-borrow-issue-12224.rs
+1
-0
src/test/compile-fail/borrowck-closures-mut-and-imm.rs
src/test/compile-fail/borrowck-closures-mut-and-imm.rs
+1
-0
src/test/compile-fail/borrowck-closures-two-mut.rs
src/test/compile-fail/borrowck-closures-two-mut.rs
+1
-0
src/test/compile-fail/borrowck-closures-use-after-free.rs
src/test/compile-fail/borrowck-closures-use-after-free.rs
+1
-0
src/test/compile-fail/borrowck-field-sensitivity.rs
src/test/compile-fail/borrowck-field-sensitivity.rs
+2
-0
src/test/compile-fail/borrowck-for-loop-correct-cmt-for-pattern.rs
...compile-fail/borrowck-for-loop-correct-cmt-for-pattern.rs
+2
-0
src/test/compile-fail/borrowck-issue-14498.rs
src/test/compile-fail/borrowck-issue-14498.rs
+2
-0
src/test/compile-fail/borrowck-issue-2657-1.rs
src/test/compile-fail/borrowck-issue-2657-1.rs
+2
-0
src/test/compile-fail/borrowck-issue-2657-2.rs
src/test/compile-fail/borrowck-issue-2657-2.rs
+2
-0
src/test/compile-fail/borrowck-lend-flow-if.rs
src/test/compile-fail/borrowck-lend-flow-if.rs
+1
-0
src/test/compile-fail/borrowck-lend-flow-loop.rs
src/test/compile-fail/borrowck-lend-flow-loop.rs
+1
-0
src/test/compile-fail/borrowck-lend-flow.rs
src/test/compile-fail/borrowck-lend-flow.rs
+1
-0
src/test/compile-fail/borrowck-loan-blocks-move-cc.rs
src/test/compile-fail/borrowck-loan-blocks-move-cc.rs
+2
-0
src/test/compile-fail/borrowck-loan-blocks-move.rs
src/test/compile-fail/borrowck-loan-blocks-move.rs
+1
-0
src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs
src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs
+2
-0
src/test/compile-fail/borrowck-move-by-capture.rs
src/test/compile-fail/borrowck-move-by-capture.rs
+2
-0
src/test/compile-fail/borrowck-move-error-with-note.rs
src/test/compile-fail/borrowck-move-error-with-note.rs
+1
-0
src/test/compile-fail/borrowck-move-from-subpath-of-borrowed-path.rs
...mpile-fail/borrowck-move-from-subpath-of-borrowed-path.rs
+2
-0
src/test/compile-fail/borrowck-move-moved-value-into-closure.rs
...st/compile-fail/borrowck-move-moved-value-into-closure.rs
+2
-0
src/test/compile-fail/borrowck-move-subcomponent.rs
src/test/compile-fail/borrowck-move-subcomponent.rs
+1
-0
src/test/compile-fail/borrowck-multiple-captures.rs
src/test/compile-fail/borrowck-multiple-captures.rs
+2
-0
src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs
src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs
+1
-0
src/test/compile-fail/borrowck-overloaded-index-2.rs
src/test/compile-fail/borrowck-overloaded-index-2.rs
+2
-0
src/test/compile-fail/borrowck-uniq-via-lend.rs
src/test/compile-fail/borrowck-uniq-via-lend.rs
+1
-0
src/test/compile-fail/borrowck-use-mut-borrow.rs
src/test/compile-fail/borrowck-use-mut-borrow.rs
+2
-0
src/test/compile-fail/check-static-values-constraints.rs
src/test/compile-fail/check-static-values-constraints.rs
+2
-0
src/test/compile-fail/class-cast-to-trait.rs
src/test/compile-fail/class-cast-to-trait.rs
+1
-0
src/test/compile-fail/cross-borrow-trait.rs
src/test/compile-fail/cross-borrow-trait.rs
+2
-0
src/test/compile-fail/dst-bad-assign-2.rs
src/test/compile-fail/dst-bad-assign-2.rs
+2
-0
src/test/compile-fail/dst-bad-assign.rs
src/test/compile-fail/dst-bad-assign.rs
+2
-0
src/test/compile-fail/dst-rvalue.rs
src/test/compile-fail/dst-rvalue.rs
+2
-0
src/test/compile-fail/fn-trait-formatting.rs
src/test/compile-fail/fn-trait-formatting.rs
+1
-0
src/test/compile-fail/infinite-autoderef.rs
src/test/compile-fail/infinite-autoderef.rs
+2
-0
src/test/compile-fail/issue-10291.rs
src/test/compile-fail/issue-10291.rs
+2
-0
src/test/compile-fail/issue-10398.rs
src/test/compile-fail/issue-10398.rs
+2
-0
src/test/compile-fail/issue-11192.rs
src/test/compile-fail/issue-11192.rs
+2
-0
src/test/compile-fail/issue-11515.rs
src/test/compile-fail/issue-11515.rs
+2
-0
src/test/compile-fail/issue-11844.rs
src/test/compile-fail/issue-11844.rs
+2
-0
src/test/compile-fail/issue-11925.rs
src/test/compile-fail/issue-11925.rs
+2
-0
src/test/compile-fail/issue-12127.rs
src/test/compile-fail/issue-12127.rs
+2
-0
src/test/compile-fail/issue-12470.rs
src/test/compile-fail/issue-12470.rs
+2
-0
src/test/compile-fail/issue-14915.rs
src/test/compile-fail/issue-14915.rs
+2
-0
src/test/compile-fail/issue-17263.rs
src/test/compile-fail/issue-17263.rs
+2
-0
src/test/compile-fail/issue-17441.rs
src/test/compile-fail/issue-17441.rs
+2
-0
src/test/compile-fail/issue-17651.rs
src/test/compile-fail/issue-17651.rs
+2
-0
src/test/compile-fail/issue-17913.rs
src/test/compile-fail/issue-17913.rs
+3
-0
src/test/compile-fail/issue-18783.rs
src/test/compile-fail/issue-18783.rs
+2
-0
src/test/compile-fail/issue-3763.rs
src/test/compile-fail/issue-3763.rs
+1
-0
src/test/compile-fail/issue-4335.rs
src/test/compile-fail/issue-4335.rs
+1
-0
src/test/compile-fail/issue-5439.rs
src/test/compile-fail/issue-5439.rs
+1
-0
src/test/compile-fail/issue-5543.rs
src/test/compile-fail/issue-5543.rs
+2
-0
src/test/compile-fail/issue-6801.rs
src/test/compile-fail/issue-6801.rs
+1
-0
src/test/compile-fail/issue-7013.rs
src/test/compile-fail/issue-7013.rs
+2
-0
src/test/compile-fail/issue-7364.rs
src/test/compile-fail/issue-7364.rs
+1
-0
src/test/compile-fail/kindck-impl-type-params-2.rs
src/test/compile-fail/kindck-impl-type-params-2.rs
+2
-0
src/test/compile-fail/kindck-impl-type-params.rs
src/test/compile-fail/kindck-impl-type-params.rs
+2
-0
src/test/compile-fail/kindck-inherited-copy-bound.rs
src/test/compile-fail/kindck-inherited-copy-bound.rs
+2
-0
src/test/compile-fail/lint-owned-heap-memory.rs
src/test/compile-fail/lint-owned-heap-memory.rs
+1
-1
src/test/compile-fail/liveness-move-call-arg.rs
src/test/compile-fail/liveness-move-call-arg.rs
+1
-0
src/test/compile-fail/liveness-move-in-loop.rs
src/test/compile-fail/liveness-move-in-loop.rs
+2
-0
src/test/compile-fail/liveness-move-in-while.rs
src/test/compile-fail/liveness-move-in-while.rs
+2
-0
src/test/compile-fail/liveness-use-after-move.rs
src/test/compile-fail/liveness-use-after-move.rs
+2
-0
src/test/compile-fail/macros-nonfatal-errors.rs
src/test/compile-fail/macros-nonfatal-errors.rs
+0
-3
src/test/compile-fail/map-types.rs
src/test/compile-fail/map-types.rs
+2
-0
src/test/compile-fail/move-out-of-tuple-field.rs
src/test/compile-fail/move-out-of-tuple-field.rs
+2
-0
src/test/compile-fail/moves-based-on-type-move-out-of-closure-env-issue-1965.rs
...moves-based-on-type-move-out-of-closure-env-issue-1965.rs
+2
-0
src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs
...le-fail/moves-based-on-type-no-recursive-stack-closure.rs
+1
-0
src/test/compile-fail/moves-based-on-type-tuple.rs
src/test/compile-fail/moves-based-on-type-tuple.rs
+1
-0
src/test/compile-fail/moves-sru-moved-field.rs
src/test/compile-fail/moves-sru-moved-field.rs
+1
-0
src/test/compile-fail/mut-cross-borrowing.rs
src/test/compile-fail/mut-cross-borrowing.rs
+2
-0
src/test/compile-fail/occurs-check-2.rs
src/test/compile-fail/occurs-check-2.rs
+1
-0
src/test/compile-fail/occurs-check.rs
src/test/compile-fail/occurs-check.rs
+1
-0
src/test/compile-fail/region-object-lifetime-in-coercion.rs
src/test/compile-fail/region-object-lifetime-in-coercion.rs
+2
-0
src/test/compile-fail/regions-close-associated-type-into-object.rs
...compile-fail/regions-close-associated-type-into-object.rs
+2
-0
src/test/compile-fail/regions-close-object-into-object.rs
src/test/compile-fail/regions-close-object-into-object.rs
+1
-0
src/test/compile-fail/regions-close-over-borrowed-ref-in-obj.rs
...st/compile-fail/regions-close-over-borrowed-ref-in-obj.rs
+2
-0
src/test/compile-fail/regions-close-over-type-parameter-1.rs
src/test/compile-fail/regions-close-over-type-parameter-1.rs
+2
-0
src/test/compile-fail/regions-close-over-type-parameter-2.rs
src/test/compile-fail/regions-close-over-type-parameter-2.rs
+2
-0
src/test/compile-fail/regions-close-over-type-parameter-multiple.rs
...ompile-fail/regions-close-over-type-parameter-multiple.rs
+2
-0
src/test/compile-fail/regions-close-param-into-object.rs
src/test/compile-fail/regions-close-param-into-object.rs
+1
-0
src/test/compile-fail/regions-nested-fns.rs
src/test/compile-fail/regions-nested-fns.rs
+2
-0
src/test/compile-fail/regions-proc-bound-capture.rs
src/test/compile-fail/regions-proc-bound-capture.rs
+2
-0
src/test/compile-fail/regions-steal-closure.rs
src/test/compile-fail/regions-steal-closure.rs
+1
-0
src/test/compile-fail/regions-trait-1.rs
src/test/compile-fail/regions-trait-1.rs
+1
-0
src/test/compile-fail/regions-trait-variance.rs
src/test/compile-fail/regions-trait-variance.rs
+2
-0
src/test/compile-fail/shadowed-type-parameter.rs
src/test/compile-fail/shadowed-type-parameter.rs
+3
-1
src/test/compile-fail/static-mut-not-constant.rs
src/test/compile-fail/static-mut-not-constant.rs
+1
-0
src/test/compile-fail/static-region-bound.rs
src/test/compile-fail/static-region-bound.rs
+1
-0
src/test/compile-fail/syntax-extension-bytes-non-ascii-char-literal.rs
...ile-fail/syntax-extension-bytes-non-ascii-char-literal.rs
+0
-14
src/test/compile-fail/syntax-extension-bytes-too-large-integer-literal.rs
...-fail/syntax-extension-bytes-too-large-integer-literal.rs
+0
-14
src/test/compile-fail/syntax-extension-bytes-too-large-u8-literal.rs
...mpile-fail/syntax-extension-bytes-too-large-u8-literal.rs
+0
-14
src/test/compile-fail/syntax-extension-bytes-too-small-integer-literal.rs
...-fail/syntax-extension-bytes-too-small-integer-literal.rs
+0
-14
src/test/compile-fail/syntax-extension-bytes-too-small-u8-literal.rs
...mpile-fail/syntax-extension-bytes-too-small-u8-literal.rs
+0
-14
src/test/compile-fail/syntax-extension-bytes-unsupported-literal.rs
...ompile-fail/syntax-extension-bytes-unsupported-literal.rs
+0
-14
src/test/compile-fail/trait-coercion-generic-bad.rs
src/test/compile-fail/trait-coercion-generic-bad.rs
+1
-0
src/test/compile-fail/trait-coercion-generic-regions.rs
src/test/compile-fail/trait-coercion-generic-regions.rs
+1
-0
src/test/compile-fail/trait-test-2.rs
src/test/compile-fail/trait-test-2.rs
+1
-0
src/test/compile-fail/ufcs-explicit-self-bad.rs
src/test/compile-fail/ufcs-explicit-self-bad.rs
+2
-0
src/test/compile-fail/unboxed-closure-illegal-move.rs
src/test/compile-fail/unboxed-closure-illegal-move.rs
+1
-0
src/test/compile-fail/unique-object-noncopyable.rs
src/test/compile-fail/unique-object-noncopyable.rs
+1
-0
src/test/compile-fail/unique-pinned-nocopy.rs
src/test/compile-fail/unique-pinned-nocopy.rs
+2
-0
src/test/compile-fail/unique-unique-kind.rs
src/test/compile-fail/unique-unique-kind.rs
+1
-0
src/test/compile-fail/unique-vec-res.rs
src/test/compile-fail/unique-vec-res.rs
+2
-0
src/test/compile-fail/use-after-move-implicity-coerced-object.rs
...t/compile-fail/use-after-move-implicity-coerced-object.rs
+2
-0
src/test/compile-fail/use-after-move-self.rs
src/test/compile-fail/use-after-move-self.rs
+1
-0
src/test/debuginfo/borrowed-struct.rs
src/test/debuginfo/borrowed-struct.rs
+1
-0
src/test/debuginfo/borrowed-tuple.rs
src/test/debuginfo/borrowed-tuple.rs
+1
-0
src/test/debuginfo/borrowed-unique-basic.rs
src/test/debuginfo/borrowed-unique-basic.rs
+1
-0
src/test/debuginfo/box.rs
src/test/debuginfo/box.rs
+1
-0
src/test/debuginfo/boxed-struct.rs
src/test/debuginfo/boxed-struct.rs
+1
-0
src/test/debuginfo/closure-in-generic-function.rs
src/test/debuginfo/closure-in-generic-function.rs
+1
-0
src/test/debuginfo/destructured-fn-argument.rs
src/test/debuginfo/destructured-fn-argument.rs
+1
-0
src/test/debuginfo/destructured-for-loop-variable.rs
src/test/debuginfo/destructured-for-loop-variable.rs
+1
-0
src/test/debuginfo/destructured-local.rs
src/test/debuginfo/destructured-local.rs
+1
-0
src/test/debuginfo/generic-method-on-generic-struct.rs
src/test/debuginfo/generic-method-on-generic-struct.rs
+1
-0
src/test/debuginfo/method-on-enum.rs
src/test/debuginfo/method-on-enum.rs
+1
-0
src/test/debuginfo/method-on-generic-struct.rs
src/test/debuginfo/method-on-generic-struct.rs
+1
-0
src/test/debuginfo/method-on-struct.rs
src/test/debuginfo/method-on-struct.rs
+1
-0
src/test/debuginfo/method-on-trait.rs
src/test/debuginfo/method-on-trait.rs
+1
-0
src/test/debuginfo/method-on-tuple-struct.rs
src/test/debuginfo/method-on-tuple-struct.rs
+1
-0
src/test/debuginfo/recursive-struct.rs
src/test/debuginfo/recursive-struct.rs
+1
-0
src/test/debuginfo/self-in-default-method.rs
src/test/debuginfo/self-in-default-method.rs
+1
-0
src/test/debuginfo/self-in-generic-default-method.rs
src/test/debuginfo/self-in-generic-default-method.rs
+1
-0
src/test/debuginfo/trait-pointers.rs
src/test/debuginfo/trait-pointers.rs
+1
-0
src/test/debuginfo/type-names.rs
src/test/debuginfo/type-names.rs
+1
-0
src/test/debuginfo/unique-enum.rs
src/test/debuginfo/unique-enum.rs
+1
-0
src/test/debuginfo/var-captured-in-nested-closure.rs
src/test/debuginfo/var-captured-in-nested-closure.rs
+1
-0
src/test/debuginfo/var-captured-in-sendable-closure.rs
src/test/debuginfo/var-captured-in-sendable-closure.rs
+1
-1
src/test/debuginfo/var-captured-in-stack-closure.rs
src/test/debuginfo/var-captured-in-stack-closure.rs
+1
-1
src/test/run-make/save-analysis/foo.rs
src/test/run-make/save-analysis/foo.rs
+2
-0
src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs
src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs
+1
-0
src/test/run-pass-valgrind/dst-dtor-1.rs
src/test/run-pass-valgrind/dst-dtor-1.rs
+2
-0
src/test/run-pass-valgrind/dst-dtor-2.rs
src/test/run-pass-valgrind/dst-dtor-2.rs
+2
-0
src/test/run-pass/box-new.rs
src/test/run-pass/box-new.rs
+2
-3
src/test/run-pass/bytes-macro-static.rs
src/test/run-pass/bytes-macro-static.rs
+0
-21
src/test/run-pass/cfg_attr.rs
src/test/run-pass/cfg_attr.rs
+11
-11
src/test/run-pass/ext-expand-inner-exprs.rs
src/test/run-pass/ext-expand-inner-exprs.rs
+2
-2
src/test/run-pass/syntax-extension-bytes.rs
src/test/run-pass/syntax-extension-bytes.rs
+0
-28
未找到文件。
src/doc/guide-error-handling.md
浏览文件 @
0dc48b47
...
...
@@ -147,10 +147,10 @@ for all but the most trivial of situations.
Here's an example of using
`Result`
:
```
rust
#[deriv
ing
(Show)]
#[deriv
e
(Show)]
enum
Version
{
Version1
,
Version2
}
#[deriv
ing
(Show)]
#[deriv
e
(Show)]
enum
ParseError
{
InvalidHeaderLength
,
InvalidVersion
}
fn
parse_version
(
header
:
&
[
u8
])
->
Result
<
Version
,
ParseError
>
{
...
...
src/doc/guide-ffi.md
浏览文件 @
0dc48b47
...
...
@@ -262,6 +262,7 @@ referenced Rust object.
Rust code:
~~~~
no_run
# use std::boxed::Box;
#[repr(C)]
struct RustObject {
...
...
@@ -286,7 +287,7 @@ extern {
fn main() {
// Create the object that will be referenced in the callback
let mut rust_object =
box RustObject { a: 5 }
;
let mut rust_object =
Box::new(RustObject { a: 5 })
;
unsafe {
register_callback(&mut *rust_object, callback);
...
...
src/doc/guide-ownership.md
浏览文件 @
0dc48b47
...
...
@@ -81,27 +81,29 @@ therefore deallocates the memory for you. Here's the equivalent example in
Rust:
```
rust
# use std::boxed::Box;
{
let
x
=
box
5
i
;
let
x
=
Box
::
new
(
5
i
)
;
}
```
The
`
box`
keyword creates a
`Box<T>`
(specifically
`Box<int>`
in this case) by
allocating a small segment of memory on the heap with enough space to fit an
`int`
. But where in the code is the box deallocated? We said before that we
must have a deallocation for each allocation. Rust handles this for you. It
The
`
Box::new`
function creates a
`Box<T>`
(specifically
`Box<int>`
in this
case) by allocating a small segment of memory on the heap with enough space to
fit an
`int`
. But where in the code is the box deallocated? We said before that
we
must have a deallocation for each allocation. Rust handles this for you. It
knows that our handle,
`x`
, is the owning reference to our box. Rust knows that
`x`
will go out of scope at the end of the block, and so it inserts a call to
deallocate the memory at the end of the scope. Because the compiler does this
for us, it's impossible to forget. We always have exactly one deallocation
paired
with each of our allocations.
for us, it's impossible to forget. We always have exactly one deallocation
paired
with each of our allocations.
This is pretty straightforward, but what happens when we want to pass our box
to a function? Let's look at some code:
```
rust
# use std::boxed::Box;
fn
main
()
{
let
x
=
box
5
i
;
let
x
=
Box
::
new
(
5
i
)
;
add_one
(
x
);
}
...
...
@@ -115,8 +117,9 @@ This code works, but it's not ideal. For example, let's add one more line of
code, where we print out the value of
`x`
:
```
{rust,ignore}
# use std::boxed::Box;
fn main() {
let x =
box 5i
;
let x =
Box::new(5i)
;
add_one(x);
...
...
@@ -148,8 +151,9 @@ To fix this, we can have `add_one` give ownership back when it's done with the
box:
```
rust
# use std::boxed::Box;
fn
main
()
{
let
x
=
box
5
i
;
let
x
=
Box
::
new
(
5
i
)
;
let
y
=
add_one
(
x
);
...
...
src/doc/guide-pointers.md
浏览文件 @
0dc48b47
...
...
@@ -455,12 +455,13 @@ fn rc_succ(x: Rc<int>) -> int { *x + 1 }
Note that the caller of your function will have to modify their calls slightly:
```
{rust}
# use std::boxed::Box;
use std::rc::Rc;
fn succ(x: &int) -> int { *x + 1 }
let ref_x = &5i;
let box_x =
box 5i
;
let box_x =
Box::new(5i)
;
let rc_x = Rc::new(5i);
succ(ref_x);
...
...
@@ -477,24 +478,17 @@ those contents.
heap allocation in Rust. Creating a box looks like this:
```
{rust}
let x = box(std::boxed::HEAP) 5i;
# use std::boxed::Box;
let x = Box::new(5i);
```
`box`
is a keyword that does 'placement new,' which we'll talk about in a bit.
`box`
will be useful for creating a number of heap-allocated types, but is not
quite finished yet. In the meantime,
`box`
's type defaults to
`std::boxed::HEAP`
, and so you can leave it off:
```
{rust}
let x = box 5i;
```
As you might assume from the
`HEAP`
, boxes are heap allocated. They are
deallocated automatically by Rust when they go out of scope:
Boxes are heap allocated and they are deallocated automatically by Rust when
they go out of scope:
```
{rust}
# use std::boxed::Box;
{
let x =
box 5i
;
let x =
Box::new(5i)
;
// stuff happens
...
...
@@ -513,8 +507,9 @@ You don't need to fully grok the theory of affine types or regions to grok
boxes, though. As a rough approximation, you can treat this Rust code:
```
{rust}
# use std::boxed::Box;
{
let x =
box 5i
;
let x =
Box::new(5i)
;
// stuff happens
}
...
...
@@ -553,12 +548,13 @@ for more detail on how lifetimes work.
Using boxes and references together is very common. For example:
```
{rust}
# use std::boxed::Box;
fn add_one(x: &int) -> int {
*x + 1
}
fn main() {
let x =
box 5i
;
let x =
Box::new(5i)
;
println!("{}", add_one(&*x));
}
...
...
@@ -570,12 +566,13 @@ function, and since it's only reading the value, allows it.
We can borrow
`x`
multiple times, as long as it's not simultaneous:
```
{rust}
# use std::boxed::Box;
fn add_one(x: &int) -> int {
*x + 1
}
fn main() {
let x =
box 5i
;
let x =
Box::new(5i)
;
println!("{}", add_one(&*x));
println!("{}", add_one(&*x));
...
...
@@ -586,12 +583,13 @@ fn main() {
Or as long as it's not a mutable borrow. This will error:
```
{rust,ignore}
# use std::boxed::Box;
fn add_one(x: &mut int) -> int {
*x + 1
}
fn main() {
let x =
box 5i
;
let x =
Box::new(5i)
;
println!("{}", add_one(&*x)); // error: cannot borrow immutable dereference
// of `&`-pointer as mutable
...
...
@@ -612,14 +610,15 @@ Sometimes, you need a recursive data structure. The simplest is known as a
```
{rust}
#[deriving(Show)]
# use std::boxed::Box;
#[derive(Show)]
enum List<T> {
Cons(T, Box<List<T>>),
Nil,
}
fn main() {
let list: List<int> = List::Cons(1,
box List::Cons(2, box List::Cons(3, box List::Nil
)));
let list: List<int> = List::Cons(1,
Box::new(List::Cons(2, Box::new(List::Cons(3, Box::new(List::Nil)))
)));
println!("{:?}", list);
}
```
...
...
@@ -627,7 +626,7 @@ fn main() {
This prints:
```
text
Cons(1,
box Cons(2, box Cons(3, box Nil
)))
Cons(1,
Box(Cons(2, Box(Cons(3, Box(Nil)))
)))
```
The reference to another
`List`
inside of the
`Cons`
enum variant must be a box,
...
...
@@ -667,6 +666,7 @@ In many languages with pointers, you'd return a pointer from a function
so as to avoid copying a large data structure. For example:
```
{rust}
# use std::boxed::Box;
struct BigStruct {
one: int,
two: int,
...
...
@@ -675,15 +675,15 @@ struct BigStruct {
}
fn foo(x: Box<BigStruct>) -> Box<BigStruct> {
return
box *x
;
return
Box::new(*x)
;
}
fn main() {
let x =
box
BigStruct {
let x =
Box::new(
BigStruct {
one: 1,
two: 2,
one_hundred: 100,
};
}
)
;
let y = foo(x);
}
...
...
@@ -695,6 +695,7 @@ than the hundred `int`s that make up the `BigStruct`.
This is an antipattern in Rust. Instead, write this:
```
{rust}
# use std::boxed::Box;
struct BigStruct {
one: int,
two: int,
...
...
@@ -707,13 +708,13 @@ fn foo(x: Box<BigStruct>) -> BigStruct {
}
fn main() {
let x =
box
BigStruct {
let x =
Box::new(
BigStruct {
one: 1,
two: 2,
one_hundred: 100,
};
}
)
;
let y =
box foo(x
);
let y =
Box::new(foo(x)
);
}
```
...
...
src/doc/guide-unsafe.md
浏览文件 @
0dc48b47
...
...
@@ -197,6 +197,7 @@ extern crate libc;
use libc::{c_void, size_t, malloc, free};
use std::mem;
use std::ptr;
# use std::boxed::Box;
// Define a wrapper around the handle returned by the foreign code.
// Unique<T> has the same semantics as Box<T>
...
...
@@ -265,7 +266,7 @@ impl<T: Send> Drop for Unique<T> {
// A comparison between the built-in `Box` and this reimplementation
fn main() {
{
let mut x =
box 5i
;
let mut x =
Box::new(5i)
;
*x = 10;
} // `x` is freed here
...
...
@@ -653,7 +654,7 @@ sugar for dynamic allocations via `malloc` and `free`:
```
#![no_std]
#![feature(lang_items)]
#![feature(lang_items
, box_syntax
)]
extern crate libc;
...
...
src/doc/guide.md
浏览文件 @
0dc48b47
...
...
@@ -3802,18 +3802,19 @@ enum List { // error: illegal recursive enum type
But the compiler complains that the type is recursive, that is, it could be
arbitrarily large. To remedy this, Rust provides a fixed-size container called
a
**
box**
that can hold any type. You can box up any value with the
`box
`
keyword
. Our boxed List gets the type
`Box<List>`
(more on the notation when we
a
**
Box**
that can hold any type. You can box up any value with the
`Box::new
`
function
. Our boxed List gets the type
`Box<List>`
(more on the notation when we
get to generics):
```
{rust}
# use std::boxed::Box;
enum List {
Node(u32, Box<List>),
Nil
}
fn main() {
let list = List::Node(0,
box List::Node(1, box List::Nil
));
let list = List::Node(0,
Box::new(List::Node(1, Box::new(List::Nil))
));
}
```
...
...
@@ -3826,8 +3827,9 @@ just like regular references. This (rather silly) example dynamically allocates
an integer
`5`
and makes
`x`
a pointer to it:
```
{rust}
# use std::boxed::Box;
{
let x =
box 5
;
let x =
Box::new(5)
;
println!("{}", *x); // Prints 5
}
```
...
...
@@ -3858,7 +3860,8 @@ Boxes are the sole owner of their contents, so you cannot take a mutable
reference to them and then use the original box:
```
{rust,ignore}
let mut x = box 5;
# use std::boxed::Box;
let mut x = Box::new(5);
let y = &mut x;
*x; // you might expect 5, but this is actually an error
...
...
@@ -3879,7 +3882,8 @@ As long as `y` is borrowing the contents, we cannot use `x`. After `y` is
done borrowing the value, we can use it again. This works fine:
```
{rust}
let mut x = box 5;
# use std::boxed::Box;
let mut x = Box::new(5);
{
let y = &mut x;
...
...
src/doc/reference.md
浏览文件 @
0dc48b47
...
...
@@ -1588,10 +1588,11 @@ pointer values (pointing to a type for which an implementation of the given
trait is in scope) to pointers to the trait name, used as a type.
```
# use std::boxed::Box;
# trait Shape { }
# impl Shape for int { }
# let mycircle = 0i;
let myshape: Box<Shape> =
box mycircle
as Box<Shape>;
let myshape: Box<Shape> =
Box::new(mycircle)
as Box<Shape>;
```
The resulting value is a box containing the value that was cast, along with
...
...
@@ -1646,12 +1647,13 @@ fn radius_times_area<T: Circle>(c: T) -> f64 {
Likewise, supertrait methods may also be called on trait objects.
```
{.ignore}
# use std::boxed::Box;
# trait Shape { fn area(&self) -> f64; }
# trait Circle : Shape { fn radius(&self) -> f64; }
# impl Shape for int { fn area(&self) -> f64 { 0.0 } }
# impl Circle for int { fn radius(&self) -> f64 { 0.0 } }
# let mycircle = 0;
let mycircle =
box mycircle
as Box<Circle>;
let mycircle =
Box::new(mycircle)
as Box<Circle>;
let nonsense = mycircle.radius() * mycircle.area();
```
...
...
@@ -3376,14 +3378,17 @@ stands for a *single* data field, whereas a wildcard `..` stands for *all* the
fields of a particular variant. For example:
```
#![feature(box_syntax)]
enum List<X> { Nil, Cons(X, Box<List<X>>) }
let x: List<int> = List::Cons(10, box List::Cons(11, box List::Nil));
fn main() {
let x: List<int> = List::Cons(10, box List::Cons(11, box List::Nil));
match x {
List::Cons(_, box List::Nil) => panic!("singleton list"),
List::Cons(..) => return,
List::Nil => panic!("empty list")
match x {
List::Cons(_, box List::Nil) => panic!("singleton list"),
List::Cons(..) => return,
List::Nil => panic!("empty list")
}
}
```
...
...
@@ -3436,25 +3441,28 @@ the inside of the match.
An example of a
`match`
expression:
```
#![feature(box_syntax)]
# fn process_pair(a: int, b: int) { }
# fn process_ten() { }
enum List<X> { Nil, Cons(X, Box<List<X>>) }
let x: List<int> = List::Cons(10, box List::Cons(11, box List::Nil));
fn main() {
let x: List<int> = List::Cons(10, box List::Cons(11, box List::Nil));
match x {
List::Cons(a, box List::Cons(b, _)) => {
process_pair(a, b);
}
List::Cons(10, _) => {
process_ten();
}
List::Nil => {
return;
}
_ => {
panic!();
match x {
List::Cons(a, box List::Cons(b, _)) => {
process_pair(a, b);
}
List::Cons(10, _) => {
process_ten();
}
List::Nil => {
return;
}
_ => {
panic!();
}
}
}
```
...
...
@@ -3468,6 +3476,8 @@ Subpatterns can also be bound to variables by the use of the syntax `variable @
subpattern`
. For example:
```
#![feature(box_syntax)]
enum List { Nil, Cons(uint, Box<List>) }
fn is_sorted(list: &List) -> bool {
...
...
@@ -3781,12 +3791,13 @@ enclosing `enum` or `struct` type itself. Such recursion has restrictions:
An example of a
*recursive*
type and its use:
```
# use std::boxed::Box;
enum List<T> {
Nil,
Cons(T, Box<List<T>>)
Nil,
Cons(T, Box<List<T>>)
}
let a: List<int> = List::Cons(7,
box List::Cons(13, box List::Nil
));
let a: List<int> = List::Cons(7,
Box::new(List::Cons(13, Box::new(List::Nil))
));
```
### Pointer types
...
...
@@ -3893,6 +3904,7 @@ implementation of `R`, and the pointer value of `E`.
An example of an object type:
```
# use std::boxed::Box;
trait Printable {
fn stringify(&self) -> String;
}
...
...
@@ -3906,7 +3918,7 @@ fn print(a: Box<Printable>) {
}
fn main() {
print(
box 10i
as Box<Printable>);
print(
Box::new(10i)
as Box<Printable>);
}
```
...
...
@@ -4100,7 +4112,8 @@ the type of a box is `std::owned::Box<T>`.
An example of a box type and value:
```
let x: Box<int> = box 10;
# use std::boxed::Box;
let x: Box<int> = Box::new(10);
```
Box values exist in 1:1 correspondence with their heap allocation, copying a
...
...
@@ -4109,7 +4122,8 @@ copy of a box to move ownership of the value. After a value has been moved,
the source location cannot be used unless it is reinitialized.
```
let x: Box<int> = box 10;
# use std::boxed::Box;
let x: Box<int> = Box::new(10);
let y = x;
// attempting to use `x` will result in an error here
```
...
...
src/liballoc/boxed.rs
浏览文件 @
0dc48b47
...
...
@@ -33,12 +33,15 @@
/// The following two examples are equivalent:
///
/// ```rust
/// #![feature(box_syntax)]
/// use std::boxed::HEAP;
///
/// fn main() {
/// # struct Bar;
/// # impl Bar { fn new(_a: int) { } }
/// let foo = box(HEAP) Bar::new(2);
/// let foo = box Bar::new(2);
/// let foo = box(HEAP) Bar::new(2);
/// let foo = box Bar::new(2);
/// }
/// ```
#[lang
=
"exchange_heap"
]
#[experimental
=
"may be renamed; uncertain about custom allocator design"
]
...
...
@@ -49,10 +52,9 @@
#[stable]
pub
struct
Box
<
T
>
(
Unique
<
T
>
);
#[unstable]
impl
<
T
>
Box
<
T
>
{
/// Moves `x` into a freshly allocated box on the global exchange heap.
#[
un
stable]
#[stable]
pub
fn
new
(
x
:
T
)
->
Box
<
T
>
{
box
x
}
...
...
src/liballoc/heap.rs
浏览文件 @
0dc48b47
...
...
@@ -125,7 +125,7 @@ unsafe fn exchange_free(ptr: *mut u8, old_size: uint, align: uint) {
not(feature
=
"external_crate"
),
any(target_arch
=
"x86"
,
target_arch
=
"x86_64"
,
target_arch
=
"aarch64"
))]
target_arch
=
"aarch64"
))
)
]
const
MIN_ALIGN
:
uint
=
16
;
#[cfg(feature
=
"external_funcs"
)]
...
...
src/libarena/lib.rs
浏览文件 @
0dc48b47
...
...
@@ -28,8 +28,10 @@
html_favicon_url
=
"http://www.rust-lang.org/favicon.ico"
,
html_root_url
=
"http://doc.rust-lang.org/nightly/"
)]
#![allow(unknown_features)]
#![feature(unsafe_destructor)]
#![feature(unboxed_closures)]
#![feature(box_syntax)]
#![allow(missing_docs)]
extern
crate
alloc
;
...
...
src/libcollections/macros.rs
浏览文件 @
0dc48b47
...
...
@@ -13,7 +13,7 @@
#[stable]
macro_rules!
vec
{
(
$
(
$x:expr
),
*
)
=>
({
let
xs
:
$crate
::
boxed
::
Box
<
[
_
]
>
=
box
[
$
(
$x
),
*
]
;
let
xs
:
$crate
::
boxed
::
Box
<
[
_
]
>
=
$crate
::
boxed
::
Box
::
new
([
$
(
$x
),
*
])
;
$crate
::
slice
::
SliceExt
::
into_vec
(
xs
)
});
(
$
(
$x:expr
,)
*
)
=>
(
vec!
[
$
(
$x
),
*
])
...
...
src/libcollections/slice.rs
浏览文件 @
0dc48b47
...
...
@@ -245,7 +245,7 @@ fn rsplitn<F>(&self, n: uint, pred: F) -> RSplitN<Self::Item, F>
/// ```rust
/// let v = &[1i, 2, 3, 4];
/// for win in v.windows(2) {
/// println!("{}", win);
/// println!("{
:?
}", win);
/// }
/// ```
#[stable]
...
...
@@ -268,7 +268,7 @@ fn rsplitn<F>(&self, n: uint, pred: F) -> RSplitN<Self::Item, F>
/// ```rust
/// let v = &[1i, 2, 3, 4, 5];
/// for win in v.chunks(2) {
/// println!("{}", win);
/// println!("{
:?
}", win);
/// }
/// ```
#[stable]
...
...
@@ -554,7 +554,7 @@ fn rsplitn_mut<F>(&mut self, n: uint, pred: F) -> RSplitNMut<Self::Item, F>
/// let mut perms = v.permutations();
///
/// for p in perms {
/// println!("{}", p);
/// println!("{
:?
}", p);
/// }
/// ```
///
...
...
src/libcore/intrinsics.rs
浏览文件 @
0dc48b47
...
...
@@ -42,6 +42,7 @@
#![experimental]
#![allow(missing_docs)]
#[cfg(not(stage0))]
use
marker
::
Sized
;
pub
type
GlueFn
=
extern
"Rust"
fn
(
*
const
i8
);
...
...
src/libcore/iter.rs
浏览文件 @
0dc48b47
...
...
@@ -2804,7 +2804,7 @@ fn next<T, F>(st: &mut IterateState<T, F>) -> Option<T> where
T
:
Clone
,
F
:
FnMut
(
T
)
->
T
,
{
let
&
(
ref
mut
f
,
ref
mut
val
,
ref
mut
first
)
=
st
;
let
&
mut
(
ref
mut
f
,
ref
mut
val
,
ref
mut
first
)
=
st
;
if
*
first
{
*
first
=
false
;
}
else
{
...
...
src/libcore/lib.rs
浏览文件 @
0dc48b47
...
...
@@ -58,6 +58,7 @@
#![no_std]
#![allow(unknown_features,
raw_pointer_derive)]
#![cfg_attr(stage0,
allow(unused_attributes))]
#![feature(intrinsics,
lang_items)]
#![feature(simd,
unsafe_destructor,
slicing_syntax)]
#![feature(unboxed_closures)]
...
...
src/libcore/num/isize.rs
浏览文件 @
0dc48b47
...
...
@@ -17,5 +17,9 @@
#![stable]
#![doc(primitive
=
"isize"
)]
#[cfg(target_word_size
=
"32"
)]
int_module!
{
isize
,
32
}
#[cfg(target_word_size
=
"64"
)]
int_module!
{
isize
,
64
}
#[cfg(any(all(stage0,
target_word_size
=
"32"
),
all(not(stage0),
target_pointer_width
=
"32"
)))]
int_module!
{
isize
,
32
}
#[cfg(any(all(stage0,
target_word_size
=
"64"
),
all(not(stage0),
target_pointer_width
=
"64"
)))]
int_module!
{
isize
,
64
}
src/libcore/option.rs
浏览文件 @
0dc48b47
...
...
@@ -66,10 +66,11 @@
//! not (`None`).
//!
//! ```
//! # use std::boxed::Box;
//! let optional: Option<Box<int>> = None;
//! check_optional(&optional);
//!
//! let optional: Option<Box<int>> = Some(
box 9000
);
//! let optional: Option<Box<int>> = Some(
Box::new(9000)
);
//! check_optional(&optional);
//!
//! fn check_optional(optional: &Option<Box<int>>) {
...
...
@@ -148,7 +149,6 @@
use
clone
::
Clone
;
use
cmp
::{
Eq
,
Ord
};
use
default
::
Default
;
use
fmt
;
use
iter
::{
ExactSizeIterator
};
use
iter
::{
Iterator
,
IteratorExt
,
DoubleEndedIterator
,
FromIterator
};
use
mem
;
...
...
src/libcore/ptr.rs
浏览文件 @
0dc48b47
...
...
@@ -46,12 +46,13 @@
//! though unsafely, transformed from one type to the other.
//!
//! ```
//! # use std::boxed::Box;
//! use std::mem;
//!
//! unsafe {
//! let my_num: Box<int> =
box 10
;
//! let my_num: Box<int> =
Box::new(10)
;
//! let my_num: *const int = mem::transmute(my_num);
//! let my_speed: Box<int> =
box 88
;
//! let my_speed: Box<int> =
Box::new(88)
;
//! let my_speed: *mut int = mem::transmute(my_speed);
//!
//! // By taking ownership of the original `Box<T>` though
...
...
src/libcoretest/hash/mod.rs
浏览文件 @
0dc48b47
...
...
@@ -113,6 +113,5 @@ fn hash<T: Hash<CustomHasher>>(t: &T) -> u64 {
::
std
::
hash
::
hash
::
<
_
,
CustomHasher
>
(
t
)
}
let
custom
=
Custom
{
hash
:
5
};
assert_eq!
(
hash
(
&
Custom
{
hash
:
5
}),
5
);
}
src/libcoretest/lib.rs
浏览文件 @
0dc48b47
...
...
@@ -7,8 +7,10 @@
// <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.
#![feature(globs,
unsafe_destructor,
slicing_syntax,
default_type_params)]
#![feature(unsafe_destructor,
slicing_syntax)]
#![feature(unboxed_closures)]
#![feature(box_syntax)]
extern
crate
core
;
extern
crate
test
;
...
...
src/libcoretest/result.rs
浏览文件 @
0dc48b47
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
core
::
iter
::
range
;
pub
fn
op1
()
->
Result
<
int
,
&
'static
str
>
{
Ok
(
666
)
}
pub
fn
op2
()
->
Result
<
int
,
&
'static
str
>
{
Err
(
"sadface"
)
}
...
...
src/librand/lib.rs
浏览文件 @
0dc48b47
...
...
@@ -194,7 +194,7 @@ fn gen<T: Rand>(&mut self) -> T {
///
/// let mut rng = thread_rng();
/// let x = rng.gen_iter::<uint>().take(10).collect::<Vec<uint>>();
/// println!("{}", x);
/// println!("{
:?
}", x);
/// println!("{:?}", rng.gen_iter::<(f64, bool)>().take(5)
/// .collect::<Vec<(f64, bool)>>());
/// ```
...
...
@@ -291,9 +291,9 @@ fn choose<'a, T>(&mut self, values: &'a [T]) -> Option<&'a T> {
/// let mut rng = thread_rng();
/// let mut y = [1i, 2, 3];
/// rng.shuffle(&mut y);
/// println!("{}", y.as_slice());
/// println!("{
:?
}", y.as_slice());
/// rng.shuffle(&mut y);
/// println!("{}", y.as_slice());
/// println!("{
:?
}", y.as_slice());
/// ```
fn
shuffle
<
T
>
(
&
mut
self
,
values
:
&
mut
[
T
])
{
let
mut
i
=
values
.len
();
...
...
src/librustc/lint/builtin.rs
浏览文件 @
0dc48b47
...
...
@@ -1918,7 +1918,7 @@ fn get_lints(&self) -> LintArray {
}
/// Forbids using the `#[feature(...)]` attribute
#[deriv
ing
(Copy)]
#[deriv
e
(Copy)]
pub
struct
UnstableFeatures
;
declare_lint!
(
UNSTABLE_FEATURES
,
Allow
,
...
...
src/librustc/lint/context.rs
浏览文件 @
0dc48b47
...
...
@@ -443,7 +443,7 @@ pub fn raw_emit_lint(sess: &Session, lint: &'static Lint,
}
for
note
in
note
.into_iter
()
{
sess
.note
(
note
.index
(
&
FullRange
)
);
sess
.note
(
&
note
[]
);
}
for
span
in
def
.into_iter
()
{
...
...
src/librustc/session/config.rs
浏览文件 @
0dc48b47
...
...
@@ -116,7 +116,7 @@ pub struct Options {
pub
unstable_features
:
UnstableFeatures
}
#[deriv
ing
(Clone,
Copy)]
#[deriv
e
(Clone,
Copy)]
pub
enum
UnstableFeatures
{
/// Hard errors for unstable features are active, as on
/// beta/stable channels.
...
...
src/librustc_back/lib.rs
浏览文件 @
0dc48b47
...
...
@@ -29,7 +29,8 @@
#![doc(html_logo_url
=
"http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png"
,
html_favicon_url
=
"http://www.rust-lang.org/favicon.ico"
,
html_root_url
=
"http://doc.rust-lang.org/nightly/"
)]
#![feature(slicing_syntax)]
#![allow(unknown_features)]
#![feature(slicing_syntax,
box_syntax)]
extern
crate
syntax
;
extern
crate
serialize
;
...
...
src/librustc_driver/test.rs
浏览文件 @
0dc48b47
...
...
@@ -61,7 +61,7 @@ fn remove_message(e: &mut ExpectErrorEmitter, msg: &str, lvl: Level) {
e
.messages
.remove
(
i
);
}
None
=>
{
panic!
(
"Unexpected error: {} Expected: {}"
,
panic!
(
"Unexpected error: {} Expected: {
:?
}"
,
msg
,
e
.messages
);
}
}
...
...
src/librustc_trans/trans/adt.rs
浏览文件 @
0dc48b47
...
...
@@ -51,7 +51,7 @@
use
llvm
::{
ValueRef
,
True
,
IntEQ
,
IntNE
};
use
back
::
abi
::
FAT_PTR_ADDR
;
use
middle
::
subst
;
use
middle
::
ty
::{
mod
,
Ty
,
UnboxedClosureTyper
};
use
middle
::
ty
::{
self
,
Ty
,
UnboxedClosureTyper
};
use
middle
::
ty
::
Disr
;
use
syntax
::
ast
;
use
syntax
::
attr
;
...
...
src/librustc_trans/trans/expr.rs
浏览文件 @
0dc48b47
...
...
@@ -1345,7 +1345,7 @@ pub fn with_field_tys<'tcx, R, F>(tcx: &ty::ctxt<'tcx>,
tcx
,
enum_id
,
variant_id
);
let
fields
=
struct_fields
(
tcx
,
variant_id
,
substs
);
let
fields
=
monomorphize
::
normalize_associated_type
(
tcx
,
&
fields
);
op
(
variant_info
.disr_val
,
&
fields
.index
[])
op
(
variant_info
.disr_val
,
&
fields
[])
}
_
=>
{
tcx
.sess
.bug
(
"resolve didn't map this expr to a
\
...
...
src/librustc_typeck/coherence/mod.rs
浏览文件 @
0dc48b47
...
...
@@ -68,9 +68,13 @@ fn get_base_type_def_id<'a, 'tcx>(inference_context: &InferCtxt<'a, 'tcx>,
Some
(
t
.principal_def_id
())
}
ty_uniq
(
_
)
=>
{
inference_context
.tcx.lang_items
.owned_box
()
}
ty_bool
|
ty_char
|
ty_int
(
..
)
|
ty_uint
(
..
)
|
ty_float
(
..
)
|
ty_str
(
..
)
|
ty_vec
(
..
)
|
ty_bare_fn
(
..
)
|
ty_tup
(
..
)
|
ty_param
(
..
)
|
ty_err
|
ty_open
(
..
)
|
ty_uniq
(
_
)
|
ty_param
(
..
)
|
ty_err
|
ty_open
(
..
)
|
ty_ptr
(
_
)
|
ty_rptr
(
_
,
_
)
|
ty_projection
(
..
)
=>
{
None
}
...
...
src/librustdoc/clean/mod.rs
浏览文件 @
0dc48b47
...
...
@@ -2454,7 +2454,7 @@ fn lang_struct(cx: &DocContext, did: Option<ast::DefId>,
}
/// An equality constraint on an associated type, e.g. `A=Bar` in `Foo<A=Bar>`
#[derive(Clone,
PartialEq,
RustcDecodable,
RustcEncodable)]
#[derive(Clone,
PartialEq,
RustcDecodable,
RustcEncodable
,
Show
)]
pub
struct
TypeBinding
{
pub
name
:
String
,
pub
ty
:
Type
...
...
src/libserialize/collection_impls.rs
浏览文件 @
0dc48b47
...
...
@@ -163,7 +163,7 @@ impl<K, V, S> Encodable for HashMap<K, V, S>
S
:
HashState
,
<
S
as
HashState
>
::
Hasher
:
Hasher
<
Output
=
u64
>
{
fn
encode
<
S
:
Encoder
>
(
&
self
,
e
:
&
mut
S
)
->
Result
<
(),
S
::
Error
>
{
fn
encode
<
E
:
Encoder
>
(
&
self
,
e
:
&
mut
E
)
->
Result
<
(),
E
::
Error
>
{
e
.emit_map
(
self
.len
(),
|
e
|
{
let
mut
i
=
0
;
for
(
key
,
val
)
in
self
.iter
()
{
...
...
@@ -201,7 +201,7 @@ impl<T, S> Encodable for HashSet<T, S>
S
:
HashState
,
<
S
as
HashState
>
::
Hasher
:
Hasher
<
Output
=
u64
>
{
fn
encode
<
S
:
Encoder
>
(
&
self
,
s
:
&
mut
S
)
->
Result
<
(),
S
::
Error
>
{
fn
encode
<
E
:
Encoder
>
(
&
self
,
s
:
&
mut
E
)
->
Result
<
(),
E
::
Error
>
{
s
.emit_seq
(
self
.len
(),
|
s
|
{
let
mut
i
=
0
;
for
e
in
self
.iter
()
{
...
...
src/libstd/fmt.rs
浏览文件 @
0dc48b47
...
...
@@ -175,7 +175,7 @@
//! use std::f64;
//! use std::num::Float;
//!
//! #[deriv
ing
(Show)]
//! #[deriv
e
(Show)]
//! struct Vector2D {
//! x: int,
//! y: int,
...
...
src/libstd/io/mod.rs
浏览文件 @
0dc48b47
...
...
@@ -1284,7 +1284,7 @@ fn flush(&mut self) -> IoResult<()> { (**self).flush() }
/// process_input(tee);
/// }
///
/// println!("input processed: {}", output);
/// println!("input processed: {
:?
}", output);
/// # }
/// ```
pub
struct
RefWriter
<
'a
,
W
:
'a
>
{
...
...
src/libstd/rand/mod.rs
浏览文件 @
0dc48b47
...
...
@@ -403,7 +403,7 @@ pub fn random<T: Rand>() -> T {
///
/// let mut rng = thread_rng();
/// let sample = sample(&mut rng, range(1i, 100), 5);
/// println!("{}", sample);
/// println!("{
:?
}", sample);
/// ```
pub
fn
sample
<
T
,
I
:
Iterator
<
Item
=
T
>
,
R
:
Rng
>
(
rng
:
&
mut
R
,
mut
iter
:
I
,
...
...
src/libstd/sys/windows/fs.rs
浏览文件 @
0dc48b47
...
...
@@ -270,7 +270,7 @@ fn prune(root: &Path, dirs: Vec<Path>) -> Vec<Path> {
return
Err
(
IoError
{
kind
:
io
::
InvalidInput
,
desc
:
"path was not valid UTF-16"
,
detail
:
Some
(
format!
(
"path was not valid UTF-16: {}"
,
filename
)),
detail
:
Some
(
format!
(
"path was not valid UTF-16: {
:?
}"
,
filename
)),
})
},
// FIXME #12056: Convert the UCS-2 to invalid utf-8 instead of erroring
}
...
...
src/libsyntax/ast.rs
浏览文件 @
0dc48b47
...
...
@@ -1730,11 +1730,8 @@ pub struct MacroDef {
#[cfg(test)]
mod
test
{
use
serialize
::
json
;
use
serialize
;
use
codemap
::
*
;
use
super
::
*
;
use
std
::
fmt
;
// are ASTs encodable?
#[test]
...
...
src/libsyntax/ext/expand.rs
浏览文件 @
0dc48b47
...
...
@@ -1295,7 +1295,7 @@ fn visit_mac(&mut self, mac: &ast::Mac) {
#[cfg(test)]
mod
test
{
use
super
::{
pattern_bindings
,
expand_crate
,
contains_macro_use
};
use
super
::{
pattern_bindings
,
expand_crate
};
use
super
::{
PatIdentFinder
,
IdentRenamer
,
PatIdentRenamer
,
ExpansionConfig
};
use
ast
;
use
ast
::{
Attribute_
,
AttrOuter
,
MetaWord
,
Name
};
...
...
@@ -1404,22 +1404,6 @@ fn test_ecfg() -> ExpansionConfig {
expand_crate
(
&
sess
,
test_ecfg
(),
vec!
(),
vec!
(),
crate_ast
);
}
// make a MetaWord outer attribute with the given name
fn
make_dummy_attr
(
s
:
&
str
)
->
ast
::
Attribute
{
Spanned
{
span
:
codemap
::
DUMMY_SP
,
node
:
Attribute_
{
id
:
attr
::
mk_attr_id
(),
style
:
AttrOuter
,
value
:
P
(
Spanned
{
node
:
MetaWord
(
token
::
intern_and_get_ident
(
s
)),
span
:
codemap
::
DUMMY_SP
,
}),
is_sugared_doc
:
false
,
}
}
}
fn
expand_crate_str
(
crate_str
:
String
)
->
ast
::
Crate
{
let
ps
=
parse
::
new_parse_sess
();
let
crate_ast
=
string_to_parser
(
&
ps
,
crate_str
)
.parse_crate_mod
();
...
...
@@ -1655,7 +1639,7 @@ fn run_renaming_test(t: &RenamingTest, test_idx: uint) {
let
varref_idents
:
Vec
<
ast
::
Ident
>
=
varref
.segments
.iter
()
.map
(|
s
|
s
.identifier
)
.collect
();
println!
(
"varref #{}: {}, resolves to {}"
,
idx
,
varref_idents
,
varref_name
);
println!
(
"varref #{}: {
:?
}, resolves to {}"
,
idx
,
varref_idents
,
varref_name
);
let
string
=
token
::
get_ident
(
final_varref_ident
);
println!
(
"varref's first segment's string:
\"
{}
\"
"
,
string
.get
());
println!
(
"binding #{}: {}, resolves to {}"
,
...
...
src/libsyntax/std_inject.rs
浏览文件 @
0dc48b47
...
...
@@ -107,19 +107,6 @@ fn fold_crate(&mut self, mut krate: ast::Crate) -> ast::Crate {
// `#![no_implicit_prelude]` at the crate level.
// fold_mod() will insert glob path.
if
!
no_prelude
(
&
krate
.attrs
[])
{
// only add `use std::prelude::*;` if there wasn't a
// `#![no_implicit_prelude]` at the crate level.
// fold_mod() will insert glob path.
let
globs_attr
=
attr
::
mk_attr_inner
(
attr
::
mk_attr_id
(),
attr
::
mk_list_item
(
InternedString
::
new
(
"feature"
),
vec!
(
attr
::
mk_word_item
(
InternedString
::
new
(
"globs"
)),
)));
// std_inject runs after feature checking so manually mark this attr
attr
::
mark_used
(
&
globs_attr
);
krate
.attrs
.push
(
globs_attr
);
krate
.module
=
self
.fold_mod
(
krate
.module
);
}
krate
...
...
src/test/auxiliary/lint_group_plugin_test.rs
浏览文件 @
0dc48b47
...
...
@@ -11,6 +11,7 @@
// force-host
#![feature(plugin_registrar)]
#![feature(box_syntax)]
extern
crate
syntax
;
...
...
src/test/auxiliary/lint_plugin_test.rs
浏览文件 @
0dc48b47
...
...
@@ -11,6 +11,7 @@
// force-host
#![feature(plugin_registrar)]
#![feature(box_syntax)]
extern
crate
syntax
;
...
...
src/test/auxiliary/macro_crate_test.rs
浏览文件 @
0dc48b47
...
...
@@ -11,6 +11,7 @@
// force-host
#![feature(plugin_registrar,
quote)]
#![feature(box_syntax)]
extern
crate
syntax
;
extern
crate
rustc
;
...
...
src/test/auxiliary/plugin_args.rs
浏览文件 @
0dc48b47
...
...
@@ -11,6 +11,7 @@
// force-host
#![feature(plugin_registrar)]
#![feature(box_syntax)]
extern
crate
syntax
;
extern
crate
rustc
;
...
...
src/test/auxiliary/plugin_crate_outlive_expansion_phase.rs
浏览文件 @
0dc48b47
...
...
@@ -11,6 +11,7 @@
// force-host
#![feature(plugin_registrar)]
#![feature(box_syntax)]
extern
crate
rustc
;
...
...
src/test/bench/msgsend-pipes-shared.rs
浏览文件 @
0dc48b47
...
...
@@ -103,6 +103,6 @@ fn main() {
args
.into_iter
()
.map
(|
x
|
x
.to_string
())
.collect
()
};
println!
(
"{}"
,
args
);
println!
(
"{
:?
}"
,
args
);
run
(
args
.as_slice
());
}
src/test/bench/msgsend-pipes.rs
浏览文件 @
0dc48b47
...
...
@@ -112,6 +112,6 @@ fn main() {
args
.clone
()
.into_iter
()
.map
(|
x
|
x
.to_string
())
.collect
()
};
println!
(
"{}"
,
args
);
println!
(
"{
:?
}"
,
args
);
run
(
args
.as_slice
());
}
src/test/bench/shootout-k-nucleotide-pipes.rs
浏览文件 @
0dc48b47
...
...
@@ -13,6 +13,8 @@
// multi tasking k-nucleotide
#![feature(box_syntax)]
use
std
::
ascii
::{
AsciiExt
,
OwnedAsciiExt
};
use
std
::
cmp
::
Ordering
::{
self
,
Less
,
Greater
,
Equal
};
use
std
::
collections
::
HashMap
;
...
...
@@ -62,7 +64,7 @@ fn sortKV(mut orig: Vec<(Vec<u8> ,f64)> ) -> Vec<(Vec<u8> ,f64)> {
let
mut
buffer
=
String
::
new
();
for
&
(
ref
k
,
v
)
in
pairs_sorted
.iter
()
{
buffer
.push_str
(
format!
(
"{} {:0.3}
\n
"
,
buffer
.push_str
(
format!
(
"{
:?
} {:0.3}
\n
"
,
k
.to_ascii_uppercase
(),
v
)
.as_slice
());
}
...
...
@@ -191,8 +193,8 @@ fn main() {
// start processing if this is the one
(
'>'
,
false
)
=>
{
match
line
.as_slice
()
.slice_from
(
1
)
.find_str
(
"THREE"
)
{
option
::
Option
::
Some
(
_
)
=>
{
proc_mode
=
true
;
}
option
::
Option
::
None
=>
{
}
Some
(
_
)
=>
{
proc_mode
=
true
;
}
None
=>
{
}
}
}
...
...
@@ -221,6 +223,6 @@ fn main() {
// now fetch and print result messages
for
(
ii
,
_
sz
)
in
sizes
.iter
()
.enumerate
()
{
println!
(
"{}"
,
from_child
[
ii
]
.recv
()
.unwrap
());
println!
(
"{
:?
}"
,
from_child
[
ii
]
.recv
()
.unwrap
());
}
}
src/test/bench/shootout-k-nucleotide.rs
浏览文件 @
0dc48b47
...
...
@@ -40,6 +40,8 @@
// ignore-android see #10393 #13206
#![feature(box_syntax)]
use
std
::
ascii
::
OwnedAsciiExt
;
use
std
::
iter
::
repeat
;
use
std
::
slice
;
...
...
src/test/bench/shootout-regex-dna.rs
浏览文件 @
0dc48b47
...
...
@@ -41,6 +41,8 @@
// ignore-stage1
// ignore-cross-compile #12102
#![feature(box_syntax)]
extern
crate
regex
;
use
std
::
io
;
...
...
src/test/bench/sudoku.rs
浏览文件 @
0dc48b47
...
...
@@ -10,6 +10,7 @@
// ignore-pretty very bad with line comments
#![feature(box_syntax)]
#![allow(non_snake_case)]
use
std
::
io
::
BufferedReader
;
...
...
src/test/bench/task-perf-alloc-unwind.rs
浏览文件 @
0dc48b47
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(unsafe_destructor)]
#![feature(unsafe_destructor
,
box_syntax
)]
use
std
::
os
;
use
std
::
thread
::
Thread
;
...
...
src/test/compile-fail/borrowck-bad-nested-calls-free.rs
浏览文件 @
0dc48b47
...
...
@@ -11,6 +11,7 @@
// Test that we detect nested calls that could free pointers evaluated
// for earlier arguments.
#![feature(box_syntax)]
fn
rewrite
(
v
:
&
mut
Box
<
uint
>
)
->
uint
{
*
v
=
box
22
;
...
...
src/test/compile-fail/borrowck-bad-nested-calls-move.rs
浏览文件 @
0dc48b47
...
...
@@ -11,6 +11,7 @@
// Test that we detect nested calls that could free pointers evaluated
// for earlier arguments.
#![feature(box_syntax)]
fn
rewrite
(
v
:
&
mut
Box
<
uint
>
)
->
uint
{
*
v
=
box
22
;
...
...
src/test/compile-fail/borrowck-borrow-immut-deref-of-box-as-mut.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
struct
A
;
impl
A
{
...
...
src/test/compile-fail/borrowck-borrowed-uniq-rvalue.rs
浏览文件 @
0dc48b47
...
...
@@ -10,6 +10,8 @@
//buggy.rs
#![feature(box_syntax)]
extern
crate
collections
;
use
std
::
collections
::
HashMap
;
...
...
src/test/compile-fail/borrowck-box-insensitivity.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
struct
A
{
x
:
Box
<
int
>
,
y
:
int
,
...
...
src/test/compile-fail/borrowck-call-is-borrow-issue-12224.rs
浏览文件 @
0dc48b47
...
...
@@ -11,6 +11,7 @@
// Ensure that invoking a closure counts as a unique immutable borrow
#![feature(unboxed_closures)]
#![feature(box_syntax)]
type
Fn
<
'a
>
=
Box
<
FnMut
()
+
'a
>
;
...
...
src/test/compile-fail/borrowck-closures-mut-and-imm.rs
浏览文件 @
0dc48b47
...
...
@@ -11,6 +11,7 @@
// Tests that two closures cannot simultaneously have mutable
// and immutable access to the variable. Issue #6801.
#![feature(box_syntax)]
fn
get
(
x
:
&
int
)
->
int
{
*
x
...
...
src/test/compile-fail/borrowck-closures-two-mut.rs
浏览文件 @
0dc48b47
...
...
@@ -12,6 +12,7 @@
// access to the variable, whether that mutable access be used
// for direct assignment or for taking mutable ref. Issue #6801.
#![feature(box_syntax)]
fn
a
()
{
let
mut
x
=
3
i
;
...
...
src/test/compile-fail/borrowck-closures-use-after-free.rs
浏览文件 @
0dc48b47
...
...
@@ -12,6 +12,7 @@
// cannot also be supplied a borrowed version of that
// variable's contents. Issue #11192.
#![feature(box_syntax)]
struct
Foo
{
x
:
int
...
...
src/test/compile-fail/borrowck-field-sensitivity.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
struct
A
{
a
:
int
,
b
:
Box
<
int
>
}
fn
deref_after_move
()
{
...
...
src/test/compile-fail/borrowck-for-loop-correct-cmt-for-pattern.rs
浏览文件 @
0dc48b47
...
...
@@ -10,6 +10,8 @@
// Issue #16205.
#![feature(box_syntax)]
struct
Foo
{
a
:
[
Box
<
int
>
;
3
],
}
...
...
src/test/compile-fail/borrowck-issue-14498.rs
浏览文件 @
0dc48b47
...
...
@@ -11,6 +11,8 @@
// This tests that we can't modify Box<&mut T> contents while they
// are borrowed.
#![feature(box_syntax)]
struct
A
{
a
:
int
}
struct
B
<
'a
>
{
a
:
Box
<&
'a
mut
int
>
}
...
...
src/test/compile-fail/borrowck-issue-2657-1.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
fn
main
()
{
let
x
=
Some
(
box
1
i
);
match
x
{
...
...
src/test/compile-fail/borrowck-issue-2657-2.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
fn
main
()
{
let
x
=
Some
(
box
1
i
);
match
x
{
...
...
src/test/compile-fail/borrowck-lend-flow-if.rs
浏览文件 @
0dc48b47
...
...
@@ -14,6 +14,7 @@
// either genuine or would require more advanced changes. The latter
// cases are noted.
#![feature(box_syntax)]
fn
borrow
(
_
v
:
&
int
)
{}
fn
borrow_mut
(
_
v
:
&
mut
int
)
{}
...
...
src/test/compile-fail/borrowck-lend-flow-loop.rs
浏览文件 @
0dc48b47
...
...
@@ -14,6 +14,7 @@
// either genuine or would require more advanced changes. The latter
// cases are noted.
#![feature(box_syntax)]
fn
borrow
(
_
v
:
&
int
)
{}
fn
borrow_mut
(
_
v
:
&
mut
int
)
{}
...
...
src/test/compile-fail/borrowck-lend-flow.rs
浏览文件 @
0dc48b47
...
...
@@ -14,6 +14,7 @@
// either genuine or would require more advanced changes. The latter
// cases are noted.
#![feature(box_syntax)]
fn
borrow
(
_
v
:
&
int
)
{}
fn
borrow_mut
(
_
v
:
&
mut
int
)
{}
...
...
src/test/compile-fail/borrowck-loan-blocks-move-cc.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
use
std
::
thread
::
Thread
;
fn
borrow
<
F
>
(
v
:
&
int
,
f
:
F
)
where
F
:
FnOnce
(
&
int
)
{
...
...
src/test/compile-fail/borrowck-loan-blocks-move.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
fn
take
(
_
v
:
Box
<
int
>
)
{
}
...
...
src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
fn
borrow
<
F
>
(
v
:
&
int
,
f
:
F
)
where
F
:
FnOnce
(
&
int
)
{
f
(
v
);
}
...
...
src/test/compile-fail/borrowck-move-by-capture.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
pub
fn
main
()
{
let
bar
=
box
3
;
let
_
g
=
|
&
mut
:|
{
...
...
src/test/compile-fail/borrowck-move-error-with-note.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
enum
Foo
{
Foo1
(
Box
<
u32
>
,
Box
<
u32
>
),
...
...
src/test/compile-fail/borrowck-move-from-subpath-of-borrowed-path.rs
浏览文件 @
0dc48b47
...
...
@@ -11,6 +11,8 @@
// verify that an error is raised when trying to move out of a
// borrowed path.
#![feature(box_syntax)]
fn
main
()
{
let
a
=
box
box
2
i
;
let
b
=
&
a
;
...
...
src/test/compile-fail/borrowck-move-moved-value-into-closure.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
fn
call_f
<
F
:
FnOnce
()
->
int
>
(
f
:
F
)
->
int
{
f
()
}
...
...
src/test/compile-fail/borrowck-move-subcomponent.rs
浏览文件 @
0dc48b47
...
...
@@ -11,6 +11,7 @@
// Tests that the borrow checker checks all components of a path when moving
// out.
#![feature(box_syntax)]
struct
S
{
x
:
Box
<
int
>
...
...
src/test/compile-fail/borrowck-multiple-captures.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
use
std
::
thread
::
Thread
;
fn
borrow
<
T
>
(
_
:
&
T
)
{
}
...
...
src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
struct
node_
{
a
:
Box
<
cycle
>
...
...
src/test/compile-fail/borrowck-overloaded-index-2.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
use
std
::
ops
::
Index
;
struct
MyVec
<
T
>
{
...
...
src/test/compile-fail/borrowck-uniq-via-lend.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
fn
borrow
(
_
v
:
&
int
)
{}
...
...
src/test/compile-fail/borrowck-use-mut-borrow.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
struct
A
{
a
:
int
,
b
:
int
}
impl
Copy
for
A
{}
...
...
src/test/compile-fail/check-static-values-constraints.rs
浏览文件 @
0dc48b47
...
...
@@ -10,6 +10,8 @@
// Verifies all possible restrictions for statics values.
#![feature(box_syntax)]
use
std
::
marker
;
struct
WithDtor
;
...
...
src/test/compile-fail/class-cast-to-trait.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
trait
noisy
{
fn
speak
(
&
self
);
...
...
src/test/compile-fail/cross-borrow-trait.rs
浏览文件 @
0dc48b47
...
...
@@ -11,6 +11,8 @@
// Test that cross-borrowing (implicitly converting from `Box<T>` to `&T`) is
// forbidden when `T` is a trait.
#![feature(box_syntax)]
struct
Foo
;
trait
Trait
{}
impl
Trait
for
Foo
{}
...
...
src/test/compile-fail/dst-bad-assign-2.rs
浏览文件 @
0dc48b47
...
...
@@ -10,6 +10,8 @@
// Forbid assignment into a dynamically sized type.
#![feature(box_syntax)]
struct
Fat
<
T
:
?
Sized
>
{
f1
:
int
,
f2
:
&
'static
str
,
...
...
src/test/compile-fail/dst-bad-assign.rs
浏览文件 @
0dc48b47
...
...
@@ -10,6 +10,8 @@
// Forbid assignment into a dynamically sized type.
#![feature(box_syntax)]
struct
Fat
<
T
:
?
Sized
>
{
f1
:
int
,
f2
:
&
'static
str
,
...
...
src/test/compile-fail/dst-rvalue.rs
浏览文件 @
0dc48b47
...
...
@@ -10,6 +10,8 @@
// Check that dynamically sized rvalues are forbidden
#![feature(box_syntax)]
pub
fn
main
()
{
let
_
x
:
Box
<
str
>
=
box
*
"hello world"
;
//~^ ERROR E0161
...
...
src/test/compile-fail/fn-trait-formatting.rs
浏览文件 @
0dc48b47
...
...
@@ -9,6 +9,7 @@
// except according to those terms.
#![feature(unboxed_closures)]
#![feature(box_syntax)]
fn
needs_fn
<
F
>
(
x
:
F
)
where
F
:
Fn
(
isize
)
->
isize
{}
...
...
src/test/compile-fail/infinite-autoderef.rs
浏览文件 @
0dc48b47
...
...
@@ -10,6 +10,8 @@
// error-pattern: reached the recursion limit while auto-dereferencing
#![feature(box_syntax)]
use
std
::
ops
::
Deref
;
struct
Foo
;
...
...
src/test/compile-fail/issue-10291.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
fn
test
<
'x
>
(
x
:
&
'x
int
)
{
drop
::
<
Box
<
for
<
'z
>
FnMut
(
&
'z
int
)
->
&
'z
int
>>
(
box
|
z
|
{
x
...
...
src/test/compile-fail/issue-10398.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
fn
main
()
{
let
x
=
box
1
i
;
let
f
=
move
|:|
{
...
...
src/test/compile-fail/issue-11192.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
struct
Foo
{
x
:
int
}
...
...
src/test/compile-fail/issue-11515.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
struct
Test
<
's
>
{
func
:
Box
<
FnMut
()
+
'static
>
}
...
...
src/test/compile-fail/issue-11844.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
fn
main
()
{
let
a
=
Some
(
box
1
);
match
a
{
...
...
src/test/compile-fail/issue-11925.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
fn
main
()
{
let
r
=
{
let
x
=
box
42
i
;
...
...
src/test/compile-fail/issue-12127.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
fn
do_it
(
x
:
&
int
)
{
}
fn
main
()
{
...
...
src/test/compile-fail/issue-12470.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
trait
X
{
fn
get_i
(
&
self
)
->
int
;
}
...
...
src/test/compile-fail/issue-14915.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
fn
main
()
{
let
x
:
Box
<
isize
>
=
box
0
;
...
...
src/test/compile-fail/issue-17263.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
struct
Foo
{
a
:
int
,
b
:
int
}
fn
main
()
{
...
...
src/test/compile-fail/issue-17441.rs
浏览文件 @
0dc48b47
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
fn
main
()
{
let
_
foo
=
&
[
1u
,
2
]
as
[
usize
];
//~^ ERROR cast to unsized type: `&[usize; 2]` as `[usize]`
...
...
src/test/compile-fail/issue-17651.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/issue-17913.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/issue-18783.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/issue-3763.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/issue-4335.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/issue-5439.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/issue-5543.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/issue-6801.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/issue-7013.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/issue-7364.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/kindck-impl-type-params-2.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/kindck-impl-type-params.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/kindck-inherited-copy-bound.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/lint-owned-heap-memory.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/liveness-move-call-arg.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/liveness-move-in-loop.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/liveness-move-in-while.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/liveness-use-after-move.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/macros-nonfatal-errors.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/map-types.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/move-out-of-tuple-field.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/moves-based-on-type-move-out-of-closure-env-issue-1965.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/moves-based-on-type-tuple.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/moves-sru-moved-field.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/mut-cross-borrowing.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/occurs-check-2.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/occurs-check.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/region-object-lifetime-in-coercion.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/regions-close-associated-type-into-object.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/regions-close-object-into-object.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/regions-close-over-borrowed-ref-in-obj.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/regions-close-over-type-parameter-1.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/regions-close-over-type-parameter-2.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/regions-close-over-type-parameter-multiple.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/regions-close-param-into-object.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/regions-nested-fns.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/regions-proc-bound-capture.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/regions-steal-closure.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/regions-trait-1.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/regions-trait-variance.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/shadowed-type-parameter.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/static-mut-not-constant.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/static-region-bound.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/syntax-extension-bytes-non-ascii-char-literal.rs
已删除
100644 → 0
浏览文件 @
11e265c2
此差异已折叠。
点击以展开。
src/test/compile-fail/syntax-extension-bytes-too-large-integer-literal.rs
已删除
100644 → 0
浏览文件 @
11e265c2
此差异已折叠。
点击以展开。
src/test/compile-fail/syntax-extension-bytes-too-large-u8-literal.rs
已删除
100644 → 0
浏览文件 @
11e265c2
此差异已折叠。
点击以展开。
src/test/compile-fail/syntax-extension-bytes-too-small-integer-literal.rs
已删除
100644 → 0
浏览文件 @
11e265c2
此差异已折叠。
点击以展开。
src/test/compile-fail/syntax-extension-bytes-too-small-u8-literal.rs
已删除
100644 → 0
浏览文件 @
11e265c2
此差异已折叠。
点击以展开。
src/test/compile-fail/syntax-extension-bytes-unsupported-literal.rs
已删除
100644 → 0
浏览文件 @
11e265c2
此差异已折叠。
点击以展开。
src/test/compile-fail/trait-coercion-generic-bad.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/trait-coercion-generic-regions.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/trait-test-2.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/ufcs-explicit-self-bad.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/unboxed-closure-illegal-move.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/unique-object-noncopyable.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/unique-pinned-nocopy.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/unique-unique-kind.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/unique-vec-res.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/use-after-move-implicity-coerced-object.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/compile-fail/use-after-move-self.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/borrowed-struct.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/borrowed-tuple.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/borrowed-unique-basic.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/box.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/boxed-struct.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/closure-in-generic-function.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/destructured-fn-argument.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/destructured-for-loop-variable.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/destructured-local.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/generic-method-on-generic-struct.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/method-on-enum.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/method-on-generic-struct.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/method-on-struct.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/method-on-trait.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/method-on-tuple-struct.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/recursive-struct.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/self-in-default-method.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/self-in-generic-default-method.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/trait-pointers.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/type-names.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/unique-enum.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/var-captured-in-nested-closure.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/var-captured-in-sendable-closure.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/debuginfo/var-captured-in-stack-closure.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/run-make/save-analysis/foo.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/run-pass-valgrind/dst-dtor-1.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/run-pass-valgrind/dst-dtor-2.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/
compile-fail/syntax-extension-bytes-non-literal
.rs
→
src/test/
run-pass/box-new
.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/run-pass/bytes-macro-static.rs
已删除
100644 → 0
浏览文件 @
11e265c2
此差异已折叠。
点击以展开。
src/test/run-pass/cfg_attr.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/run-pass/ext-expand-inner-exprs.rs
浏览文件 @
0dc48b47
此差异已折叠。
点击以展开。
src/test/run-pass/syntax-extension-bytes.rs
已删除
100644 → 0
浏览文件 @
11e265c2
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录