Auto merge of #49875 - kennytm:rollup, r=kennytm
Rollup of 14 pull requests Successful merges: - #49525 (Use sort_by_cached_key where appropriate) - #49575 (Stabilize `Option::filter`.) - #49614 (in which the non-shorthand patterns lint keeps its own counsel in macros) - #49665 (Small nits to make couple of tests pass on mips targets.) - #49781 (add regression test for #16223 (NLL): use of collaterally moved value) - #49795 (Properly look for uninhabitedness of variants in niche-filling check) - #49809 (Stop emitting color codes on TERM=dumb) - #49856 (Do not uppercase-lint #[no_mangle] statics) - #49863 (fixed typo) - #49857 (Fix "fp" target feature for AArch64) - #49849 (Add --enable-debug flag to musl CI build script) - #49734 (proc_macro: Generalize `FromIterator` impl) - #49730 (Fix ICE with impl Trait) - #48270 (Replace `structurally_resolved_type` in casts check.) Failed merges:
This commit is contained in:
commit
e28ef22ae5
43 changed files with 243 additions and 64 deletions
|
@ -1167,7 +1167,9 @@ pub fn stream_cargo(
|
||||||
cargo.arg("--message-format").arg("json")
|
cargo.arg("--message-format").arg("json")
|
||||||
.stdout(Stdio::piped());
|
.stdout(Stdio::piped());
|
||||||
|
|
||||||
if stderr_isatty() && build.ci_env == CiEnv::None {
|
if stderr_isatty() && build.ci_env == CiEnv::None &&
|
||||||
|
// if the terminal is reported as dumb, then we don't want to enable color for rustc
|
||||||
|
env::var_os("TERM").map(|t| t != *"dumb").unwrap_or(true) {
|
||||||
// since we pass message-format=json to cargo, we need to tell the rustc
|
// since we pass message-format=json to cargo, we need to tell the rustc
|
||||||
// wrapper to give us colored output if necessary. This is because we
|
// wrapper to give us colored output if necessary. This is because we
|
||||||
// only want Cargo's JSON output, not rustcs.
|
// only want Cargo's JSON output, not rustcs.
|
||||||
|
|
|
@ -40,7 +40,7 @@ if [ ! -d $MUSL ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $MUSL
|
cd $MUSL
|
||||||
./configure --disable-shared --prefix=/musl-$TAG $@
|
./configure --enable-optimize --enable-debug --disable-shared --prefix=/musl-$TAG $@
|
||||||
if [ "$TAG" = "i586" -o "$TAG" = "i686" ]; then
|
if [ "$TAG" = "i586" -o "$TAG" = "i686" ]; then
|
||||||
hide_output make -j$(nproc) AR=ar RANLIB=ranlib
|
hide_output make -j$(nproc) AR=ar RANLIB=ranlib
|
||||||
else
|
else
|
||||||
|
|
|
@ -1400,6 +1400,7 @@ impl<T> [T] {
|
||||||
let sz_usize = mem::size_of::<(K, usize)>();
|
let sz_usize = mem::size_of::<(K, usize)>();
|
||||||
|
|
||||||
let len = self.len();
|
let len = self.len();
|
||||||
|
if len < 2 { return }
|
||||||
if sz_u8 < sz_u16 && len <= ( u8::MAX as usize) { return sort_by_key!( u8, self, f) }
|
if sz_u8 < sz_u16 && len <= ( u8::MAX as usize) { return sort_by_key!( u8, self, f) }
|
||||||
if sz_u16 < sz_u32 && len <= (u16::MAX as usize) { return sort_by_key!(u16, self, f) }
|
if sz_u16 < sz_u32 && len <= (u16::MAX as usize) { return sort_by_key!(u16, self, f) }
|
||||||
if sz_u32 < sz_usize && len <= (u32::MAX as usize) { return sort_by_key!(u32, self, f) }
|
if sz_u32 < sz_usize && len <= (u32::MAX as usize) { return sort_by_key!(u32, self, f) }
|
||||||
|
|
|
@ -628,8 +628,6 @@ impl<T> Option<T> {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// #![feature(option_filter)]
|
|
||||||
///
|
|
||||||
/// fn is_even(n: &i32) -> bool {
|
/// fn is_even(n: &i32) -> bool {
|
||||||
/// n % 2 == 0
|
/// n % 2 == 0
|
||||||
/// }
|
/// }
|
||||||
|
@ -639,7 +637,7 @@ impl<T> Option<T> {
|
||||||
/// assert_eq!(Some(4).filter(is_even), Some(4));
|
/// assert_eq!(Some(4).filter(is_even), Some(4));
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "option_filter", issue = "45860")]
|
#[stable(feature = "option_filter", since = "1.27.0")]
|
||||||
pub fn filter<P: FnOnce(&T) -> bool>(self, predicate: P) -> Self {
|
pub fn filter<P: FnOnce(&T) -> bool>(self, predicate: P) -> Self {
|
||||||
if let Some(x) = self {
|
if let Some(x) = self {
|
||||||
if predicate(&x) {
|
if predicate(&x) {
|
||||||
|
|
|
@ -140,9 +140,16 @@ impl From<TokenTree> for TokenStream {
|
||||||
#[unstable(feature = "proc_macro", issue = "38356")]
|
#[unstable(feature = "proc_macro", issue = "38356")]
|
||||||
impl iter::FromIterator<TokenTree> for TokenStream {
|
impl iter::FromIterator<TokenTree> for TokenStream {
|
||||||
fn from_iter<I: IntoIterator<Item = TokenTree>>(trees: I) -> Self {
|
fn from_iter<I: IntoIterator<Item = TokenTree>>(trees: I) -> Self {
|
||||||
|
trees.into_iter().map(TokenStream::from).collect()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[unstable(feature = "proc_macro", issue = "38356")]
|
||||||
|
impl iter::FromIterator<TokenStream> for TokenStream {
|
||||||
|
fn from_iter<I: IntoIterator<Item = TokenStream>>(streams: I) -> Self {
|
||||||
let mut builder = tokenstream::TokenStreamBuilder::new();
|
let mut builder = tokenstream::TokenStreamBuilder::new();
|
||||||
for tree in trees {
|
for stream in streams {
|
||||||
builder.push(tree.to_internal());
|
builder.push(stream.0);
|
||||||
}
|
}
|
||||||
TokenStream(builder.build())
|
TokenStream(builder.build())
|
||||||
}
|
}
|
||||||
|
|
|
@ -533,10 +533,14 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for ReverseMapper<'cx, 'gcx, 'tcx>
|
||||||
match r {
|
match r {
|
||||||
// ignore bound regions that appear in the type (e.g., this
|
// ignore bound regions that appear in the type (e.g., this
|
||||||
// would ignore `'r` in a type like `for<'r> fn(&'r u32)`.
|
// would ignore `'r` in a type like `for<'r> fn(&'r u32)`.
|
||||||
ty::ReLateBound(..) => return r,
|
ty::ReLateBound(..) |
|
||||||
|
|
||||||
// ignore `'static`, as that can appear anywhere
|
// ignore `'static`, as that can appear anywhere
|
||||||
ty::ReStatic => return r,
|
ty::ReStatic |
|
||||||
|
|
||||||
|
// ignore `ReScope`, as that can appear anywhere
|
||||||
|
// See `src/test/run-pass/issue-49556.rs` for example.
|
||||||
|
ty::ReScope(..) => return r,
|
||||||
|
|
||||||
_ => { }
|
_ => { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,7 +181,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||||
self.msg_span_from_early_bound_and_free_regions(region)
|
self.msg_span_from_early_bound_and_free_regions(region)
|
||||||
},
|
},
|
||||||
ty::ReStatic => ("the static lifetime".to_owned(), None),
|
ty::ReStatic => ("the static lifetime".to_owned(), None),
|
||||||
_ => bug!(),
|
_ => bug!("{:?}", region),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
#![feature(refcell_replace_swap)]
|
#![feature(refcell_replace_swap)]
|
||||||
#![feature(rustc_diagnostic_macros)]
|
#![feature(rustc_diagnostic_macros)]
|
||||||
#![feature(slice_patterns)]
|
#![feature(slice_patterns)]
|
||||||
|
#![feature(slice_sort_by_cached_key)]
|
||||||
#![feature(specialization)]
|
#![feature(specialization)]
|
||||||
#![feature(unboxed_closures)]
|
#![feature(unboxed_closures)]
|
||||||
#![feature(trace_macros)]
|
#![feature(trace_macros)]
|
||||||
|
|
|
@ -401,7 +401,7 @@ pub fn used_crates(tcx: TyCtxt, prefer: LinkagePreference)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
let mut ordering = tcx.postorder_cnums(LOCAL_CRATE);
|
let mut ordering = tcx.postorder_cnums(LOCAL_CRATE);
|
||||||
Lrc::make_mut(&mut ordering).reverse();
|
Lrc::make_mut(&mut ordering).reverse();
|
||||||
libs.sort_by_key(|&(a, _)| {
|
libs.sort_by_cached_key(|&(a, _)| {
|
||||||
ordering.iter().position(|x| *x == a)
|
ordering.iter().position(|x| *x == a)
|
||||||
});
|
});
|
||||||
libs
|
libs
|
||||||
|
|
|
@ -20,7 +20,6 @@ use syntax::ast;
|
||||||
pub enum IntTy {
|
pub enum IntTy {
|
||||||
U(ast::UintTy),
|
U(ast::UintTy),
|
||||||
I,
|
I,
|
||||||
Ivar,
|
|
||||||
CEnum,
|
CEnum,
|
||||||
Bool,
|
Bool,
|
||||||
Char
|
Char
|
||||||
|
@ -64,7 +63,7 @@ impl<'tcx> CastTy<'tcx> {
|
||||||
ty::TyBool => Some(CastTy::Int(IntTy::Bool)),
|
ty::TyBool => Some(CastTy::Int(IntTy::Bool)),
|
||||||
ty::TyChar => Some(CastTy::Int(IntTy::Char)),
|
ty::TyChar => Some(CastTy::Int(IntTy::Char)),
|
||||||
ty::TyInt(_) => Some(CastTy::Int(IntTy::I)),
|
ty::TyInt(_) => Some(CastTy::Int(IntTy::I)),
|
||||||
ty::TyInfer(ty::InferTy::IntVar(_)) => Some(CastTy::Int(IntTy::Ivar)),
|
ty::TyInfer(ty::InferTy::IntVar(_)) => Some(CastTy::Int(IntTy::I)),
|
||||||
ty::TyInfer(ty::InferTy::FloatVar(_)) => Some(CastTy::Float),
|
ty::TyInfer(ty::InferTy::FloatVar(_)) => Some(CastTy::Float),
|
||||||
ty::TyUint(u) => Some(CastTy::Int(IntTy::U(u))),
|
ty::TyUint(u) => Some(CastTy::Int(IntTy::U(u))),
|
||||||
ty::TyFloat(_) => Some(CastTy::Float),
|
ty::TyFloat(_) => Some(CastTy::Float),
|
||||||
|
|
|
@ -1471,10 +1471,10 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
|
||||||
|
|
||||||
// Find one non-ZST variant.
|
// Find one non-ZST variant.
|
||||||
'variants: for (v, fields) in variants.iter().enumerate() {
|
'variants: for (v, fields) in variants.iter().enumerate() {
|
||||||
|
if fields.iter().any(|f| f.abi == Abi::Uninhabited) {
|
||||||
|
continue 'variants;
|
||||||
|
}
|
||||||
for f in fields {
|
for f in fields {
|
||||||
if f.abi == Abi::Uninhabited {
|
|
||||||
continue 'variants;
|
|
||||||
}
|
|
||||||
if !f.is_zst() {
|
if !f.is_zst() {
|
||||||
if dataful_variant.is_none() {
|
if dataful_variant.is_none() {
|
||||||
dataful_variant = Some(v);
|
dataful_variant = Some(v);
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#![cfg_attr(unix, feature(libc))]
|
#![cfg_attr(unix, feature(libc))]
|
||||||
#![feature(quote)]
|
#![feature(quote)]
|
||||||
#![feature(rustc_diagnostic_macros)]
|
#![feature(rustc_diagnostic_macros)]
|
||||||
|
#![feature(slice_sort_by_cached_key)]
|
||||||
#![feature(set_stdio)]
|
#![feature(set_stdio)]
|
||||||
#![feature(rustc_stack_internals)]
|
#![feature(rustc_stack_internals)]
|
||||||
|
|
||||||
|
@ -82,7 +83,6 @@ use rustc_trans_utils::trans_crate::TransCrate;
|
||||||
use serialize::json::ToJson;
|
use serialize::json::ToJson;
|
||||||
|
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use std::cmp::Ordering::Equal;
|
|
||||||
use std::cmp::max;
|
use std::cmp::max;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::env::consts::{DLL_PREFIX, DLL_SUFFIX};
|
use std::env::consts::{DLL_PREFIX, DLL_SUFFIX};
|
||||||
|
@ -1176,13 +1176,8 @@ Available lint options:
|
||||||
|
|
||||||
fn sort_lints(sess: &Session, lints: Vec<(&'static Lint, bool)>) -> Vec<&'static Lint> {
|
fn sort_lints(sess: &Session, lints: Vec<(&'static Lint, bool)>) -> Vec<&'static Lint> {
|
||||||
let mut lints: Vec<_> = lints.into_iter().map(|(x, _)| x).collect();
|
let mut lints: Vec<_> = lints.into_iter().map(|(x, _)| x).collect();
|
||||||
lints.sort_by(|x: &&Lint, y: &&Lint| {
|
// The sort doesn't case-fold but it's doubtful we care.
|
||||||
match x.default_level(sess).cmp(&y.default_level(sess)) {
|
lints.sort_by_cached_key(|x: &&Lint| (x.default_level(sess), x.name));
|
||||||
// The sort doesn't case-fold but it's doubtful we care.
|
|
||||||
Equal => x.name.cmp(y.name),
|
|
||||||
r => r,
|
|
||||||
}
|
|
||||||
});
|
|
||||||
lints
|
lints
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -368,6 +368,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonUpperCaseGlobals {
|
||||||
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
|
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
|
||||||
match it.node {
|
match it.node {
|
||||||
hir::ItemStatic(..) => {
|
hir::ItemStatic(..) => {
|
||||||
|
if attr::find_by_name(&it.attrs, "no_mangle").is_some() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
NonUpperCaseGlobals::check_upper_case(cx, "static variable", it.name, it.span);
|
NonUpperCaseGlobals::check_upper_case(cx, "static variable", it.name, it.span);
|
||||||
}
|
}
|
||||||
hir::ItemConst(..) => {
|
hir::ItemConst(..) => {
|
||||||
|
|
|
@ -173,6 +173,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonShorthandFieldPatterns {
|
||||||
}
|
}
|
||||||
if let PatKind::Binding(_, _, name, None) = fieldpat.node.pat.node {
|
if let PatKind::Binding(_, _, name, None) = fieldpat.node.pat.node {
|
||||||
if name.node == fieldpat.node.name {
|
if name.node == fieldpat.node.name {
|
||||||
|
if let Some(_) = fieldpat.span.ctxt().outer().expn_info() {
|
||||||
|
// Don't lint if this is a macro expansion: macro authors
|
||||||
|
// shouldn't have to worry about this kind of style issue
|
||||||
|
// (Issue #49588)
|
||||||
|
return;
|
||||||
|
}
|
||||||
let mut err = cx.struct_span_lint(NON_SHORTHAND_FIELD_PATTERNS,
|
let mut err = cx.struct_span_lint(NON_SHORTHAND_FIELD_PATTERNS,
|
||||||
fieldpat.span,
|
fieldpat.span,
|
||||||
&format!("the `{}:` in this pattern is redundant",
|
&format!("the `{}:` in this pattern is redundant",
|
||||||
|
|
|
@ -1414,7 +1414,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
|
||||||
let mut all_impls: Vec<_> = visitor.impls.into_iter().collect();
|
let mut all_impls: Vec<_> = visitor.impls.into_iter().collect();
|
||||||
|
|
||||||
// Bring everything into deterministic order for hashing
|
// Bring everything into deterministic order for hashing
|
||||||
all_impls.sort_unstable_by_key(|&(trait_def_id, _)| {
|
all_impls.sort_by_cached_key(|&(trait_def_id, _)| {
|
||||||
tcx.def_path_hash(trait_def_id)
|
tcx.def_path_hash(trait_def_id)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1422,7 +1422,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(trait_def_id, mut impls)| {
|
.map(|(trait_def_id, mut impls)| {
|
||||||
// Bring everything into deterministic order for hashing
|
// Bring everything into deterministic order for hashing
|
||||||
impls.sort_unstable_by_key(|&def_index| {
|
impls.sort_by_cached_key(|&def_index| {
|
||||||
tcx.hir.definitions().def_path_hash(def_index)
|
tcx.hir.definitions().def_path_hash(def_index)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#![feature(macro_lifetime_matcher)]
|
#![feature(macro_lifetime_matcher)]
|
||||||
#![feature(quote)]
|
#![feature(quote)]
|
||||||
#![feature(rustc_diagnostic_macros)]
|
#![feature(rustc_diagnostic_macros)]
|
||||||
|
#![feature(slice_sort_by_cached_key)]
|
||||||
#![feature(specialization)]
|
#![feature(specialization)]
|
||||||
#![feature(rustc_private)]
|
#![feature(rustc_private)]
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#![feature(slice_patterns)]
|
#![feature(slice_patterns)]
|
||||||
|
#![feature(slice_sort_by_cached_key)]
|
||||||
#![feature(from_ref)]
|
#![feature(from_ref)]
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
|
@ -112,11 +112,11 @@ use rustc::ty::{self, TyCtxt, InstanceDef};
|
||||||
use rustc::ty::item_path::characteristic_def_id_of_type;
|
use rustc::ty::item_path::characteristic_def_id_of_type;
|
||||||
use rustc::util::nodemap::{FxHashMap, FxHashSet};
|
use rustc::util::nodemap::{FxHashMap, FxHashSet};
|
||||||
use std::collections::hash_map::Entry;
|
use std::collections::hash_map::Entry;
|
||||||
|
use std::cmp;
|
||||||
use syntax::ast::NodeId;
|
use syntax::ast::NodeId;
|
||||||
use syntax::symbol::{Symbol, InternedString};
|
use syntax::symbol::{Symbol, InternedString};
|
||||||
use rustc::mir::mono::MonoItem;
|
use rustc::mir::mono::MonoItem;
|
||||||
use monomorphize::item::{MonoItemExt, InstantiationMode};
|
use monomorphize::item::{MonoItemExt, InstantiationMode};
|
||||||
use core::usize;
|
|
||||||
|
|
||||||
pub use rustc::mir::mono::CodegenUnit;
|
pub use rustc::mir::mono::CodegenUnit;
|
||||||
|
|
||||||
|
@ -189,11 +189,9 @@ pub trait CodegenUnitExt<'tcx> {
|
||||||
}, item.symbol_name(tcx))
|
}, item.symbol_name(tcx))
|
||||||
}
|
}
|
||||||
|
|
||||||
let items: Vec<_> = self.items().iter().map(|(&i, &l)| (i, l)).collect();
|
let mut items: Vec<_> = self.items().iter().map(|(&i, &l)| (i, l)).collect();
|
||||||
let mut items : Vec<_> = items.iter()
|
items.sort_by_cached_key(|&(i, _)| item_sort_key(tcx, i));
|
||||||
.map(|il| (il, item_sort_key(tcx, il.0))).collect();
|
items
|
||||||
items.sort_by(|&(_, ref key1), &(_, ref key2)| key1.cmp(key2));
|
|
||||||
items.into_iter().map(|(&item_linkage, _)| item_linkage).collect()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,7 +507,7 @@ fn merge_codegen_units<'tcx>(initial_partitioning: &mut PreInliningPartitioning<
|
||||||
// Merge the two smallest codegen units until the target size is reached.
|
// Merge the two smallest codegen units until the target size is reached.
|
||||||
while codegen_units.len() > target_cgu_count {
|
while codegen_units.len() > target_cgu_count {
|
||||||
// Sort small cgus to the back
|
// Sort small cgus to the back
|
||||||
codegen_units.sort_by_key(|cgu| usize::MAX - cgu.size_estimate());
|
codegen_units.sort_by_cached_key(|cgu| cmp::Reverse(cgu.size_estimate()));
|
||||||
let mut smallest = codegen_units.pop().unwrap();
|
let mut smallest = codegen_units.pop().unwrap();
|
||||||
let second_smallest = codegen_units.last_mut().unwrap();
|
let second_smallest = codegen_units.last_mut().unwrap();
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||||
|
|
||||||
#![feature(rustc_diagnostic_macros)]
|
#![feature(rustc_diagnostic_macros)]
|
||||||
|
#![feature(slice_sort_by_cached_key)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
@ -1149,13 +1150,9 @@ impl<'a> ModuleData<'a> {
|
||||||
|
|
||||||
fn for_each_child_stable<F: FnMut(Ident, Namespace, &'a NameBinding<'a>)>(&self, mut f: F) {
|
fn for_each_child_stable<F: FnMut(Ident, Namespace, &'a NameBinding<'a>)>(&self, mut f: F) {
|
||||||
let resolutions = self.resolutions.borrow();
|
let resolutions = self.resolutions.borrow();
|
||||||
let mut resolutions = resolutions.iter().map(|(&(ident, ns), &resolution)| {
|
let mut resolutions = resolutions.iter().collect::<Vec<_>>();
|
||||||
// Pre-compute keys for sorting
|
resolutions.sort_by_cached_key(|&(&(ident, ns), _)| (ident.name.as_str(), ns));
|
||||||
(ident.name.as_str(), ns, ident, resolution)
|
for &(&(ident, ns), &resolution) in resolutions.iter() {
|
||||||
})
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
resolutions.sort_unstable_by_key(|&(str, ns, ..)| (str, ns));
|
|
||||||
for &(_, ns, ident, resolution) in resolutions.iter() {
|
|
||||||
resolution.borrow().binding.map(|binding| f(ident, ns, binding));
|
resolution.borrow().binding.map(|binding| f(ident, ns, binding));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3340,7 +3337,9 @@ impl<'a> Resolver<'a> {
|
||||||
let is_mod = |def| match def { Def::Mod(..) => true, _ => false };
|
let is_mod = |def| match def { Def::Mod(..) => true, _ => false };
|
||||||
let mut candidates =
|
let mut candidates =
|
||||||
self.lookup_import_candidates(name, TypeNS, is_mod);
|
self.lookup_import_candidates(name, TypeNS, is_mod);
|
||||||
candidates.sort_by_key(|c| (c.path.segments.len(), c.path.to_string()));
|
candidates.sort_by_cached_key(|c| {
|
||||||
|
(c.path.segments.len(), c.path.to_string())
|
||||||
|
});
|
||||||
if let Some(candidate) = candidates.get(0) {
|
if let Some(candidate) = candidates.get(0) {
|
||||||
format!("Did you mean `{}`?", candidate.path)
|
format!("Did you mean `{}`?", candidate.path)
|
||||||
} else {
|
} else {
|
||||||
|
@ -3578,7 +3577,7 @@ impl<'a> Resolver<'a> {
|
||||||
|
|
||||||
let name = path[path.len() - 1].name;
|
let name = path[path.len() - 1].name;
|
||||||
// Make sure error reporting is deterministic.
|
// Make sure error reporting is deterministic.
|
||||||
names.sort_by_key(|name| name.as_str());
|
names.sort_by_cached_key(|name| name.as_str());
|
||||||
match find_best_match_for_name(names.iter(), &name.as_str(), None) {
|
match find_best_match_for_name(names.iter(), &name.as_str(), None) {
|
||||||
Some(found) if found != name => Some(found),
|
Some(found) if found != name => Some(found),
|
||||||
_ => None,
|
_ => None,
|
||||||
|
|
|
@ -82,7 +82,8 @@ use std::ffi::CString;
|
||||||
use std::str;
|
use std::str;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::{Instant, Duration};
|
use std::time::{Instant, Duration};
|
||||||
use std::{i32, usize};
|
use std::i32;
|
||||||
|
use std::cmp;
|
||||||
use std::sync::mpsc;
|
use std::sync::mpsc;
|
||||||
use syntax_pos::Span;
|
use syntax_pos::Span;
|
||||||
use syntax_pos::symbol::InternedString;
|
use syntax_pos::symbol::InternedString;
|
||||||
|
@ -830,7 +831,7 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
// a bit more efficiently.
|
// a bit more efficiently.
|
||||||
let codegen_units = {
|
let codegen_units = {
|
||||||
let mut codegen_units = codegen_units;
|
let mut codegen_units = codegen_units;
|
||||||
codegen_units.sort_by_key(|cgu| usize::MAX - cgu.size_estimate());
|
codegen_units.sort_by_cached_key(|cgu| cmp::Reverse(cgu.size_estimate()));
|
||||||
codegen_units
|
codegen_units
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#![feature(libc)]
|
#![feature(libc)]
|
||||||
#![feature(quote)]
|
#![feature(quote)]
|
||||||
#![feature(rustc_diagnostic_macros)]
|
#![feature(rustc_diagnostic_macros)]
|
||||||
|
#![feature(slice_sort_by_cached_key)]
|
||||||
#![feature(optin_builtin_traits)]
|
#![feature(optin_builtin_traits)]
|
||||||
#![feature(inclusive_range_fields)]
|
#![feature(inclusive_range_fields)]
|
||||||
#![feature(underscore_lifetimes)]
|
#![feature(underscore_lifetimes)]
|
||||||
|
|
|
@ -134,6 +134,7 @@ pub fn to_llvm_feature<'a>(sess: &Session, s: &'a str) -> &'a str {
|
||||||
("x86", "pclmulqdq") => "pclmul",
|
("x86", "pclmulqdq") => "pclmul",
|
||||||
("x86", "rdrand") => "rdrnd",
|
("x86", "rdrand") => "rdrnd",
|
||||||
("x86", "bmi1") => "bmi",
|
("x86", "bmi1") => "bmi",
|
||||||
|
("aarch64", "fp") => "fp-armv8",
|
||||||
("aarch64", "fp16") => "fullfp16",
|
("aarch64", "fp16") => "fullfp16",
|
||||||
(_, s) => s,
|
(_, s) => s,
|
||||||
}
|
}
|
||||||
|
|
|
@ -486,11 +486,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> {
|
||||||
ty::TypeVariants::TyInfer(t) => {
|
ty::TypeVariants::TyInfer(t) => {
|
||||||
match t {
|
match t {
|
||||||
ty::InferTy::IntVar(_) |
|
ty::InferTy::IntVar(_) |
|
||||||
ty::InferTy::FloatVar(_) |
|
ty::InferTy::FloatVar(_) => Err(CastError::NeedDeref),
|
||||||
ty::InferTy::FreshIntTy(_) |
|
|
||||||
ty::InferTy::FreshFloatTy(_) => {
|
|
||||||
Err(CastError::NeedDeref)
|
|
||||||
}
|
|
||||||
_ => Err(CastError::NeedViaPtr),
|
_ => Err(CastError::NeedViaPtr),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -799,7 +799,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
// sort them by the name so we have a stable result
|
// sort them by the name so we have a stable result
|
||||||
names.sort_by_key(|n| n.as_str());
|
names.sort_by_cached_key(|n| n.as_str());
|
||||||
names
|
names
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,11 +76,11 @@ This API is completely unstable and subject to change.
|
||||||
#![feature(crate_visibility_modifier)]
|
#![feature(crate_visibility_modifier)]
|
||||||
#![feature(from_ref)]
|
#![feature(from_ref)]
|
||||||
#![feature(exhaustive_patterns)]
|
#![feature(exhaustive_patterns)]
|
||||||
#![feature(option_filter)]
|
|
||||||
#![feature(quote)]
|
#![feature(quote)]
|
||||||
#![feature(refcell_replace_swap)]
|
#![feature(refcell_replace_swap)]
|
||||||
#![feature(rustc_diagnostic_macros)]
|
#![feature(rustc_diagnostic_macros)]
|
||||||
#![feature(slice_patterns)]
|
#![feature(slice_patterns)]
|
||||||
|
#![feature(slice_sort_by_cached_key)]
|
||||||
#![feature(dyn_trait)]
|
#![feature(dyn_trait)]
|
||||||
|
|
||||||
#[macro_use] extern crate log;
|
#[macro_use] extern crate log;
|
||||||
|
|
|
@ -1437,9 +1437,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
|
||||||
// involved (impls rarely have more than a few bounds) means that it
|
// involved (impls rarely have more than a few bounds) means that it
|
||||||
// shouldn't matter in practice.
|
// shouldn't matter in practice.
|
||||||
fn unstable_debug_sort<T: Debug>(&self, vec: &mut Vec<T>) {
|
fn unstable_debug_sort<T: Debug>(&self, vec: &mut Vec<T>) {
|
||||||
vec.sort_unstable_by(|first, second| {
|
vec.sort_by_cached_key(|x| format!("{:?}", x))
|
||||||
format!("{:?}", first).cmp(&format!("{:?}", second))
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_fn_ty(&self, tcx: &TyCtxt, ty: &Type) -> bool {
|
fn is_fn_ty(&self, tcx: &TyCtxt, ty: &Type) -> bool {
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(fs_read_write)]
|
#![feature(fs_read_write)]
|
||||||
#![feature(set_stdio)]
|
#![feature(set_stdio)]
|
||||||
|
#![feature(slice_sort_by_cached_key)]
|
||||||
#![feature(test)]
|
#![feature(test)]
|
||||||
#![feature(unicode)]
|
#![feature(unicode)]
|
||||||
#![feature(vec_remove_item)]
|
#![feature(vec_remove_item)]
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#![feature(unicode)]
|
#![feature(unicode)]
|
||||||
#![feature(rustc_diagnostic_macros)]
|
#![feature(rustc_diagnostic_macros)]
|
||||||
|
#![feature(slice_sort_by_cached_key)]
|
||||||
#![feature(non_exhaustive)]
|
#![feature(non_exhaustive)]
|
||||||
#![feature(const_atomic_usize_new)]
|
#![feature(const_atomic_usize_new)]
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
|
|
|
@ -689,7 +689,7 @@ impl<'a> Parser<'a> {
|
||||||
.chain(inedible.iter().map(|x| TokenType::Token(x.clone())))
|
.chain(inedible.iter().map(|x| TokenType::Token(x.clone())))
|
||||||
.chain(self.expected_tokens.iter().cloned())
|
.chain(self.expected_tokens.iter().cloned())
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
expected.sort_by(|a, b| a.to_string().cmp(&b.to_string()));
|
expected.sort_by_cached_key(|x| x.to_string());
|
||||||
expected.dedup();
|
expected.dedup();
|
||||||
let expect = tokens_to_string(&expected[..]);
|
let expect = tokens_to_string(&expected[..]);
|
||||||
let actual = self.this_token_to_string();
|
let actual = self.this_token_to_string();
|
||||||
|
|
|
@ -15,8 +15,14 @@
|
||||||
// CHECK: @VAR1 = constant <{ [4 x i8] }> <{ [4 x i8] c"\01\00\00\00" }>, section ".test_one"
|
// CHECK: @VAR1 = constant <{ [4 x i8] }> <{ [4 x i8] c"\01\00\00\00" }>, section ".test_one"
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
#[link_section = ".test_one"]
|
#[link_section = ".test_one"]
|
||||||
|
#[cfg(target_endian = "little")]
|
||||||
pub static VAR1: u32 = 1;
|
pub static VAR1: u32 = 1;
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
#[link_section = ".test_one"]
|
||||||
|
#[cfg(target_endian = "big")]
|
||||||
|
pub static VAR1: u32 = 0x01000000;
|
||||||
|
|
||||||
pub enum E {
|
pub enum E {
|
||||||
A(u32),
|
A(u32),
|
||||||
B(f32)
|
B(f32)
|
||||||
|
|
|
@ -16,4 +16,7 @@ static foo: isize = 1; //~ ERROR static variable `foo` should have an upper case
|
||||||
static mut bar: isize = 1;
|
static mut bar: isize = 1;
|
||||||
//~^ ERROR static variable `bar` should have an upper case name such as `BAR`
|
//~^ ERROR static variable `bar` should have an upper case name such as `BAR`
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub static extern_foo: isize = 1; // OK, because #[no_mangle] supersedes the warning
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -19,4 +19,9 @@ pub fn main() {
|
||||||
assert_eq!(i as u8 as i8, 'Q' as u8 as i8);
|
assert_eq!(i as u8 as i8, 'Q' as u8 as i8);
|
||||||
assert_eq!(0x51 as char, 'Q');
|
assert_eq!(0x51 as char, 'Q');
|
||||||
assert_eq!(0 as u32, false as u32);
|
assert_eq!(0 as u32, false as u32);
|
||||||
|
|
||||||
|
// Test that `_` is correctly inferred.
|
||||||
|
let x = &"hello";
|
||||||
|
let mut y = x as *const _;
|
||||||
|
y = 0 as *const _;
|
||||||
}
|
}
|
||||||
|
|
22
src/test/run-pass/issue-49556.rs
Normal file
22
src/test/run-pass/issue-49556.rs
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||||
|
// file at the top-level directory of this distribution and at
|
||||||
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
fn iter<'a>(data: &'a [usize]) -> impl Iterator<Item = usize> + 'a {
|
||||||
|
data.iter()
|
||||||
|
.map(
|
||||||
|
|x| x // fn(&'a usize) -> &'(ReScope) usize
|
||||||
|
)
|
||||||
|
.map(
|
||||||
|
|x| *x // fn(&'(ReScope) usize) -> usize
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||||
|
// file at the top-level directory of this distribution and at
|
||||||
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
#![deny(non_shorthand_field_patterns)]
|
||||||
|
|
||||||
|
pub struct Value<A> { pub value: A }
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! pat {
|
||||||
|
($a:pat) => {
|
||||||
|
Value { value: $a }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let pat!(value) = Value { value: () };
|
||||||
|
}
|
|
@ -42,6 +42,12 @@ enum ReorderedEnum {
|
||||||
B(u8, u16, u8),
|
B(u8, u16, u8),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum NicheFilledEnumWithInhabitedVariant {
|
||||||
|
A(&'static ()),
|
||||||
|
B(&'static (), !),
|
||||||
|
C,
|
||||||
|
}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
assert_eq!(size_of::<u8>(), 1 as usize);
|
assert_eq!(size_of::<u8>(), 1 as usize);
|
||||||
assert_eq!(size_of::<u32>(), 4 as usize);
|
assert_eq!(size_of::<u32>(), 4 as usize);
|
||||||
|
@ -67,4 +73,5 @@ pub fn main() {
|
||||||
assert_eq!(size_of::<e3>(), 4 as usize);
|
assert_eq!(size_of::<e3>(), 4 as usize);
|
||||||
assert_eq!(size_of::<ReorderedStruct>(), 4);
|
assert_eq!(size_of::<ReorderedStruct>(), 4);
|
||||||
assert_eq!(size_of::<ReorderedEnum>(), 6);
|
assert_eq!(size_of::<ReorderedEnum>(), 6);
|
||||||
|
assert_eq!(size_of::<NicheFilledEnumWithInhabitedVariant>(), size_of::<&'static ()>());
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
// ignore-emscripten
|
// ignore-emscripten
|
||||||
// ignore-powerpc
|
// ignore-powerpc
|
||||||
// ignore-sparc
|
// ignore-sparc
|
||||||
|
// ignore-mips
|
||||||
|
|
||||||
#![feature(asm)]
|
#![feature(asm)]
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0384]: cannot assign twice to immutable variable `x`
|
error[E0384]: cannot assign twice to immutable variable `x`
|
||||||
--> $DIR/asm-out-assign-imm.rs:29:9
|
--> $DIR/asm-out-assign-imm.rs:30:9
|
||||||
|
|
|
|
||||||
LL | x = 1;
|
LL | x = 1;
|
||||||
| ----- first assignment to `x`
|
| ----- first assignment to `x`
|
||||||
|
|
63
src/test/ui/nll/issue-16223.rs
Normal file
63
src/test/ui/nll/issue-16223.rs
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||||
|
// file at the top-level directory of this distribution and at
|
||||||
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
// Regression test for #16223: without NLL the `if let` construct together with
|
||||||
|
// the nested box-structure of `Root` causes an unwanted collateral move.
|
||||||
|
|
||||||
|
// The exact error prevented here is:
|
||||||
|
//
|
||||||
|
// error[E0382]: use of collaterally moved value: `(root.boxed.rhs as SomeVariant::B).0`
|
||||||
|
// --> src/main.rs:55:29
|
||||||
|
// |
|
||||||
|
// 56 | lhs: SomeVariant::A(a),
|
||||||
|
// | - value moved here
|
||||||
|
// 57 | rhs: SomeVariant::B(b),
|
||||||
|
// | ^ value used here after move
|
||||||
|
// |
|
||||||
|
// = note: move occurs because the value has type `A`, which does not implement the `Copy` trait
|
||||||
|
|
||||||
|
// must-compile-successfully
|
||||||
|
|
||||||
|
#![feature(nll)]
|
||||||
|
#![feature(box_patterns)]
|
||||||
|
|
||||||
|
struct Root {
|
||||||
|
boxed: Box<SetOfVariants>,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SetOfVariants {
|
||||||
|
lhs: SomeVariant,
|
||||||
|
rhs: SomeVariant,
|
||||||
|
}
|
||||||
|
|
||||||
|
enum SomeVariant {
|
||||||
|
A(A),
|
||||||
|
B(B),
|
||||||
|
}
|
||||||
|
|
||||||
|
struct A(String);
|
||||||
|
struct B(String);
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let root = Root {
|
||||||
|
boxed: Box::new(SetOfVariants {
|
||||||
|
lhs: SomeVariant::A(A(String::from("This is A"))),
|
||||||
|
rhs: SomeVariant::B(B(String::from("This is B"))),
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
if let box SetOfVariants {
|
||||||
|
lhs: SomeVariant::A(a),
|
||||||
|
rhs: SomeVariant::B(b),
|
||||||
|
} = root.boxed
|
||||||
|
{
|
||||||
|
println!("a = {}", a.0);
|
||||||
|
println!("b = {}", b.0);
|
||||||
|
}
|
||||||
|
}
|
18
src/test/ui/order-dependent-cast-inference.rs
Normal file
18
src/test/ui/order-dependent-cast-inference.rs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||||
|
// file at the top-level directory of this distribution and at
|
||||||
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
// Tests case where inference fails due to the order in which casts are checked.
|
||||||
|
// Ideally this would compile, see #48270.
|
||||||
|
let x = &"hello";
|
||||||
|
let mut y = 0 as *const _;
|
||||||
|
//~^ ERROR cannot cast to a pointer of an unknown kind
|
||||||
|
y = x as *const _;
|
||||||
|
}
|
13
src/test/ui/order-dependent-cast-inference.stderr
Normal file
13
src/test/ui/order-dependent-cast-inference.stderr
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
error[E0641]: cannot cast to a pointer of an unknown kind
|
||||||
|
--> $DIR/order-dependent-cast-inference.rs:15:17
|
||||||
|
|
|
||||||
|
LL | let mut y = 0 as *const _;
|
||||||
|
| ^^^^^--------
|
||||||
|
| |
|
||||||
|
| help: consider giving more type information
|
||||||
|
|
|
||||||
|
= note: The type information given here is insufficient to check whether the pointer cast is valid
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0641`.
|
|
@ -12,6 +12,9 @@
|
||||||
// ignore-aarch64
|
// ignore-aarch64
|
||||||
// ignore-wasm
|
// ignore-wasm
|
||||||
// ignore-emscripten
|
// ignore-emscripten
|
||||||
|
// ignore-mips
|
||||||
|
// ignore-powerpc
|
||||||
|
// ignore-s390x
|
||||||
|
|
||||||
#![feature(target_feature)]
|
#![feature(target_feature)]
|
||||||
|
|
||||||
|
|
|
@ -1,35 +1,35 @@
|
||||||
warning: #[target_feature = ".."] is deprecated and will eventually be removed, use #[target_feature(enable = "..")] instead
|
warning: #[target_feature = ".."] is deprecated and will eventually be removed, use #[target_feature(enable = "..")] instead
|
||||||
--> $DIR/target-feature-wrong.rs:18:1
|
--> $DIR/target-feature-wrong.rs:21:1
|
||||||
|
|
|
|
||||||
LL | #[target_feature = "+sse2"]
|
LL | #[target_feature = "+sse2"]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: the feature named `foo` is not valid for this target
|
error: the feature named `foo` is not valid for this target
|
||||||
--> $DIR/target-feature-wrong.rs:20:18
|
--> $DIR/target-feature-wrong.rs:23:18
|
||||||
|
|
|
|
||||||
LL | #[target_feature(enable = "foo")]
|
LL | #[target_feature(enable = "foo")]
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: #[target_feature(..)] only accepts sub-keys of `enable` currently
|
error: #[target_feature(..)] only accepts sub-keys of `enable` currently
|
||||||
--> $DIR/target-feature-wrong.rs:22:18
|
--> $DIR/target-feature-wrong.rs:25:18
|
||||||
|
|
|
|
||||||
LL | #[target_feature(bar)]
|
LL | #[target_feature(bar)]
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: #[target_feature(..)] only accepts sub-keys of `enable` currently
|
error: #[target_feature(..)] only accepts sub-keys of `enable` currently
|
||||||
--> $DIR/target-feature-wrong.rs:24:18
|
--> $DIR/target-feature-wrong.rs:27:18
|
||||||
|
|
|
|
||||||
LL | #[target_feature(disable = "baz")]
|
LL | #[target_feature(disable = "baz")]
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: #[target_feature(..)] can only be applied to `unsafe` function
|
error: #[target_feature(..)] can only be applied to `unsafe` function
|
||||||
--> $DIR/target-feature-wrong.rs:28:1
|
--> $DIR/target-feature-wrong.rs:31:1
|
||||||
|
|
|
|
||||||
LL | #[target_feature(enable = "sse2")]
|
LL | #[target_feature(enable = "sse2")]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: attribute should be applied to a function
|
error: attribute should be applied to a function
|
||||||
--> $DIR/target-feature-wrong.rs:32:1
|
--> $DIR/target-feature-wrong.rs:35:1
|
||||||
|
|
|
|
||||||
LL | #[target_feature(enable = "sse2")]
|
LL | #[target_feature(enable = "sse2")]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -38,7 +38,7 @@ LL | mod another {}
|
||||||
| -------------- not a function
|
| -------------- not a function
|
||||||
|
|
||||||
error: cannot use #[inline(always)] with #[target_feature]
|
error: cannot use #[inline(always)] with #[target_feature]
|
||||||
--> $DIR/target-feature-wrong.rs:36:1
|
--> $DIR/target-feature-wrong.rs:39:1
|
||||||
|
|
|
|
||||||
LL | #[inline(always)]
|
LL | #[inline(always)]
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
@ -595,7 +595,7 @@ impl Config {
|
||||||
fn has_cfg_prefix(&self, line: &str, prefix: &str) -> bool {
|
fn has_cfg_prefix(&self, line: &str, prefix: &str) -> bool {
|
||||||
// returns whether this line contains this prefix or not. For prefix
|
// returns whether this line contains this prefix or not. For prefix
|
||||||
// "ignore", returns true if line says "ignore-x86_64", "ignore-arch",
|
// "ignore", returns true if line says "ignore-x86_64", "ignore-arch",
|
||||||
// "ignore-andorid" etc.
|
// "ignore-android" etc.
|
||||||
line.starts_with(prefix) && line.as_bytes().get(prefix.len()) == Some(&b'-')
|
line.starts_with(prefix) && line.as_bytes().get(prefix.len()) == Some(&b'-')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue