Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
7c90189e
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,发现更多精彩内容 >>
提交
7c90189e
编写于
2月 24, 2018
作者:
V
Vadim Petrochenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Stabilize slice patterns without `..`
Merge `feature(advanced_slice_patterns)` into `feature(slice_patterns)`
上级
a04b88d1
变更
75
隐藏空白更改
内联
并排
Showing
75 changed file
with
124 addition
and
226 deletion
+124
-226
src/doc/unstable-book/src/language-features/advanced-slice-patterns.md
...ble-book/src/language-features/advanced-slice-patterns.md
+0
-35
src/doc/unstable-book/src/language-features/slice-patterns.md
...doc/unstable-book/src/language-features/slice-patterns.md
+16
-12
src/liballoc/lib.rs
src/liballoc/lib.rs
+0
-1
src/libcore/benches/lib.rs
src/libcore/benches/lib.rs
+0
-1
src/libcore/tests/lib.rs
src/libcore/tests/lib.rs
+1
-0
src/librustc/benches/lib.rs
src/librustc/benches/lib.rs
+0
-1
src/librustc_apfloat/lib.rs
src/librustc_apfloat/lib.rs
+1
-1
src/librustc_const_eval/lib.rs
src/librustc_const_eval/lib.rs
+0
-1
src/librustc_lint/lib.rs
src/librustc_lint/lib.rs
+0
-1
src/librustc_trans/lib.rs
src/librustc_trans/lib.rs
+1
-1
src/librustc_trans_utils/lib.rs
src/librustc_trans_utils/lib.rs
+0
-1
src/librustc_typeck/diagnostics.rs
src/librustc_typeck/diagnostics.rs
+0
-6
src/librustc_typeck/lib.rs
src/librustc_typeck/lib.rs
+1
-1
src/librustdoc/lib.rs
src/librustdoc/lib.rs
+1
-1
src/libsyntax/feature_gate.rs
src/libsyntax/feature_gate.rs
+5
-11
src/libsyntax/parse/parser.rs
src/libsyntax/parse/parser.rs
+1
-1
src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs
src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs
+0
-1
src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs
...ile-fail/borrowck/borrowck-match-binding-is-assignment.rs
+0
-2
src/test/compile-fail/borrowck/borrowck-move-out-from-array.rs
...est/compile-fail/borrowck/borrowck-move-out-from-array.rs
+2
-1
src/test/compile-fail/borrowck/borrowck-vec-pattern-element-loan.rs
...ompile-fail/borrowck/borrowck-vec-pattern-element-loan.rs
+0
-1
src/test/compile-fail/issue-12369.rs
src/test/compile-fail/issue-12369.rs
+0
-1
src/test/compile-fail/issue-13482-2.rs
src/test/compile-fail/issue-13482-2.rs
+0
-2
src/test/compile-fail/issue-13482.rs
src/test/compile-fail/issue-13482.rs
+0
-2
src/test/compile-fail/issue-15381.rs
src/test/compile-fail/issue-15381.rs
+0
-2
src/test/compile-fail/issue-41255.rs
src/test/compile-fail/issue-41255.rs
+0
-1
src/test/compile-fail/issue-6804.rs
src/test/compile-fail/issue-6804.rs
+0
-1
src/test/compile-fail/match-byte-array-patterns-2.rs
src/test/compile-fail/match-byte-array-patterns-2.rs
+0
-2
src/test/compile-fail/match-byte-array-patterns.rs
src/test/compile-fail/match-byte-array-patterns.rs
+1
-1
src/test/compile-fail/match-ref-ice.rs
src/test/compile-fail/match-ref-ice.rs
+0
-1
src/test/compile-fail/match-slice-patterns.rs
src/test/compile-fail/match-slice-patterns.rs
+1
-1
src/test/compile-fail/match-vec-fixed.rs
src/test/compile-fail/match-vec-fixed.rs
+0
-1
src/test/compile-fail/match-vec-mismatch-2.rs
src/test/compile-fail/match-vec-mismatch-2.rs
+0
-2
src/test/compile-fail/match-vec-unreachable.rs
src/test/compile-fail/match-vec-unreachable.rs
+0
-1
src/test/compile-fail/move-out-of-slice-1.rs
src/test/compile-fail/move-out-of-slice-1.rs
+1
-1
src/test/compile-fail/regions-pattern-typing-issue-19552.rs
src/test/compile-fail/regions-pattern-typing-issue-19552.rs
+0
-2
src/test/compile-fail/uninhabited-matches-feature-gated.rs
src/test/compile-fail/uninhabited-matches-feature-gated.rs
+0
-2
src/test/compile-fail/uninhabited-patterns.rs
src/test/compile-fail/uninhabited-patterns.rs
+1
-1
src/test/mir-opt/uniform_array_move_out.rs
src/test/mir-opt/uniform_array_move_out.rs
+2
-1
src/test/run-pass-fulldeps/auxiliary/roman_numerals.rs
src/test/run-pass-fulldeps/auxiliary/roman_numerals.rs
+0
-1
src/test/run-pass/destructure-array-1.rs
src/test/run-pass/destructure-array-1.rs
+0
-3
src/test/run-pass/dynamic-drop.rs
src/test/run-pass/dynamic-drop.rs
+2
-1
src/test/run-pass/ignore-all-the-things.rs
src/test/run-pass/ignore-all-the-things.rs
+5
-6
src/test/run-pass/issue-13027.rs
src/test/run-pass/issue-13027.rs
+0
-2
src/test/run-pass/issue-15080.rs
src/test/run-pass/issue-15080.rs
+0
-1
src/test/run-pass/issue-15104.rs
src/test/run-pass/issue-15104.rs
+0
-1
src/test/run-pass/issue-16648.rs
src/test/run-pass/issue-16648.rs
+0
-3
src/test/run-pass/issue-17877.rs
src/test/run-pass/issue-17877.rs
+0
-1
src/test/run-pass/issue-37598.rs
src/test/run-pass/issue-37598.rs
+1
-1
src/test/run-pass/issue-38002.rs
src/test/run-pass/issue-38002.rs
+0
-2
src/test/run-pass/issue-46855.rs
src/test/run-pass/issue-46855.rs
+0
-2
src/test/run-pass/issue-7784.rs
src/test/run-pass/issue-7784.rs
+0
-2
src/test/run-pass/match-vec-alternatives.rs
src/test/run-pass/match-vec-alternatives.rs
+0
-2
src/test/run-pass/rfc-2005-default-binding-mode/slice.rs
src/test/run-pass/rfc-2005-default-binding-mode/slice.rs
+1
-1
src/test/run-pass/trailing-comma.rs
src/test/run-pass/trailing-comma.rs
+0
-1
src/test/run-pass/vec-matching-autoslice.rs
src/test/run-pass/vec-matching-autoslice.rs
+0
-3
src/test/run-pass/vec-matching-fixed.rs
src/test/run-pass/vec-matching-fixed.rs
+0
-2
src/test/run-pass/vec-matching-fold.rs
src/test/run-pass/vec-matching-fold.rs
+0
-2
src/test/run-pass/vec-matching.rs
src/test/run-pass/vec-matching.rs
+0
-2
src/test/run-pass/vec-tail-matching.rs
src/test/run-pass/vec-tail-matching.rs
+0
-2
src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs
src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs
+0
-1
src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr
src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr
+8
-8
src/test/ui/error-codes/E0527.rs
src/test/ui/error-codes/E0527.rs
+0
-2
src/test/ui/error-codes/E0527.stderr
src/test/ui/error-codes/E0527.stderr
+1
-1
src/test/ui/error-codes/E0529.rs
src/test/ui/error-codes/E0529.rs
+0
-2
src/test/ui/error-codes/E0529.stderr
src/test/ui/error-codes/E0529.stderr
+1
-1
src/test/ui/feature-gate-advanced-slice-features.rs
src/test/ui/feature-gate-advanced-slice-features.rs
+0
-22
src/test/ui/feature-gate-advanced-slice-features.stderr
src/test/ui/feature-gate-advanced-slice-features.stderr
+0
-19
src/test/ui/feature-gate-slice-patterns.rs
src/test/ui/feature-gate-slice-patterns.rs
+11
-2
src/test/ui/feature-gate-slice-patterns.stderr
src/test/ui/feature-gate-slice-patterns.stderr
+45
-5
src/test/ui/mismatched_types/issue-38371.rs
src/test/ui/mismatched_types/issue-38371.rs
+0
-2
src/test/ui/mismatched_types/issue-38371.stderr
src/test/ui/mismatched_types/issue-38371.stderr
+4
-4
src/test/ui/non-exhaustive-pattern-witness.rs
src/test/ui/non-exhaustive-pattern-witness.rs
+0
-1
src/test/ui/non-exhaustive-pattern-witness.stderr
src/test/ui/non-exhaustive-pattern-witness.stderr
+7
-7
src/test/ui/pat-slice-old-style.rs
src/test/ui/pat-slice-old-style.rs
+2
-2
src/test/ui/rfc-2005-default-binding-mode/slice.rs
src/test/ui/rfc-2005-default-binding-mode/slice.rs
+1
-1
未找到文件。
src/doc/unstable-book/src/language-features/advanced-slice-patterns.md
已删除
100644 → 0
浏览文件 @
a04b88d1
# `advanced_slice_patterns`
The tracking issue for this feature is: [#23121]
[
#23121
]:
https://github.com/rust-lang/rust/issues/23121
See also
[
`slice_patterns`
](
language-features/slice-patterns.html
)
.
------------------------
The
`advanced_slice_patterns`
gate lets you use
`..`
to indicate any number of
elements inside a pattern matching a slice. This wildcard can only be used once
for a given array. If there's an identifier before the
`..`
, the result of the
slice will be bound to that name. For example:
```
rust
#![feature(advanced_slice_patterns,
slice_patterns)]
fn
is_symmetric
(
list
:
&
[
u32
])
->
bool
{
match
list
{
&
[]
|
&
[
_
]
=>
true
,
&
[
x
,
ref
inside
..
,
y
]
if
x
==
y
=>
is_symmetric
(
inside
),
_
=>
false
}
}
fn
main
()
{
let
sym
=
&
[
0
,
1
,
4
,
2
,
4
,
1
,
0
];
assert
!
(
is_symmetric
(
sym
));
let
not_sym
=
&
[
0
,
1
,
7
,
2
,
4
,
1
,
0
];
assert
!
(
!
is_symmetric
(
not_sym
));
}
```
src/doc/unstable-book/src/language-features/slice-patterns.md
浏览文件 @
7c90189e
...
...
@@ -4,25 +4,29 @@ The tracking issue for this feature is: [#23121]
[
#23121
]:
https://github.com/rust-lang/rust/issues/23121
See also
[
`advanced_slice_patterns`
](
language-features/advanced-slice-patterns.html
)
.
------------------------
If you want to match against a slice or array, you can use
`&`
with the
`slice_patterns`
feature:
The
`slice_patterns`
feature gate lets you use
`..`
to indicate any number of
elements inside a pattern matching a slice. This wildcard can only be used once
for a given array. If there's an pattern before the
`..`
, the subslice will be
matched against that pattern. For example:
```
rust
#![feature(slice_patterns)]
fn
is_symmetric
(
list
:
&
[
u32
])
->
bool
{
match
list
{
&
[]
|
&
[
_
]
=>
true
,
&
[
x
,
ref
inside
..
,
y
]
if
x
==
y
=>
is_symmetric
(
inside
),
&
[
..
]
=>
false
,
}
}
fn
main
()
{
let
v
=
vec!
[
"match_this"
,
"1"
];
let
sym
=
&
[
0
,
1
,
4
,
2
,
4
,
1
,
0
];
assert
!
(
is_symmetric
(
sym
));
match
&
v
[
..
]
{
&
[
"match_this"
,
second
]
=>
println!
(
"The second element is {}"
,
second
),
_
=>
{},
}
let
not_sym
=
&
[
0
,
1
,
7
,
2
,
4
,
1
,
0
];
assert
!
(
!
is_symmetric
(
not_sym
));
}
```
src/liballoc/lib.rs
浏览文件 @
7c90189e
...
...
@@ -110,7 +110,6 @@
#![feature(ptr_internals)]
#![feature(rustc_attrs)]
#![feature(slice_get_slice)]
#![feature(slice_patterns)]
#![feature(slice_rsplit)]
#![feature(specialization)]
#![feature(staged_api)]
...
...
src/libcore/benches/lib.rs
浏览文件 @
7c90189e
...
...
@@ -11,7 +11,6 @@
#![deny(warnings)]
#![feature(flt2dec)]
#![feature(slice_patterns)]
#![feature(test)]
extern
crate
core
;
...
...
src/libcore/tests/lib.rs
浏览文件 @
7c90189e
...
...
@@ -37,6 +37,7 @@
#![feature(raw)]
#![feature(refcell_replace_swap)]
#![feature(slice_patterns)]
#![feature(slice_rotate)]
#![feature(sort_internals)]
#![feature(specialization)]
#![feature(step_trait)]
...
...
src/librustc/benches/lib.rs
浏览文件 @
7c90189e
...
...
@@ -10,7 +10,6 @@
#![deny(warnings)]
#![feature(slice_patterns)]
#![feature(test)]
extern
crate
test
;
...
...
src/librustc_apfloat/lib.rs
浏览文件 @
7c90189e
...
...
@@ -47,7 +47,7 @@
#![forbid(unsafe_code)]
#![feature(i128_type)]
#![
feature(slice_patterns
)]
#![
cfg_attr(stage0,
feature(slice_patterns)
)]
#![feature(try_from)]
// See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
...
...
src/librustc_const_eval/lib.rs
浏览文件 @
7c90189e
...
...
@@ -20,7 +20,6 @@
#![deny(warnings)]
#![feature(rustc_diagnostic_macros)]
#![feature(slice_patterns)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(macro_lifetime_matcher)]
...
...
src/librustc_lint/lib.rs
浏览文件 @
7c90189e
...
...
@@ -31,7 +31,6 @@
#![feature(macro_vis_matcher)]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(slice_patterns)]
#![cfg_attr(stage0,
feature(never_type))]
#[macro_use]
...
...
src/librustc_trans/lib.rs
浏览文件 @
7c90189e
...
...
@@ -30,7 +30,7 @@
#![feature(libc)]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![
feature(slice_patterns
)]
#![
cfg_attr(stage0,
feature(slice_patterns)
)]
#![feature(conservative_impl_trait)]
#![feature(optin_builtin_traits)]
#![feature(inclusive_range_fields)]
...
...
src/librustc_trans_utils/lib.rs
浏览文件 @
7c90189e
...
...
@@ -24,7 +24,6 @@
#![feature(i128_type)]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(slice_patterns)]
#![feature(conservative_impl_trait)]
extern
crate
ar
;
...
...
src/librustc_typeck/diagnostics.rs
浏览文件 @
7c90189e
...
...
@@ -3559,8 +3559,6 @@ fn fly(&self) {} // And now that's ok!
Example of erroneous code:
```compile_fail,E0527
#![feature(slice_patterns)]
let r = &[1, 2, 3, 4];
match r {
&[a, b] => { // error: pattern requires 2 elements but array
...
...
@@ -3625,8 +3623,6 @@ fn fly(&self) {} // And now that's ok!
Example of erroneous code:
```compile_fail,E0529
#![feature(slice_patterns)]
let r: f32 = 1.0;
match r {
[a, b] => { // error: expected an array or slice, found `f32`
...
...
@@ -3639,8 +3635,6 @@ fn fly(&self) {} // And now that's ok!
types:
```
#![feature(slice_patterns)]
let r = [1.0, 2.0];
match r {
[a, b] => { // ok!
...
...
src/librustc_typeck/lib.rs
浏览文件 @
7c90189e
...
...
@@ -72,7 +72,7 @@
#![allow(non_camel_case_types)]
#![
feature(advanced_slice_patterns
)]
#![
cfg_attr(stage0,
feature(advanced_slice_patterns)
)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(conservative_impl_trait)]
...
...
src/librustdoc/lib.rs
浏览文件 @
7c90189e
...
...
@@ -20,7 +20,7 @@
#![feature(box_syntax)]
#![feature(fs_read_write)]
#![feature(set_stdio)]
#![
feature(slice_patterns
)]
#![
cfg_attr(stage0,
feature(slice_patterns)
)]
#![feature(test)]
#![feature(unicode)]
#![feature(vec_remove_item)]
...
...
src/libsyntax/feature_gate.rs
浏览文件 @
7c90189e
...
...
@@ -145,7 +145,6 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
// rustc internal
(
active
,
rustc_diagnostic_macros
,
"1.0.0"
,
None
,
None
),
(
active
,
rustc_const_unstable
,
"1.0.0"
,
None
,
None
),
(
active
,
advanced_slice_patterns
,
"1.0.0"
,
Some
(
23121
),
None
),
(
active
,
box_syntax
,
"1.0.0"
,
Some
(
27779
),
None
),
(
active
,
placement_in_syntax
,
"1.0.0"
,
Some
(
27779
),
None
),
(
active
,
unboxed_closures
,
"1.0.0"
,
Some
(
29625
),
None
),
...
...
@@ -474,6 +473,8 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
(
removed
,
allocator
,
"1.0.0"
,
None
,
None
),
// Allows the `#[simd]` attribute -- removed in favor of `#[repr(simd)]`
(
removed
,
simd
,
"1.0.0"
,
Some
(
27731
),
None
),
// Merged into `slice_patterns`
(
removed
,
advanced_slice_patterns
,
"1.0.0"
,
Some
(
23121
),
None
),
);
declare_features!
(
...
...
@@ -1655,17 +1656,10 @@ fn visit_arm(&mut self, arm: &'a ast::Arm) {
fn
visit_pat
(
&
mut
self
,
pattern
:
&
'a
ast
::
Pat
)
{
match
pattern
.node
{
PatKind
::
Slice
(
_
,
Some
(
_
),
ref
last
)
if
!
last
.is_empty
()
=>
{
gate_feature_post!
(
&
self
,
advanced_slice_patterns
,
pattern
.span
,
"multiple-element slice matches anywhere
\
but at the end of a slice (e.g.
\
`[0, ..xs, 0]`) are experimental"
)
}
PatKind
::
Slice
(
..
)
=>
{
PatKind
::
Slice
(
_
,
Some
(
ref
subslice
),
_
)
=>
{
gate_feature_post!
(
&
self
,
slice_patterns
,
pattern
.span
,
"slice pattern syntax is experimental
"
);
subslice
.span
,
"syntax for subslices in slice patterns is not yet stabilized
"
);
}
PatKind
::
Box
(
..
)
=>
{
gate_feature_post!
(
&
self
,
box_patterns
,
...
...
src/libsyntax/parse/parser.rs
浏览文件 @
7c90189e
...
...
@@ -3618,7 +3618,7 @@ fn parse_pat_vec_elements(
slice
=
Some
(
P
(
Pat
{
id
:
ast
::
DUMMY_NODE_ID
,
node
:
PatKind
::
Wild
,
span
:
self
.span
,
span
:
self
.
prev_
span
,
}));
before_slice
=
false
;
}
...
...
src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs
浏览文件 @
7c90189e
...
...
@@ -13,7 +13,6 @@
//[mir]compile-flags: -Z borrowck=mir
#![feature(slice_patterns)]
#![feature(advanced_slice_patterns)]
pub
struct
Foo
{
x
:
u32
...
...
src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs
浏览文件 @
7c90189e
...
...
@@ -13,8 +13,6 @@
// Test that immutable pattern bindings cannot be reassigned.
#![feature(slice_patterns)]
enum
E
{
Foo
(
isize
)
}
...
...
src/test/compile-fail/borrowck/borrowck-move-out-from-array.rs
浏览文件 @
7c90189e
...
...
@@ -11,7 +11,8 @@
// revisions: ast mir
//[mir]compile-flags: -Z borrowck=mir
#![feature(box_syntax,
slice_patterns,
advanced_slice_patterns)]
#![feature(box_syntax)]
#![feature(slice_patterns)]
fn
move_out_from_begin_and_end
()
{
let
a
=
[
box
1
,
box
2
];
...
...
src/test/compile-fail/borrowck/borrowck-vec-pattern-element-loan.rs
浏览文件 @
7c90189e
...
...
@@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(advanced_slice_patterns)]
#![feature(slice_patterns)]
fn
a
<
'a
>
()
->
&
'a
[
isize
]
{
...
...
src/test/compile-fail/issue-12369.rs
浏览文件 @
7c90189e
...
...
@@ -9,7 +9,6 @@
// except according to those terms.
#![feature(slice_patterns)]
#![allow(unused_variables)]
#![deny(unreachable_patterns)]
fn
main
()
{
...
...
src/test/compile-fail/issue-13482-2.rs
浏览文件 @
7c90189e
...
...
@@ -10,8 +10,6 @@
// compile-flags:-Z verbose
#![feature(slice_patterns)]
fn
main
()
{
let
x
=
[
1
,
2
];
let
y
=
match
x
{
...
...
src/test/compile-fail/issue-13482.rs
浏览文件 @
7c90189e
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(slice_patterns)]
fn
main
()
{
let
x
=
[
1
,
2
];
let
y
=
match
x
{
...
...
src/test/compile-fail/issue-15381.rs
浏览文件 @
7c90189e
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(slice_patterns)]
fn
main
()
{
let
values
:
Vec
<
u8
>
=
vec!
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
];
...
...
src/test/compile-fail/issue-41255.rs
浏览文件 @
7c90189e
...
...
@@ -10,7 +10,6 @@
// Matching against float literals should result in a linter error
#![feature(slice_patterns)]
#![feature(exclusive_range_pattern)]
#![allow(unused)]
#![forbid(illegal_floating_point_literal_pattern)]
...
...
src/test/compile-fail/issue-6804.rs
浏览文件 @
7c90189e
...
...
@@ -10,7 +10,6 @@
// Matching against NaN should result in a warning
#![feature(slice_patterns)]
#![allow(unused)]
#![deny(illegal_floating_point_literal_pattern)]
...
...
src/test/compile-fail/match-byte-array-patterns-2.rs
浏览文件 @
7c90189e
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(advanced_slice_patterns,
slice_patterns)]
fn
main
()
{
let
buf
=
&
[
0
,
1
,
2
,
3
];
...
...
src/test/compile-fail/match-byte-array-patterns.rs
浏览文件 @
7c90189e
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(
advanced_slice_patterns,
slice_patterns)]
#![feature(slice_patterns)]
#![deny(unreachable_patterns)]
fn
main
()
{
...
...
src/test/compile-fail/match-ref-ice.rs
浏览文件 @
7c90189e
...
...
@@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(slice_patterns)]
#![deny(unreachable_patterns)]
// The arity of `ref x` is always 1. If the pattern is compared to some non-structural type whose
...
...
src/test/compile-fail/match-slice-patterns.rs
浏览文件 @
7c90189e
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(
advanced_slice_patterns,
slice_patterns)]
#![feature(slice_patterns)]
fn
check
(
list
:
&
[
Option
<
()
>
])
{
match
list
{
...
...
src/test/compile-fail/match-vec-fixed.rs
浏览文件 @
7c90189e
...
...
@@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(slice_patterns)]
#![deny(unreachable_patterns)]
fn
a
()
{
...
...
src/test/compile-fail/match-vec-mismatch-2.rs
浏览文件 @
7c90189e
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(slice_patterns)]
fn
main
()
{
match
()
{
[()]
=>
{
}
...
...
src/test/compile-fail/match-vec-unreachable.rs
浏览文件 @
7c90189e
...
...
@@ -10,7 +10,6 @@
#![feature(slice_patterns)]
#![deny(unreachable_patterns)]
#![allow(unused_variables)]
fn
main
()
{
let
x
:
Vec
<
(
isize
,
isize
)
>
=
Vec
::
new
();
...
...
src/test/compile-fail/move-out-of-slice-1.rs
浏览文件 @
7c90189e
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(
slice_patterns,
box_patterns)]
#![feature(box_patterns)]
struct
A
;
...
...
src/test/compile-fail/regions-pattern-typing-issue-19552.rs
浏览文件 @
7c90189e
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(slice_patterns)]
fn
assert_static
<
T
:
'static
>
(
_
t
:
T
)
{}
fn
main
()
{
...
...
src/test/compile-fail/uninhabited-matches-feature-gated.rs
浏览文件 @
7c90189e
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(slice_patterns)]
enum
Void
{}
fn
main
()
{
...
...
src/test/compile-fail/uninhabited-patterns.rs
浏览文件 @
7c90189e
...
...
@@ -9,9 +9,9 @@
// except according to those terms.
#![feature(box_patterns)]
#![feature(slice_patterns)]
#![feature(box_syntax)]
#![feature(exhaustive_patterns)]
#![feature(slice_patterns)]
#![deny(unreachable_patterns)]
mod
foo
{
...
...
src/test/mir-opt/uniform_array_move_out.rs
浏览文件 @
7c90189e
...
...
@@ -8,7 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax,
slice_patterns,
advanced_slice_patterns)]
#![feature(box_syntax)]
#![feature(slice_patterns)]
fn
move_out_from_end
()
{
let
a
=
[
box
1
,
box
2
];
...
...
src/test/run-pass-fulldeps/auxiliary/roman_numerals.rs
浏览文件 @
7c90189e
...
...
@@ -12,7 +12,6 @@
#![crate_type=
"dylib"
]
#![feature(plugin_registrar,
rustc_private)]
#![feature(slice_patterns)]
extern
crate
syntax
;
extern
crate
syntax_pos
;
...
...
src/test/run-pass/destructure-array-1.rs
浏览文件 @
7c90189e
...
...
@@ -11,9 +11,6 @@
// Ensure that we can do a destructuring bind of a fixed-size array,
// even when the element type has a destructor.
#![feature(slice_patterns)]
struct
D
{
x
:
u8
}
impl
Drop
for
D
{
fn
drop
(
&
mut
self
)
{
}
}
...
...
src/test/run-pass/dynamic-drop.rs
浏览文件 @
7c90189e
...
...
@@ -13,7 +13,8 @@
// ignore-wasm32-bare compiled with panic=abort by default
#![feature(generators,
generator_trait,
untagged_unions,
slice_patterns,
advanced_slice_patterns)]
#![feature(generators,
generator_trait,
untagged_unions)]
#![feature(slice_patterns)]
use
std
::
cell
::{
Cell
,
RefCell
};
use
std
::
ops
::
Generator
;
...
...
src/test/run-pass/ignore-all-the-things.rs
浏览文件 @
7c90189e
...
...
@@ -10,7 +10,6 @@
// pretty-expanded FIXME #23616
#![feature(advanced_slice_patterns)]
#![feature(slice_patterns)]
struct
Foo
(
isize
,
isize
,
isize
,
isize
);
...
...
@@ -20,11 +19,11 @@ pub fn main() {
let
Foo
(
..
)
=
Foo
(
5
,
5
,
5
,
5
);
let
Foo
(
..
)
=
Foo
(
5
,
5
,
5
,
5
);
let
Bar
{
..
}
=
Bar
{
a
:
5
,
b
:
5
,
c
:
5
,
d
:
5
};
//
let (..) = (5, 5, 5, 5);
//
let Foo(a, b, ..) = Foo(5, 5, 5, 5);
//
let Foo(.., d) = Foo(5, 5, 5, 5);
//
let (a, b, ..) = (5, 5, 5, 5);
//
let (.., c, d) = (5, 5, 5, 5);
let
(
..
)
=
(
5
,
5
,
5
,
5
);
let
Foo
(
a
,
b
,
..
)
=
Foo
(
5
,
5
,
5
,
5
);
let
Foo
(
..
,
d
)
=
Foo
(
5
,
5
,
5
,
5
);
let
(
a
,
b
,
..
)
=
(
5
,
5
,
5
,
5
);
let
(
..
,
c
,
d
)
=
(
5
,
5
,
5
,
5
);
let
Bar
{
b
:
b
,
..
}
=
Bar
{
a
:
5
,
b
:
5
,
c
:
5
,
d
:
5
};
match
[
5
,
5
,
5
,
5
]
{
[
..
]
=>
{
}
...
...
src/test/run-pass/issue-13027.rs
浏览文件 @
7c90189e
...
...
@@ -12,8 +12,6 @@
// Tests that match expression handles overlapped literal and range
// properly in the presence of guard function.
#![feature(slice_patterns)]
fn
val
()
->
usize
{
1
}
static
CONST
:
usize
=
1
;
...
...
src/test/run-pass/issue-15080.rs
浏览文件 @
7c90189e
...
...
@@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(slice_patterns)]
fn
main
()
{
...
...
src/test/run-pass/issue-15104.rs
浏览文件 @
7c90189e
...
...
@@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(slice_patterns)]
fn
main
()
{
...
...
src/test/run-pass/issue-16648.rs
浏览文件 @
7c90189e
...
...
@@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(slice_patterns)]
fn
main
()
{
let
x
:
(
isize
,
&
[
isize
])
=
(
2
,
&
[
1
,
2
]);
assert_eq!
(
match
x
{
...
...
src/test/run-pass/issue-17877.rs
浏览文件 @
7c90189e
...
...
@@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(slice_patterns)]
fn
main
()
{
...
...
src/test/run-pass/issue-37598.rs
浏览文件 @
7c90189e
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(
advanced_slice_patterns,
slice_patterns)]
#![feature(slice_patterns)]
fn
check
(
list
:
&
[
u8
])
{
match
list
{
...
...
src/test/run-pass/issue-38002.rs
浏览文件 @
7c90189e
...
...
@@ -10,8 +10,6 @@
// Check that constant ADTs are translated OK, part k of N.
#![feature(slice_patterns)]
enum
Bar
{
C
}
...
...
src/test/run-pass/issue-46855.rs
浏览文件 @
7c90189e
...
...
@@ -10,8 +10,6 @@
// compile-flags: -Zmir-opt-level=1
#![feature(slice_patterns)]
use
std
::
mem
;
#[derive(Copy,
Clone)]
...
...
src/test/run-pass/issue-7784.rs
浏览文件 @
7c90189e
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(advanced_slice_patterns)]
#![feature(slice_patterns)]
use
std
::
ops
::
Add
;
...
...
src/test/run-pass/match-vec-alternatives.rs
浏览文件 @
7c90189e
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(advanced_slice_patterns)]
#![feature(slice_patterns)]
fn
match_vecs
<
'a
,
T
>
(
l1
:
&
'a
[
T
],
l2
:
&
'a
[
T
])
->
&
'static
str
{
...
...
src/test/run-pass/rfc-2005-default-binding-mode/slice.rs
浏览文件 @
7c90189e
...
...
@@ -8,8 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(slice_patterns)]
#![feature(match_default_bindings)]
#![feature(slice_patterns)]
fn
slice_pat
()
{
let
sl
:
&
[
u8
]
=
b
"foo"
;
...
...
src/test/run-pass/trailing-comma.rs
浏览文件 @
7c90189e
...
...
@@ -10,7 +10,6 @@
// pretty-expanded FIXME #23616
#![feature(advanced_slice_patterns,)]
#![feature(slice_patterns)]
fn
f
<
T
,
>
(
_
:
T
,)
{}
...
...
src/test/run-pass/vec-matching-autoslice.rs
浏览文件 @
7c90189e
...
...
@@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(slice_patterns)]
pub
fn
main
()
{
let
x
=
[
1
,
2
,
3
];
match
x
{
...
...
src/test/run-pass/vec-matching-fixed.rs
浏览文件 @
7c90189e
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(advanced_slice_patterns)]
#![feature(slice_patterns)]
fn
a
()
{
...
...
src/test/run-pass/vec-matching-fold.rs
浏览文件 @
7c90189e
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(advanced_slice_patterns)]
#![feature(slice_patterns)]
use
std
::
fmt
::
Debug
;
...
...
src/test/run-pass/vec-matching.rs
浏览文件 @
7c90189e
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(advanced_slice_patterns)]
#![feature(slice_patterns)]
fn
a
()
{
...
...
src/test/run-pass/vec-tail-matching.rs
浏览文件 @
7c90189e
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(slice_patterns)]
struct
Foo
{
...
...
src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs
浏览文件 @
7c90189e
...
...
@@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(advanced_slice_patterns)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(slice_patterns)]
...
...
src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr
浏览文件 @
7c90189e
error[E0506]: cannot assign to `vec[..]` because it is borrowed
--> $DIR/borrowck-vec-pattern-nesting.rs:2
1
:13
--> $DIR/borrowck-vec-pattern-nesting.rs:2
0
:13
|
LL | [box ref _a, _, _] => {
| ------ borrow of `vec[..]` occurs here
...
...
@@ -8,7 +8,7 @@ LL | vec[0] = box 4; //~ ERROR cannot assign
| ^^^^^^^^^^^^^^ assignment to borrowed `vec[..]` occurs here
error[E0506]: cannot assign to `vec[..]` because it is borrowed
--> $DIR/borrowck-vec-pattern-nesting.rs:3
3
:13
--> $DIR/borrowck-vec-pattern-nesting.rs:3
2
:13
|
LL | &mut [ref _b..] => {
| ------ borrow of `vec[..]` occurs here
...
...
@@ -17,7 +17,7 @@ LL | vec[0] = box 4; //~ ERROR cannot assign
| ^^^^^^^^^^^^^^ assignment to borrowed `vec[..]` occurs here
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
--> $DIR/borrowck-vec-pattern-nesting.rs:4
3
:14
--> $DIR/borrowck-vec-pattern-nesting.rs:4
2
:14
|
LL | &mut [_a, //~ ERROR cannot move out
| ^-- hint: to prevent move, use `ref _a` or `ref mut _a`
...
...
@@ -30,7 +30,7 @@ LL | | ] => {
| |_________^ cannot move out of here
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
--> $DIR/borrowck-vec-pattern-nesting.rs:5
6
:13
--> $DIR/borrowck-vec-pattern-nesting.rs:5
5
:13
|
LL | let a = vec[0]; //~ ERROR cannot move out
| ^^^^^^
...
...
@@ -39,7 +39,7 @@ LL | let a = vec[0]; //~ ERROR cannot move out
| help: consider using a reference instead: `&vec[0]`
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
--> $DIR/borrowck-vec-pattern-nesting.rs:6
4
:14
--> $DIR/borrowck-vec-pattern-nesting.rs:6
3
:14
|
LL | &mut [ //~ ERROR cannot move out
| ______________^
...
...
@@ -50,7 +50,7 @@ LL | | _b] => {}
| hint: to prevent move, use `ref _b` or `ref mut _b`
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
--> $DIR/borrowck-vec-pattern-nesting.rs:6
9
:13
--> $DIR/borrowck-vec-pattern-nesting.rs:6
8
:13
|
LL | let a = vec[0]; //~ ERROR cannot move out
| ^^^^^^
...
...
@@ -59,7 +59,7 @@ LL | let a = vec[0]; //~ ERROR cannot move out
| help: consider using a reference instead: `&vec[0]`
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
--> $DIR/borrowck-vec-pattern-nesting.rs:7
7
:14
--> $DIR/borrowck-vec-pattern-nesting.rs:7
6
:14
|
LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out
| ^--^^--^^--^
...
...
@@ -70,7 +70,7 @@ LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out
| cannot move out of here
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
--> $DIR/borrowck-vec-pattern-nesting.rs:8
1
:13
--> $DIR/borrowck-vec-pattern-nesting.rs:8
0
:13
|
LL | let a = vec[0]; //~ ERROR cannot move out
| ^^^^^^
...
...
src/test/ui/error-codes/E0527.rs
浏览文件 @
7c90189e
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(slice_patterns)]
fn
main
()
{
let
r
=
&
[
1
,
2
,
3
,
4
];
match
r
{
...
...
src/test/ui/error-codes/E0527.stderr
浏览文件 @
7c90189e
error[E0527]: pattern requires 2 elements but array has 4
--> $DIR/E0527.rs:1
6
:10
--> $DIR/E0527.rs:1
4
:10
|
LL | &[a, b] => {
| ^^^^^^ expected 4 elements
...
...
src/test/ui/error-codes/E0529.rs
浏览文件 @
7c90189e
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(slice_patterns)]
fn
main
()
{
let
r
:
f32
=
1.0
;
match
r
{
...
...
src/test/ui/error-codes/E0529.stderr
浏览文件 @
7c90189e
error[E0529]: expected an array or slice, found `f32`
--> $DIR/E0529.rs:1
6
:9
--> $DIR/E0529.rs:1
4
:9
|
LL | [a, b] => {
| ^^^^^^ pattern cannot match with input type `f32`
...
...
src/test/ui/feature-gate-advanced-slice-features.rs
已删除
100644 → 0
浏览文件 @
a04b88d1
// Copyright 2014 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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <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.
// gate-test-advanced_slice_patterns
#![feature(slice_patterns)]
fn
main
()
{
let
x
=
[
1
,
2
,
3
,
4
,
5
];
match
x
{
[
xs
..
,
4
,
5
]
=>
{}
//~ ERROR multiple-element slice matches
[
1
,
xs
..
,
5
]
=>
{}
//~ ERROR multiple-element slice matches
[
1
,
2
,
xs
..
]
=>
{}
// OK without feature gate
}
}
src/test/ui/feature-gate-advanced-slice-features.stderr
已删除
100644 → 0
浏览文件 @
a04b88d1
error[E0658]: multiple-element slice matches anywhere but at the end of a slice (e.g. `[0, ..xs, 0]`) are experimental (see issue #23121)
--> $DIR/feature-gate-advanced-slice-features.rs:18:9
|
LL | [ xs.., 4, 5 ] => {} //~ ERROR multiple-element slice matches
| ^^^^^^^^^^^^^^
|
= help: add #![feature(advanced_slice_patterns)] to the crate attributes to enable
error[E0658]: multiple-element slice matches anywhere but at the end of a slice (e.g. `[0, ..xs, 0]`) are experimental (see issue #23121)
--> $DIR/feature-gate-advanced-slice-features.rs:19:9
|
LL | [ 1, xs.., 5 ] => {} //~ ERROR multiple-element slice matches
| ^^^^^^^^^^^^^^
|
= help: add #![feature(advanced_slice_patterns)] to the crate attributes to enable
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.
src/test/ui/feature-gate-slice-patterns.rs
浏览文件 @
7c90189e
...
...
@@ -8,11 +8,20 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Test that slice pattern syntax is gated by `slice_patterns` feature gate
// Test that slice pattern syntax
with `..`
is gated by `slice_patterns` feature gate
fn
main
()
{
let
x
=
[
1
,
2
,
3
,
4
,
5
];
match
x
{
[
1
,
2
,
xs
..
]
=>
{}
//~ ERROR slice pattern syntax is experimental
[
1
,
2
,
..
]
=>
{}
//~ ERROR syntax for subslices in slice patterns is not yet stabilized
[
1
,
..
,
5
]
=>
{}
//~ ERROR syntax for subslices in slice patterns is not yet stabilized
[
..
,
4
,
5
]
=>
{}
//~ ERROR syntax for subslices in slice patterns is not yet stabilized
}
let
x
=
[
1
,
2
,
3
,
4
,
5
];
match
x
{
[
xs
..
,
4
,
5
]
=>
{}
//~ ERROR syntax for subslices in slice patterns is not yet stabilized
[
1
,
xs
..
,
5
]
=>
{}
//~ ERROR syntax for subslices in slice patterns is not yet stabilized
[
1
,
2
,
xs
..
]
=>
{}
//~ ERROR syntax for subslices in slice patterns is not yet stabilized
}
}
src/test/ui/feature-gate-slice-patterns.stderr
浏览文件 @
7c90189e
error[E0658]: s
lice pattern syntax is experimental
(see issue #23121)
--> $DIR/feature-gate-slice-patterns.rs:16:
9
error[E0658]: s
yntax for subslices in slice patterns is not yet stabilized
(see issue #23121)
--> $DIR/feature-gate-slice-patterns.rs:16:
16
|
LL | [1, 2,
xs..] => {} //~ ERROR slice pattern syntax is experimental
|
^^^^^^^^^^
^^
LL | [1, 2,
..] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized
|
^^
|
= help: add #![feature(slice_patterns)] to the crate attributes to enable
error: aborting due to previous error
error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121)
--> $DIR/feature-gate-slice-patterns.rs:17:13
|
LL | [1, .., 5] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized
| ^^
|
= help: add #![feature(slice_patterns)] to the crate attributes to enable
error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121)
--> $DIR/feature-gate-slice-patterns.rs:18:10
|
LL | [.., 4, 5] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized
| ^^
|
= help: add #![feature(slice_patterns)] to the crate attributes to enable
error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121)
--> $DIR/feature-gate-slice-patterns.rs:23:11
|
LL | [ xs.., 4, 5 ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized
| ^^
|
= help: add #![feature(slice_patterns)] to the crate attributes to enable
error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121)
--> $DIR/feature-gate-slice-patterns.rs:24:14
|
LL | [ 1, xs.., 5 ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized
| ^^
|
= help: add #![feature(slice_patterns)] to the crate attributes to enable
error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121)
--> $DIR/feature-gate-slice-patterns.rs:25:17
|
LL | [ 1, 2, xs.. ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized
| ^^
|
= help: add #![feature(slice_patterns)] to the crate attributes to enable
error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0658`.
src/test/ui/mismatched_types/issue-38371.rs
浏览文件 @
7c90189e
...
...
@@ -7,8 +7,6 @@
// <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(slice_patterns)]
struct
Foo
{
}
...
...
src/test/ui/mismatched_types/issue-38371.stderr
浏览文件 @
7c90189e
error[E0308]: mismatched types
--> $DIR/issue-38371.rs:1
6
:8
--> $DIR/issue-38371.rs:1
4
:8
|
LL | fn foo(&foo: Foo) { //~ ERROR mismatched types
| ^^^^ expected struct `Foo`, found reference
...
...
@@ -9,7 +9,7 @@ LL | fn foo(&foo: Foo) { //~ ERROR mismatched types
= help: did you mean `foo: &Foo`?
error[E0308]: mismatched types
--> $DIR/issue-38371.rs:
30
:9
--> $DIR/issue-38371.rs:
28
:9
|
LL | fn agh(&&bar: &u32) { //~ ERROR mismatched types
| ^^^^ expected u32, found reference
...
...
@@ -19,7 +19,7 @@ LL | fn agh(&&bar: &u32) { //~ ERROR mismatched types
= help: did you mean `bar: &u32`?
error[E0308]: mismatched types
--> $DIR/issue-38371.rs:3
3
:8
--> $DIR/issue-38371.rs:3
1
:8
|
LL | fn bgh(&&bar: u32) { //~ ERROR mismatched types
| ^^^^^ expected u32, found reference
...
...
@@ -28,7 +28,7 @@ LL | fn bgh(&&bar: u32) { //~ ERROR mismatched types
found type `&_`
error[E0529]: expected an array or slice, found `u32`
--> $DIR/issue-38371.rs:3
6
:9
--> $DIR/issue-38371.rs:3
4
:9
|
LL | fn ugh(&[bar]: &u32) { //~ ERROR expected an array or slice
| ^^^^^ pattern cannot match with input type `u32`
...
...
src/test/ui/non-exhaustive-pattern-witness.rs
浏览文件 @
7c90189e
...
...
@@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(advanced_slice_patterns)]
#![feature(slice_patterns)]
struct
Foo
{
...
...
src/test/ui/non-exhaustive-pattern-witness.stderr
浏览文件 @
7c90189e
error[E0004]: non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered
--> $DIR/non-exhaustive-pattern-witness.rs:
20
:11
--> $DIR/non-exhaustive-pattern-witness.rs:
19
:11
|
LL | match (Foo { first: true, second: None }) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { first: false, second: Some([_, _, _, _]) }` not covered
error[E0004]: non-exhaustive patterns: `Red` not covered
--> $DIR/non-exhaustive-pattern-witness.rs:3
6
:11
--> $DIR/non-exhaustive-pattern-witness.rs:3
5
:11
|
LL | match Color::Red {
| ^^^^^^^^^^ pattern `Red` not covered
error[E0004]: non-exhaustive patterns: `East`, `South` and `West` not covered
--> $DIR/non-exhaustive-pattern-witness.rs:4
8
:11
--> $DIR/non-exhaustive-pattern-witness.rs:4
7
:11
|
LL | match Direction::North {
| ^^^^^^^^^^^^^^^^ patterns `East`, `South` and `West` not covered
error[E0004]: non-exhaustive patterns: `Second`, `Third`, `Fourth` and 8 more not covered
--> $DIR/non-exhaustive-pattern-witness.rs:5
9
:11
--> $DIR/non-exhaustive-pattern-witness.rs:5
8
:11
|
LL | match ExcessiveEnum::First {
| ^^^^^^^^^^^^^^^^^^^^ patterns `Second`, `Third`, `Fourth` and 8 more not covered
error[E0004]: non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered
--> $DIR/non-exhaustive-pattern-witness.rs:6
7
:11
--> $DIR/non-exhaustive-pattern-witness.rs:6
6
:11
|
LL | match Color::Red {
| ^^^^^^^^^^ pattern `CustomRGBA { a: true, .. }` not covered
error[E0004]: non-exhaustive patterns: `[Second(true), Second(false)]` not covered
--> $DIR/non-exhaustive-pattern-witness.rs:8
3
:11
--> $DIR/non-exhaustive-pattern-witness.rs:8
2
:11
|
LL | match *x {
| ^^ pattern `[Second(true), Second(false)]` not covered
error[E0004]: non-exhaustive patterns: `((), false)` not covered
--> $DIR/non-exhaustive-pattern-witness.rs:9
6
:11
--> $DIR/non-exhaustive-pattern-witness.rs:9
5
:11
|
LL | match ((), false) {
| ^^^^^^^^^^^ pattern `((), false)` not covered
...
...
src/test/ui/pat-slice-old-style.rs
浏览文件 @
7c90189e
...
...
@@ -8,11 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(slice_patterns)]
// NB: this test was introduced in #23121 and will have to change when default match binding modes
// stabilizes.
#![feature(slice_patterns)]
fn
slice_pat
(
x
:
&
[
u8
])
{
// OLD!
match
x
{
...
...
src/test/ui/rfc-2005-default-binding-mode/slice.rs
浏览文件 @
7c90189e
...
...
@@ -8,8 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(slice_patterns)]
#![feature(match_default_bindings)]
#![feature(slice_patterns)]
pub
fn
main
()
{
let
sl
:
&
[
u8
]
=
b
"foo"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录