Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Oct 12, 2014

(I am new to Git and Github so I'm really sorry if I messed up somewhere)

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @huonw (or someone else) soon.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd just remove this comment.

@pcwalton
Copy link
Contributor

r=me with comment removed. Thanks!

@alexcrichton
Copy link
Member

Could you also be sure to add a test case for this as well?

@ghost
Copy link
Author

ghost commented Oct 25, 2014

Updated. Is the test case ok?

@alexcrichton
Copy link
Member

Thanks! Could you also squash the commits together as well?

Only change is to stop an ICE when a foreign static are referenced in
consts and statics.

See: #16538, #16479, #14227, #13325
@ghost
Copy link
Author

ghost commented Oct 25, 2014

Ok, I think that worked.

@thestinger
Copy link
Contributor

Isn't it already impossible to refer to the value of a static in a constant expression?

@ghost
Copy link
Author

ghost commented Oct 25, 2014

It is. There is still an error when you do that, it's just more useful than an ICE.

E.g. compiling this code:

extern {
    static x: i32;
}

const X: i32 = x;

fn main() { }

before:

$ rustc main.rs
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'expected item, found foreign item x::x (id=5)', .../rust/src/libsyntax/ast_map/mod.rs:327

after:

$ rustc main.rs
main.rs:5:16: 5:17 error: cannot refer to other statics by value, use the address-of operator or a constant instead
main.rs:5 const X: i32 = x;
                         ^
main.rs:5:16: 5:17 error: constants cannot refer to other statics, insert an intermediate constant instead
main.rs:5 const X: i32 = x;
                         ^

@ghost ghost closed this Oct 29, 2014
lnicola pushed a commit to lnicola/rust that referenced this pull request Aug 29, 2024
Expand proc-macros in workspace root, not package root

Should fix rust-lang/rust-analyzer#17748. The approach is generally not perfect though as rust-project.json projects don't benefit from this (still, nothing changes in that regard)
This pull request was closed.
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.

6 participants