Skip to content

Add support for include_str #5100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2020
Merged

Add support for include_str #5100

merged 1 commit into from
Jun 27, 2020

Conversation

lnicola
Copy link
Member

@lnicola lnicola commented Jun 27, 2020

@lnicola
Copy link
Member Author

lnicola commented Jun 27, 2020

I'm not sure what to test for? For some reason, "expand macros recursively" doesn't seem to work.

@edwin0cheng
Copy link
Member

Adding something like this inside the out_dir_checks should works:

let should_<|>be_str = include_str!(“text.rs”);

@lnicola
Copy link
Member Author

lnicola commented Jun 27, 2020

For some reason, we don't seem to find the file -- relative_file(db, arg_id.into(), &path) is None even though path looks correct. This happens even with include!("main.rs"), but we might not find the file in the database anyway. Should we expand to "" for now?

@edwin0cheng
Copy link
Member

iirc, we added a constraint for limiting self including in relative_path in include! case. Maybe we should add an enum to turn off it if needed ?

@lnicola
Copy link
Member Author

lnicola commented Jun 27, 2020

Oh, right, it works with other files. But what about non-.rs files? I assume they're not going to be found in the database.

@edwin0cheng
Copy link
Member

edwin0cheng commented Jun 27, 2020

I remember we have some discussion with @matklad that all non-rs files should be included by users explicitly. So I think it is okay for now

@lnicola
Copy link
Member Author

lnicola commented Jun 27, 2020

Added a small hack.

@edwin0cheng
Copy link
Member

Just small nits, otherwise LGTM

bors d+

@bors
Copy link
Contributor

bors bot commented Jun 27, 2020

✌️ lnicola can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@lnicola
Copy link
Member Author

lnicola commented Jun 27, 2020

Just small nits, otherwise LGTM

Which nits? 😄

),
work_done_progress_params: Default::default(),
});
assert!(dbg!(res.to_string()).contains("&str"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remain dbg ?

@lnicola
Copy link
Member Author

lnicola commented Jun 27, 2020

bors r=edwin0cheng

@bors
Copy link
Contributor

bors bot commented Jun 27, 2020

@bors bors bot merged commit 446fd3f into rust-lang:master Jun 27, 2020
@lnicola lnicola deleted the include-str branch June 27, 2020 16:46
@lnicola lnicola restored the include-str branch June 27, 2020 16:46
@lnicola lnicola deleted the include-str branch June 27, 2020 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants