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

Macros show up in rust docs when pub use'd #40768

Closed
jrobsonchase opened this issue Mar 23, 2017 · 15 comments
Closed

Macros show up in rust docs when pub use'd #40768

jrobsonchase opened this issue Mar 23, 2017 · 15 comments
Assignees
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@jrobsonchase
Copy link

From my understanding, macro re-export is unstable and feature-gated, but macros are showing up in rust docs when, for example, I have:

#[macro_use]
extern crate log;
pub use log::*;

Which would seem to imply that they should be accessible from other crates, even though they can't.

rustc version:
rustc 1.17.0-nightly (134c4a0 2017-03-20)

cc @jseyfried

@jseyfried jseyfried self-assigned this Mar 24, 2017
@jseyfried
Copy link
Contributor

@Pursuit92
use with macros should be feature-gated, but glob imports can bypass the feature gate (this is a bug -- the feature gate only got implemented for single imports).

That being said, we want to stabilize #![feature(use_extern_macros)] as is this cycle, so I don't think this is worth gating this gating today and breaking procedural-masquerade.

@jseyfried jseyfried added the A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) label Mar 24, 2017
@brson brson added I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 17, 2017
@brson
Copy link
Contributor

brson commented Jul 17, 2017

Apparently this allows stable reexport of macro_rules macros, not on purpose. Seems like this should be addressed.

@SimonSapin
Copy link
Contributor

We have been shipping for several months code that relies on stable reexporting of macro_rules macros. Please don’t break this now.

@jrobsonchase
Copy link
Author

I disagree with the notion that we shouldn't fix bugs just because there might be code that relies on the incorrect behavior. That's how we end up with windows-esque insanity where bugs from back in the DOS days get forward ported rather than fixed to actually match the spec.

@SimonSapin
Copy link
Contributor

there might be code

There definitely is, this is not theoretical.

the incorrect behavior

This behavior is not incorrect: it is working perfectly as intended. The only part that wasn’t intended is making that behavior available on the stable channel yet.

There is also no other way to achieve this on today’s stable rust, so "fixing" this accidental stabilization would be a regression in functionality.

@jrobsonchase
Copy link
Author

There was also some code in existence (some of mine included) that relied on Go's built-in hashmaps being consistently ordered between separate range iterations, even though the spec explicitly said that iteration order was not guaranteed and should be considered random. That doesn't mean, IMO, that it was a mistake to change iteration order to truly be random and break everything that depended on it. They were just wrong in their reliance on an implementation detail.

And there are plenty of things that aren't possible in stable rust. The fact that something was made possible by mistake is no reason to get stuck with a feature design that may or may not be how it would eventually end up.

@jseyfried
Copy link
Contributor

@jechas01

no reason to get stuck with a feature design that may or may not be how it would eventually end up.

There's wide agreement that this is how it will end up, so there's very little risk of this. We almost stabilized use_extern_macros a couple of release cycles ago but wanted to avoid advertising it until declarative macros 2.0 was further along (we could re-evaluate now that declarative macros 2.0 is landed behind a feature gate).

@Mark-Simulacrum Mark-Simulacrum added C-bug Category: This is a bug. and removed I-wrong labels Jul 27, 2017
@nikomatsakis
Copy link
Contributor

I don't really know what's going on. @jseyfried -- what is your recommended course of action here?

@jseyfried
Copy link
Contributor

Recommended course of action is to stabilize #![feature(use_extern_macros)], but there's no hurry.

@nikomatsakis nikomatsakis added T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. I-nominated labels Sep 7, 2017
@nikomatsakis
Copy link
Contributor

Recategorizing as a @rust-lang/t-dev-tools-docs issue, since this appears to be a rustdoc limitation, though I think @jseyfried's recommendation (that we stabilize the underlying feature) may be wise. @jseyfried -- what is the relevant tracking issue?

@arielb1 arielb1 added T-lang Relevant to the language team, which will review and decide on the PR/issue. I-nominated and removed T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools labels Sep 7, 2017
@arielb1
Copy link
Contributor

arielb1 commented Sep 7, 2017

See #40768 (comment)

Looks like something was accidentally stabilized. I bet it's common-law-stable by now.

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Sep 7, 2017

Er, I take it back, sorry dev-tools-doc team =)

@aturon
Copy link
Member

aturon commented Oct 19, 2017

Lang team discussed in meeting. Conclusion was: we don't want to break code working today, and would prefer to push toward stabilization of re-exports. @withoutboats will take action on the applicable tracking issue.

@jseyfried
Copy link
Contributor

jseyfried commented Oct 19, 2017

Relevant tracking issue is #35896.

@jrobsonchase
Copy link
Author

No longer relevant as of the stable 1.30 release, closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

8 participants