-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #113865 - Dylan-DPC:rollup-pt960bk, r=Dylan-DPC
Rollup of 7 pull requests Successful merges: - #113444 (add tests for alias bound preference) - #113716 (Add the `no-builtins` attribute to functions when `no_builtins` is applied at the crate level.) - #113754 (Simplify native_libs query) - #113765 (Make it clearer that edition functions are `>=`, not `==`) - #113774 (Improve error message when closing bracket interpreted as formatting fill character) - #113785 (Fix invalid display of inlined re-export when both local and foreign items are inlined) - #113803 (Fix inline_const with interpolated block) r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
46 changed files
with
425 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,28 @@ | ||
use rustc_data_structures::fx::FxIndexMap; | ||
use rustc_hir as hir; | ||
use rustc_hir::def::DefKind; | ||
use rustc_hir::def_id::DefId; | ||
use rustc_middle::query::LocalCrate; | ||
use rustc_middle::ty::TyCtxt; | ||
use rustc_session::cstore::ForeignModule; | ||
|
||
pub(crate) fn collect(tcx: TyCtxt<'_>) -> Vec<ForeignModule> { | ||
let mut modules = Vec::new(); | ||
pub(crate) fn collect(tcx: TyCtxt<'_>, LocalCrate: LocalCrate) -> FxIndexMap<DefId, ForeignModule> { | ||
let mut modules = FxIndexMap::default(); | ||
|
||
// We need to collect all the `ForeignMod`, even if they are empty. | ||
for id in tcx.hir().items() { | ||
if !matches!(tcx.def_kind(id.owner_id), DefKind::ForeignMod) { | ||
continue; | ||
} | ||
|
||
let def_id = id.owner_id.to_def_id(); | ||
let item = tcx.hir().item(id); | ||
if let hir::ItemKind::ForeignMod { items, .. } = item.kind { | ||
|
||
if let hir::ItemKind::ForeignMod { abi, items } = item.kind { | ||
let foreign_items = items.iter().map(|it| it.id.owner_id.to_def_id()).collect(); | ||
modules.push(ForeignModule { foreign_items, def_id: id.owner_id.to_def_id() }); | ||
modules.insert(def_id, ForeignModule { def_id, abi, foreign_items }); | ||
} | ||
} | ||
|
||
modules | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.