Skip to content

Commit a7a60dc

Browse files
committed
Auto merge of #51969 - pietroalbini:rollup, r=pietroalbini
Rollup of 7 pull requests Successful merges: - #51511 (Stabilize Iterator::flatten in 1.29, fixes #48213.) - #51853 (Fix some doc links) - #51890 (Fix inconsequential typo in GlobalAlloc doc example) - #51920 (use literal span for concrete type suggestion) - #51921 (improve the error message when `#[panic_implementation]` is missing) - #51922 (rename the llvm-tools component to llvm-tools-preview and tweak its image) - #51961 (Fix typo in /src/librustc_resolve/lib.rs) Failed merges: r? @ghost
2 parents a2be769 + 3e95491 commit a7a60dc

File tree

16 files changed

+89
-42
lines changed

16 files changed

+89
-42
lines changed

src/bootstrap/dist.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -1787,15 +1787,18 @@ impl Step for LlvmTools {
17871787
let tmp = tmpdir(builder);
17881788
let image = tmp.join("llvm-tools-image");
17891789
drop(fs::remove_dir_all(&image));
1790-
t!(fs::create_dir_all(&image.join("bin")));
17911790

17921791
// Prepare the image directory
1792+
let bindir = builder
1793+
.llvm_out(target)
1794+
.join("bin");
1795+
let dst = image.join("lib/rustlib")
1796+
.join(target)
1797+
.join("bin");
1798+
t!(fs::create_dir_all(&dst));
17931799
for tool in LLVM_TOOLS {
1794-
let exe = builder
1795-
.llvm_out(target)
1796-
.join("bin")
1797-
.join(exe(tool, &target));
1798-
builder.install(&exe, &image.join("bin"), 0o755);
1800+
let exe = bindir.join(exe(tool, &target));
1801+
builder.install(&exe, &dst, 0o755);
17991802
}
18001803

18011804
// Prepare the overlay
@@ -1818,7 +1821,7 @@ impl Step for LlvmTools {
18181821
.arg("--non-installed-overlay").arg(&overlay)
18191822
.arg(format!("--package-name={}-{}", name, target))
18201823
.arg("--legacy-manifest-dirs=rustlib,cargo")
1821-
.arg("--component-name=llvm-tools");
1824+
.arg("--component-name=llvm-tools-preview");
18221825

18231826

18241827
builder.run(&mut cmd);

src/libcore/future.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ pub trait Future {
4545
///
4646
/// This function returns:
4747
///
48-
/// - `Poll::Pending` if the future is not ready yet
49-
/// - `Poll::Ready(val)` with the result `val` of this future if it finished
50-
/// successfully.
48+
/// - [`Poll::Pending`] if the future is not ready yet
49+
/// - [`Poll::Ready(val)`] with the result `val` of this future if it
50+
/// finished successfully.
5151
///
5252
/// Once a future has finished, clients should not `poll` it again.
5353
///
5454
/// When a future is not ready yet, `poll` returns
55-
/// [`Poll::Pending`](::task::Poll). The future will *also* register the
55+
/// `Poll::Pending`. The future will *also* register the
5656
/// interest of the current task in the value being produced. For example,
5757
/// if the future represents the availability of data on a socket, then the
5858
/// task is recorded so that when data arrives, it is woken up (via
59-
/// [`cx.waker()`](::task::Context::waker)). Once a task has been woken up,
59+
/// [`cx.waker()`]). Once a task has been woken up,
6060
/// it should attempt to `poll` the future again, which may or may not
6161
/// produce a final value.
6262
///
@@ -90,6 +90,10 @@ pub trait Future {
9090
/// then any future calls to `poll` may panic, block forever, or otherwise
9191
/// cause bad behavior. The `Future` trait itself provides no guarantees
9292
/// about the behavior of `poll` after a future has completed.
93+
///
94+
/// [`Poll::Pending`]: ../task/enum.Poll.html#variant.Pending
95+
/// [`Poll::Ready(val)`]: ../task/enum.Poll.html#variant.Ready
96+
/// [`cx.waker()`]: ../task/struct.Context.html#method.waker
9397
fn poll(self: PinMut<Self>, cx: &mut task::Context) -> Poll<Self::Output>;
9498
}
9599

src/libcore/iter/iterator.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -1036,8 +1036,6 @@ pub trait Iterator {
10361036
/// Basic usage:
10371037
///
10381038
/// ```
1039-
/// #![feature(iterator_flatten)]
1040-
///
10411039
/// let data = vec![vec![1, 2, 3, 4], vec![5, 6]];
10421040
/// let flattened = data.into_iter().flatten().collect::<Vec<u8>>();
10431041
/// assert_eq!(flattened, &[1, 2, 3, 4, 5, 6]);
@@ -1046,8 +1044,6 @@ pub trait Iterator {
10461044
/// Mapping and then flattening:
10471045
///
10481046
/// ```
1049-
/// #![feature(iterator_flatten)]
1050-
///
10511047
/// let words = ["alpha", "beta", "gamma"];
10521048
///
10531049
/// // chars() returns an iterator
@@ -1074,8 +1070,6 @@ pub trait Iterator {
10741070
/// Flattening once only removes one level of nesting:
10751071
///
10761072
/// ```
1077-
/// #![feature(iterator_flatten)]
1078-
///
10791073
/// let d3 = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]];
10801074
///
10811075
/// let d2 = d3.iter().flatten().collect::<Vec<_>>();
@@ -1093,7 +1087,7 @@ pub trait Iterator {
10931087
///
10941088
/// [`flat_map()`]: #method.flat_map
10951089
#[inline]
1096-
#[unstable(feature = "iterator_flatten", issue = "48213")]
1090+
#[stable(feature = "iterator_flatten", since = "1.29")]
10971091
fn flatten(self) -> Flatten<Self>
10981092
where Self: Sized, Self::Item: IntoIterator {
10991093
Flatten { inner: flatten_compat(self) }

src/libcore/iter/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -2575,13 +2575,13 @@ impl<I, U, F> FusedIterator for FlatMap<I, U, F>
25752575
/// [`flatten`]: trait.Iterator.html#method.flatten
25762576
/// [`Iterator`]: trait.Iterator.html
25772577
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
2578-
#[unstable(feature = "iterator_flatten", issue = "48213")]
2578+
#[stable(feature = "iterator_flatten", since = "1.29")]
25792579
pub struct Flatten<I: Iterator>
25802580
where I::Item: IntoIterator {
25812581
inner: FlattenCompat<I, <I::Item as IntoIterator>::IntoIter>,
25822582
}
25832583

2584-
#[unstable(feature = "iterator_flatten", issue = "48213")]
2584+
#[stable(feature = "iterator_flatten", since = "1.29")]
25852585
impl<I, U> fmt::Debug for Flatten<I>
25862586
where I: Iterator + fmt::Debug, U: Iterator + fmt::Debug,
25872587
I::Item: IntoIterator<IntoIter = U, Item = U::Item>,
@@ -2591,15 +2591,15 @@ impl<I, U> fmt::Debug for Flatten<I>
25912591
}
25922592
}
25932593

2594-
#[unstable(feature = "iterator_flatten", issue = "48213")]
2594+
#[stable(feature = "iterator_flatten", since = "1.29")]
25952595
impl<I, U> Clone for Flatten<I>
25962596
where I: Iterator + Clone, U: Iterator + Clone,
25972597
I::Item: IntoIterator<IntoIter = U, Item = U::Item>,
25982598
{
25992599
fn clone(&self) -> Self { Flatten { inner: self.inner.clone() } }
26002600
}
26012601

2602-
#[unstable(feature = "iterator_flatten", issue = "48213")]
2602+
#[stable(feature = "iterator_flatten", since = "1.29")]
26032603
impl<I, U> Iterator for Flatten<I>
26042604
where I: Iterator, U: Iterator,
26052605
I::Item: IntoIterator<IntoIter = U, Item = U::Item>
@@ -2627,7 +2627,7 @@ impl<I, U> Iterator for Flatten<I>
26272627
}
26282628
}
26292629

2630-
#[unstable(feature = "iterator_flatten", issue = "48213")]
2630+
#[stable(feature = "iterator_flatten", since = "1.29")]
26312631
impl<I, U> DoubleEndedIterator for Flatten<I>
26322632
where I: DoubleEndedIterator, U: DoubleEndedIterator,
26332633
I::Item: IntoIterator<IntoIter = U, Item = U::Item>
@@ -2650,7 +2650,7 @@ impl<I, U> DoubleEndedIterator for Flatten<I>
26502650
}
26512651
}
26522652

2653-
#[unstable(feature = "iterator_flatten", issue = "48213")]
2653+
#[stable(feature = "iterator_flatten", since = "1.29")]
26542654
impl<I, U> FusedIterator for Flatten<I>
26552655
where I: FusedIterator, U: Iterator,
26562656
I::Item: IntoIterator<IntoIter = U, Item = U::Item> {}

src/libcore/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
#![feature(extern_types)]
9090
#![feature(fundamental)]
9191
#![feature(intrinsics)]
92-
#![feature(iterator_flatten)]
9392
#![feature(lang_items)]
9493
#![feature(link_llvm_intrinsics)]
9594
#![feature(never_type)]

src/libcore/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#![feature(flt2dec)]
2424
#![feature(fmt_internals)]
2525
#![feature(hashmap_internals)]
26-
#![feature(iterator_flatten)]
2726
#![feature(pattern)]
2827
#![feature(range_is_empty)]
2928
#![feature(raw)]

src/librustc/middle/weak_lang_items.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,13 @@ fn verify<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
112112
if missing.contains(&lang_items::$item) &&
113113
!whitelisted(tcx, lang_items::$item) &&
114114
items.$name().is_none() {
115-
tcx.sess.err(&format!("language item required, but not found: `{}`",
116-
stringify!($name)));
117-
115+
if lang_items::$item == lang_items::PanicImplLangItem {
116+
tcx.sess.err(&format!("`#[panic_implementation]` function required, \
117+
but not found"));
118+
} else {
119+
tcx.sess.err(&format!("language item required, but not found: `{}`",
120+
stringify!($name)));
121+
}
118122
}
119123
)*
120124
}

src/librustc_resolve/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2794,7 +2794,7 @@ impl<'a> Resolver<'a> {
27942794
/// A variant of `smart_resolve_path` where you also specify extra
27952795
/// information about where the path came from; this extra info is
27962796
/// sometimes needed for the lint that recommends rewriting
2797-
/// absoluate paths to `crate`, so that it knows how to frame the
2797+
/// absolute paths to `crate`, so that it knows how to frame the
27982798
/// suggestion. If you are just resolving a path like `foo::bar`
27992799
/// that appears...somewhere, though, then you just want
28002800
/// `CrateLint::SimplePath`, which is what `smart_resolve_path`

src/librustc_typeck/check/method/suggest.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
245245
"f32"
246246
};
247247
match expr.node {
248-
hir::ExprLit(_) => { // numeric literal
249-
let snippet = tcx.sess.codemap().span_to_snippet(expr.span)
248+
hir::ExprLit(ref lit) => { // numeric literal
249+
let snippet = tcx.sess.codemap().span_to_snippet(lit.span)
250250
.unwrap_or("<numeric literal>".to_string());
251-
// FIXME: use the literal for missing snippet
252251

253-
err.span_suggestion(expr.span,
252+
err.span_suggestion(lit.span,
254253
&format!("you must specify a concrete type for \
255254
this numeric value, like `{}`",
256255
concrete_type),

src/libstd/alloc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
//! ```rust,ignore (demonstrates crates.io usage)
6262
//! extern crate jemallocator;
6363
//!
64-
//! use jemallacator::Jemalloc;
64+
//! use jemallocator::Jemalloc;
6565
//!
6666
//! #[global_allocator]
6767
//! static GLOBAL: Jemalloc = Jemalloc;

src/libstd/error.rs

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ use string;
4949
///
5050
/// [`Result<T, E>`]: ../result/enum.Result.html
5151
/// [`Display`]: ../fmt/trait.Display.html
52+
/// [`Debug`]: ../fmt/trait.Debug.html
5253
/// [`cause`]: trait.Error.html#method.cause
5354
#[stable(feature = "rust1", since = "1.0.0")]
5455
pub trait Error: Debug + Display {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// error-pattern: `#[panic_implementation]` function required, but not found
12+
13+
#![feature(lang_items)]
14+
#![no_main]
15+
#![no_std]
16+
17+
#[lang = "eh_personality"]
18+
fn eh() {}

src/test/compile-fail/weak-lang-item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
// aux-build:weak-lang-items.rs
12-
// error-pattern: language item required, but not found: `panic_impl`
12+
// error-pattern: `#[panic_implementation]` function required, but not found
1313
// error-pattern: language item required, but not found: `eh_personality`
1414
// ignore-wasm32-bare compiled with panic=abort, personality not required
1515

src/test/ui/issue-51874.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
let a = (1.0).pow(1.0); //~ ERROR can't call method `pow` on ambiguous numeric type
13+
}

src/test/ui/issue-51874.stderr

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error[E0689]: can't call method `pow` on ambiguous numeric type `{float}`
2+
--> $DIR/issue-51874.rs:12:19
3+
|
4+
LL | let a = (1.0).pow(1.0); //~ ERROR can't call method `pow` on ambiguous numeric type
5+
| ^^^
6+
help: you must specify a concrete type for this numeric value, like `f32`
7+
|
8+
LL | let a = (1.0_f32).pow(1.0); //~ ERROR can't call method `pow` on ambiguous numeric type
9+
| ^^^^^^^
10+
11+
error: aborting due to previous error
12+
13+
For more information about this error, try `rustc --explain E0689`.

src/tools/build-manifest/src/main.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,11 @@ impl Builder {
298298
self.package("rls-preview", &mut manifest.pkg, HOSTS);
299299
self.package("rustfmt-preview", &mut manifest.pkg, HOSTS);
300300
self.package("rust-analysis", &mut manifest.pkg, TARGETS);
301-
self.package("llvm-tools", &mut manifest.pkg, TARGETS);
301+
self.package("llvm-tools-preview", &mut manifest.pkg, TARGETS);
302302

303303
let rls_present = manifest.pkg.contains_key("rls-preview");
304304
let rustfmt_present = manifest.pkg.contains_key("rustfmt-preview");
305-
let llvm_tools_present = manifest.pkg.contains_key("llvm-tools");
305+
let llvm_tools_present = manifest.pkg.contains_key("llvm-tools-preview");
306306

307307
if rls_present {
308308
manifest.renames.insert("rls".to_owned(), Rename { to: "rls-preview".to_owned() });
@@ -359,7 +359,7 @@ impl Builder {
359359
}
360360
if llvm_tools_present {
361361
extensions.push(Component {
362-
pkg: "llvm-tools".to_string(),
362+
pkg: "llvm-tools-preview".to_string(),
363363
target: host.to_string(),
364364
});
365365
}
@@ -486,7 +486,7 @@ impl Builder {
486486
&self.rls_version
487487
} else if component == "rustfmt" || component == "rustfmt-preview" {
488488
&self.rustfmt_version
489-
} else if component == "llvm-tools" {
489+
} else if component == "llvm-tools" || component == "llvm-tools-preview" {
490490
&self.llvm_tools_version
491491
} else {
492492
&self.rust_version
@@ -500,7 +500,7 @@ impl Builder {
500500
&self.rls_git_commit_hash
501501
} else if component == "rustfmt" || component == "rustfmt-preview" {
502502
&self.rustfmt_git_commit_hash
503-
} else if component == "llvm-tools" {
503+
} else if component == "llvm-tools" || component == "llvm-tools-preview" {
504504
&self.llvm_tools_git_commit_hash
505505
} else {
506506
&self.rust_git_commit_hash

0 commit comments

Comments
 (0)