Skip to content

Rollup of 11 pull requests #56557

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

Merged
merged 39 commits into from
Dec 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
50b4eef
rustdoc: Fix inlining reexported custom derives
weiznich Nov 28, 2018
230f5d5
rustdoc: Fix inlining reexporting bang-macros
weiznich Nov 28, 2018
dd717de
Add crate filtering
GuillaumeGomez Sep 30, 2018
8062c7a
Add test for crate filtering
GuillaumeGomez Sep 30, 2018
afe4107
Add arrow to the crate select box
GuillaumeGomez Nov 29, 2018
f1f6d87
Stabilise exhaustive_integer_patterns
varkor Nov 30, 2018
e018268
Add precise_pointer_size_matching feature
varkor Nov 30, 2018
4fc5758
Update existing tests with more precise error messages
varkor Nov 30, 2018
0fb52fb
Separate out precise_pointer_size_matching tests from exhaustive_inte…
varkor Nov 30, 2018
4406391
Fix bug in matching on floating-point ranges
varkor Nov 30, 2018
3b705a0
rustbuild: Fix issues with compiler docs
ollie27 Dec 2, 2018
59e9a1e
pass the parameter environment to `traits::find_associated_item`
arielb1 Dec 2, 2018
101467c
syntax: `dyn` is a used keyword now
petrochenkov Dec 2, 2018
08f8fae
syntax: Rename some keywords
petrochenkov Dec 2, 2018
d415844
syntax: Remove `#[non_exhaustive]` from `Edition`
petrochenkov Dec 2, 2018
3f253f5
Improve filter test
GuillaumeGomez Dec 3, 2018
d08f7dc
Address review comments
petrochenkov Dec 2, 2018
11fb023
Allow renaming macro
weiznich Dec 4, 2018
9d4e17a
Remove support for proc macro doc inlining
weiznich Dec 4, 2018
956b03f
Add a test case for inlining the docs of a macro reexport
weiznich Dec 4, 2018
d0c64bb
cleanup: remove static lifetimes from consts
ljedrz Dec 4, 2018
3512fb0
Avoid extra copy and syscall in std::env::current_exe
udoprog Dec 5, 2018
6cfbb5b
Remove unused dependency (rustc_lint -> rustc_mir)
sinkuu Dec 5, 2018
ed64b19
Fix precise_pointer_size_matching tests on all platforms
varkor Dec 5, 2018
180dcc3
Optimized string FromIterator impls
Lucretiel Dec 5, 2018
823dd8c
Fixed mutability
Lucretiel Dec 5, 2018
811a2bf
Added explainatory comments
Lucretiel Dec 6, 2018
3858aff
Don't print the profiling summary to stdout when -Zprofile-json is set
wesleywiser Dec 6, 2018
3073c7a
Rollup merge of #56315 - weiznich:rustdoc_inline_macro_reexport, r=Qu…
pietroalbini Dec 6, 2018
a88feab
Rollup merge of #56332 - GuillaumeGomez:specifi-crate-search, r=Quiet…
pietroalbini Dec 6, 2018
e57ed0d
Rollup merge of #56362 - varkor:stabilise-exhaustive-integer-patterns…
pietroalbini Dec 6, 2018
0aa72ad
Rollup merge of #56426 - petrochenkov:syntweak, r=nikomatsakis
pietroalbini Dec 6, 2018
0be8537
Rollup merge of #56441 - ollie27:rustbuild_compiler_docs, r=alexcrichton
pietroalbini Dec 6, 2018
50148a9
Rollup merge of #56446 - arielb1:special-env-implications, r=nikomats…
pietroalbini Dec 6, 2018
e941e1a
Rollup merge of #56500 - ljedrz:cleanup_rest_of_const_lifetimes, r=za…
pietroalbini Dec 6, 2018
bd8dd11
Rollup merge of #56525 - udoprog:linux-current-exe, r=alexcrichton
pietroalbini Dec 6, 2018
9e7ff56
Rollup merge of #56528 - sinkuu:unused_dep, r=Mark-Simulacrum
pietroalbini Dec 6, 2018
e9e92d5
Rollup merge of #56548 - Lucretiel:string-extend-optimize, r=sfackler
pietroalbini Dec 6, 2018
cd1ee5e
Rollup merge of #56553 - wesleywiser:silence_profiler_output, r=Mark-…
pietroalbini Dec 6, 2018
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
1 change: 0 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2352,7 +2352,6 @@ dependencies = [
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc 0.0.0",
"rustc_data_structures 0.0.0",
"rustc_mir 0.0.0",
"rustc_target 0.0.0",
"syntax 0.0.0",
"syntax_pos 0.0.0",
Expand Down
17 changes: 11 additions & 6 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,6 @@ impl Step for Rustc {
return;
}

// Build libstd docs so that we generate relative links.
builder.ensure(Std { stage, target });

// Build rustc.
builder.ensure(compile::Rustc { compiler, target });

Expand All @@ -718,12 +715,16 @@ impl Step for Rustc {

// Find dependencies for top level crates.
let mut compiler_crates = HashSet::new();
for root_crate in &["rustc", "rustc_driver", "rustc_codegen_llvm"] {
for root_crate in &["rustc_driver", "rustc_codegen_llvm", "rustc_codegen_ssa"] {
let interned_root_crate = INTERNER.intern_str(root_crate);
find_compiler_crates(builder, &interned_root_crate, &mut compiler_crates);
}

for krate in &compiler_crates {
// Create all crate output directories first to make sure rustdoc uses
// relative links.
// FIXME: Cargo should probably do this itself.
t!(fs::create_dir_all(out_dir.join(krate)));
cargo.arg("-p").arg(krate);
}

Expand Down Expand Up @@ -797,8 +798,8 @@ impl Step for Rustdoc {
return;
}

// Build libstd docs so that we generate relative links.
builder.ensure(Std { stage, target });
// Build rustc docs so that we generate relative links.
builder.ensure(Rustc { stage, target });

// Build rustdoc.
builder.ensure(tool::Rustdoc { host: compiler.host });
Expand All @@ -822,6 +823,10 @@ impl Step for Rustdoc {
&[]
);

// Only include compiler crates, no dependencies of those, such as `libc`.
cargo.arg("--no-deps");
cargo.arg("-p").arg("rustdoc");

cargo.env("RUSTDOCFLAGS", "--document-private-items");
builder.run(&mut cargo);
}
Expand Down
4 changes: 2 additions & 2 deletions src/grammar/parser-lalr.y
Original file line number Diff line number Diff line change
Expand Up @@ -741,14 +741,14 @@ fn_anon_params
;

fn_params_with_self
: '(' maybe_mut SELF maybe_ty_ascription maybe_comma_params ')' { $$ = mk_node("SelfValue", 3, $2, $4, $5); }
: '(' maybe_mut SELF maybe_ty_ascription maybe_comma_params ')' { $$ = mk_node("SelfLower", 3, $2, $4, $5); }
| '(' '&' maybe_mut SELF maybe_ty_ascription maybe_comma_params ')' { $$ = mk_node("SelfRegion", 3, $3, $5, $6); }
| '(' '&' lifetime maybe_mut SELF maybe_ty_ascription maybe_comma_params ')' { $$ = mk_node("SelfRegion", 4, $3, $4, $6, $7); }
| '(' maybe_params ')' { $$ = mk_node("SelfStatic", 1, $2); }
;

fn_anon_params_with_self
: '(' maybe_mut SELF maybe_ty_ascription maybe_comma_anon_params ')' { $$ = mk_node("SelfValue", 3, $2, $4, $5); }
: '(' maybe_mut SELF maybe_ty_ascription maybe_comma_anon_params ')' { $$ = mk_node("SelfLower", 3, $2, $4, $5); }
| '(' '&' maybe_mut SELF maybe_ty_ascription maybe_comma_anon_params ')' { $$ = mk_node("SelfRegion", 3, $3, $5, $6); }
| '(' '&' lifetime maybe_mut SELF maybe_ty_ascription maybe_comma_anon_params ')' { $$ = mk_node("SelfRegion", 4, $3, $4, $6, $7); }
| '(' maybe_anon_params ')' { $$ = mk_node("SelfStatic", 1, $2); }
Expand Down
49 changes: 30 additions & 19 deletions src/liballoc/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ impl String {
return Cow::Borrowed("");
};

const REPLACEMENT: &'static str = "\u{FFFD}";
const REPLACEMENT: &str = "\u{FFFD}";

let mut res = String::with_capacity(v.len());
res.push_str(first_valid);
Expand Down Expand Up @@ -1732,18 +1732,37 @@ impl<'a> FromIterator<&'a str> for String {
#[stable(feature = "extend_string", since = "1.4.0")]
impl FromIterator<String> for String {
fn from_iter<I: IntoIterator<Item = String>>(iter: I) -> String {
let mut buf = String::new();
buf.extend(iter);
buf
let mut iterator = iter.into_iter();

// Because we're iterating over `String`s, we can avoid at least
// one allocation by getting the first string from the iterator
// and appending to it all the subsequent strings.
match iterator.next() {
None => String::new(),
Some(mut buf) => {
buf.extend(iterator);
buf
}
}
}
}

#[stable(feature = "herd_cows", since = "1.19.0")]
impl<'a> FromIterator<Cow<'a, str>> for String {
fn from_iter<I: IntoIterator<Item = Cow<'a, str>>>(iter: I) -> String {
let mut buf = String::new();
buf.extend(iter);
buf
let mut iterator = iter.into_iter();

// Because we're iterating over CoWs, we can (potentially) avoid at least
// one allocation by getting the first item and appending to it all the
// subsequent items.
match iterator.next() {
None => String::new(),
Some(cow) => {
let mut buf = cow.into_owned();
buf.extend(iterator);
buf
}
}
}
}

Expand All @@ -1753,9 +1772,7 @@ impl Extend<char> for String {
let iterator = iter.into_iter();
let (lower_bound, _) = iterator.size_hint();
self.reserve(lower_bound);
for ch in iterator {
self.push(ch)
}
iterator.for_each(move |c| self.push(c));
}
}

Expand All @@ -1769,27 +1786,21 @@ impl<'a> Extend<&'a char> for String {
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a> Extend<&'a str> for String {
fn extend<I: IntoIterator<Item = &'a str>>(&mut self, iter: I) {
for s in iter {
self.push_str(s)
}
iter.into_iter().for_each(move |s| self.push_str(s));
}
}

#[stable(feature = "extend_string", since = "1.4.0")]
impl Extend<String> for String {
fn extend<I: IntoIterator<Item = String>>(&mut self, iter: I) {
for s in iter {
self.push_str(&s)
}
iter.into_iter().for_each(move |s| self.push_str(&s));
}
}

#[stable(feature = "herd_cows", since = "1.19.0")]
impl<'a> Extend<Cow<'a, str>> for String {
fn extend<I: IntoIterator<Item = Cow<'a, str>>>(&mut self, iter: I) {
for s in iter {
self.push_str(&s)
}
iter.into_iter().for_each(move |s| self.push_str(&s));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1381,7 +1381,7 @@ impl<'a> Formatter<'a> {
for part in formatted.parts {
match *part {
flt2dec::Part::Zero(mut nzeroes) => {
const ZEROES: &'static str = // 64 zeroes
const ZEROES: &str = // 64 zeroes
"0000000000000000000000000000000000000000000000000000000000000000";
while nzeroes > ZEROES.len() {
self.buf.write_str(ZEROES)?;
Expand Down
12 changes: 6 additions & 6 deletions src/libcore/unicode/printable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pub(crate) fn is_printable(x: char) -> bool {
}
}

const SINGLETONS0U: &'static [(u8, u8)] = &[
const SINGLETONS0U: &[(u8, u8)] = &[
(0x00, 1),
(0x03, 5),
(0x05, 6),
Expand Down Expand Up @@ -122,7 +122,7 @@ const SINGLETONS0U: &'static [(u8, u8)] = &[
(0xfe, 3),
(0xff, 9),
];
const SINGLETONS0L: &'static [u8] = &[
const SINGLETONS0L: &[u8] = &[
0xad, 0x78, 0x79, 0x8b, 0x8d, 0xa2, 0x30, 0x57,
0x58, 0x8b, 0x8c, 0x90, 0x1c, 0x1d, 0xdd, 0x0e,
0x0f, 0x4b, 0x4c, 0xfb, 0xfc, 0x2e, 0x2f, 0x3f,
Expand Down Expand Up @@ -162,7 +162,7 @@ const SINGLETONS0L: &'static [u8] = &[
0x91, 0xfe, 0xff, 0x53, 0x67, 0x75, 0xc8, 0xc9,
0xd0, 0xd1, 0xd8, 0xd9, 0xe7, 0xfe, 0xff,
];
const SINGLETONS1U: &'static [(u8, u8)] = &[
const SINGLETONS1U: &[(u8, u8)] = &[
(0x00, 6),
(0x01, 1),
(0x03, 1),
Expand Down Expand Up @@ -197,7 +197,7 @@ const SINGLETONS1U: &'static [(u8, u8)] = &[
(0xf0, 4),
(0xf9, 4),
];
const SINGLETONS1L: &'static [u8] = &[
const SINGLETONS1L: &[u8] = &[
0x0c, 0x27, 0x3b, 0x3e, 0x4e, 0x4f, 0x8f, 0x9e,
0x9e, 0x9f, 0x06, 0x07, 0x09, 0x36, 0x3d, 0x3e,
0x56, 0xf3, 0xd0, 0xd1, 0x04, 0x14, 0x18, 0x36,
Expand All @@ -219,7 +219,7 @@ const SINGLETONS1L: &'static [u8] = &[
0x78, 0x7d, 0x7f, 0x8a, 0xa4, 0xaa, 0xaf, 0xb0,
0xc0, 0xd0, 0x3f, 0x71, 0x72, 0x7b,
];
const NORMAL0: &'static [u8] = &[
const NORMAL0: &[u8] = &[
0x00, 0x20,
0x5f, 0x22,
0x82, 0xdf, 0x04,
Expand Down Expand Up @@ -363,7 +363,7 @@ const NORMAL0: &'static [u8] = &[
0x1b, 0x03,
0x0f, 0x0d,
];
const NORMAL1: &'static [u8] = &[
const NORMAL1: &[u8] = &[
0x5e, 0x22,
0x7b, 0x05,
0x03, 0x04,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ macro_rules! define_dep_nodes {
#[allow(dead_code, non_upper_case_globals)]
pub mod label_strs {
$(
pub const $variant: &'static str = stringify!($variant);
pub const $variant: &str = stringify!($variant);
)*
}
);
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,7 @@ impl<'a> LoweringContext<'a> {
None,
P(hir::Path {
def: self.expect_full_def(t.id),
segments: hir_vec![hir::PathSegment::from_ident(keywords::SelfType.ident())],
segments: hir_vec![hir::PathSegment::from_ident(keywords::SelfUpper.ident())],
span: t.span,
}),
)),
Expand Down Expand Up @@ -2425,7 +2425,7 @@ impl<'a> LoweringContext<'a> {
// Don't expose `Self` (recovered "keyword used as ident" parse error).
// `rustc::ty` expects `Self` to be only used for a trait's `Self`.
// Instead, use gensym("Self") to create a distinct name that looks the same.
let ident = if param.ident.name == keywords::SelfType.name() {
let ident = if param.ident.name == keywords::SelfUpper.name() {
param.ident.gensym()
} else {
param.ident
Expand Down Expand Up @@ -2981,7 +2981,7 @@ impl<'a> LoweringContext<'a> {

// Correctly resolve `self` imports
if path.segments.len() > 1
&& path.segments.last().unwrap().ident.name == keywords::SelfValue.name()
&& path.segments.last().unwrap().ident.name == keywords::SelfLower.name()
{
let _ = path.segments.pop();
if rename.is_none() {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ impl<'hir> Map<'hir> {

pub fn ty_param_name(&self, id: NodeId) -> Name {
match self.get(id) {
Node::Item(&Item { node: ItemKind::Trait(..), .. }) => keywords::SelfType.name(),
Node::Item(&Item { node: ItemKind::Trait(..), .. }) => keywords::SelfUpper.name(),
Node::GenericParam(param) => param.name.ident().name,
_ => bug!("ty_param_name: {} not a type parameter", self.node_to_string(id)),
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ pub struct Path {

impl Path {
pub fn is_global(&self) -> bool {
!self.segments.is_empty() && self.segments[0].ident.name == keywords::CrateRoot.name()
!self.segments.is_empty() && self.segments[0].ident.name == keywords::PathRoot.name()
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/librustc/hir/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub trait PpAnn {

pub struct NoAnn;
impl PpAnn for NoAnn {}
pub const NO_ANN: &'static dyn PpAnn = &NoAnn;
pub const NO_ANN: &dyn PpAnn = &NoAnn;

impl PpAnn for hir::Crate {
fn try_fetch_item(&self, item: ast::NodeId) -> Option<&hir::Item> {
Expand Down Expand Up @@ -1622,7 +1622,7 @@ impl<'a> State<'a> {
if i > 0 {
self.s.word("::")?
}
if segment.ident.name != keywords::CrateRoot.name() &&
if segment.ident.name != keywords::PathRoot.name() &&
segment.ident.name != keywords::DollarCrate.name() {
self.print_ident(segment.ident)?;
segment.with_generic_args(|generic_args| {
Expand All @@ -1636,7 +1636,7 @@ impl<'a> State<'a> {
}

pub fn print_path_segment(&mut self, segment: &hir::PathSegment) -> io::Result<()> {
if segment.ident.name != keywords::CrateRoot.name() &&
if segment.ident.name != keywords::PathRoot.name() &&
segment.ident.name != keywords::DollarCrate.name() {
self.print_ident(segment.ident)?;
segment.with_generic_args(|generic_args| {
Expand Down Expand Up @@ -1664,7 +1664,7 @@ impl<'a> State<'a> {
if i > 0 {
self.s.word("::")?
}
if segment.ident.name != keywords::CrateRoot.name() &&
if segment.ident.name != keywords::PathRoot.name() &&
segment.ident.name != keywords::DollarCrate.name() {
self.print_ident(segment.ident)?;
segment.with_generic_args(|generic_args| {
Expand Down
12 changes: 4 additions & 8 deletions src/librustc/ich/impls_syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,10 @@ impl_stable_hash_for!(struct ::syntax::attr::Stability {
const_stability
});

impl<'a> HashStable<StableHashingContext<'a>>
for ::syntax::edition::Edition {
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a>,
hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher);
}
}
impl_stable_hash_for!(enum ::syntax::edition::Edition {
Edition2015,
Edition2018,
});

impl<'a> HashStable<StableHashingContext<'a>>
for ::syntax::attr::StabilityLevel {
Expand Down
16 changes: 8 additions & 8 deletions src/librustc/ich/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ mod impls_misc;
mod impls_ty;
mod impls_syntax;

pub const ATTR_DIRTY: &'static str = "rustc_dirty";
pub const ATTR_CLEAN: &'static str = "rustc_clean";
pub const ATTR_IF_THIS_CHANGED: &'static str = "rustc_if_this_changed";
pub const ATTR_THEN_THIS_WOULD_NEED: &'static str = "rustc_then_this_would_need";
pub const ATTR_PARTITION_REUSED: &'static str = "rustc_partition_reused";
pub const ATTR_PARTITION_CODEGENED: &'static str = "rustc_partition_codegened";
pub const ATTR_EXPECTED_CGU_REUSE: &'static str = "rustc_expected_cgu_reuse";
pub const ATTR_DIRTY: &str = "rustc_dirty";
pub const ATTR_CLEAN: &str = "rustc_clean";
pub const ATTR_IF_THIS_CHANGED: &str = "rustc_if_this_changed";
pub const ATTR_THEN_THIS_WOULD_NEED: &str = "rustc_then_this_would_need";
pub const ATTR_PARTITION_REUSED: &str = "rustc_partition_reused";
pub const ATTR_PARTITION_CODEGENED: &str = "rustc_partition_codegened";
pub const ATTR_EXPECTED_CGU_REUSE: &str = "rustc_expected_cgu_reuse";

pub const IGNORED_ATTRIBUTES: &'static [&'static str] = &[
pub const IGNORED_ATTRIBUTES: &[&str] = &[
"cfg",
ATTR_IF_THIS_CHANGED,
ATTR_THEN_THIS_WOULD_NEED,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/liveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1575,7 +1575,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
let sp = ident.span;
let var = self.variable(hir_id, sp);
// Ignore unused self.
if ident.name != keywords::SelfValue.name() {
if ident.name != keywords::SelfLower.name() {
if !self.warn_about_unused(sp, hir_id, entry_ln, var) {
if self.live_on_entry(entry_ln, var).is_none() {
self.report_dead_assign(hir_id, sp, var, true);
Expand Down
Loading