Skip to content

Rollup of 11 pull requests #87539

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

Closed
wants to merge 36 commits into from
Closed
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
43217fe
Update fs.rs
D1mon Jul 3, 2021
29fd958
Merge branch 'master' into patch-1
D1mon Jul 6, 2021
0efd350
Update fs.rs
D1mon Jul 8, 2021
9b75213
Add docs for raw-dylib to unstable book
ricobbe Jul 20, 2021
3061b9b
Ignore example in automation
ricobbe Jul 20, 2021
8e84e4d
Fix ignore annotation
ricobbe Jul 20, 2021
e7fe2df
Use hashbrown's `extend_reserve()` in `HashMap`
inquisitivecrystal Jul 20, 2021
7cab739
Don't treat git repos as non-existent when `ignore_git` is set
jyn514 Jul 24, 2021
e8238a7
suggest removing unnecessary \&mut as help message
ibraheemdev Jul 25, 2021
30df151
tidy
ibraheemdev Jul 25, 2021
880e691
fix test/ui/borrowck/issue-33819
ibraheemdev Jul 25, 2021
7abbc6e
Document math behind MIN/MAX consts on integers
syvb Jul 27, 2021
eb6f2d4
Revert "SGX mutex is movable"
Jul 27, 2021
b518dc7
Add warning to SGX mutex implementation
Jul 27, 2021
1259742
bootstrap.py: remove unused `git log` option
hudson-ayers Jul 27, 2021
5bff842
Use type_alias_impl_trait instead of min in compiler and lib
spastorino Jul 27, 2021
38bdd0e
Make all tests use type_alias_impl_trait feature instead of min
spastorino Jul 26, 2021
66dbeb5
existential_type was removed in favor of type_alias_impl_trait
spastorino Jul 26, 2021
9629d79
Remove min_type_alias_impl_trait feature
spastorino Jul 26, 2021
df5e516
remove allow(unconditional_recursion)
ibraheemdev Jul 27, 2021
47414aa
Update range.rs
frogtd Jul 27, 2021
0e01749
remove unneeded stringify
syvb Jul 27, 2021
d395fe8
Bless nll tests
spastorino Jul 27, 2021
f16ae7e
Remove min_tait and full_tait stderr dangling files
spastorino Jul 27, 2021
dbd0fd2
Fix ICE in `diagnostic_hir_wf_check`
FabianWolff Jul 27, 2021
609bed8
Rollup merge of #86839 - D1mon:patch-1, r=JohnTitor
JohnTitor Jul 28, 2021
e9862fc
Rollup merge of #87315 - ricobbe:raw-dylib-unstable-book, r=wesleywiser
JohnTitor Jul 28, 2021
d80b86e
Rollup merge of #87330 - inquisitivecrystal:extend-reserve, r=JohnTitor
JohnTitor Jul 28, 2021
3a3dd78
Rollup merge of #87443 - jyn514:submodules-take-n, r=jyn514
JohnTitor Jul 28, 2021
e5677a6
Rollup merge of #87453 - ibraheemdev:i-68697, r=wesleywiser
JohnTitor Jul 28, 2021
ca62d19
Rollup merge of #87500 - Smittyvb:min-max-docs, r=kennytm
JohnTitor Jul 28, 2021
3a423cc
Rollup merge of #87501 - spastorino:remove-min-tait, r=oli-obk
JohnTitor Jul 28, 2021
7987e0f
Rollup merge of #87507 - jethrogb:jb/sgx-unmoveable-mutex, r=dtolnay
JohnTitor Jul 28, 2021
75f7a87
Rollup merge of #87513 - hudson-ayers:bootstrap-py-fix, r=jyn514
JohnTitor Jul 28, 2021
707f39d
Rollup merge of #87523 - frogtd:patch-2, r=dtolnay
JohnTitor Jul 28, 2021
a78c1fa
Rollup merge of #87524 - FabianWolff:issue-87495, r=Aaron1011
JohnTitor Jul 28, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
@@ -287,7 +287,7 @@ impl<'a> PostExpansionVisitor<'a> {
if let ast::TyKind::ImplTrait(..) = ty.kind {
gate_feature_post!(
&self.vis,
min_type_alias_impl_trait,
type_alias_impl_trait,
ty.span,
"`impl Trait` in type aliases is unstable"
);
3 changes: 2 additions & 1 deletion compiler/rustc_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
@@ -21,7 +21,8 @@
#![feature(iter_map_while)]
#![feature(maybe_uninit_uninit_array)]
#![feature(min_specialization)]
#![feature(min_type_alias_impl_trait)]
#![cfg_attr(bootstrap, feature(min_type_alias_impl_trait))]
#![cfg_attr(not(bootstrap), feature(type_alias_impl_trait))]
#![feature(new_uninit)]
#![feature(nll)]
#![feature(once_cell)]
5 changes: 1 addition & 4 deletions compiler/rustc_feature/src/active.rs
Original file line number Diff line number Diff line change
@@ -486,7 +486,7 @@ declare_features! (
(active, async_closure, "1.37.0", Some(62290), None),

/// Allows `impl Trait` to be used inside type aliases (RFC 2515).
(incomplete, type_alias_impl_trait, "1.38.0", Some(63063), None),
(active, type_alias_impl_trait, "1.38.0", Some(63063), None),

/// Allows the definition of `const extern fn` and `const unsafe extern fn`.
(active, const_extern_fn, "1.40.0", Some(64926), None),
@@ -619,9 +619,6 @@ declare_features! (
/// Allows macro attributes to observe output of `#[derive]`.
(active, macro_attributes_in_derive_output, "1.51.0", Some(81119), None),

/// Allows the use of type alias impl trait in function return positions
(active, min_type_alias_impl_trait, "1.52.0", Some(63063), None),

/// Allows associated types in inherent impls.
(incomplete, inherent_associated_types, "1.52.0", Some(8995), None),

6 changes: 5 additions & 1 deletion compiler/rustc_feature/src/removed.rs
Original file line number Diff line number Diff line change
@@ -111,7 +111,7 @@ declare_features! (
Some("subsumed by `.await` syntax")),
/// Allows defining `existential type`s.
(removed, existential_type, "1.38.0", Some(63063), None,
Some("removed in favor of `#![feature(min_type_alias_impl_trait)]`")),
Some("removed in favor of `#![feature(type_alias_impl_trait)]`")),
/// Allows using the macros:
/// + `__diagnostic_used`
/// + `__register_diagnostic`
@@ -152,6 +152,10 @@ declare_features! (
(removed, impl_trait_in_bindings, "1.55.0", Some(63065), None,
Some("the implementation was not maintainable, the feature may get reintroduced once the current refactorings are done")),

/// Allows the use of type alias impl trait in function return positions
(removed, min_type_alias_impl_trait, "1.55.0", Some(63063), None,
Some("removed in favor of full type_alias_impl_trait")),

// -------------------------------------------------------------------------
// feature-group-end: removed features
// -------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -242,7 +242,12 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
.unwrap_or(false) =>
{
err.span_label(span, format!("cannot {ACT}", ACT = act));
err.span_label(span, "try removing `&mut` here");
err.span_suggestion(
span,
"try removing `&mut` here",
String::new(),
Applicability::MaybeIncorrect,
);
}

// We want to suggest users use `let mut` for local (user
@@ -324,7 +329,12 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
} =>
{
err.span_label(span, format!("cannot {ACT}", ACT = act));
err.span_label(span, "try removing `&mut` here");
err.span_suggestion(
span,
"try removing `&mut` here",
String::new(),
Applicability::MaybeIncorrect,
);
}

PlaceRef { local, projection: [ProjectionElem::Deref] }
Original file line number Diff line number Diff line change
@@ -240,8 +240,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {

let mut err = match *error {
SelectionError::Unimplemented => {
// If this obligation was generated as a result of well-formed checking, see if we
// can get a better error message by performing HIR-based well formed checking.
// If this obligation was generated as a result of well-formedness checking, see if we
// can get a better error message by performing HIR-based well-formedness checking.
if let ObligationCauseCode::WellFormed(Some(wf_loc)) =
root_obligation.cause.code.peel_derives()
{
12 changes: 7 additions & 5 deletions compiler/rustc_typeck/src/hir_wf_check.rs
Original file line number Diff line number Diff line change
@@ -38,20 +38,20 @@ fn diagnostic_hir_wf_check<'tcx>(
// given the type `Option<MyStruct<u8>>`, we will check
// `Option<MyStruct<u8>>`, `MyStruct<u8>`, and `u8`.
// For each type, we perform a well-formed check, and see if we get
// an erorr that matches our expected predicate. We keep save
// an error that matches our expected predicate. We save
// the `ObligationCause` corresponding to the *innermost* type,
// which is the most specific type that we can point to.
// In general, the different components of an `hir::Ty` may have
// completely differentr spans due to macro invocations. Pointing
// completely different spans due to macro invocations. Pointing
// to the most accurate part of the type can be the difference
// between a useless span (e.g. the macro invocation site)
// and a useful span (e.g. a user-provided type passed in to the macro).
// and a useful span (e.g. a user-provided type passed into the macro).
//
// This approach is quite inefficient - we redo a lot of work done
// by the normal WF checker. However, this code is run at most once
// per reported error - it will have no impact when compilation succeeds,
// and should only have an impact if a very large number of errors are
// displaydd to the user.
// and should only have an impact if a very large number of errors is
// displayed to the user.
struct HirWfCheck<'tcx> {
tcx: TyCtxt<'tcx>,
predicate: ty::Predicate<'tcx>,
@@ -126,10 +126,12 @@ fn diagnostic_hir_wf_check<'tcx>(
WellFormedLoc::Ty(_) => match hir.get(hir_id) {
hir::Node::ImplItem(item) => match item.kind {
hir::ImplItemKind::TyAlias(ty) => Some(ty),
hir::ImplItemKind::Const(ty, _) => Some(ty),
ref item => bug!("Unexpected ImplItem {:?}", item),
},
hir::Node::TraitItem(item) => match item.kind {
hir::TraitItemKind::Type(_, ty) => ty,
hir::TraitItemKind::Const(ty, _) => Some(ty),
ref item => bug!("Unexpected TraitItem {:?}", item),
},
hir::Node::Item(item) => match item.kind {
3 changes: 2 additions & 1 deletion library/alloc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -142,7 +142,8 @@
#![feature(alloc_layout_extra)]
#![feature(trusted_random_access)]
#![feature(try_trait_v2)]
#![feature(min_type_alias_impl_trait)]
#![cfg_attr(bootstrap, feature(min_type_alias_impl_trait))]
#![cfg_attr(not(bootstrap), feature(type_alias_impl_trait))]
#![feature(associated_type_bounds)]
#![feature(slice_group_by)]
#![feature(decl_macro)]
8 changes: 5 additions & 3 deletions library/core/src/num/int_macros.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
macro_rules! int_impl {
($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $BITS_MINUS_ONE:expr, $Min:expr, $Max:expr,
$rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
$reversed:expr, $le_bytes:expr, $be_bytes:expr,
$to_xe_bytes_doc:expr, $from_xe_bytes_doc:expr) => {
/// The smallest value that can be represented by this integer type.
/// The smallest value that can be represented by this integer type,
#[doc = concat!("-2<sup>", $BITS_MINUS_ONE, "</sup>.")]
///
/// # Examples
///
@@ -15,7 +16,8 @@ macro_rules! int_impl {
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
pub const MIN: Self = !0 ^ ((!0 as $UnsignedT) >> 1) as Self;

/// The largest value that can be represented by this integer type.
/// The largest value that can be represented by this integer type,
#[doc = concat!("2<sup>", $BITS_MINUS_ONE, "</sup> - 1.")]
///
/// # Examples
///
16 changes: 8 additions & 8 deletions library/core/src/num/mod.rs
Original file line number Diff line number Diff line change
@@ -91,34 +91,34 @@ depending on the target pointer size.

#[lang = "i8"]
impl i8 {
int_impl! { i8, i8, u8, 8, -128, 127, 2, "-0x7e", "0xa", "0x12", "0x12", "0x48",
int_impl! { i8, i8, u8, 8, 7, -128, 127, 2, "-0x7e", "0xa", "0x12", "0x12", "0x48",
"[0x12]", "[0x12]", "", "" }
}

#[lang = "i16"]
impl i16 {
int_impl! { i16, i16, u16, 16, -32768, 32767, 4, "-0x5ffd", "0x3a", "0x1234", "0x3412",
int_impl! { i16, i16, u16, 16, 15, -32768, 32767, 4, "-0x5ffd", "0x3a", "0x1234", "0x3412",
"0x2c48", "[0x34, 0x12]", "[0x12, 0x34]", "", "" }
}

#[lang = "i32"]
impl i32 {
int_impl! { i32, i32, u32, 32, -2147483648, 2147483647, 8, "0x10000b3", "0xb301",
int_impl! { i32, i32, u32, 32, 31, -2147483648, 2147483647, 8, "0x10000b3", "0xb301",
"0x12345678", "0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]",
"[0x12, 0x34, 0x56, 0x78]", "", "" }
}

#[lang = "i64"]
impl i64 {
int_impl! { i64, i64, u64, 64, -9223372036854775808, 9223372036854775807, 12,
int_impl! { i64, i64, u64, 64, 63, -9223372036854775808, 9223372036854775807, 12,
"0xaa00000000006e1", "0x6e10aa", "0x1234567890123456", "0x5634129078563412",
"0x6a2c48091e6a2c48", "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
"[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]", "", "" }
}

#[lang = "i128"]
impl i128 {
int_impl! { i128, i128, u128, 128, -170141183460469231731687303715884105728,
int_impl! { i128, i128, u128, 128, 127, -170141183460469231731687303715884105728,
170141183460469231731687303715884105727, 16,
"0x13f40000000000000000000000004f76", "0x4f7613f4", "0x12345678901234567890123456789012",
"0x12907856341290785634129078563412", "0x48091e6a2c48091e6a2c48091e6a2c48",
@@ -131,15 +131,15 @@ impl i128 {
#[cfg(target_pointer_width = "16")]
#[lang = "isize"]
impl isize {
int_impl! { isize, i16, usize, 16, -32768, 32767, 4, "-0x5ffd", "0x3a", "0x1234",
int_impl! { isize, i16, usize, 16, 15, -32768, 32767, 4, "-0x5ffd", "0x3a", "0x1234",
"0x3412", "0x2c48", "[0x34, 0x12]", "[0x12, 0x34]",
usize_isize_to_xe_bytes_doc!(), usize_isize_from_xe_bytes_doc!() }
}

#[cfg(target_pointer_width = "32")]
#[lang = "isize"]
impl isize {
int_impl! { isize, i32, usize, 32, -2147483648, 2147483647, 8, "0x10000b3", "0xb301",
int_impl! { isize, i32, usize, 32, 31, -2147483648, 2147483647, 8, "0x10000b3", "0xb301",
"0x12345678", "0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]",
"[0x12, 0x34, 0x56, 0x78]",
usize_isize_to_xe_bytes_doc!(), usize_isize_from_xe_bytes_doc!() }
@@ -148,7 +148,7 @@ impl isize {
#[cfg(target_pointer_width = "64")]
#[lang = "isize"]
impl isize {
int_impl! { isize, i64, usize, 64, -9223372036854775808, 9223372036854775807,
int_impl! { isize, i64, usize, 64, 63, -9223372036854775808, 9223372036854775807,
12, "0xaa00000000006e1", "0x6e10aa", "0x1234567890123456", "0x5634129078563412",
"0x6a2c48091e6a2c48", "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
"[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]",
3 changes: 2 additions & 1 deletion library/core/src/num/uint_macros.rs
Original file line number Diff line number Diff line change
@@ -15,7 +15,8 @@ macro_rules! uint_impl {
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
pub const MIN: Self = 0;

/// The largest value that can be represented by this integer type.
/// The largest value that can be represented by this integer type,
#[doc = concat!("2<sup>", $BITS, "</sup> - 1.")]
///
/// # Examples
///
8 changes: 4 additions & 4 deletions library/core/src/ops/range.rs
Original file line number Diff line number Diff line change
@@ -812,12 +812,12 @@ pub trait RangeBounds<T: ?Sized> {
U: ?Sized + PartialOrd<T>,
{
(match self.start_bound() {
Included(ref start) => *start <= item,
Excluded(ref start) => *start < item,
Included(start) => start <= item,
Excluded(start) => start < item,
Unbounded => true,
}) && (match self.end_bound() {
Included(ref end) => item <= *end,
Excluded(ref end) => item < *end,
Included(end) => item <= end,
Excluded(end) => item < end,
Unbounded => true,
})
}
10 changes: 1 addition & 9 deletions library/std/src/collections/hash/map.rs
Original file line number Diff line number Diff line change
@@ -2821,15 +2821,7 @@ where

#[inline]
fn extend_reserve(&mut self, additional: usize) {
// self.base.extend_reserve(additional);
// FIXME: hashbrown should implement this method.
// But until then, use the same reservation logic:

// Reserve the entire hint lower bound if the map is empty.
// Otherwise reserve half the hint (rounded up), so the map
// will only resize twice in the worst case.
let reserve = if self.is_empty() { additional } else { (additional + 1) / 2 };
self.base.reserve(reserve);
self.base.extend_reserve(additional);
}
}

2 changes: 2 additions & 0 deletions library/std/src/fs.rs
Original file line number Diff line number Diff line change
@@ -1912,6 +1912,7 @@ pub fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
/// Ok(())
/// }
/// ```
#[doc(alias = "mkdir")]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn create_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
DirBuilder::new().create(path.as_ref())
@@ -1991,6 +1992,7 @@ pub fn create_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
/// Ok(())
/// }
/// ```
#[doc(alias = "rmdir")]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn remove_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
fs_imp::rmdir(path.as_ref())
3 changes: 2 additions & 1 deletion library/std/src/sys/sgx/mutex.rs
Original file line number Diff line number Diff line change
@@ -8,7 +8,8 @@ pub struct Mutex {
inner: SpinMutex<WaitVariable<bool>>,
}

pub type MovableMutex = Mutex;
// not movable: see UnsafeList implementation
pub type MovableMutex = Box<Mutex>;

// Implementation according to “Operating Systems: Three Easy Pieces”, chapter 28
impl Mutex {
1 change: 1 addition & 0 deletions library/std/src/sys/sgx/waitqueue/unsafe_list.rs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ impl<T> UnsafeListEntry<T> {
}
}

// WARNING: self-referential struct!
pub struct UnsafeList<T> {
head_tail: NonNull<UnsafeListEntry<T>>,
head_tail_entry: Option<UnsafeListEntry<T>>,
2 changes: 1 addition & 1 deletion src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
@@ -473,7 +473,7 @@ def download_toolchain(self, stage0=True, rustc_channel=None):
]).decode(sys.getdefaultencoding()).strip()
llvm_sha = subprocess.check_output([
"git", "log", "--author=bors", "--format=%H", "-n1",
"-m", "--first-parent",
"--no-patch", "--first-parent",
"--",
"{}/src/llvm-project".format(top_level),
"{}/src/bootstrap/download-ci-llvm-stamp".format(top_level),
Loading