Skip to content
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

Refcounted hooks #221

Merged
merged 3 commits into from
Dec 13, 2020
Merged

Refcounted hooks #221

merged 3 commits into from
Dec 13, 2020

Conversation

udoprog
Copy link
Collaborator

@udoprog udoprog commented Dec 13, 2020

This accomplishes the following:

  • Public items are correctly exported if they're within a recursively public module.
  • #[test] functions are correctly discovered regardless of where they are using a new CompileVisitor::register_meta hook that is called for every item registered (instead of every item used).
  • For consistency, the file loader hook is also made to be refcounted.

TODO

On issue this causes is that nested test functions are picked up incorrectly:

fn function() {
    #[test]
    fn test_fn() {
        assert!(true);
    }
}

This runs as:

testing hello::$0::test_fn                       passed
====
Ran 1 tests with 0 failures in 0.002 seconds

Strictly speaking this also exports functions like this if they are pub. This could be fixed by setting up an internal module which prevents it from being public.

@udoprog udoprog added the enhancement New feature or request label Dec 13, 2020
@udoprog udoprog merged commit f8694f2 into main Dec 13, 2020
@udoprog udoprog deleted the refcounted-hooks branch December 13, 2020 17:56
@udoprog udoprog added the changelog Issue has been added to the changelog label Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog Issue has been added to the changelog enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant