Skip to content

unintended provocation of thread_local_internals feature #24334

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

Closed
BurntSushi opened this issue Apr 11, 2015 · 5 comments
Closed

unintended provocation of thread_local_internals feature #24334

BurntSushi opened this issue Apr 11, 2015 · 5 comments
Labels
A-stability Area: `#[stable]`, `#[unstable]` etc.

Comments

@BurntSushi
Copy link
Member

I have no idea what's causing this, but on the current nightly, this fails:

use std::thread::scoped;
fn main() { let _ = scoped(move || ()); }

with "use of unstable library feature 'thread_local_internals'." Enabling the feature works, but this should be a stable function. Interestingly, tweaking the use works:

use std::thread;
fn main() { let _ = thread::scoped(move || ()); }

I wonder if it's because there is a (private) sub-module called scoped which has a module-wide unstable marker.

Version info:

[andrew@Liger scoped] rustc --version
rustc 1.0.0-nightly (93f7fe32d 2015-04-10) (built 2015-04-11)
@rprichard
Copy link
Contributor

I wonder if it's because there is a (private) sub-module called scoped which has a module-wide unstable marker.

This change was introduced just recently: f651bea.

I reproduced the problem without using anything thread-related:

mycrate.rs:

#![feature(staged_api)]
#![crate_type = "lib"]
#![staged_api]
#![stable(feature = "mycrate", since = "1.0.0")]

#[unstable(feature = "mycrate_internals")]
mod bar {}
#[stable(feature = "mycrate", since = "1.0.0")]
pub fn bar() {}

main.rs:

extern crate mycrate;
use mycrate::bar;
fn main() {}

Commands:

rustc mycrate.rs
rustc main.rs -L.

Output:

main.rs:2:5: 2:17 error: use of unstable library feature 'mycrate_internals'
main.rs:2 use mycrate::bar;
              ^~~~~~~~~~~~
main.rs:2:17: 2:17 help: add #![feature(mycrate_internals)] to the crate attributes to enable
main.rs:2:5: 2:17 warning: unused import, #[warn(unused_imports)] on by default
main.rs:2 use mycrate::bar;
              ^~~~~~~~~~~~
  • If I remove the unstable attribute from the mycrate::bar module, the code gives me the use of unmarked library feature error.
  • I mark mycrate::bar as stable, then the code compiles.
  • If I instead remove the mycrate::bar function, I get the module bar is private error.

cc @alexcrichton

alexcrichton added a commit to alexcrichton/rust that referenced this issue Apr 13, 2015
Make sure the unstable `scoped` modules isn't named the same as the `scoped`
function.

cc rust-lang#24334
bors added a commit that referenced this issue Apr 13, 2015
Make sure the unstable `scoped` modules isn't named the same as the `scoped`
function.

cc #24334
@steveklabnik
Copy link
Member

With #24362 merged, is this fixed?

@alexcrichton
Copy link
Member

The exact issue at hand has been resolved, but the underlying issue remains. Specifically a module and free-function of the same name but different stability level will cause problems.

@shadowmint
Copy link

Also hit by this; still affecting the nightly for osx right now, but hopefully the next build will include the fix.

@steveklabnik steveklabnik added the A-stability Area: `#[stable]`, `#[unstable]` etc. label Apr 20, 2015
@brson
Copy link
Contributor

brson commented Dec 1, 2016

Stability is an internal detail. This is unlikely to impact out-of-tree code.

@brson brson closed this as completed Dec 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-stability Area: `#[stable]`, `#[unstable]` etc.
Projects
None yet
Development

No branches or pull requests

6 participants