From ff5226cd2fa12fe82c7cef8112905af7cb48fe9d Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 1 Nov 2018 14:17:39 -0700 Subject: std: Enable usage of `thread_local!` through imports The `thread_local!` macro delegated to an internal macro but it didn't do so in a macros-and-the-module-system compatible fashion, meaning if a `#![no_std]` crate imported `std` and tried to use `thread_local!` it would fail due to missing a lookup of an internal macro. This commit switches the macro to instead use `$crate` to invoke other macros, ensuring that it'll work when `thread_local!` is imported alone. --- src/libstd/thread/local.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index 59f100fad1b..74bed0a64c5 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -145,13 +145,13 @@ macro_rules! thread_local { // process multiple declarations ($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty = $init:expr; $($rest:tt)*) => ( - __thread_local_inner!($(#[$attr])* $vis $name, $t, $init); - thread_local!($($rest)*); + $crate::__thread_local_inner!($(#[$attr])* $vis $name, $t, $init); + $crate::thread_local!($($rest)*); ); // handle a single declaration ($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty = $init:expr) => ( - __thread_local_inner!($(#[$attr])* $vis $name, $t, $init); + $crate::__thread_local_inner!($(#[$attr])* $vis $name, $t, $init); ); } @@ -201,7 +201,7 @@ macro_rules! __thread_local_inner { }; ($(#[$attr:meta])* $vis:vis $name:ident, $t:ty, $init:expr) => { $(#[$attr])* $vis const $name: $crate::thread::LocalKey<$t> = - __thread_local_inner!(@key $(#[$attr])* $vis $name, $t, $init); + $crate::__thread_local_inner!(@key $(#[$attr])* $vis $name, $t, $init); } } -- cgit 1.4.1-3-g733a5 From 424fecdfb612f82527d8b74be3510b2171d0f5b3 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 2 Nov 2018 18:23:51 +0100 Subject: Add precision for create_dir function --- src/libstd/fs.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/libstd') diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 017949291bc..49012a7d341 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -1755,12 +1755,19 @@ pub fn canonicalize>(path: P) -> io::Result { /// /// [changes]: ../io/index.html#platform-specific-behavior /// +/// **NOTE**: If a parent of the given path doesn't exist, this function will +/// return an error. To create a directory and all its missing parents at the +/// same time, use the [`create_dir_all`] function. +/// /// # Errors /// /// This function will return an error in the following situations, but is not /// limited to just these cases: /// /// * User lacks permissions to create directory at `path`. +/// * A parent of the given path doesn't exist. (To create a directory and all +/// its missing parents at the same time, use the [`create_dir_all`] +/// function.) /// * `path` already exists. /// /// # Examples -- cgit 1.4.1-3-g733a5