forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#105512 - matthiaskrgr:rollup-i74avrf, r=matth…
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#102406 (Make `missing_copy_implementations` more cautious) - rust-lang#105265 (Add `rustc_on_unimplemented` to `Sum` and `Product` trait.) - rust-lang#105385 (Skip test on s390x as LLD does not support the platform) - rust-lang#105453 (Make `VecDeque::from_iter` O(1) from `vec(_deque)::IntoIter`) - rust-lang#105468 (Mangle "main" as "__main_void" on wasm32-wasi) - rust-lang#105480 (rustdoc: remove no-op mobile CSS `#sidebar-toggle { text-align }`) - rust-lang#105489 (Fix typo in apple_base.rs) - rust-lang#105504 (rustdoc: make stability badge CSS more consistent) - rust-lang#105506 (Tweak `rustc_must_implement_one_of` diagnostic output) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
21 changed files
with
357 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use super::{IntoIter, VecDeque}; | ||
|
||
/// Specialization trait used for `VecDeque::from_iter` | ||
pub(super) trait SpecFromIter<T, I> { | ||
fn spec_from_iter(iter: I) -> Self; | ||
} | ||
|
||
impl<T, I> SpecFromIter<T, I> for VecDeque<T> | ||
where | ||
I: Iterator<Item = T>, | ||
{ | ||
default fn spec_from_iter(iterator: I) -> Self { | ||
// Since converting is O(1) now, just re-use the `Vec` logic for | ||
// anything where we can't do something extra-special for `VecDeque`, | ||
// especially as that could save us some monomorphiziation work | ||
// if one uses the same iterators (like slice ones) with both. | ||
crate::vec::Vec::from_iter(iterator).into() | ||
} | ||
} | ||
|
||
impl<T> SpecFromIter<T, crate::vec::IntoIter<T>> for VecDeque<T> { | ||
#[inline] | ||
fn spec_from_iter(iterator: crate::vec::IntoIter<T>) -> Self { | ||
iterator.into_vecdeque() | ||
} | ||
} | ||
|
||
impl<T> SpecFromIter<T, IntoIter<T>> for VecDeque<T> { | ||
#[inline] | ||
fn spec_from_iter(iterator: IntoIter<T>) -> Self { | ||
iterator.into_vecdeque() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.