File tree Expand file tree Collapse file tree 6 files changed +56
-10
lines changed
test/run-make/thumb-none-qemu/example
rustc-std-workspace-alloc Expand file tree Collapse file tree 6 files changed +56
-10
lines changed Original file line number Diff line number Diff line change 22name = " example"
33version = " 0.1.0"
44authors = [" Hideki Sekine <sekineh@me.com>" ]
5- # edition = "2018"
5+ edition = " 2018"
66
77[dependencies ]
88cortex-m = " 0.5.4"
Original file line number Diff line number Diff line change 11// #![feature(stdsimd)]
22#![ no_main]
33#![ 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-
114use core:: fmt:: Write ;
125use 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;
1412
1513entry ! ( main) ;
1614
@@ -22,7 +20,7 @@ fn main() -> ! {
2220
2321 // write something through semihosting interface
2422 let mut hstdout = semihosting:: hio:: hstdout ( ) . unwrap ( ) ;
25- write ! ( hstdout, "x = {}\n " , x) ;
23+ let _ = write ! ( hstdout, "x = {}\n " , x) ;
2624
2725 // exit from qemu
2826 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'
66description = """
77Hack for the compiler's own build system
88"""
9+ edition = " 2018"
910
1011[lib ]
1112path = " 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;
3434pub mod errors;
3535pub mod features;
3636pub mod cargo;
37+ pub mod edition;
3738pub mod pal;
3839pub mod deps;
3940pub mod extdeps;
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ fn main() {
2222 style:: check ( & path, & mut bad) ;
2323 errors:: check ( & path, & mut bad) ;
2424 cargo:: check ( & path, & mut bad) ;
25+ edition:: check ( & path, & mut bad) ;
2526 let collected = features:: check ( & path, & mut bad, verbose) ;
2627 pal:: check ( & path, & mut bad) ;
2728 unstable_book:: check ( & path, collected, & mut bad) ;
You can’t perform that action at this time.
0 commit comments