Skip to content

Monomorphised log statements have the wrong path in the crate_map #3046

New issue

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

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

Already on GitHub? # to your account

Closed
brson opened this issue Jul 28, 2012 · 11 comments
Closed

Monomorphised log statements have the wrong path in the crate_map #3046

brson opened this issue Jul 28, 2012 · 11 comments
Labels
A-codegen Area: Code generation A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows

Comments

@brson
Copy link
Contributor

brson commented Jul 28, 2012

If you write RUST_LOG=::help ./servo you get a list that includes modules from core, std, and servo, but not any of the many other used crates. As a result I can't turn logging on for a lot of stuff. Probably we're hitting some arbitrary limit.

Edit:

When a generic function in crate http_client gets monomorphised when compiling servo, then you have to use RUST_LOG=servo to turn the logs on instead of RUST_LOG=http_client. The problem is this line in trans:

    let modpath = vec::append(                                                                                                                                                
        ~[path_mod(ccx.link_meta.name)],                                                                                                                                      
        vec::filter(bcx.fcx.path, |e|                                                                                                                                         
            alt e { path_mod(_) { true } _ { false } }                                                                                                                        
        ));                                                                                                                                                                   
    let modname = path_str(modpath);  

It prepends the current crate's name to every logging key, so logs for http_client::response_header end up as servo::response_header.

@brson
Copy link
Contributor Author

brson commented Jul 28, 2012

I'm particularly expecting to see http_client in the log map

@brson
Copy link
Contributor Author

brson commented Jul 28, 2012

Right now i'm thinking this is specifically a problem compiling the module map for logs in the top-level module. http_client's log statements are all in the top level, and they work when compiling with --test, but not when used as a library.

@brson
Copy link
Contributor Author

brson commented Jul 28, 2012

Indeed, when I add log statements to http_client::parser they do appear in the log map

@brson
Copy link
Contributor Author

brson commented Jul 28, 2012

The log statements are all inside a generic class, so they are not being compiled with the http_client crate. so what are they being called?

@brson
Copy link
Contributor Author

brson commented Jul 28, 2012

Updated the OP to reflect the actual problem.

@brson
Copy link
Contributor Author

brson commented Sep 1, 2012

I think this can be fixed by converting log to a macro that uses other macros to get the module path during the original syntax expansion.

@nikomatsakis
Copy link
Contributor

This may also be related to the fact that inlining does not preserve span information atm. (#1972)

@nikomatsakis
Copy link
Contributor

Oh, reading more of your comments, I think I was wrong.

@pcwalton
Copy link
Contributor

I don't believe this is backwards incompatible, renominating.

@graydon
Copy link
Contributor

graydon commented Jun 6, 2013

just a bug, removing milestone/nomination.

@graydon
Copy link
Contributor

graydon commented Jun 6, 2013

accepted for production-ready milestone

RalfJung pushed a commit to RalfJung/rust that referenced this issue Aug 31, 2023
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Adds a hidden `--crate-name` option to standalone Kani (i.e., `kani`)
only. This option allows users to override the crate name used during
the compilation of single-file Rust programs, making it easier to apply
Kani to non-Cargo projects (see rust-lang#3046 for more details).

Resolves rust-lang#3046
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-codegen Area: Code generation A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows
Projects
None yet
Development

No branches or pull requests

4 participants