@@ -3448,6 +3448,7 @@ impl Remap {
3448
3448
let include_world_id = self . map_world ( include_world, Some ( span) ) ?;
3449
3449
let include_world = & resolve. worlds [ include_world_id] ;
3450
3450
let mut names_ = names. to_owned ( ) ;
3451
+ let is_external_include = world. package != include_world. package ;
3451
3452
3452
3453
// remove all imports and exports that match the names we're including
3453
3454
for import in include_world. imports . iter ( ) {
@@ -3465,11 +3466,25 @@ impl Remap {
3465
3466
3466
3467
// copy the imports and exports from the included world into the current world
3467
3468
for import in include_world. imports . iter ( ) {
3468
- self . resolve_include_item ( names, & mut world. imports , import, span, "import" ) ?;
3469
+ self . resolve_include_item (
3470
+ names,
3471
+ & mut world. imports ,
3472
+ import,
3473
+ span,
3474
+ "import" ,
3475
+ is_external_include,
3476
+ ) ?;
3469
3477
}
3470
3478
3471
3479
for export in include_world. exports . iter ( ) {
3472
- self . resolve_include_item ( names, & mut world. exports , export, span, "export" ) ?;
3480
+ self . resolve_include_item (
3481
+ names,
3482
+ & mut world. exports ,
3483
+ export,
3484
+ span,
3485
+ "export" ,
3486
+ is_external_include,
3487
+ ) ?;
3473
3488
}
3474
3489
Ok ( ( ) )
3475
3490
}
@@ -3481,6 +3496,7 @@ impl Remap {
3481
3496
item : ( & WorldKey , & WorldItem ) ,
3482
3497
span : Span ,
3483
3498
item_type : & str ,
3499
+ is_external_include : bool ,
3484
3500
) -> Result < ( ) > {
3485
3501
match item. 0 {
3486
3502
WorldKey :: Name ( n) => {
@@ -3515,7 +3531,7 @@ impl Remap {
3515
3531
} ,
3516
3532
) => {
3517
3533
assert_eq ! ( * aid, * bid) ;
3518
- merge_stability ( astability, bstability) ?;
3534
+ merge_include_stability ( astability, bstability, is_external_include ) ?;
3519
3535
}
3520
3536
( WorldItem :: Interface { .. } , _) => unreachable ! ( ) ,
3521
3537
( WorldItem :: Function ( _) , _) => unreachable ! ( ) ,
@@ -3948,25 +3964,18 @@ fn update_stability(from: &Stability, into: &mut Stability) -> Result<()> {
3948
3964
bail ! ( "mismatch in stability from '{:?}' to '{:?}'" , from, into)
3949
3965
}
3950
3966
3951
- /// Compares the two attributes and if the `from` is more stable than the `into` then
3952
- /// it will elevate the `into` to the same stability.
3953
- /// This should be used after its already been confirmed that the types are the same and
3954
- /// should be apart of the component because versions/features are enabled.
3955
- fn merge_stability ( from : & Stability , into : & mut Stability ) -> Result < ( ) > {
3956
- // If the two stability annotations are equal then
3957
- // there's nothing to do here.
3958
- if from == into {
3959
- return Ok ( ( ) ) ;
3960
- }
3961
-
3962
- // if the from is more stable elevate stability of into
3963
- if from > into {
3964
- * into = from. clone ( ) ;
3967
+ fn merge_include_stability (
3968
+ from : & Stability ,
3969
+ into : & mut Stability ,
3970
+ is_external_include : bool ,
3971
+ ) -> Result < ( ) > {
3972
+ if is_external_include && from. is_stable ( ) {
3973
+ log:: trace!( "dropped stability from external package" ) ;
3974
+ * into = Stability :: Unknown ;
3965
3975
return Ok ( ( ) ) ;
3966
3976
}
3967
3977
3968
- // otherwise `into`` already has higher stability
3969
- return Ok ( ( ) ) ;
3978
+ return update_stability ( from, into) ;
3970
3979
}
3971
3980
3972
3981
/// An error that can be returned during "world elaboration" during various
0 commit comments