File tree Expand file tree Collapse file tree 4 files changed +30
-0
lines changed
Expand file tree Collapse file tree 4 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,14 @@ impl<'s> ScriptSource<'s> {
7575 raw. len ( ) ..raw. len ( ) ,
7676 ) . push_visible_span ( open_start..open_end) ) ;
7777 }
78+ _ if u8:: try_from ( fence_length) . is_err ( ) => {
79+ return Err ( FrontmatterError :: new (
80+ format ! (
81+ "too many `-` symbols: frontmatter openings may be delimited by up to 255 `-` symbols, but found {fence_length}"
82+ ) ,
83+ open_start..open_end,
84+ ) ) ;
85+ }
7886 _ => { }
7987 }
8088 source. open = Some ( open_start..open_end) ;
Original file line number Diff line number Diff line change @@ -270,6 +270,14 @@ fn fence_mismatch_2() {
270270 assert_failure ( fixture_path, assertion_path) ;
271271}
272272
273+ #[ cargo_test( nightly, reason = "-Zscript is unstable" ) ]
274+ #[ rustfmt:: skip] // code-generated
275+ fn fence_too_many_dashes ( ) {
276+ let fixture_path = "tests/testsuite/script/rustc_fixtures/fence-too-many-dashes.rs" ;
277+ let assertion_path = "tests/testsuite/script/rustc_fixtures/fence-too-many-dashes.stderr" ;
278+ assert_failure ( fixture_path, assertion_path) ;
279+ }
280+
273281#[ cargo_test( nightly, reason = "-Zscript is unstable" ) ]
274282#[ rustfmt:: skip] // code-generated
275283fn fence_unclosed_1 ( ) {
Original file line number Diff line number Diff line change 1+ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2+ [ dependencies]
3+ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4+
5+ #![ feature ( frontmatter) ]
6+
7+ // check that we limit fence lengths
8+
9+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ [ERROR] too many `-` symbols: frontmatter openings may be delimited by up to 255 `-` symbols, but found 256
2+ --> script:1:1
3+ |
4+ 1 | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
5+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You can’t perform that action at this time.
0 commit comments