Skip to content

Commit 8bf7fda

Browse files
committed
Auto merge of #58189 - kennytm:rollup, r=kennytm
Rollup of 23 pull requests Successful merges: - #58001 (proc_macro: make `TokenStream::from_streams` pre-allocate its vector.) - #58096 (Transition linkchecker to 2018 edition) - #58097 (Transition remote test to Rust 2018) - #58106 (libfmt_macros => 2018) - #58107 (libgraphviz => 2018) - #58108 (Add NVPTX target to a build manifest) - #58109 (librustc_privacy => 2018) - #58112 (libpanic_abort => 2018) - #58113 (Transition build-manifest to 2018 edition) - #58114 (Transition tidy and unstable-book-gen to 2018 edition) - #58116 (Include the span of attributes of the lhs to the span of the assignment expression) - #58117 (Transition rustdoc-theme to 2018 edition) - #58128 (libunwind => 2018) - #58138 (Fix #58101) - #58139 (hir: add more HirId methods) - #58141 (Remove weasel word in docs for iter's take_while()) - #58142 (Remove stray FIXME) - #58145 (Add #[must_use] to core::task::Poll) - #58162 (Add more debugging code to track down appveyor 259 exit code) - #58169 (Update contributor name in .mailmap) - #58172 (update split docs) - #58182 (SGX target: handle empty user buffers correctly) - #58186 (Add Rustlings to the doc index) Failed merges: r? @ghost
2 parents b2c6b8c + c23871a commit 8bf7fda

File tree

40 files changed

+188
-62
lines changed

40 files changed

+188
-62
lines changed

.mailmap

+1
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ Matt Brubeck <[email protected]> <[email protected]>
155155
Matthew Auld <[email protected]>
156156
157157
Matthijs Hofstra <[email protected]>
158+
158159
Michael Williams <[email protected]>
159160
Michael Woerister <michaelwoerister@posteo> <michaelwoerister@gmail>
160161
Mickaël Raybaud-Roig <[email protected]> m-r-r <[email protected]>

appveyor.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,10 @@ test_script:
207207
- sh src/ci/init_repo.sh . /c/cache/rustsrc
208208
- set SRC=.
209209
- set NO_CCACHE=1
210-
- sh src/ci/run.sh
210+
# Added this debugging code to try tracking down https://github.com/rust-lang/rust/issues/58160
211+
# Replace it with the commented line below after the issue with AppVeyor is fixed
212+
- "sh src/ci/run.sh & set ret=%errorlevel% & echo exit code in appveyor.yml: %ret% & exit %ret%"
213+
# - sh src/ci/run.sh
211214

212215
on_failure:
213216
# Dump crash log

src/ci/run.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,13 @@ if [ ! -z "$SCRIPT" ]; then
127127
set +e
128128
sh -x -c "$SCRIPT"
129129
ret=$?
130-
echo "script exited with $ret"
130+
echo "exit code in src/ci/run.sh: $ret"
131+
132+
echo "tasklist:"
133+
tasklist
134+
echo -n "location of sh: "
135+
where sh
136+
131137
exit $ret
132138
else
133139
do_make() {

src/doc/index.md

+6
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ If reading multiple hundreds of pages about a language isn't your style, then
5252
a lot of words, RBE shows off a bunch of code, and keeps the talking to a
5353
minimum. It also includes exercises!
5454

55+
## Rustlings
56+
57+
[Rustlings](https://github.com/rust-lang/rustlings) guides you through downloading and setting up the Rust toolchain,
58+
and teaches you the basics of reading and writing Rust syntax. It's an
59+
alternative to Rust by Example that works with your own environment.
60+
5561
# Use Rust
5662

5763
Once you've gotten familiar with the language, these resources can help you

src/libcore/iter/traits/iterator.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -952,8 +952,7 @@ pub trait Iterator {
952952
/// ```
953953
///
954954
/// The `3` is no longer there, because it was consumed in order to see if
955-
/// the iteration should stop, but wasn't placed back into the iterator or
956-
/// some similar thing.
955+
/// the iteration should stop, but wasn't placed back into the iterator.
957956
#[inline]
958957
#[stable(feature = "rust1", since = "1.0.0")]
959958
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where

src/libcore/str/mod.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -2961,8 +2961,8 @@ impl str {
29612961
/// An iterator over substrings of this string slice, separated by
29622962
/// characters matched by a pattern.
29632963
///
2964-
/// The pattern can be a `&str`, [`char`], or a closure that determines the
2965-
/// split.
2964+
/// The pattern can be any type that implements the Pattern trait. Notable
2965+
/// examples are `&str`, [`char`], and closures that determines the split.
29662966
///
29672967
/// # Iterator behavior
29682968
///
@@ -3078,8 +3078,8 @@ impl str {
30783078
/// An iterator over substrings of the given string slice, separated by
30793079
/// characters matched by a pattern and yielded in reverse order.
30803080
///
3081-
/// The pattern can be a `&str`, [`char`], or a closure that determines the
3082-
/// split.
3081+
/// The pattern can be any type that implements the Pattern trait. Notable
3082+
/// examples are `&str`, [`char`], and closures that determines the split.
30833083
///
30843084
/// # Iterator behavior
30853085
///
@@ -3128,8 +3128,8 @@ impl str {
31283128
/// An iterator over substrings of the given string slice, separated by
31293129
/// characters matched by a pattern.
31303130
///
3131-
/// The pattern can be a `&str`, [`char`], or a closure that determines the
3132-
/// split.
3131+
/// The pattern can be any type that implements the Pattern trait. Notable
3132+
/// examples are `&str`, [`char`], and closures that determines the split.
31333133
///
31343134
/// Equivalent to [`split`], except that the trailing substring
31353135
/// is skipped if empty.
@@ -3175,8 +3175,8 @@ impl str {
31753175
/// An iterator over substrings of `self`, separated by characters
31763176
/// matched by a pattern and yielded in reverse order.
31773177
///
3178-
/// The pattern can be a simple `&str`, [`char`], or a closure that
3179-
/// determines the split.
3178+
/// The pattern can be any type that implements the Pattern trait. Notable
3179+
/// examples are `&str`, [`char`], and closures that determines the split.
31803180
/// Additional libraries might provide more complex patterns like
31813181
/// regular expressions.
31823182
///
@@ -3222,8 +3222,8 @@ impl str {
32223222
/// If `n` substrings are returned, the last substring (the `n`th substring)
32233223
/// will contain the remainder of the string.
32243224
///
3225-
/// The pattern can be a `&str`, [`char`], or a closure that determines the
3226-
/// split.
3225+
/// The pattern can be any type that implements the Pattern trait. Notable
3226+
/// examples are `&str`, [`char`], and closures that determines the split.
32273227
///
32283228
/// # Iterator behavior
32293229
///
@@ -3275,8 +3275,8 @@ impl str {
32753275
/// If `n` substrings are returned, the last substring (the `n`th substring)
32763276
/// will contain the remainder of the string.
32773277
///
3278-
/// The pattern can be a `&str`, [`char`], or a closure that
3279-
/// determines the split.
3278+
/// The pattern can be any type that implements the Pattern trait. Notable
3279+
/// examples are `&str`, [`char`], and closures that determines the split.
32803280
///
32813281
/// # Iterator behavior
32823282
///
@@ -3319,8 +3319,8 @@ impl str {
33193319
/// An iterator over the disjoint matches of a pattern within the given string
33203320
/// slice.
33213321
///
3322-
/// The pattern can be a `&str`, [`char`], or a closure that
3323-
/// determines if a character matches.
3322+
/// The pattern can be any type that implements the Pattern trait. Notable
3323+
/// examples are `&str`, [`char`], and closures that determines the split.
33243324
///
33253325
/// # Iterator behavior
33263326
///

src/libcore/task/poll.rs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use result::Result;
77

88
/// Indicates whether a value is available or if the current task has been
99
/// scheduled to receive a wakeup instead.
10+
#[must_use = "this `Poll` may be a `Pending` variant, which should be handled"]
1011
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1112
pub enum Poll<T> {
1213
/// Represents that a value is immediately ready.

src/libfmt_macros/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
authors = ["The Rust Project Developers"]
33
name = "fmt_macros"
44
version = "0.0.0"
5+
edition = "2018"
56

67
[lib]
78
name = "fmt_macros"

src/libfmt_macros/lib.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@
1010
html_playground_url = "https://play.rust-lang.org/",
1111
test(attr(deny(warnings))))]
1212

13-
#![feature(nll)]
13+
#![deny(rust_2018_idioms)]
14+
1415
#![feature(rustc_private)]
1516

16-
pub use self::Piece::*;
17-
pub use self::Position::*;
18-
pub use self::Alignment::*;
19-
pub use self::Flag::*;
20-
pub use self::Count::*;
17+
pub use Piece::*;
18+
pub use Position::*;
19+
pub use Alignment::*;
20+
pub use Flag::*;
21+
pub use Count::*;
2122

2223
use std::str;
2324
use std::string;

src/libgraphviz/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
authors = ["The Rust Project Developers"]
33
name = "graphviz"
44
version = "0.0.0"
5+
edition = "2018"
56

67
[lib]
78
name = "graphviz"

src/libgraphviz/lib.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,11 @@
276276
html_root_url = "https://doc.rust-lang.org/nightly/",
277277
test(attr(allow(unused_variables), deny(warnings))))]
278278

279-
#![feature(nll)]
279+
#![deny(rust_2018_idioms)]
280+
280281
#![feature(str_escape)]
281282

282-
use self::LabelText::*;
283+
use LabelText::*;
283284

284285
use std::borrow::Cow;
285286
use std::io::prelude::*;
@@ -548,12 +549,12 @@ impl<'a> LabelText<'a> {
548549
}
549550

550551
/// Puts `prefix` on a line above this label, with a blank line separator.
551-
pub fn prefix_line(self, prefix: LabelText) -> LabelText<'static> {
552+
pub fn prefix_line(self, prefix: LabelText<'_>) -> LabelText<'static> {
552553
prefix.suffix_line(self)
553554
}
554555

555556
/// Puts `suffix` on a line below this label, with a blank line separator.
556-
pub fn suffix_line(self, suffix: LabelText) -> LabelText<'static> {
557+
pub fn suffix_line(self, suffix: LabelText<'_>) -> LabelText<'static> {
557558
let mut prefix = self.pre_escaped_content().into_owned();
558559
let suffix = suffix.pre_escaped_content();
559560
prefix.push_str(r"\n\n");
@@ -686,7 +687,7 @@ pub fn render_opts<'a, N, E, G, W>(g: &'a G,
686687

687688
#[cfg(test)]
688689
mod tests {
689-
use self::NodeLabels::*;
690+
use NodeLabels::*;
690691
use super::{Id, Labeller, Nodes, Edges, GraphWalk, render, Style};
691692
use super::LabelText::{self, LabelStr, EscStr, HtmlStr};
692693
use std::io;

src/libpanic_abort/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
authors = ["The Rust Project Developers"]
33
name = "panic_abort"
44
version = "0.0.0"
5+
edition = "2018"
56

67
[lib]
78
path = "lib.rs"

src/libpanic_abort/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
html_root_url = "https://doc.rust-lang.org/nightly/",
1111
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]
1212
#![panic_runtime]
13+
1314
#![allow(unused_features)]
15+
#![deny(rust_2018_idioms)]
1416

1517
#![feature(core_intrinsics)]
1618
#![feature(libc)]
17-
#![feature(nll)]
1819
#![feature(panic_runtime)]
1920
#![feature(staged_api)]
2021
#![feature(rustc_attrs)]
@@ -46,7 +47,6 @@ pub unsafe extern fn __rust_start_panic(_payload: usize) -> u32 {
4647

4748
#[cfg(any(unix, target_os = "cloudabi"))]
4849
unsafe fn abort() -> ! {
49-
extern crate libc;
5050
libc::abort();
5151
}
5252

src/librustc/hir/map/mod.rs

+60
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,12 @@ impl<'hir> Map<'hir> {
401401
}
402402
}
403403

404+
// FIXME(@ljedrz): replace the NodeId variant
405+
pub fn describe_def_by_hir_id(&self, hir_id: HirId) -> Option<Def> {
406+
let node_id = self.hir_to_node_id(hir_id);
407+
self.describe_def(node_id)
408+
}
409+
404410
fn entry_count(&self) -> usize {
405411
self.map.len()
406412
}
@@ -445,6 +451,12 @@ impl<'hir> Map<'hir> {
445451
}
446452
}
447453

454+
// FIXME(@ljedrz): replace the NodeId variant
455+
pub fn fn_decl_by_hir_id(&self, hir_id: HirId) -> Option<FnDecl> {
456+
let node_id = self.hir_to_node_id(hir_id);
457+
self.fn_decl(node_id)
458+
}
459+
448460
/// Returns the `NodeId` that corresponds to the definition of
449461
/// which this is the body of, i.e., a `fn`, `const` or `static`
450462
/// item (possibly associated), a closure, or a `hir::AnonConst`.
@@ -855,6 +867,12 @@ impl<'hir> Map<'hir> {
855867
self.local_def_id(self.get_parent(id))
856868
}
857869

870+
// FIXME(@ljedrz): replace the NodeId variant
871+
pub fn get_parent_did_by_hir_id(&self, id: HirId) -> DefId {
872+
let node_id = self.hir_to_node_id(id);
873+
self.get_parent_did(node_id)
874+
}
875+
858876
pub fn get_foreign_abi(&self, id: NodeId) -> Abi {
859877
let parent = self.get_parent(id);
860878
if let Some(entry) = self.find_entry(parent) {
@@ -868,6 +886,12 @@ impl<'hir> Map<'hir> {
868886
bug!("expected foreign mod or inlined parent, found {}", self.node_to_string(parent))
869887
}
870888

889+
// FIXME(@ljedrz): replace the NodeId variant
890+
pub fn get_foreign_abi_by_hir_id(&self, id: HirId) -> Abi {
891+
let node_id = self.hir_to_node_id(id);
892+
self.get_foreign_abi(node_id)
893+
}
894+
871895
pub fn expect_item(&self, id: NodeId) -> &'hir Item {
872896
match self.find(id) { // read recorded by `find`
873897
Some(Node::Item(item)) => item,
@@ -888,6 +912,18 @@ impl<'hir> Map<'hir> {
888912
}
889913
}
890914

915+
// FIXME(@ljedrz): replace the NodeId variant
916+
pub fn expect_impl_item_by_hir_id(&self, id: HirId) -> &'hir ImplItem {
917+
let node_id = self.hir_to_node_id(id);
918+
self.expect_impl_item(node_id)
919+
}
920+
921+
// FIXME(@ljedrz): replace the NodeId variant
922+
pub fn expect_trait_item_by_hir_id(&self, id: HirId) -> &'hir TraitItem {
923+
let node_id = self.hir_to_node_id(id);
924+
self.expect_trait_item(node_id)
925+
}
926+
891927
pub fn expect_trait_item(&self, id: NodeId) -> &'hir TraitItem {
892928
match self.find(id) {
893929
Some(Node::TraitItem(item)) => item,
@@ -931,6 +967,12 @@ impl<'hir> Map<'hir> {
931967
}
932968
}
933969

970+
// FIXME(@ljedrz): replace the NodeId variant
971+
pub fn expect_expr_by_hir_id(&self, id: HirId) -> &'hir Expr {
972+
let node_id = self.hir_to_node_id(id);
973+
self.expect_expr(node_id)
974+
}
975+
934976
/// Returns the name associated with the given NodeId's AST.
935977
pub fn name(&self, id: NodeId) -> Name {
936978
match self.get(id) {
@@ -948,6 +990,12 @@ impl<'hir> Map<'hir> {
948990
}
949991
}
950992

993+
// FIXME(@ljedrz): replace the NodeId variant
994+
pub fn name_by_hir_id(&self, id: HirId) -> Name {
995+
let node_id = self.hir_to_node_id(id);
996+
self.name(node_id)
997+
}
998+
951999
/// Given a node ID, get a list of attributes associated with the AST
9521000
/// corresponding to the Node ID
9531001
pub fn attrs(&self, id: NodeId) -> &'hir [ast::Attribute] {
@@ -970,6 +1018,12 @@ impl<'hir> Map<'hir> {
9701018
attrs.unwrap_or(&[])
9711019
}
9721020

1021+
// FIXME(@ljedrz): replace the NodeId variant
1022+
pub fn attrs_by_hir_id(&self, id: HirId) -> &'hir [ast::Attribute] {
1023+
let node_id = self.hir_to_node_id(id);
1024+
self.attrs(node_id)
1025+
}
1026+
9731027
/// Returns an iterator that yields the node id's with paths that
9741028
/// match `parts`. (Requires `parts` is non-empty.)
9751029
///
@@ -1019,6 +1073,12 @@ impl<'hir> Map<'hir> {
10191073
}
10201074
}
10211075

1076+
// FIXME(@ljedrz): replace the NodeId variant
1077+
pub fn span_by_hir_id(&self, id: HirId) -> Span {
1078+
let node_id = self.hir_to_node_id(id);
1079+
self.span(node_id)
1080+
}
1081+
10221082
pub fn span_if_local(&self, id: DefId) -> Option<Span> {
10231083
self.as_local_node_id(id).map(|id| self.span(id))
10241084
}

src/librustc/middle/stability.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
765765
}
766766
}
767767
EvalResult::Unmarked => {
768-
span_bug!(span, "encountered unmarked API: {:?}", def_id);
768+
// The API could be uncallable for other reasons, for example when a private module
769+
// was referenced.
770+
self.sess.delay_span_bug(span, &format!("encountered unmarked API: {:?}", def_id));
769771
}
770772
}
771773
}

src/librustc_privacy/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
authors = ["The Rust Project Developers"]
33
name = "rustc_privacy"
44
version = "0.0.0"
5+
edition = "2018"
56

67
[lib]
78
name = "rustc_privacy"

0 commit comments

Comments
 (0)