File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change
1
+ //! Test that `#![no_core]` doesn't break modern Rust syntax in edition 2018.
2
+ //!
3
+ //! When you use `#![no_core]`, you lose the automatic prelude, but you can still
4
+ //! get everything back by manually importing `use core::{prelude::v1::*, *}`.
5
+ //! This test makes sure that after doing that, things like `for` loops and the
6
+ //! `?` operator still work as expected.
7
+
1
8
//@ run-pass
9
+ //@ edition:2018
2
10
3
11
#![ allow( dead_code, unused_imports) ]
4
12
#![ feature( no_core) ]
5
13
#![ no_core]
6
- //@ edition:2018
7
14
8
- extern crate std;
9
15
extern crate core;
10
- use core:: { prelude:: v1:: * , * } ;
16
+ extern crate std;
17
+ use core:: prelude:: v1:: * ;
18
+ use core:: * ;
11
19
12
- fn foo ( ) {
20
+ fn test_for_loop ( ) {
13
21
for _ in & [ ( ) ] { }
14
22
}
15
23
16
- fn bar ( ) -> Option < ( ) > {
24
+ fn test_question_mark_operator ( ) -> Option < ( ) > {
17
25
None ?
18
26
}
19
27
You can’t perform that action at this time.
0 commit comments