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

Rollup of 7 pull requests #64713

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9755fe8
Add fs::read_dir() and ReadDir warning about iterator order + example
Aug 7, 2019
8068812
Remove Iteration order heading
Aug 8, 2019
53c5046
Fix gramitcal error in read_dir example
Aug 15, 2019
3c820fe
Comment out println in read_dir sorting example
Aug 26, 2019
91fd8ef
document the unstable iter_order_by library feature
KodrAus Sep 8, 2019
1161aeb
Replace println statements with explanatory comments
Sep 9, 2019
df7789c
Made a thread local storage panic message more explanatory
tomtau Sep 14, 2019
68c3739
updated the panic message wording
tomtau Sep 16, 2019
983e035
add long error explanation for E0524
GuillaumeGomez Sep 13, 2019
d2b873b
update ui tests
GuillaumeGomez Sep 13, 2019
c16a547
libtest: Add --report-time flag to print test execution time
jakoschiko Sep 21, 2019
645cdca
reduce visibility of a bunch of stuff in ext::tt
matklad Sep 22, 2019
827a5b2
rename libsyntax::ext::tt to mbe
matklad Sep 22, 2019
49f849c
rename tt -> mbe, part 2
matklad Sep 22, 2019
e30c516
move mbe module to a separate file
matklad Sep 22, 2019
636b354
docstring for mbe module
matklad Sep 22, 2019
9fd75f5
pull mbe token tree definition up
matklad Sep 22, 2019
9835697
push TokenTree::parse down
matklad Sep 22, 2019
81fe857
make mbe::TokenTree private to module
matklad Sep 22, 2019
d91b965
libtest: Make --report-time an unstable option
jakoschiko Sep 22, 2019
4ea371e
Delete iter-order-by.md
KodrAus Sep 23, 2019
0423c2a
Remove unused dependencies
sinkuu Sep 19, 2019
81ba34e
Rollup merge of #63356 - ali-raheem:issue#63183, r=KodrAus
Centril Sep 23, 2019
4d54581
Rollup merge of #64296 - KodrAus:chore/iter_order_by, r=Centril
Centril Sep 23, 2019
5d8a8b6
Rollup merge of #64428 - GuillaumeGomez:error-explanation-E0524, r=Ce…
Centril Sep 23, 2019
855bac5
Rollup merge of #64481 - tomtau:fix/tls-error-message, r=KodrAus
Centril Sep 23, 2019
4ac9261
Rollup merge of #64663 - jakoschiko:report-time, r=alexcrichton
Centril Sep 23, 2019
16f8f54
Rollup merge of #64689 - matklad:refactor-mbe, r=petrochenkov
Centril Sep 23, 2019
da42509
Rollup merge of #64702 - sinkuu:deps, r=jonas-schievink
Centril Sep 23, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3325,8 +3325,6 @@ dependencies = [
"log",
"rustc",
"rustc_data_structures",
"rustc_errors",
"syntax",
"syntax_pos",
]

Expand All @@ -3348,7 +3346,6 @@ dependencies = [
"log",
"memmap",
"num_cpus",
"parking_lot 0.9.0",
"rustc",
"rustc_apfloat",
"rustc_codegen_utils",
Expand All @@ -3367,7 +3364,6 @@ dependencies = [
name = "rustc_codegen_utils"
version = "0.0.0"
dependencies = [
"flate2",
"log",
"punycode",
"rustc",
Expand Down Expand Up @@ -3562,7 +3558,6 @@ name = "rustc_mir"
version = "0.0.0"
dependencies = [
"arena",
"byteorder",
"either",
"graphviz",
"log",
Expand Down Expand Up @@ -3615,7 +3610,6 @@ name = "rustc_plugin_impl"
version = "0.0.0"
dependencies = [
"rustc",
"rustc_errors",
"rustc_metadata",
"syntax",
"syntax_pos",
Expand All @@ -3639,7 +3633,6 @@ version = "0.0.0"
dependencies = [
"arena",
"bitflags",
"indexmap",
"log",
"rustc",
"rustc_data_structures",
Expand All @@ -3661,7 +3654,6 @@ dependencies = [
"rustc_codegen_utils",
"rustc_data_structures",
"rustc_target",
"rustc_typeck",
"serde_json",
"syntax",
"syntax_pos",
Expand Down Expand Up @@ -3692,9 +3684,7 @@ checksum = "b725dadae9fabc488df69a287f5a99c5eaf5d10853842a8a3dfac52476f544ee"
name = "rustc_traits"
version = "0.0.0"
dependencies = [
"bitflags",
"chalk-engine",
"graphviz",
"log",
"rustc",
"rustc_data_structures",
Expand Down Expand Up @@ -4057,7 +4047,6 @@ version = "0.0.0"
dependencies = [
"alloc",
"backtrace",
"cc",
"cfg-if",
"compiler_builtins",
"core",
Expand Down Expand Up @@ -4242,7 +4231,6 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_lexer",
"rustc_macros",
"rustc_target",
"scoped-tls",
"serialize",
Expand All @@ -4258,7 +4246,6 @@ dependencies = [
"log",
"rustc_data_structures",
"rustc_errors",
"rustc_lexer",
"rustc_target",
"smallvec",
"syntax",
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2581,7 +2581,7 @@ pub trait Iterator {
/// assert_eq!(xs.iter().cmp_by(&ys, |&x, &y| (x * x).cmp(&y)), Ordering::Equal);
/// assert_eq!(xs.iter().cmp_by(&ys, |&x, &y| (2 * x).cmp(&y)), Ordering::Greater);
/// ```
#[unstable(feature = "iter_order_by", issue = "0")]
#[unstable(feature = "iter_order_by", issue = "64295")]
fn cmp_by<I, F>(mut self, other: I, mut cmp: F) -> Ordering
where
Self: Sized,
Expand Down Expand Up @@ -2664,7 +2664,7 @@ pub trait Iterator {
/// Some(Ordering::Greater)
/// );
/// ```
#[unstable(feature = "iter_order_by", issue = "0")]
#[unstable(feature = "iter_order_by", issue = "64295")]
fn partial_cmp_by<I, F>(mut self, other: I, mut partial_cmp: F) -> Option<Ordering>
where
Self: Sized,
Expand Down Expand Up @@ -2729,7 +2729,7 @@ pub trait Iterator {
///
/// assert!(xs.iter().eq_by(&ys, |&x, &y| x * x == y));
/// ```
#[unstable(feature = "iter_order_by", issue = "0")]
#[unstable(feature = "iter_order_by", issue = "64295")]
fn eq_by<I, F>(mut self, other: I, mut eq: F) -> bool
where
Self: Sized,
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_ast_borrowck/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ doctest = false

[dependencies]
log = "0.4"
syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" }
# for "clarity", rename the graphviz crate to dot; graphviz within `borrowck`
# refers to the borrowck-specific graphviz adapter traits.
dot = { path = "../libgraphviz", package = "graphviz" }
rustc = { path = "../librustc" }
errors = { path = "../librustc_errors", package = "rustc_errors" }
rustc_data_structures = { path = "../librustc_data_structures" }
1 change: 0 additions & 1 deletion src/librustc_codegen_ssa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ memmap = "0.6"
log = "0.4.5"
libc = "0.2.44"
jobserver = "0.1.11"
parking_lot = "0.9"
tempfile = "3.1"

rustc_serialize = { path = "../libserialize", package = "serialize" }
Expand Down
1 change: 0 additions & 1 deletion src/librustc_codegen_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ path = "lib.rs"
test = false

[dependencies]
flate2 = "1.0"
log = "0.4"
punycode = "0.4.0"
rustc-demangle = "0.1.16"
Expand Down
1 change: 0 additions & 1 deletion src/librustc_mir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ rustc_lexer = { path = "../librustc_lexer" }
rustc_serialize = { path = "../libserialize", package = "serialize" }
syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" }
byteorder = { version = "1.3" }
rustc_apfloat = { path = "../librustc_apfloat" }
smallvec = { version = "0.6.7", features = ["union", "may_dangle"] }
64 changes: 63 additions & 1 deletion src/librustc_mir/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1993,6 +1993,69 @@ fn get_owned_iterator() -> IntoIter<i32> {
```
"##,

E0524: r##"
A variable which requires unique access is being used in more than one closure
at the same time.

Erroneous code example:

```compile_fail,E0524
fn set(x: &mut isize) {
*x += 4;
}

fn dragoooon(x: &mut isize) {
let mut c1 = || set(x);
let mut c2 = || set(x); // error!

c2();
c1();
}
```

To solve this issue, multiple solutions are available. First, is it required
for this variable to be used in more than one closure at a time? If it is the
case, use reference counted types such as `Rc` (or `Arc` if it runs
concurrently):

```
use std::rc::Rc;
use std::cell::RefCell;

fn set(x: &mut isize) {
*x += 4;
}

fn dragoooon(x: &mut isize) {
let x = Rc::new(RefCell::new(x));
let y = Rc::clone(&x);
let mut c1 = || { let mut x2 = x.borrow_mut(); set(&mut x2); };
let mut c2 = || { let mut x2 = y.borrow_mut(); set(&mut x2); }; // ok!

c2();
c1();
}
```

If not, just run closures one at a time:

```
fn set(x: &mut isize) {
*x += 4;
}

fn dragoooon(x: &mut isize) {
{ // This block isn't necessary since non-lexical lifetimes, it's just to
// make it more clear.
let mut c1 = || set(&mut *x);
c1();
} // `c1` has been dropped here so we're free to use `x` again!
let mut c2 = || set(&mut *x);
c2();
}
```
"##,

E0595: r##"
#### Note: this error code is no longer emitted by the compiler.

Expand Down Expand Up @@ -2393,7 +2456,6 @@ There are some known bugs that trigger this message.
// E0385, // {} in an aliasable location
E0493, // destructors cannot be evaluated at compile-time
E0521, // borrowed data escapes outside of closure
E0524, // two closures require unique access to `..` at the same time
E0526, // shuffle indices are not constant
E0594, // cannot assign to {}
// E0598, // lifetime of {} is too short to guarantee its contents can be...
Expand Down
1 change: 0 additions & 1 deletion src/librustc_plugin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ rustc = { path = "../librustc" }
rustc_metadata = { path = "../librustc_metadata" }
syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" }
rustc_errors = { path = "../librustc_errors" }
1 change: 0 additions & 1 deletion src/librustc_resolve/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ doctest = false

[dependencies]
bitflags = "1.0"
indexmap = "1"
log = "0.4"
syntax = { path = "../libsyntax" }
rustc = { path = "../librustc" }
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_resolve/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use syntax::ext::base::{self, InvocationRes, Indeterminate, SpecialDerives};
use syntax::ext::base::{MacroKind, SyntaxExtension};
use syntax::ext::expand::{AstFragment, AstFragmentKind, Invocation, InvocationKind};
use syntax::ext::hygiene::{self, ExpnId, ExpnData, ExpnKind};
use syntax::ext::tt::macro_rules;
use syntax::ext::compile_declarative_macro;
use syntax::feature_gate::{emit_feature_err, is_builtin_attr_name};
use syntax::feature_gate::GateIssue;
use syntax::symbol::{Symbol, kw, sym};
Expand Down Expand Up @@ -843,7 +843,7 @@ impl<'a> Resolver<'a> {
/// Compile the macro into a `SyntaxExtension` and possibly replace it with a pre-defined
/// extension partially or entirely for built-in macros and legacy plugin macros.
crate fn compile_macro(&mut self, item: &ast::Item, edition: Edition) -> SyntaxExtension {
let mut result = macro_rules::compile(
let mut result = compile_declarative_macro(
&self.session.parse_sess, self.session.features_untracked(), item, edition
);

Expand Down
1 change: 0 additions & 1 deletion src/librustc_save_analysis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ rustc = { path = "../librustc" }
rustc_data_structures = { path = "../librustc_data_structures" }
rustc_codegen_utils = { path = "../librustc_codegen_utils" }
rustc_target = { path = "../librustc_target" }
rustc_typeck = { path = "../librustc_typeck" }
serde_json = "1"
syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" }
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_traits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ name = "rustc_traits"
path = "lib.rs"

[dependencies]
bitflags = "1.0"
graphviz = { path = "../libgraphviz" }
log = { version = "0.4" }
rustc = { path = "../librustc" }
rustc_data_structures = { path = "../librustc_data_structures" }
Expand Down
3 changes: 0 additions & 3 deletions src/libstd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ fortanix-sgx-abi = { version = "0.3.2", features = ['rustc-dep-of-std'] }
[target.wasm32-wasi.dependencies]
wasi = { version = "0.7.0", features = ['rustc-dep-of-std', 'alloc'] }

[build-dependencies]
cc = "1.0"

[features]
default = ["std_detect_file_io", "std_detect_dlsym_getauxval"]

Expand Down
25 changes: 25 additions & 0 deletions src/libstd/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ pub struct Metadata(fs_imp::FileAttr);
/// information like the entry's path and possibly other metadata can be
/// learned.
///
/// The order in which this iterator returns entries is platform and filesystem
/// dependent.
///
/// # Errors
///
/// This [`io::Result`] will be an [`Err`] if there's some sort of intermittent
Expand Down Expand Up @@ -1962,6 +1965,9 @@ pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
///
/// [changes]: ../io/index.html#platform-specific-behavior
///
/// The order in which this iterator returns entries is platform and filesystem
/// dependent.
///
/// # Errors
///
/// This function will return an error in the following situations, but is not
Expand Down Expand Up @@ -1994,6 +2000,25 @@ pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
/// Ok(())
/// }
/// ```
///
/// ```rust,no_run
/// use std::{fs, io};
///
/// fn main() -> io::Result<()> {
/// let mut entries = fs::read_dir(".")?
/// .map(|res| res.map(|e| e.path()))
/// .collect::<Result<Vec<_>, io::Error>>()?;
///
/// // The order in which `read_dir` returns entries is not guaranteed. If reproducible
/// // ordering is required the entries should be explicitly sorted.
///
/// entries.sort();
///
/// // The entries have now been sorted by their path.
///
/// Ok(())
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn read_dir<P: AsRef<Path>>(path: P) -> io::Result<ReadDir> {
fs_imp::readdir(path.as_ref()).map(ReadDir)
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/thread/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ impl<T: 'static> LocalKey<T> {
#[stable(feature = "rust1", since = "1.0.0")]
pub fn with<F, R>(&'static self, f: F) -> R
where F: FnOnce(&T) -> R {
self.try_with(f).expect("cannot access a TLS value during or \
after it is destroyed")
self.try_with(f).expect("cannot access a Thread Local Storage value \
during or after destruction")
}

/// Acquires a reference to the value in this TLS key.
Expand Down
1 change: 0 additions & 1 deletion src/libsyntax/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ syntax_pos = { path = "../libsyntax_pos" }
errors = { path = "../librustc_errors", package = "rustc_errors" }
rustc_data_structures = { path = "../librustc_data_structures" }
rustc_lexer = { path = "../librustc_lexer" }
rustc_macros = { path = "../librustc_macros" }
rustc_target = { path = "../librustc_target" }
smallvec = { version = "0.6.7", features = ["union", "may_dangle"] }
6 changes: 3 additions & 3 deletions src/libsyntax/ext/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::config::StripUnconfigured;
use crate::ext::base::*;
use crate::ext::proc_macro::{collect_derives, MarkAttrs};
use crate::ext::hygiene::{ExpnId, SyntaxContext, ExpnData, ExpnKind};
use crate::ext::tt::macro_rules::annotate_err_with_kind;
use crate::ext::mbe::macro_rules::annotate_err_with_kind;
use crate::ext::placeholders::{placeholder, PlaceholderExpander};
use crate::feature_gate::{self, Features, GateIssue, is_builtin_attr, emit_feature_err};
use crate::mut_visit::*;
Expand Down Expand Up @@ -115,8 +115,8 @@ macro_rules! ast_fragments {
}
}

impl<'a> MacResult for crate::ext::tt::macro_rules::ParserAnyMacro<'a> {
$(fn $make_ast(self: Box<crate::ext::tt::macro_rules::ParserAnyMacro<'a>>)
impl<'a> MacResult for crate::ext::mbe::macro_rules::ParserAnyMacro<'a> {
$(fn $make_ast(self: Box<crate::ext::mbe::macro_rules::ParserAnyMacro<'a>>)
-> Option<$AstTy> {
Some(self.make(AstFragmentKind::$Kind).$make_ast())
})*
Expand Down
Loading