2个稳定版本
| 9001.0.1 | 2020年2月13日 | 
|---|
#1378 in 数据结构
4KB
想要数组索引不再工作吗?
只需创建一个依赖于 break_array 的crate
use break_array as _;
fn main(){
    let array=[0,1,2,3];
    assert_eq!( array[0], 0 );
}
并欣赏编译器错误
  |
6 |     assert_eq!( array[0], 0 );
  |                       ^ expected struct `break_array::MyType`, found integer
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.
注意:如果你来自遥远的未来,你可能无法获得这个编译器错误。
lib.rs:
想要数组索引不再工作吗?
只需创建一个依赖于 break_array 的crate
use break_array as _;
fn main(){
    let array=[0,1,2,3];
    assert_eq!( array[0], 0 );
}
并欣赏编译器错误
  |
6 |     assert_eq!( array[0], 0 );
  |                       ^ expected struct `break_array::MyType`, found integer
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.