fix: Fix, clarify and require a value for proc_macro_cwd of CrateData

This commit is contained in:
Lukas Wirth 2025-03-29 07:59:59 +01:00
parent 2e1ff255ae
commit faf1b49a9a
17 changed files with 143 additions and 74 deletions

View file

@ -362,7 +362,7 @@ impl ProcMacroExpander for IdentityWhenValidProcMacroExpander {
_: Span,
_: Span,
_: Span,
_: Option<String>,
_: String,
) -> Result<TopSubtree, ProcMacroExpansionError> {
let (parse, _) = syntax_bridge::token_tree_to_syntax_node(
subtree,

View file

@ -52,6 +52,7 @@ pub const BAZ: u32 = 0;
{
// Add a dependency a -> b.
let mut new_crate_graph = CrateGraphBuilder::default();
let mut add_crate = |crate_name, root_file_idx: usize| {
new_crate_graph.add_crate_root(
files[root_file_idx].file_id(),
@ -63,7 +64,13 @@ pub const BAZ: u32 = 0;
Env::default(),
CrateOrigin::Local { repo: None, name: Some(Symbol::intern(crate_name)) },
false,
None,
Arc::new(
// FIXME: This is less than ideal
TryFrom::try_from(
&*std::env::current_dir().unwrap().as_path().to_string_lossy(),
)
.unwrap(),
),
Arc::new(CrateWorkspaceData { data_layout: Err("".into()), toolchain: None }),
)
};