Skip to content

Commit

Permalink
Auto merge of #83376 - Dylan-DPC:rollup-s2fsjwj, r=Dylan-DPC
Browse files Browse the repository at this point in the history
Rollup of 7 pull requests

Successful merges:

 - #82374 (Add license metadata for std dependencies)
 - #82683 (Document panicking cases for integer division and remainder)
 - #83272 (Clarify non-exact length in the Iterator::take documentation)
 - #83338 (Fix test for #82270)
 - #83351 (post-drop-elab check-const: explain why we still check qualifs)
 - #83367 (Improve error message for unassigned query provider)
 - #83372 (SplitInclusive is public API)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Mar 22, 2021
2 parents d04c3aa + ce06787 commit 2287a88
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 20 deletions.
7 changes: 5 additions & 2 deletions compiler/rustc_middle/src/ty/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,11 @@ macro_rules! define_callbacks {
fn default() -> Self {
Providers {
$($name: |_, key| bug!(
"`tcx.{}({:?})` unsupported by its crate",
stringify!($name), key
"`tcx.{}({:?})` unsupported by its crate; \
perhaps the `{}` query was never assigned a provider function",
stringify!($name),
key,
stringify!($name),
),)*
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,20 @@ impl Visitor<'tcx> for CheckLiveDrops<'mir, 'tcx> {
mir::TerminatorKind::Drop { place: dropped_place, .. } => {
let dropped_ty = dropped_place.ty(self.body, self.tcx).ty;
if !NeedsDrop::in_any_value_of_ty(self.ccx, dropped_ty) {
return;
bug!(
"Drop elaboration left behind a Drop for a type that does not need dropping"
);
}

if dropped_place.is_indirect() {
self.check_live_drop(terminator.source_info.span);
return;
}

// Drop elaboration is not precise enough to accept code like
// `src/test/ui/consts/control-flow/drop-pass.rs`; e.g., when an `Option<Vec<T>>` is
// initialized with `None` and never changed, it still emits drop glue.
// Hence we additionally check the qualifs here to allow more code to pass.
if self.qualifs.needs_drop(self.ccx, dropped_place.local, location) {
// Use the span where the dropped local was declared for the error.
let span = self.body.local_decls[dropped_place.local].source_info.span;
Expand Down
3 changes: 3 additions & 0 deletions library/alloc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
authors = ["The Rust Project Developers"]
name = "alloc"
version = "0.0.0"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/rust.git"
description = "The Rust core allocation and collections library"
autotests = false
autobenches = false
edition = "2018"
Expand Down
3 changes: 3 additions & 0 deletions library/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
authors = ["The Rust Project Developers"]
name = "core"
version = "0.0.0"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/rust.git"
description = "The Rust Core Library"
autotests = false
autobenches = false
edition = "2018"
Expand Down
15 changes: 13 additions & 2 deletions library/core/src/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,11 @@ pub trait Iterator {

/// Creates an iterator that skips the first `n` elements.
///
/// After they have been consumed, the rest of the elements are yielded.
/// `skip(n)` skips elements until `n` elements are skipped or the end of the
/// iterator is reached (whichever happens first). After that, all the remaining
/// elements are yielded. In particular, if the original iterator is too short,
/// then the returned iterator is empty.
///
/// Rather than overriding this method directly, instead override the `nth` method.
///
/// # Examples
Expand All @@ -1252,7 +1256,14 @@ pub trait Iterator {
Skip::new(self, n)
}

/// Creates an iterator that yields its first `n` elements.
/// Creates an iterator that yields the first `n` elements, or fewer
/// if the underlying iterator ends sooner.
///
/// `take(n)` yields elements until `n` elements are yielded or the end of
/// the iterator is reached (whichever happens first).
/// The returned iterator is a prefix of length `n` if the original iterator
/// contains at least `n` elements, otherwise it contains all of the
/// (fewer than `n`) elements of the original iterator.
///
/// # Examples
///
Expand Down
26 changes: 20 additions & 6 deletions library/core/src/ops/arith.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,13 @@ pub trait Div<Rhs = Self> {
}

macro_rules! div_impl_integer {
($($t:ty)*) => ($(
($(($($t:ty)*) => $panic:expr),*) => ($($(
/// This operation rounds towards zero, truncating any
/// fractional part of the exact result.
///
/// # Panics
///
#[doc = $panic]
#[stable(feature = "rust1", since = "1.0.0")]
impl Div for $t {
type Output = $t;
Expand All @@ -468,10 +472,13 @@ macro_rules! div_impl_integer {
}

forward_ref_binop! { impl Div, div for $t, $t }
)*)
)*)*)
}

div_impl_integer! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
div_impl_integer! {
(usize u8 u16 u32 u64 u128) => "This operation will panic if `other == 0`.",
(isize i8 i16 i32 i64 i128) => "This operation will panic if `other == 0` or the division results in overflow."
}

macro_rules! div_impl_float {
($($t:ty)*) => ($(
Expand Down Expand Up @@ -549,9 +556,13 @@ pub trait Rem<Rhs = Self> {
}

macro_rules! rem_impl_integer {
($($t:ty)*) => ($(
($(($($t:ty)*) => $panic:expr),*) => ($($(
/// This operation satisfies `n % d == n - (n / d) * d`. The
/// result has the same sign as the left operand.
///
/// # Panics
///
#[doc = $panic]
#[stable(feature = "rust1", since = "1.0.0")]
impl Rem for $t {
type Output = $t;
Expand All @@ -561,10 +572,13 @@ macro_rules! rem_impl_integer {
}

forward_ref_binop! { impl Rem, rem for $t, $t }
)*)
)*)*)
}

rem_impl_integer! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
rem_impl_integer! {
(usize u8 u16 u32 u64 u128) => "This operation will panic if `other == 0`.",
(isize i8 i16 i32 i64 i128) => "This operation will panic if `other == 0` or if `self / other` results in overflow."
}

macro_rules! rem_impl_float {
($($t:ty)*) => ($(
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub use iter::{EscapeDebug, EscapeDefault, EscapeUnicode};
pub use iter::SplitAsciiWhitespace;

#[stable(feature = "split_inclusive", since = "1.51.0")]
use iter::SplitInclusive;
pub use iter::SplitInclusive;

#[unstable(feature = "str_internals", issue = "none")]
pub use validations::next_code_point;
Expand Down
3 changes: 3 additions & 0 deletions library/panic_abort/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
authors = ["The Rust Project Developers"]
name = "panic_abort"
version = "0.0.0"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/rust.git"
description = "Implementation of Rust panics via process aborts"
edition = "2018"

[lib]
Expand Down
3 changes: 3 additions & 0 deletions library/panic_unwind/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
authors = ["The Rust Project Developers"]
name = "panic_unwind"
version = "0.0.0"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/rust.git"
description = "Implementation of Rust panics via stack unwinding"
edition = "2018"

[lib]
Expand Down
2 changes: 2 additions & 0 deletions library/unwind/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
authors = ["The Rust Project Developers"]
name = "unwind"
version = "0.0.0"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/rust.git"
edition = "2018"
include = [
'/libunwind/*',
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/asm/inline-syntax.arm.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: att syntax is the default syntax on this target, and trying to use this directive may cause issues
--> $DIR/inline-syntax.rs:22:15
--> $DIR/inline-syntax.rs:23:15
|
LL | asm!(".att_syntax noprefix", "nop");
| ^^^^^^^^^^^^^^^^^^^^ help: remove this assembler directive

error: att syntax is the default syntax on this target, and trying to use this directive may cause issues
--> $DIR/inline-syntax.rs:25:15
--> $DIR/inline-syntax.rs:26:15
|
LL | asm!(".att_syntax bbb noprefix", "nop");
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this assembler directive
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/asm/inline-syntax.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// needs-llvm-components: arm
// revisions: x86_64 arm
//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu
//[arm] compile-flags: --target armv7-unknown-linux-gnueabihf
Expand Down
12 changes: 6 additions & 6 deletions src/test/ui/asm/inline-syntax.x86_64.stderr
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
error: intel syntax is the default syntax on this target, and trying to use this directive may cause issues
--> $DIR/inline-syntax.rs:18:15
--> $DIR/inline-syntax.rs:19:15
|
LL | asm!(".intel_syntax noprefix", "nop");
| ^^^^^^^^^^^^^^^^^^^^^^ help: remove this assembler directive

error: intel syntax is the default syntax on this target, and trying to use this directive may cause issues
--> $DIR/inline-syntax.rs:20:15
--> $DIR/inline-syntax.rs:21:15
|
LL | asm!(".intel_syntax aaa noprefix", "nop");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this assembler directive

error: using the .att_syntax directive may cause issues, use the att_syntax option instead
--> $DIR/inline-syntax.rs:22:15
--> $DIR/inline-syntax.rs:23:15
|
LL | asm!(".att_syntax noprefix", "nop");
| ^^^^^^^^^^^^^^^^^^^^
Expand All @@ -22,7 +22,7 @@ LL | asm!("", "nop", options(att_syntax));
| -- ^^^^^^^^^^^^^^^^^^^^^

error: using the .att_syntax directive may cause issues, use the att_syntax option instead
--> $DIR/inline-syntax.rs:25:15
--> $DIR/inline-syntax.rs:26:15
|
LL | asm!(".att_syntax bbb noprefix", "nop");
| ^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -33,13 +33,13 @@ LL | asm!("", "nop", options(att_syntax));
| -- ^^^^^^^^^^^^^^^^^^^^^

error: intel syntax is the default syntax on this target, and trying to use this directive may cause issues
--> $DIR/inline-syntax.rs:28:15
--> $DIR/inline-syntax.rs:29:15
|
LL | asm!(".intel_syntax noprefix; nop");
| ^^^^^^^^^^^^^^^^^^^^^^ help: remove this assembler directive

error: intel syntax is the default syntax on this target, and trying to use this directive may cause issues
--> $DIR/inline-syntax.rs:33:14
--> $DIR/inline-syntax.rs:34:14
|
LL | .intel_syntax noprefix
| ______________^
Expand Down

0 comments on commit 2287a88

Please sign in to comment.