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

cfg_eval exits prematurely if it encounters an experimental_... argument #6985

Open
ironcev opened this issue Mar 4, 2025 · 0 comments
Open
Assignees
Labels
bug Something isn't working compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen compiler General compiler. Should eventually become more specific as the issue is triaged team:compiler Compiler Team

Comments

@ironcev
Copy link
Member

ironcev commented Mar 4, 2025

cfg_eval must return false if any of the cfg attributes return false. Currently cfg_eval exists immediately if it encounters an experimental_... argument and returns the value of that particular evaluation.

E.g., in this example, the fun function exists and can be called in main, although the program_type is not a library.

script;

#[cfg(experimental_new_encoding = true)]
#[cfg(program_type = "library")]
fn fun() -> bool {
     true
}

fn main() {
    let _ = fun();
}

If the order of the two cfg attributes changes or the #[cfg(experimental_new_encoding = true)] gets removed, the cfg_eval will properly evaluate to false and the fun will not be available in main.

@ironcev ironcev added bug Something isn't working compiler General compiler. Should eventually become more specific as the issue is triaged compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen team:compiler Compiler Team labels Mar 4, 2025
@ironcev ironcev self-assigned this Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen compiler General compiler. Should eventually become more specific as the issue is triaged team:compiler Compiler Team
Projects
None yet
Development

No branches or pull requests

1 participant