mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
fix: Fix target-data-layout fetching incorrectly passing 'rustc' to rustc
This commit is contained in:
parent
c9d33cddc9
commit
384fa4b84a
8 changed files with 144 additions and 63 deletions
|
@ -12,6 +12,13 @@ pub fn target_data_layout_query(
|
|||
krate: CrateId,
|
||||
) -> Option<Arc<TargetDataLayout>> {
|
||||
let crate_graph = db.crate_graph();
|
||||
let target_layout = crate_graph[krate].target_layout.as_ref()?;
|
||||
Some(Arc::new(TargetDataLayout::parse_from_llvm_datalayout_string(&target_layout).ok()?))
|
||||
let target_layout = crate_graph[krate].target_layout.as_ref().ok()?;
|
||||
let res = TargetDataLayout::parse_from_llvm_datalayout_string(&target_layout);
|
||||
if let Err(_e) = &res {
|
||||
// FIXME: Print the error here once it implements debug/display
|
||||
// also logging here is somewhat wrong, but unfortunately this is the earliest place we can
|
||||
// parse that doesn't impose a dependency to the rust-abi crate for project-model
|
||||
tracing::error!("Failed to parse target data layout for {krate:?}");
|
||||
}
|
||||
res.ok().map(Arc::new)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue