Skip to content

mir-opt tests: add ability to match lines that contain the filename #43621

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

Closed
wants to merge 1 commit into from

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Aug 3, 2017

As part of #43403, I wanted to write mir-opt tests that check lines that contain types which involve the name of the file was was compiled (this is because with closures, that filename leaks into the name of the type as printed). It is currently not possible to write such a test as the filename is not stable.

So, this PR introduces the magic variable $FILE that can be used in mir-opt tests to refer to the name of the current file, so that it can be used to test against.

@rust-highfive
Copy link
Contributor

r? @aturon

(rust_highfive has picked a reviewer for you, use r? to override)

@RalfJung
Copy link
Member Author

RalfJung commented Aug 3, 2017

Cc @nikomatsakis

@aidanhs aidanhs added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 3, 2017
@aturon
Copy link
Member

aturon commented Aug 4, 2017

@eddyb @arielb1, one of you up for reviewing this?

@arielb1
Copy link
Contributor

arielb1 commented Aug 4, 2017

rustc has the -Z span_free_formats option that disables span emission for closures, which is used say in https://github.com/rust-lang/rust/blob/master/src/test/mir-opt/end_region_7.rs#L11. Does that work for you @RalfJung ?

@RalfJung
Copy link
Member Author

RalfJung commented Aug 4, 2017

Yes, that looks great, thanks!

@RalfJung RalfJung closed this Aug 4, 2017
@RalfJung RalfJung deleted the mir-opt branch August 16, 2018 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants