File tree 6 files changed +56
-10
lines changed
test/run-make/thumb-none-qemu/example
rustc-std-workspace-alloc
6 files changed +56
-10
lines changed Original file line number Diff line number Diff line change 2
2
name = " example"
3
3
version = " 0.1.0"
4
4
authors = [
" Hideki Sekine <[email protected] >" ]
5
- # edition = "2018"
5
+ edition = " 2018"
6
6
7
7
[dependencies ]
8
8
cortex-m = " 0.5.4"
Original file line number Diff line number Diff line change 1
1
// #![feature(stdsimd)]
2
2
#![ no_main]
3
3
#![ no_std]
4
-
5
- extern crate cortex_m;
6
-
7
- extern crate cortex_m_rt as rt;
8
- extern crate cortex_m_semihosting as semihosting;
9
- extern crate panic_halt;
10
-
11
4
use core:: fmt:: Write ;
12
5
use cortex_m:: asm;
13
- use rt:: entry;
6
+ use cortex_m_rt:: entry;
7
+ use cortex_m_semihosting as semihosting;
8
+
9
+ //FIXME: This imports the provided #[panic_handler].
10
+ #[ allow( rust_2018_idioms) ]
11
+ extern crate panic_halt;
14
12
15
13
entry ! ( main) ;
16
14
@@ -22,7 +20,7 @@ fn main() -> ! {
22
20
23
21
// write something through semihosting interface
24
22
let mut hstdout = semihosting:: hio:: hstdout ( ) . unwrap ( ) ;
25
- write ! ( hstdout, "x = {}\n " , x) ;
23
+ let _ = write ! ( hstdout, "x = {}\n " , x) ;
26
24
27
25
// exit from qemu
28
26
semihosting:: debug:: exit ( semihosting:: debug:: EXIT_SUCCESS ) ;
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ license = 'MIT OR Apache-2.0'
6
6
description = """
7
7
Hack for the compiler's own build system
8
8
"""
9
+ edition = " 2018"
9
10
10
11
[lib ]
11
12
path = " lib.rs"
Original file line number Diff line number Diff line change
1
+ //! Tidy check to ensure that crate `edition` is '2018'
2
+ //!
3
+
4
+ use std:: path:: Path ;
5
+
6
+ fn filter_dirs ( path : & Path ) -> bool {
7
+ // FIXME: just use super::filter_dirs after the submodules are updated.
8
+ if super :: filter_dirs ( path) {
9
+ return true ;
10
+ }
11
+ let skip = [
12
+ "src/doc/book/second-edition" ,
13
+ "src/doc/book/2018-edition" ,
14
+ "src/doc/book/ci/stable-check" ,
15
+ "src/doc/reference/stable-check" ,
16
+ ] ;
17
+ skip. iter ( ) . any ( |p| path. ends_with ( p) )
18
+ }
19
+
20
+ fn is_edition_2018 ( mut line : & str ) -> bool {
21
+ line = line. trim ( ) ;
22
+ line == "edition = \" 2018\" " || line == "edition = \' 2018\' "
23
+ }
24
+
25
+ pub fn check ( path : & Path , bad : & mut bool ) {
26
+ super :: walk (
27
+ path,
28
+ & mut |path| filter_dirs ( path) || path. ends_with ( "src/test" ) ,
29
+ & mut |entry, contents| {
30
+ let file = entry. path ( ) ;
31
+ let filename = file. file_name ( ) . unwrap ( ) ;
32
+ if filename != "Cargo.toml" {
33
+ return ;
34
+ }
35
+ let has_edition = contents. lines ( ) . any ( is_edition_2018) ;
36
+ if !has_edition {
37
+ tidy_error ! (
38
+ bad,
39
+ "{} doesn't have `edition = \" 2018\" ` on a separate line" ,
40
+ file. display( )
41
+ ) ;
42
+ }
43
+ } ,
44
+ ) ;
45
+ }
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ pub mod style;
34
34
pub mod errors;
35
35
pub mod features;
36
36
pub mod cargo;
37
+ pub mod edition;
37
38
pub mod pal;
38
39
pub mod deps;
39
40
pub mod extdeps;
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ fn main() {
22
22
style:: check ( & path, & mut bad) ;
23
23
errors:: check ( & path, & mut bad) ;
24
24
cargo:: check ( & path, & mut bad) ;
25
+ edition:: check ( & path, & mut bad) ;
25
26
let collected = features:: check ( & path, & mut bad, verbose) ;
26
27
pal:: check ( & path, & mut bad) ;
27
28
unstable_book:: check ( & path, collected, & mut bad) ;
You can’t perform that action at this time.
0 commit comments