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 15 pull requests #76937

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a06edda
Fix segfault if pthread_getattr_np fails
tavianator Sep 9, 2020
a684153
Only call pthread_attr_destroy() after getattr_np() succeeds on all l…
tavianator Sep 9, 2020
176956c
Test and fix Sync & Send traits of BTreeMap artefacts
ssomers Sep 14, 2020
c35ce3f
Don't generate bootstrap usage unless it's needed
jyn514 Sep 16, 2020
94dae60
simplfy condition in ItemLowerer::with_trait_impl_ref()
matthiaskrgr Sep 16, 2020
b7c8bea
Fix wording in mir doc
pickfire Sep 17, 2020
f4a7149
Don't compile regex at every function call.
hbina Sep 17, 2020
b479139
Remove intrinsics::arith_offset use from libarena
est31 Sep 17, 2020
4fe6ca3
Replace const_generics feature gate with min_const_generics
est31 Sep 17, 2020
ebdea01
Remove redundant #![feature(...)] 's from compiler/
est31 Sep 17, 2020
5f58e00
fix array_windows docs
lcnr Sep 17, 2020
2793672
use `array_windows` instead of `windows` in the compiler
lcnr Sep 17, 2020
f193593
array pattern
lcnr Sep 17, 2020
012974d
use strip_prefix over starts_with and manual slicing based on pattern…
matthiaskrgr Sep 17, 2020
764d307
docs `array` -> `slice`
lcnr Sep 17, 2020
1dd3df6
black_box: silence unused_mut warning when building with cfg(miri)
RalfJung Sep 17, 2020
76ec3f8
Move to intra doc links in core/src/future
poliorcetics Sep 17, 2020
8e9ad31
Use intra-doc links
denisvasilik Sep 17, 2020
3323a26
Fixed some intra-docs links in library/core
Amjad50 Sep 17, 2020
878dfa6
Fixed intra-docs links in library/std/src/collections/hash/map.rs
Amjad50 Sep 17, 2020
baafc71
Remove unused libc feature gate
est31 Sep 18, 2020
4c92b3d
Apply suggestions from code review
poliorcetics Sep 18, 2020
f272896
Remove some unused features from alloc core and std
est31 Sep 18, 2020
3d32169
Rollup merge of #76521 - tavianator:fix-pthread-getattr-destroy, r=Am…
RalfJung Sep 19, 2020
cfd233f
Rollup merge of #76722 - ssomers:btree_send_sync, r=Mark-Simulacrum
RalfJung Sep 19, 2020
3ff6b26
Rollup merge of #76800 - jyn514:usage, r=Mark-Simulacrum
RalfJung Sep 19, 2020
511a6b0
Rollup merge of #76809 - matthiaskrgr:simplify_cond, r=varkor
RalfJung Sep 19, 2020
c4eb073
Rollup merge of #76815 - pickfire:patch-6, r=jonas-schievink
RalfJung Sep 19, 2020
682770b
Rollup merge of #76818 - hbina:dont_compile_regex_all_the_time, r=ecs…
RalfJung Sep 19, 2020
753fd7a
Rollup merge of #76821 - est31:remove_redundant_nightly_features, r=o…
RalfJung Sep 19, 2020
c9859bb
Rollup merge of #76823 - RalfJung:black-box-warn, r=joshtriplett
RalfJung Sep 19, 2020
e794529
Rollup merge of #76825 - lcnr:array-windows-apply, r=varkor
RalfJung Sep 19, 2020
fff2344
Rollup merge of #76827 - lcnr:array_windows-docs, r=jonas-schievink
RalfJung Sep 19, 2020
b396bfe
Rollup merge of #76828 - matthiaskrgr:clippy_manual_strip, r=lcnr
RalfJung Sep 19, 2020
dec4ddc
Rollup merge of #76840 - poliorcetics:intra-doc-core-sync-and-future,…
RalfJung Sep 19, 2020
7c1623b
Rollup merge of #76845 - Amjad50:fix-intra-docs-links, r=jyn514
RalfJung Sep 19, 2020
5518cc9
Rollup merge of #76853 - denisvasilik:intra-doc-links-core-wake, r=jy…
RalfJung Sep 19, 2020
771fdde
Rollup merge of #76866 - est31:master, r=lcnr
RalfJung Sep 19, 2020
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
4 changes: 1 addition & 3 deletions compiler/rustc_arena/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
html_root_url = "https://doc.rust-lang.org/nightly/",
test(no_crate_inject, attr(deny(warnings)))
)]
#![feature(core_intrinsics)]
#![feature(dropck_eyepatch)]
#![feature(new_uninit)]
#![feature(maybe_uninit_slice)]
Expand All @@ -24,7 +23,6 @@ use smallvec::SmallVec;
use std::alloc::Layout;
use std::cell::{Cell, RefCell};
use std::cmp;
use std::intrinsics;
use std::marker::{PhantomData, Send};
use std::mem::{self, MaybeUninit};
use std::ptr;
Expand Down Expand Up @@ -122,7 +120,7 @@ impl<T> TypedArena<T> {

unsafe {
if mem::size_of::<T>() == 0 {
self.ptr.set(intrinsics::arith_offset(self.ptr.get() as *mut u8, 1) as *mut T);
self.ptr.set((self.ptr.get() as *mut u8).wrapping_offset(1) as *mut T);
let ptr = mem::align_of::<T>() as *mut T;
// Don't drop the object. This `write` is equivalent to `forget`.
ptr::write(ptr, object);
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_ast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
//! This API is completely unstable and subject to change.

#![doc(html_root_url = "https://doc.rust-lang.org/nightly/", test(attr(deny(warnings))))]
#![feature(bool_to_option)]
#![feature(box_syntax)]
#![feature(const_fn)] // For the `transmute` in `P::new`
#![feature(const_panic)]
#![feature(const_fn_transmute)]
#![feature(crate_visibility_modifier)]
#![feature(label_break_value)]
#![feature(nll)]
#![feature(or_patterns)]
#![feature(try_trait)]
#![feature(unicode_internals)]
#![recursion_limit = "256"]

#[macro_use]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub(super) struct ItemLowerer<'a, 'lowering, 'hir> {
impl ItemLowerer<'_, '_, '_> {
fn with_trait_impl_ref(&mut self, impl_ref: &Option<TraitRef>, f: impl FnOnce(&mut Self)) {
let old = self.lctx.is_in_trait_impl;
self.lctx.is_in_trait_impl = if let &None = impl_ref { false } else { true };
self.lctx.is_in_trait_impl = impl_ref.is_some();
f(self);
self.lctx.is_in_trait_impl = old;
}
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_codegen_ssa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#![feature(or_patterns)]
#![feature(trusted_len)]
#![feature(associated_type_bounds)]
#![feature(const_fn)] // for rustc_index::newtype_index
#![feature(const_panic)] // for rustc_index::newtype_index
#![recursion_limit = "256"]

//! This crate contains codegen code that is used by all codegen backends (LLVM and others).
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
#![allow(incomplete_features)]
#![feature(array_windows)]
#![feature(control_flow_enum)]
#![feature(in_band_lifetimes)]
#![feature(unboxed_closures)]
#![feature(generators)]
#![feature(generator_trait)]
#![feature(fn_traits)]
#![feature(int_bits_const)]
Expand All @@ -27,7 +27,7 @@
#![feature(thread_id_value)]
#![feature(extend_one)]
#![feature(const_panic)]
#![feature(const_generics)]
#![feature(min_const_generics)]
#![feature(once_cell)]
#![allow(rustc::default_hash_types)]

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_data_structures/src/sorted_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl<K: Ord, V> SortedMap<K, V> {
/// and that there are no duplicates.
#[inline]
pub fn from_presorted_elements(elements: Vec<(K, V)>) -> SortedMap<K, V> {
debug_assert!(elements.windows(2).all(|w| w[0].0 < w[1].0));
debug_assert!(elements.array_windows().all(|[fst, snd]| fst.0 < snd.0));

SortedMap { data: elements }
}
Expand Down Expand Up @@ -159,7 +159,7 @@ impl<K: Ord, V> SortedMap<K, V> {
return;
}

debug_assert!(elements.windows(2).all(|w| w[0].0 < w[1].0));
debug_assert!(elements.array_windows().all(|[fst, snd]| fst.0 < snd.0));

let start_index = self.lookup_index_for(&elements[0].0);

Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_driver/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use std::fs;
use std::io;

pub fn arg_expand(arg: String) -> Result<Vec<String>, Error> {
if arg.starts_with('@') {
let path = &arg[1..];
if let Some(path) = arg.strip_prefix('@') {
let file = match fs::read_to_string(path) {
Ok(file) => file,
Err(ref err) if err.kind() == io::ErrorKind::InvalidData => {
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_expand/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(bool_to_option)]
#![feature(cow_is_borrowed)]
#![feature(crate_visibility_modifier)]
#![feature(decl_macro)]
#![feature(or_patterns)]
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_infer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
//! This API is completely unstable and subject to change.

#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
#![feature(bindings_after_at)]
#![feature(bool_to_option)]
#![feature(box_patterns)]
#![feature(box_syntax)]
Expand All @@ -23,7 +22,6 @@
#![feature(never_type)]
#![feature(or_patterns)]
#![feature(in_band_lifetimes)]
#![feature(crate_visibility_modifier)]
#![recursion_limit = "512"] // For rustdoc

#[macro_use]
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_lint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(test, feature(test))]
#![feature(array_windows)]
#![feature(bool_to_option)]
#![feature(box_syntax)]
#![feature(crate_visibility_modifier)]
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_lint/src/nonstandard_style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ fn is_camel_case(name: &str) -> bool {
// ones (some scripts don't have a concept of upper/lowercase)
!name.chars().next().unwrap().is_lowercase()
&& !name.contains("__")
&& !name.chars().collect::<Vec<_>>().windows(2).any(|pair| {
&& !name.chars().collect::<Vec<_>>().array_windows().any(|&[fst, snd]| {
// contains a capitalisable character followed by, or preceded by, an underscore
char_has_case(pair[0]) && pair[1] == '_' || char_has_case(pair[1]) && pair[0] == '_'
char_has_case(fst) && snd == '_' || char_has_case(snd) && fst == '_'
})
}

Expand Down
6 changes: 1 addition & 5 deletions compiler/rustc_middle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,29 @@
//! This API is completely unstable and subject to change.

#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
#![feature(array_windows)]
#![feature(backtrace)]
#![feature(bool_to_option)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(cmp_min_max_by)]
#![feature(const_fn)]
#![feature(const_panic)]
#![feature(const_fn_transmute)]
#![feature(core_intrinsics)]
#![feature(discriminant_kind)]
#![feature(drain_filter)]
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![feature(extern_types)]
#![feature(nll)]
#![feature(once_cell)]
#![feature(option_expect_none)]
#![feature(or_patterns)]
#![feature(min_specialization)]
#![feature(trusted_len)]
#![feature(stmt_expr_attributes)]
#![feature(test)]
#![feature(in_band_lifetimes)]
#![feature(crate_visibility_modifier)]
#![feature(associated_type_bounds)]
#![feature(rustc_attrs)]
#![feature(hash_raw_entry)]
#![feature(int_error_matching)]
#![recursion_limit = "512"]

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2286,7 +2286,7 @@ impl<'tcx> Debug for Rvalue<'tcx> {
/// Constants
///
/// Two constants are equal if they are the same constant. Note that
/// this does not necessarily mean that they are `==` in Rust -- in
/// this does not necessarily mean that they are `==` in Rust. In
/// particular, one must be wary of `NaN`!

#[derive(Clone, Copy, PartialEq, TyEncodable, TyDecodable, HashStable)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2419,7 +2419,7 @@ impl<'tcx> TyCtxt<'tcx> {
eps: &[ExistentialPredicate<'tcx>],
) -> &'tcx List<ExistentialPredicate<'tcx>> {
assert!(!eps.is_empty());
assert!(eps.windows(2).all(|w| w[0].stable_cmp(self, &w[1]) != Ordering::Greater));
assert!(eps.array_windows().all(|[a, b]| a.stable_cmp(self, b) != Ordering::Greater));
self._intern_existential_predicates(eps)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,8 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
{
if let Ok(pat_snippet) = self.infcx.tcx.sess.source_map().span_to_snippet(pat_span)
{
if pat_snippet.starts_with('&') {
let pat_snippet = pat_snippet[1..].trim_start();
if let Some(stripped) = pat_snippet.strip_prefix('&') {
let pat_snippet = stripped.trim_start();
let (suggestion, to_remove) = if pat_snippet.starts_with("mut")
&& pat_snippet["mut".len()..].starts_with(rustc_lexer::is_whitespace)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,9 +631,8 @@ fn suggest_ampmut<'tcx>(
let lt_name = &src[1..ws_pos];
let ty = &src[ws_pos..];
return (assignment_rhs_span, format!("&{} mut {}", lt_name, ty));
} else if src.starts_with('&') {
let borrowed_expr = &src[1..];
return (assignment_rhs_span, format!("&mut {}", borrowed_expr));
} else if let Some(stripped) = src.strip_prefix('&') {
return (assignment_rhs_span, format!("&mut {}", stripped));
}
}
}
Expand Down
10 changes: 9 additions & 1 deletion compiler/rustc_mir/src/dataflow/framework/graphviz.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! A helpful diagram for debugging dataflow problems.

use std::borrow::Cow;
use std::lazy::SyncOnceCell;
use std::{io, ops, str};

use regex::Regex;
Expand Down Expand Up @@ -570,6 +571,13 @@ where
}
}

macro_rules! regex {
($re:literal $(,)?) => {{
static RE: SyncOnceCell<regex::Regex> = SyncOnceCell::new();
RE.get_or_init(|| Regex::new($re).unwrap())
}};
}

fn diff_pretty<T, C>(new: T, old: T, ctxt: &C) -> String
where
T: DebugWithContext<C>,
Expand All @@ -578,7 +586,7 @@ where
return String::new();
}

let re = Regex::new("\t?\u{001f}([+-])").unwrap();
let re = regex!("\t?\u{001f}([+-])");

let raw_diff = format!("{:#?}", DebugDiffWithAdapter { new, old, ctxt });

Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_mir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,26 @@ Rust MIR: a lowered representation of Rust.

#![feature(nll)]
#![feature(in_band_lifetimes)]
#![feature(array_windows)]
#![feature(bool_to_option)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(const_fn)]
#![feature(const_panic)]
#![feature(crate_visibility_modifier)]
#![feature(decl_macro)]
#![feature(drain_filter)]
#![feature(exact_size_is_empty)]
#![feature(exhaustive_patterns)]
#![feature(iter_order_by)]
#![feature(never_type)]
#![feature(min_specialization)]
#![feature(trusted_len)]
#![feature(try_blocks)]
#![feature(associated_type_bounds)]
#![feature(associated_type_defaults)]
#![feature(stmt_expr_attributes)]
#![feature(trait_alias)]
#![feature(option_expect_none)]
#![feature(or_patterns)]
#![feature(once_cell)]
#![recursion_limit = "256"]

#[macro_use]
Expand Down
8 changes: 1 addition & 7 deletions compiler/rustc_mir/src/monomorphize/partitioning/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,8 @@ where

symbols.sort_by_key(|sym| sym.1);

for pair in symbols.windows(2) {
let sym1 = &pair[0].1;
let sym2 = &pair[1].1;

for &[(mono_item1, ref sym1), (mono_item2, ref sym2)] in symbols.array_windows() {
if sym1 == sym2 {
let mono_item1 = pair[0].0;
let mono_item2 = pair[1].0;

let span1 = mono_item1.local_span(tcx);
let span2 = mono_item2.local_span(tcx);

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Construction of MIR from HIR.
//!
//! This crate also contains the match exhaustiveness and usefulness checking.

#![feature(array_windows)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(const_fn)]
Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_mir_build/src/thir/pattern/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2299,19 +2299,19 @@ fn split_grouped_constructors<'p, 'tcx>(
// interval into a constructor.
split_ctors.extend(
borders
.windows(2)
.filter_map(|window| match (window[0], window[1]) {
(Border::JustBefore(n), Border::JustBefore(m)) => {
.array_windows()
.filter_map(|&pair| match pair {
[Border::JustBefore(n), Border::JustBefore(m)] => {
if n < m {
Some(IntRange { range: n..=(m - 1), ty, span })
} else {
None
}
}
(Border::JustBefore(n), Border::AfterMax) => {
[Border::JustBefore(n), Border::AfterMax] => {
Some(IntRange { range: n..=u128::MAX, ty, span })
}
(Border::AfterMax, _) => None,
[Border::AfterMax, _] => None,
})
.map(IntRange),
);
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_parse/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#![feature(bool_to_option)]
#![feature(crate_visibility_modifier)]
#![feature(bindings_after_at)]
#![feature(try_blocks)]
#![feature(or_patterns)]

use rustc_ast as ast;
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_parse_format/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
)]
#![feature(nll)]
#![feature(or_patterns)]
#![feature(rustc_private)]
#![feature(unicode_internals)]
#![feature(bool_to_option)]

pub use Alignment::*;
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_privacy/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
#![feature(in_band_lifetimes)]
#![feature(nll)]
#![feature(or_patterns)]
#![recursion_limit = "256"]

use rustc_attr as attr;
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_resolve/src/late/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1418,9 +1418,9 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
if snippet.starts_with('&') && !snippet.starts_with("&'") {
introduce_suggestion
.push((param.span, format!("&{} {}", lt_name, &snippet[1..])));
} else if snippet.starts_with("&'_ ") {
} else if let Some(stripped) = snippet.strip_prefix("&'_ ") {
introduce_suggestion
.push((param.span, format!("&{} {}", lt_name, &snippet[4..])));
.push((param.span, format!("&{} {}", lt_name, stripped)));
}
}
}
Expand Down
Loading