@@ -43,14 +43,8 @@ impl DocTestBuilder {
43
43
// If `test_id` is `None`, it means we're generating code for a code example "run" link.
44
44
test_id : Option < String > ,
45
45
) -> Self {
46
- let SourceInfo {
47
- crate_attrs,
48
- maybe_crate_attrs,
49
- crates,
50
- everything_else,
51
- has_features,
52
- has_no_std,
53
- } = partition_source ( source, edition) ;
46
+ let SourceInfo { crate_attrs, maybe_crate_attrs, crates, everything_else } =
47
+ partition_source ( source, edition) ;
54
48
55
49
// Uses librustc_ast to parse the doctest and find if there's a main fn and the extern
56
50
// crate already is included.
@@ -92,9 +86,8 @@ impl DocTestBuilder {
92
86
// others. Same if it contains `#[feature]` or `#[no_std]`.
93
87
let can_be_merged = can_merge_doctests
94
88
&& !failed_ast
95
- && !has_no_std
96
- && !has_features
97
89
&& !has_global_allocator
90
+ && crate_attrs. is_empty ( )
98
91
// If this is a merged doctest and a defined macro uses `$crate`, then the path will
99
92
// not work, so better not put it into merged doctests.
100
93
&& !( has_macro_def && everything_else. contains ( "$crate" ) ) ;
@@ -427,8 +420,6 @@ fn check_for_main_and_extern_crate(
427
420
enum AttrKind {
428
421
CrateAttr ,
429
422
Attr ,
430
- Feature ,
431
- NoStd ,
432
423
}
433
424
434
425
/// Returns `Some` if the attribute is complete and `Some(true)` if it is an attribute that can be
@@ -473,11 +464,7 @@ fn check_if_attr_is_complete(source: &str, edition: Edition) -> Option<AttrKind>
473
464
Ok ( attr) => {
474
465
let attr_name = attr. name_or_empty ( ) ;
475
466
476
- if attr_name == sym:: feature {
477
- Some ( AttrKind :: Feature )
478
- } else if attr_name == sym:: no_std {
479
- Some ( AttrKind :: NoStd )
480
- } else if not_crate_attrs. contains ( & attr_name) {
467
+ if not_crate_attrs. contains ( & attr_name) {
481
468
// There is one exception to these attributes:
482
469
// `#![allow(internal_features)]`. If this attribute is used, we need to
483
470
// consider it only as a crate-level attribute.
@@ -511,14 +498,6 @@ fn handle_attr(mod_attr_pending: &mut String, source_info: &mut SourceInfo, edit
511
498
let push_to = match attr_kind {
512
499
AttrKind :: CrateAttr => & mut source_info. crate_attrs ,
513
500
AttrKind :: Attr => & mut source_info. maybe_crate_attrs ,
514
- AttrKind :: Feature => {
515
- source_info. has_features = true ;
516
- & mut source_info. crate_attrs
517
- }
518
- AttrKind :: NoStd => {
519
- source_info. has_no_std = true ;
520
- & mut source_info. crate_attrs
521
- }
522
501
} ;
523
502
push_to. push_str ( mod_attr_pending) ;
524
503
push_to. push ( '\n' ) ;
@@ -535,8 +514,6 @@ struct SourceInfo {
535
514
maybe_crate_attrs : String ,
536
515
crates : String ,
537
516
everything_else : String ,
538
- has_features : bool ,
539
- has_no_std : bool ,
540
517
}
541
518
542
519
fn partition_source ( s : & str , edition : Edition ) -> SourceInfo {
0 commit comments