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

unintended provocation of thread_local_internals feature #24334

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

Comments

Projects
None yet
6 participants
@BurntSushi
Copy link
Member

BurntSushi commented Apr 11, 2015

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

This comment has been minimized.

Copy link
Contributor

rprichard commented Apr 11, 2015

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

std: Work around a stability bug in thread
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

Auto merge of #24362 - alexcrichton:issue-24334, r=huonw
Make sure the unstable `scoped` modules isn't named the same as the `scoped`
function.

cc #24334
@steveklabnik

This comment has been minimized.

Copy link
Member

steveklabnik commented Apr 13, 2015

With #24362 merged, is this fixed?

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Apr 13, 2015

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

This comment has been minimized.

Copy link

shadowmint commented Apr 14, 2015

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

@brson

This comment has been minimized.

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 Dec 1, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.