Skip to content

Commit 2b8de6f

Browse files
committed
Auto merge of #87746 - JohnTitor:rollup-zaapqgl, r=JohnTitor
Rollup of 8 pull requests Successful merges: - #81797 (Add `core::stream::from_iter`) - #87267 (Remove space after negative sign in Literal to_string) - #87663 (Rustdoc accessibility: use an icon for the [-]/[+] controls) - #87720 (don't use .into() to convert types to identical types (clippy::useless_conversion)) - #87723 (Use .contains instead of manual reimplementation.) - #87729 (Remove the aarch64 `crypto` target_feature) - #87731 (Update cargo) - #87734 (Test dropping union fields more) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents a6ece56 + 7c5588e commit 2b8de6f

35 files changed

+375
-67
lines changed

Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ checksum = "81a18687293a1546b67c246452202bbbf143d239cb43494cc163da14979082da"
255255

256256
[[package]]
257257
name = "cargo"
258-
version = "0.56.0"
258+
version = "0.57.0"
259259
dependencies = [
260260
"anyhow",
261261
"atty",
@@ -388,7 +388,7 @@ dependencies = [
388388

389389
[[package]]
390390
name = "cargo-util"
391-
version = "0.1.0"
391+
version = "0.1.1"
392392
dependencies = [
393393
"anyhow",
394394
"core-foundation",

compiler/rustc_codegen_ssa/src/target_features.rs

-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ const AARCH64_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
4747
("sve", Some(sym::aarch64_target_feature)),
4848
// FEAT_CRC
4949
("crc", Some(sym::aarch64_target_feature)),
50-
// Cryptographic extension
51-
("crypto", Some(sym::aarch64_target_feature)),
5250
// FEAT_RAS
5351
("ras", Some(sym::aarch64_target_feature)),
5452
// FEAT_LSE

compiler/rustc_expand/src/proc_macro_server.rs

+3
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,9 @@ impl server::Literal for Rustc<'_> {
582582

583583
Ok(Literal { lit, span: self.call_site })
584584
}
585+
fn to_string(&mut self, literal: &Self::Literal) -> String {
586+
literal.lit.to_string()
587+
}
585588
fn debug_kind(&mut self, literal: &Self::Literal) -> String {
586589
format!("{:?}", literal.lit.kind)
587590
}

compiler/rustc_mir/src/interpret/operand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
599599
let ptr = self.global_base_pointer(Pointer::new(id, offset))?;
600600
Operand::Indirect(MemPlace::from_ptr(ptr.into(), layout.align.abi))
601601
}
602-
ConstValue::Scalar(x) => Operand::Immediate(tag_scalar(x.into())?.into()),
602+
ConstValue::Scalar(x) => Operand::Immediate(tag_scalar(x)?.into()),
603603
ConstValue::Slice { data, start, end } => {
604604
// We rely on mutability being set correctly in `data` to prevent writes
605605
// where none should happen.

compiler/rustc_mir/src/interpret/terminator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
7373
ty::FnPtr(sig) => {
7474
let caller_abi = sig.abi();
7575
let fn_ptr = self.read_pointer(&func)?;
76-
let fn_val = self.memory.get_fn(fn_ptr.into())?;
76+
let fn_val = self.memory.get_fn(fn_ptr)?;
7777
(
7878
fn_val,
7979
caller_abi,

compiler/rustc_mir/src/transform/simplify_comparison_integral.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ fn find_branch_value_info<'tcx>(
211211
return None;
212212
};
213213
let branch_value_scalar = branch_value.literal.try_to_scalar()?;
214-
Some((branch_value_scalar.into(), branch_value_ty, *to_switch_on))
214+
Some((branch_value_scalar, branch_value_ty, *to_switch_on))
215215
}
216216
_ => None,
217217
}

library/core/src/num/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ fn from_str_radix<T: FromStrRadixHelper>(src: &str, radix: u32) -> Result<T, Par
847847
use self::ParseIntError as PIE;
848848

849849
assert!(
850-
radix >= 2 && radix <= 36,
850+
(2..=36).contains(&radix),
851851
"from_str_radix_int: must lie in the range `[2, 36]` - found {}",
852852
radix
853853
);

library/core/src/stream/from_iter.rs

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
use crate::pin::Pin;
2+
3+
use crate::stream::Stream;
4+
use crate::task::{Context, Poll};
5+
6+
/// A stream that was created from iterator.
7+
///
8+
/// This stream is created by the [`from_iter`] function.
9+
/// See it documentation for more.
10+
///
11+
/// [`from_iter`]: fn.from_iter.html
12+
#[unstable(feature = "stream_from_iter", issue = "81798")]
13+
#[derive(Clone, Debug)]
14+
pub struct FromIter<I> {
15+
iter: I,
16+
}
17+
18+
#[unstable(feature = "stream_from_iter", issue = "81798")]
19+
impl<I> Unpin for FromIter<I> {}
20+
21+
/// Converts an iterator into a stream.
22+
#[unstable(feature = "stream_from_iter", issue = "81798")]
23+
pub fn from_iter<I: IntoIterator>(iter: I) -> FromIter<I::IntoIter> {
24+
FromIter { iter: iter.into_iter() }
25+
}
26+
27+
#[unstable(feature = "stream_from_iter", issue = "81798")]
28+
impl<I: Iterator> Stream for FromIter<I> {
29+
type Item = I::Item;
30+
31+
fn poll_next(mut self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
32+
Poll::Ready(self.iter.next())
33+
}
34+
35+
fn size_hint(&self) -> (usize, Option<usize>) {
36+
self.iter.size_hint()
37+
}
38+
}

library/core/src/stream/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@
122122
//! warning: unused result that must be used: streams do nothing unless polled
123123
//! ```
124124
125+
mod from_iter;
125126
mod stream;
126127

128+
pub use from_iter::{from_iter, FromIter};
127129
pub use stream::Stream;

library/proc_macro/src/bridge/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ macro_rules! with_api {
109109
fn drop($self: $S::Literal);
110110
fn clone($self: &$S::Literal) -> $S::Literal;
111111
fn from_str(s: &str) -> Result<$S::Literal, ()>;
112+
fn to_string($self: &$S::Literal) -> String;
112113
fn debug_kind($self: &$S::Literal) -> String;
113114
fn symbol($self: &$S::Literal) -> String;
114115
fn suffix($self: &$S::Literal) -> Option<String>;

library/proc_macro/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,7 @@ impl FromStr for Literal {
11951195
#[stable(feature = "proc_macro_lib", since = "1.15.0")]
11961196
impl ToString for Literal {
11971197
fn to_string(&self) -> String {
1198-
TokenStream::from(TokenTree::from(self.clone())).to_string()
1198+
self.0.to_string()
11991199
}
12001200
}
12011201

library/std/tests/run-time-detect.rs

+36-2
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,56 @@
1616
fn arm_linux() {
1717
println!("neon: {}", is_arm_feature_detected!("neon"));
1818
println!("pmull: {}", is_arm_feature_detected!("pmull"));
19+
println!("crypto: {}", is_arm_feature_detected!("crypto"));
20+
println!("crc: {}", is_arm_feature_detected!("crc"));
21+
println!("aes: {}", is_arm_feature_detected!("aes"));
22+
println!("sha2: {}", is_arm_feature_detected!("sha2"));
1923
}
2024

2125
#[test]
2226
#[cfg(all(target_arch = "aarch64", any(target_os = "linux", target_os = "android")))]
2327
fn aarch64_linux() {
24-
println!("fp: {}", is_aarch64_feature_detected!("fp"));
25-
println!("fp16: {}", is_aarch64_feature_detected!("fp16"));
2628
println!("neon: {}", is_aarch64_feature_detected!("neon"));
2729
println!("asimd: {}", is_aarch64_feature_detected!("asimd"));
30+
println!("pmull: {}", is_aarch64_feature_detected!("pmull"));
31+
println!("fp: {}", is_aarch64_feature_detected!("fp"));
32+
println!("fp16: {}", is_aarch64_feature_detected!("fp16"));
2833
println!("sve: {}", is_aarch64_feature_detected!("sve"));
2934
println!("crc: {}", is_aarch64_feature_detected!("crc"));
3035
println!("lse: {}", is_aarch64_feature_detected!("lse"));
36+
println!("lse2: {}", is_aarch64_feature_detected!("lse2"));
3137
println!("rdm: {}", is_aarch64_feature_detected!("rdm"));
3238
println!("rcpc: {}", is_aarch64_feature_detected!("rcpc"));
39+
println!("rcpc2: {}", is_aarch64_feature_detected!("rcpc2"));
3340
println!("dotprod: {}", is_aarch64_feature_detected!("dotprod"));
3441
println!("tme: {}", is_aarch64_feature_detected!("tme"));
42+
println!("fhm: {}", is_aarch64_feature_detected!("fhm"));
43+
println!("dit: {}", is_aarch64_feature_detected!("dit"));
44+
println!("flagm: {}", is_aarch64_feature_detected!("flagm"));
45+
println!("ssbs: {}", is_aarch64_feature_detected!("ssbs"));
46+
println!("sb: {}", is_aarch64_feature_detected!("sb"));
47+
println!("pauth: {}", is_aarch64_feature_detected!("pauth"));
48+
println!("dpb: {}", is_aarch64_feature_detected!("dpb"));
49+
println!("dpb2: {}", is_aarch64_feature_detected!("dpb2"));
50+
println!("sve2: {}", is_aarch64_feature_detected!("sve2"));
51+
println!("sve2-aes: {}", is_aarch64_feature_detected!("sve2-aes"));
52+
println!("sve2-sm4: {}", is_aarch64_feature_detected!("sve2-sm4"));
53+
println!("sve2-sha3: {}", is_aarch64_feature_detected!("sve2-sha3"));
54+
println!("sve2-bitperm: {}", is_aarch64_feature_detected!("sve2-bitperm"));
55+
println!("frintts: {}", is_aarch64_feature_detected!("frintts"));
56+
println!("i8mm: {}", is_aarch64_feature_detected!("i8mm"));
57+
println!("f32mm: {}", is_aarch64_feature_detected!("f32mm"));
58+
println!("f64mm: {}", is_aarch64_feature_detected!("f64mm"));
59+
println!("bf16: {}", is_aarch64_feature_detected!("bf16"));
60+
println!("rand: {}", is_aarch64_feature_detected!("rand"));
61+
println!("bti: {}", is_aarch64_feature_detected!("bti"));
62+
println!("mte: {}", is_aarch64_feature_detected!("mte"));
63+
println!("jsconv: {}", is_aarch64_feature_detected!("jsconv"));
64+
println!("fcma: {}", is_aarch64_feature_detected!("fcma"));
65+
println!("aes: {}", is_aarch64_feature_detected!("aes"));
66+
println!("sha2: {}", is_aarch64_feature_detected!("sha2"));
67+
println!("sha3: {}", is_aarch64_feature_detected!("sha3"));
68+
println!("sm4: {}", is_aarch64_feature_detected!("sm4"));
3569
}
3670

3771
#[test]

src/librustdoc/clean/mod.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -675,11 +675,10 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, ty::GenericPredicates<'tcx
675675
if let Some(((_, trait_did, name), rhs)) =
676676
proj.as_ref().and_then(|(lhs, rhs)| Some((lhs.projection()?, rhs)))
677677
{
678-
impl_trait_proj.entry(param_idx).or_default().push((
679-
trait_did.into(),
680-
name,
681-
rhs,
682-
));
678+
impl_trait_proj
679+
.entry(param_idx)
680+
.or_default()
681+
.push((trait_did, name, rhs));
683682
}
684683

685684
return None;

src/librustdoc/clean/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1614,7 +1614,7 @@ impl Type {
16141614
impl Type {
16151615
fn inner_def_id(&self, cache: Option<&Cache>) -> Option<DefId> {
16161616
let t: PrimitiveType = match *self {
1617-
ResolvedPath { did, .. } => return Some(did.into()),
1617+
ResolvedPath { did, .. } => return Some(did),
16181618
DynTrait(ref bounds, _) => return bounds[0].trait_.inner_def_id(cache),
16191619
Primitive(p) => return cache.and_then(|c| c.primitive_locations.get(&p).cloned()),
16201620
BorrowedRef { type_: box Generic(..), .. } => PrimitiveType::Reference,

src/librustdoc/formats/cache.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
228228
if i.blanket_impl.is_none() {
229229
self.cache
230230
.implementors
231-
.entry(did.into())
231+
.entry(did)
232232
.or_default()
233233
.push(Impl { impl_item: item.clone() });
234234
}

src/librustdoc/html/format.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ crate fn anchor<'a, 'cx: 'a>(
688688
text: &'a str,
689689
cx: &'cx Context<'_>,
690690
) -> impl fmt::Display + 'a {
691-
let parts = href(did.into(), cx);
691+
let parts = href(did, cx);
692692
display_fn(move |f| {
693693
if let Ok((url, short_ty, fqp)) = parts {
694694
write!(
@@ -921,7 +921,7 @@ fn fmt_type<'cx>(
921921
// everything comes in as a fully resolved QPath (hard to
922922
// look at).
923923
box clean::ResolvedPath { did, .. } => {
924-
match href(did.into(), cx) {
924+
match href(did, cx) {
925925
Ok((ref url, _, ref path)) if !f.alternate() => {
926926
write!(
927927
f,

src/librustdoc/html/render/cache.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ crate fn build_index<'tcx>(krate: &clean::Crate, cache: &mut Cache, tcx: TyCtxt<
4242
name: item.name.unwrap().to_string(),
4343
path: fqp[..fqp.len() - 1].join("::"),
4444
desc,
45-
parent: Some(did.into()),
45+
parent: Some(did),
4646
parent_idx: None,
4747
search_type: get_index_search_type(&item, tcx),
4848
aliases: item.attrs.get_doc_aliases(),

src/librustdoc/html/render/write_shared.rs

+39-1
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,45 @@ pub(super) fn write_shared(
175175
cx.write_shared(SharedResource::InvocationSpecific { basename: p }, content, &options.emit)
176176
};
177177

178+
fn add_background_image_to_css(
179+
cx: &Context<'_>,
180+
css: &mut String,
181+
rule: &str,
182+
file: &'static str,
183+
) {
184+
css.push_str(&format!(
185+
"{} {{ background-image: url({}); }}",
186+
rule,
187+
SharedResource::ToolchainSpecific { basename: file }
188+
.path(cx)
189+
.file_name()
190+
.unwrap()
191+
.to_str()
192+
.unwrap()
193+
))
194+
}
195+
196+
// Add all the static files. These may already exist, but we just
197+
// overwrite them anyway to make sure that they're fresh and up-to-date.
198+
let mut rustdoc_css = static_files::RUSTDOC_CSS.to_owned();
199+
add_background_image_to_css(
200+
cx,
201+
&mut rustdoc_css,
202+
"details.undocumented[open] > summary::before, \
203+
details.rustdoc-toggle[open] > summary::before, \
204+
details.rustdoc-toggle[open] > summary.hideme::before",
205+
"toggle-minus.svg",
206+
);
207+
add_background_image_to_css(
208+
cx,
209+
&mut rustdoc_css,
210+
"details.undocumented > summary::before, details.rustdoc-toggle > summary::before",
211+
"toggle-plus.svg",
212+
);
213+
write_minify("rustdoc.css", &rustdoc_css)?;
214+
178215
// Add all the static files. These may already exist, but we just
179216
// overwrite them anyway to make sure that they're fresh and up-to-date.
180-
write_minify("rustdoc.css", static_files::RUSTDOC_CSS)?;
181217
write_minify("settings.css", static_files::SETTINGS_CSS)?;
182218
write_minify("noscript.css", static_files::NOSCRIPT_CSS)?;
183219

@@ -217,6 +253,8 @@ pub(super) fn write_shared(
217253
write_toolchain("wheel.svg", static_files::WHEEL_SVG)?;
218254
write_toolchain("clipboard.svg", static_files::CLIPBOARD_SVG)?;
219255
write_toolchain("down-arrow.svg", static_files::DOWN_ARROW_SVG)?;
256+
write_toolchain("toggle-minus.svg", static_files::TOGGLE_MINUS_PNG)?;
257+
write_toolchain("toggle-plus.svg", static_files::TOGGLE_PLUS_PNG)?;
220258

221259
let mut themes: Vec<&String> = themes.iter().collect();
222260
themes.sort();

0 commit comments

Comments
 (0)