Skip to content

Move std::{reflect,repr,Poly} to a libdebug crate #14364

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

Merged
merged 1 commit into from
May 28, 2014

Conversation

alexcrichton
Copy link
Member

This commit moves reflection (as well as the {:?} format modifier) to a new
libdebug crate, all of which is marked experimental.

This is a breaking change because it now requires the debug crate to be
explicitly linked if the :? format qualifier is used. This means that any code
using this feature will have to add extern crate debug; to the top of the
crate. Any code relying on reflection will also need to do this.

Closes #12019

[breaking-change]

# fn main() {
# let mystery_object = ();
// `{:?}` will conveniently print any type,
// but it requires the `debug` crate is linked in
Copy link
Member

Choose a reason for hiding this comment

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

"requires that the..." or "requires the debug crate to be linked in"

@alexcrichton
Copy link
Member Author

Updated with comments.

extern crate arena;
extern crate collections;
extern crate debug;
Copy link
Member

Choose a reason for hiding this comment

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

Would be great to not need this (even better if it's not required to build rustc and its dependencies at all), especially if we want to fiddle around with reflection (I thought of some improvements that weren't worth pursuing when everything was in libstd).

@seanmonstar
Copy link
Contributor

It'd be cool if this took the opportunity to allow registering flags for fmt. Would open the way for serialize::json to add some sort of {:json} or whatever flag.

@brson
Copy link
Contributor

brson commented May 28, 2014

What's the failure mode when somebody tries to use :? in a format string?

@alexcrichton
Copy link
Member Author

Resolve will complain about the undefined path debug::fmt::Poly and will ask if you meant to have an extern crate debug

This commit moves reflection (as well as the {:?} format modifier) to a new
libdebug crate, all of which is marked experimental.

This is a breaking change because it now requires the debug crate to be
explicitly linked if the :? format qualifier is used. This means that any code
using this feature will have to add `extern crate debug;` to the top of the
crate. Any code relying on reflection will also need to do this.

Closes rust-lang#12019

[breaking-change]
bors added a commit that referenced this pull request May 28, 2014
This commit moves reflection (as well as the {:?} format modifier) to a new
libdebug crate, all of which is marked experimental.

This is a breaking change because it now requires the debug crate to be
explicitly linked if the :? format qualifier is used. This means that any code
using this feature will have to add `extern crate debug;` to the top of the
crate. Any code relying on reflection will also need to do this.

Closes #12019

[breaking-change]
@bors bors closed this May 28, 2014
@bors bors merged commit b53454e into rust-lang:master May 28, 2014
@alexcrichton alexcrichton deleted the libdebug branch May 28, 2014 15:34
AngryLawyer added a commit to Rust-SDL2/rust-sdl2 that referenced this pull request May 29, 2014
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.

put reflection in format strings behind a feature gate or mark it with #[experimental]
6 participants