Skip to content
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

Rollup of 9 pull requests #87741

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
660f585
Add `core::stream::from_iter`
yoshuawuyts Feb 4, 2021
ee300b6
Remove trailing whitespace from error messages
FabianWolff Jun 10, 2021
02b7754
don't use .into() to convert types to identical types (clippy::useles…
matthiaskrgr Aug 3, 2021
499758a
Use .contains instead of manual reimplementation.
frogtd Aug 3, 2021
f9b168f
Update `stdarch` to deprecate `crypto` aarch64 target_feature
adamgemmell Jul 30, 2021
3be9261
Remove crypto composite feature from allowed aarch64 features.
adamgemmell Jun 1, 2021
e817b50
Update aarch64 runtime feature detection tests
adamgemmell Jun 1, 2021
c58246e
Rustdoc accessibility: use an icon for the [-]/[+] controls
notriddle Jul 17, 2021
59460a6
Pull the "Expand" / "Collapse" text to the end of the line, instead o…
notriddle Jul 17, 2021
64c9903
Use empty string instead of single space
notriddle Jul 17, 2021
6698cdc
Update cargo
ehuss Aug 3, 2021
3744dc8
Remove space after negative sign in Literal to_string
dtolnay Jul 19, 2021
6fe0972
Simplify usage of CSS background-image
GuillaumeGomez Jul 31, 2021
6953f17
Test dropping union fields more
syvb Aug 3, 2021
d57aba9
Rollup merge of #81797 - yoshuawuyts:stream_from_iter, r=dtolnay
JohnTitor Aug 3, 2021
e252bc6
Rollup merge of #86197 - FabianWolff:trailing-whitespace, r=JohnTitor
JohnTitor Aug 3, 2021
a53bede
Rollup merge of #87267 - dtolnay:negspace, r=Aaron1011
JohnTitor Aug 3, 2021
4d4da57
Rollup merge of #87663 - GuillaumeGomez:rustdoc-brace-minus-brace, r=…
JohnTitor Aug 3, 2021
f32ede0
Rollup merge of #87720 - matthiaskrgr:clippy_into, r=jyn514
JohnTitor Aug 3, 2021
4921e73
Rollup merge of #87723 - frogtd:patch-3, r=JohnTitor
JohnTitor Aug 3, 2021
38bfbeb
Rollup merge of #87729 - adamgemmell:dev/deprecate-crypto, r=Amanieu
JohnTitor Aug 3, 2021
9f0eba9
Rollup merge of #87731 - ehuss:update-cargo, r=ehuss
JohnTitor Aug 3, 2021
4e00f2e
Rollup merge of #87734 - Smittyvb:more-union-tests, r=LeSeulArtichaut
JohnTitor Aug 3, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock
Expand Up @@ -255,7 +255,7 @@ checksum = "81a18687293a1546b67c246452202bbbf143d239cb43494cc163da14979082da"

[[package]]
name = "cargo"
version = "0.56.0"
version = "0.57.0"
dependencies = [
"anyhow",
"atty",
Expand Down Expand Up @@ -388,7 +388,7 @@ dependencies = [

[[package]]
name = "cargo-util"
version = "0.1.0"
version = "0.1.1"
dependencies = [
"anyhow",
"core-foundation",
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_codegen_ssa/src/target_features.rs
Expand Up @@ -47,8 +47,6 @@ const AARCH64_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
("sve", Some(sym::aarch64_target_feature)),
// FEAT_CRC
("crc", Some(sym::aarch64_target_feature)),
// Cryptographic extension
("crypto", Some(sym::aarch64_target_feature)),
// FEAT_RAS
("ras", Some(sym::aarch64_target_feature)),
// FEAT_LSE
Expand Down
7 changes: 5 additions & 2 deletions compiler/rustc_errors/src/emitter.rs
Expand Up @@ -954,7 +954,6 @@ impl EmitterWriter {
// |
for pos in 0..=line_len {
draw_col_separator(buffer, line_offset + pos + 1, width_offset - 2);
buffer.putc(line_offset + pos + 1, width_offset - 2, '|', Style::LineNumber);
}

// Write the horizontal lines for multiline annotations
Expand Down Expand Up @@ -1344,7 +1343,11 @@ impl EmitterWriter {
let buffer_msg_line_offset = buffer.num_lines();

// Add spacing line
draw_col_separator(&mut buffer, buffer_msg_line_offset, max_line_num_len + 1);
draw_col_separator_no_space(
&mut buffer,
buffer_msg_line_offset,
max_line_num_len + 1,
);

// Then, the secondary file indicator
buffer.prepend(buffer_msg_line_offset + 1, "::: ", Style::LineNumber);
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_expand/src/proc_macro_server.rs
Expand Up @@ -582,6 +582,9 @@ impl server::Literal for Rustc<'_> {

Ok(Literal { lit, span: self.call_site })
}
fn to_string(&mut self, literal: &Self::Literal) -> String {
literal.lit.to_string()
}
fn debug_kind(&mut self, literal: &Self::Literal) -> String {
format!("{:?}", literal.lit.kind)
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/interpret/operand.rs
Expand Up @@ -599,7 +599,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
let ptr = self.global_base_pointer(Pointer::new(id, offset))?;
Operand::Indirect(MemPlace::from_ptr(ptr.into(), layout.align.abi))
}
ConstValue::Scalar(x) => Operand::Immediate(tag_scalar(x.into())?.into()),
ConstValue::Scalar(x) => Operand::Immediate(tag_scalar(x)?.into()),
ConstValue::Slice { data, start, end } => {
// We rely on mutability being set correctly in `data` to prevent writes
// where none should happen.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/interpret/terminator.rs
Expand Up @@ -73,7 +73,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
ty::FnPtr(sig) => {
let caller_abi = sig.abi();
let fn_ptr = self.read_pointer(&func)?;
let fn_val = self.memory.get_fn(fn_ptr.into())?;
let fn_val = self.memory.get_fn(fn_ptr)?;
(
fn_val,
caller_abi,
Expand Down
Expand Up @@ -211,7 +211,7 @@ fn find_branch_value_info<'tcx>(
return None;
};
let branch_value_scalar = branch_value.literal.try_to_scalar()?;
Some((branch_value_scalar.into(), branch_value_ty, *to_switch_on))
Some((branch_value_scalar, branch_value_ty, *to_switch_on))
}
_ => None,
}
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/num/mod.rs
Expand Up @@ -847,7 +847,7 @@ fn from_str_radix<T: FromStrRadixHelper>(src: &str, radix: u32) -> Result<T, Par
use self::ParseIntError as PIE;

assert!(
radix >= 2 && radix <= 36,
(2..=36).contains(&radix),
"from_str_radix_int: must lie in the range `[2, 36]` - found {}",
radix
);
Expand Down
38 changes: 38 additions & 0 deletions library/core/src/stream/from_iter.rs
@@ -0,0 +1,38 @@
use crate::pin::Pin;

use crate::stream::Stream;
use crate::task::{Context, Poll};

/// A stream that was created from iterator.
///
/// This stream is created by the [`from_iter`] function.
/// See it documentation for more.
///
/// [`from_iter`]: fn.from_iter.html
#[unstable(feature = "stream_from_iter", issue = "81798")]
#[derive(Clone, Debug)]
pub struct FromIter<I> {
iter: I,
}

#[unstable(feature = "stream_from_iter", issue = "81798")]
impl<I> Unpin for FromIter<I> {}

/// Converts an iterator into a stream.
#[unstable(feature = "stream_from_iter", issue = "81798")]
pub fn from_iter<I: IntoIterator>(iter: I) -> FromIter<I::IntoIter> {
FromIter { iter: iter.into_iter() }
}

#[unstable(feature = "stream_from_iter", issue = "81798")]
impl<I: Iterator> Stream for FromIter<I> {
type Item = I::Item;

fn poll_next(mut self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
Poll::Ready(self.iter.next())
}

fn size_hint(&self) -> (usize, Option<usize>) {
self.iter.size_hint()
}
}
2 changes: 2 additions & 0 deletions library/core/src/stream/mod.rs
Expand Up @@ -122,6 +122,8 @@
//! warning: unused result that must be used: streams do nothing unless polled
//! ```

mod from_iter;
mod stream;

pub use from_iter::{from_iter, FromIter};
pub use stream::Stream;
1 change: 1 addition & 0 deletions library/proc_macro/src/bridge/mod.rs
Expand Up @@ -109,6 +109,7 @@ macro_rules! with_api {
fn drop($self: $S::Literal);
fn clone($self: &$S::Literal) -> $S::Literal;
fn from_str(s: &str) -> Result<$S::Literal, ()>;
fn to_string($self: &$S::Literal) -> String;
fn debug_kind($self: &$S::Literal) -> String;
fn symbol($self: &$S::Literal) -> String;
fn suffix($self: &$S::Literal) -> Option<String>;
Expand Down
2 changes: 1 addition & 1 deletion library/proc_macro/src/lib.rs
Expand Up @@ -1195,7 +1195,7 @@ impl FromStr for Literal {
#[stable(feature = "proc_macro_lib", since = "1.15.0")]
impl ToString for Literal {
fn to_string(&self) -> String {
TokenStream::from(TokenTree::from(self.clone())).to_string()
self.0.to_string()
}
}

Expand Down
38 changes: 36 additions & 2 deletions library/std/tests/run-time-detect.rs
Expand Up @@ -16,22 +16,56 @@
fn arm_linux() {
println!("neon: {}", is_arm_feature_detected!("neon"));
println!("pmull: {}", is_arm_feature_detected!("pmull"));
println!("crypto: {}", is_arm_feature_detected!("crypto"));
println!("crc: {}", is_arm_feature_detected!("crc"));
println!("aes: {}", is_arm_feature_detected!("aes"));
println!("sha2: {}", is_arm_feature_detected!("sha2"));
}

#[test]
#[cfg(all(target_arch = "aarch64", any(target_os = "linux", target_os = "android")))]
fn aarch64_linux() {
println!("fp: {}", is_aarch64_feature_detected!("fp"));
println!("fp16: {}", is_aarch64_feature_detected!("fp16"));
println!("neon: {}", is_aarch64_feature_detected!("neon"));
println!("asimd: {}", is_aarch64_feature_detected!("asimd"));
println!("pmull: {}", is_aarch64_feature_detected!("pmull"));
println!("fp: {}", is_aarch64_feature_detected!("fp"));
println!("fp16: {}", is_aarch64_feature_detected!("fp16"));
println!("sve: {}", is_aarch64_feature_detected!("sve"));
println!("crc: {}", is_aarch64_feature_detected!("crc"));
println!("lse: {}", is_aarch64_feature_detected!("lse"));
println!("lse2: {}", is_aarch64_feature_detected!("lse2"));
println!("rdm: {}", is_aarch64_feature_detected!("rdm"));
println!("rcpc: {}", is_aarch64_feature_detected!("rcpc"));
println!("rcpc2: {}", is_aarch64_feature_detected!("rcpc2"));
println!("dotprod: {}", is_aarch64_feature_detected!("dotprod"));
println!("tme: {}", is_aarch64_feature_detected!("tme"));
println!("fhm: {}", is_aarch64_feature_detected!("fhm"));
println!("dit: {}", is_aarch64_feature_detected!("dit"));
println!("flagm: {}", is_aarch64_feature_detected!("flagm"));
println!("ssbs: {}", is_aarch64_feature_detected!("ssbs"));
println!("sb: {}", is_aarch64_feature_detected!("sb"));
println!("pauth: {}", is_aarch64_feature_detected!("pauth"));
println!("dpb: {}", is_aarch64_feature_detected!("dpb"));
println!("dpb2: {}", is_aarch64_feature_detected!("dpb2"));
println!("sve2: {}", is_aarch64_feature_detected!("sve2"));
println!("sve2-aes: {}", is_aarch64_feature_detected!("sve2-aes"));
println!("sve2-sm4: {}", is_aarch64_feature_detected!("sve2-sm4"));
println!("sve2-sha3: {}", is_aarch64_feature_detected!("sve2-sha3"));
println!("sve2-bitperm: {}", is_aarch64_feature_detected!("sve2-bitperm"));
println!("frintts: {}", is_aarch64_feature_detected!("frintts"));
println!("i8mm: {}", is_aarch64_feature_detected!("i8mm"));
println!("f32mm: {}", is_aarch64_feature_detected!("f32mm"));
println!("f64mm: {}", is_aarch64_feature_detected!("f64mm"));
println!("bf16: {}", is_aarch64_feature_detected!("bf16"));
println!("rand: {}", is_aarch64_feature_detected!("rand"));
println!("bti: {}", is_aarch64_feature_detected!("bti"));
println!("mte: {}", is_aarch64_feature_detected!("mte"));
println!("jsconv: {}", is_aarch64_feature_detected!("jsconv"));
println!("fcma: {}", is_aarch64_feature_detected!("fcma"));
println!("aes: {}", is_aarch64_feature_detected!("aes"));
println!("sha2: {}", is_aarch64_feature_detected!("sha2"));
println!("sha3: {}", is_aarch64_feature_detected!("sha3"));
println!("sm4: {}", is_aarch64_feature_detected!("sm4"));
}

#[test]
Expand Down
9 changes: 4 additions & 5 deletions src/librustdoc/clean/mod.rs
Expand Up @@ -675,11 +675,10 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, ty::GenericPredicates<'tcx
if let Some(((_, trait_did, name), rhs)) =
proj.as_ref().and_then(|(lhs, rhs)| Some((lhs.projection()?, rhs)))
{
impl_trait_proj.entry(param_idx).or_default().push((
trait_did.into(),
name,
rhs,
));
impl_trait_proj
.entry(param_idx)
.or_default()
.push((trait_did, name, rhs));
}

return None;
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/clean/types.rs
Expand Up @@ -1614,7 +1614,7 @@ impl Type {
impl Type {
fn inner_def_id(&self, cache: Option<&Cache>) -> Option<DefId> {
let t: PrimitiveType = match *self {
ResolvedPath { did, .. } => return Some(did.into()),
ResolvedPath { did, .. } => return Some(did),
DynTrait(ref bounds, _) => return bounds[0].trait_.inner_def_id(cache),
Primitive(p) => return cache.and_then(|c| c.primitive_locations.get(&p).cloned()),
BorrowedRef { type_: box Generic(..), .. } => PrimitiveType::Reference,
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/formats/cache.rs
Expand Up @@ -228,7 +228,7 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
if i.blanket_impl.is_none() {
self.cache
.implementors
.entry(did.into())
.entry(did)
.or_default()
.push(Impl { impl_item: item.clone() });
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/html/format.rs
Expand Up @@ -688,7 +688,7 @@ crate fn anchor<'a, 'cx: 'a>(
text: &'a str,
cx: &'cx Context<'_>,
) -> impl fmt::Display + 'a {
let parts = href(did.into(), cx);
let parts = href(did, cx);
display_fn(move |f| {
if let Ok((url, short_ty, fqp)) = parts {
write!(
Expand Down Expand Up @@ -921,7 +921,7 @@ fn fmt_type<'cx>(
// everything comes in as a fully resolved QPath (hard to
// look at).
box clean::ResolvedPath { did, .. } => {
match href(did.into(), cx) {
match href(did, cx) {
Ok((ref url, _, ref path)) if !f.alternate() => {
write!(
f,
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/render/cache.rs
Expand Up @@ -42,7 +42,7 @@ crate fn build_index<'tcx>(krate: &clean::Crate, cache: &mut Cache, tcx: TyCtxt<
name: item.name.unwrap().to_string(),
path: fqp[..fqp.len() - 1].join("::"),
desc,
parent: Some(did.into()),
parent: Some(did),
parent_idx: None,
search_type: get_index_search_type(&item, tcx),
aliases: item.attrs.get_doc_aliases(),
Expand Down
40 changes: 39 additions & 1 deletion src/librustdoc/html/render/write_shared.rs
Expand Up @@ -175,9 +175,45 @@ pub(super) fn write_shared(
cx.write_shared(SharedResource::InvocationSpecific { basename: p }, content, &options.emit)
};

fn add_background_image_to_css(
cx: &Context<'_>,
css: &mut String,
rule: &str,
file: &'static str,
) {
css.push_str(&format!(
"{} {{ background-image: url({}); }}",
rule,
SharedResource::ToolchainSpecific { basename: file }
.path(cx)
.file_name()
.unwrap()
.to_str()
.unwrap()
))
}

// Add all the static files. These may already exist, but we just
// overwrite them anyway to make sure that they're fresh and up-to-date.
let mut rustdoc_css = static_files::RUSTDOC_CSS.to_owned();
add_background_image_to_css(
cx,
&mut rustdoc_css,
"details.undocumented[open] > summary::before, \
details.rustdoc-toggle[open] > summary::before, \
details.rustdoc-toggle[open] > summary.hideme::before",
"toggle-minus.svg",
);
add_background_image_to_css(
cx,
&mut rustdoc_css,
"details.undocumented > summary::before, details.rustdoc-toggle > summary::before",
"toggle-plus.svg",
);
write_minify("rustdoc.css", &rustdoc_css)?;

// Add all the static files. These may already exist, but we just
// overwrite them anyway to make sure that they're fresh and up-to-date.
write_minify("rustdoc.css", static_files::RUSTDOC_CSS)?;
write_minify("settings.css", static_files::SETTINGS_CSS)?;
write_minify("noscript.css", static_files::NOSCRIPT_CSS)?;

Expand Down Expand Up @@ -217,6 +253,8 @@ pub(super) fn write_shared(
write_toolchain("wheel.svg", static_files::WHEEL_SVG)?;
write_toolchain("clipboard.svg", static_files::CLIPBOARD_SVG)?;
write_toolchain("down-arrow.svg", static_files::DOWN_ARROW_SVG)?;
write_toolchain("toggle-minus.svg", static_files::TOGGLE_MINUS_PNG)?;
write_toolchain("toggle-plus.svg", static_files::TOGGLE_PLUS_PNG)?;

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