Auto merge of #122012 - matthiaskrgr:rollup-bzqjj2n, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - #121213 (Add an example to demonstrate how Rc::into_inner works) - #121262 (Add vector time complexity) - #121287 (Clarify/add `must_use` message for Rc/Arc/Weak::into_raw.) - #121664 (Adjust error `yield`/`await` lowering) - #121826 (Use root obligation on E0277 for some cases) - #121838 (Use the correct logic for nested impl trait in assoc types) - #121913 (Don't panic when waiting on poisoned queries) - #121987 (pattern analysis: abort on arity mismatch) - #121993 (Avoid using unnecessary queries when printing the query stack in panics) - #121997 (interpret/cast: make more matches on FloatTy properly exhaustive) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
@@ -30,8 +30,7 @@ use crate::task::{Context, Poll};
|
||||
#[lang = "future_trait"]
|
||||
#[diagnostic::on_unimplemented(
|
||||
label = "`{Self}` is not a future",
|
||||
message = "`{Self}` is not a future",
|
||||
note = "{Self} must be a future or must implement `IntoFuture` to be awaited"
|
||||
message = "`{Self}` is not a future"
|
||||
)]
|
||||
pub trait Future {
|
||||
/// The type of value produced on completion.
|
||||
|
||||
@@ -100,6 +100,11 @@ use crate::future::Future;
|
||||
/// ```
|
||||
#[stable(feature = "into_future", since = "1.64.0")]
|
||||
#[rustc_diagnostic_item = "IntoFuture"]
|
||||
#[diagnostic::on_unimplemented(
|
||||
label = "`{Self}` is not a future",
|
||||
message = "`{Self}` is not a future",
|
||||
note = "{Self} must be a future or must implement `IntoFuture` to be awaited"
|
||||
)]
|
||||
pub trait IntoFuture {
|
||||
/// The output that the future will produce on completion.
|
||||
#[stable(feature = "into_future", since = "1.64.0")]
|
||||
|
||||
@@ -236,6 +236,49 @@ pub trait FromIterator<A>: Sized {
|
||||
/// ```
|
||||
#[rustc_diagnostic_item = "IntoIterator"]
|
||||
#[rustc_skip_array_during_method_dispatch]
|
||||
#[rustc_on_unimplemented(
|
||||
on(
|
||||
_Self = "core::ops::range::RangeTo<Idx>",
|
||||
label = "if you meant to iterate until a value, add a starting value",
|
||||
note = "`..end` is a `RangeTo`, which cannot be iterated on; you might have meant to have a \
|
||||
bounded `Range`: `0..end`"
|
||||
),
|
||||
on(
|
||||
_Self = "core::ops::range::RangeToInclusive<Idx>",
|
||||
label = "if you meant to iterate until a value (including it), add a starting value",
|
||||
note = "`..=end` is a `RangeToInclusive`, which cannot be iterated on; you might have meant \
|
||||
to have a bounded `RangeInclusive`: `0..=end`"
|
||||
),
|
||||
on(
|
||||
_Self = "[]",
|
||||
label = "`{Self}` is not an iterator; try calling `.into_iter()` or `.iter()`"
|
||||
),
|
||||
on(_Self = "&[]", label = "`{Self}` is not an iterator; try calling `.iter()`"),
|
||||
on(
|
||||
_Self = "alloc::vec::Vec<T, A>",
|
||||
label = "`{Self}` is not an iterator; try calling `.into_iter()` or `.iter()`"
|
||||
),
|
||||
on(
|
||||
_Self = "&str",
|
||||
label = "`{Self}` is not an iterator; try calling `.chars()` or `.bytes()`"
|
||||
),
|
||||
on(
|
||||
_Self = "alloc::string::String",
|
||||
label = "`{Self}` is not an iterator; try calling `.chars()` or `.bytes()`"
|
||||
),
|
||||
on(
|
||||
_Self = "{integral}",
|
||||
note = "if you want to iterate between `start` until a value `end`, use the exclusive range \
|
||||
syntax `start..end` or the inclusive range syntax `start..=end`"
|
||||
),
|
||||
on(
|
||||
_Self = "{float}",
|
||||
note = "if you want to iterate between `start` until a value `end`, use the exclusive range \
|
||||
syntax `start..end` or the inclusive range syntax `start..=end`"
|
||||
),
|
||||
label = "`{Self}` is not an iterator",
|
||||
message = "`{Self}` is not an iterator"
|
||||
)]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait IntoIterator {
|
||||
/// The type of the elements being iterated over.
|
||||
|
||||
@@ -28,42 +28,11 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item = ()>) {}
|
||||
#[rustc_on_unimplemented(
|
||||
on(
|
||||
_Self = "core::ops::range::RangeTo<Idx>",
|
||||
label = "if you meant to iterate until a value, add a starting value",
|
||||
note = "`..end` is a `RangeTo`, which cannot be iterated on; you might have meant to have a \
|
||||
bounded `Range`: `0..end`"
|
||||
note = "you might have meant to use a bounded `Range`"
|
||||
),
|
||||
on(
|
||||
_Self = "core::ops::range::RangeToInclusive<Idx>",
|
||||
label = "if you meant to iterate until a value (including it), add a starting value",
|
||||
note = "`..=end` is a `RangeToInclusive`, which cannot be iterated on; you might have meant \
|
||||
to have a bounded `RangeInclusive`: `0..=end`"
|
||||
),
|
||||
on(
|
||||
_Self = "[]",
|
||||
label = "`{Self}` is not an iterator; try calling `.into_iter()` or `.iter()`"
|
||||
),
|
||||
on(_Self = "&[]", label = "`{Self}` is not an iterator; try calling `.iter()`"),
|
||||
on(
|
||||
_Self = "alloc::vec::Vec<T, A>",
|
||||
label = "`{Self}` is not an iterator; try calling `.into_iter()` or `.iter()`"
|
||||
),
|
||||
on(
|
||||
_Self = "&str",
|
||||
label = "`{Self}` is not an iterator; try calling `.chars()` or `.bytes()`"
|
||||
),
|
||||
on(
|
||||
_Self = "alloc::string::String",
|
||||
label = "`{Self}` is not an iterator; try calling `.chars()` or `.bytes()`"
|
||||
),
|
||||
on(
|
||||
_Self = "{integral}",
|
||||
note = "if you want to iterate between `start` until a value `end`, use the exclusive range \
|
||||
syntax `start..end` or the inclusive range syntax `start..=end`"
|
||||
),
|
||||
on(
|
||||
_Self = "{float}",
|
||||
note = "if you want to iterate between `start` until a value `end`, use the exclusive range \
|
||||
syntax `start..end` or the inclusive range syntax `start..=end`"
|
||||
note = "you might have meant to use a bounded `RangeInclusive`"
|
||||
),
|
||||
label = "`{Self}` is not an iterator",
|
||||
message = "`{Self}` is not an iterator"
|
||||
|
||||
Reference in New Issue
Block a user