Auto merge of #52616 - kennytm:rollup, r=kennytm

Rollup of 11 pull requests

Successful merges:

 - #51807 (Deprecation of str::slice_unchecked(_mut))
 - #52051 (mem::swap the obvious way for types smaller than the SIMD optimization's block size)
 - #52465 (Add CI test harness for `thumb*` targets. [IRR-2018-embedded])
 - #52507 (Reword when `_` couldn't be inferred)
 - #52508 (Document that Unique::empty() and NonNull::dangling() aren't sentinel values)
 - #52521 (Fix links in rustdoc book.)
 - #52581 (Avoid using `#[macro_export]` for documenting builtin macros)
 - #52582 (Typo)
 - #52587 (Add missing backtick in UniversalRegions doc comment)
 - #52594 (Run the error index tool against the sysroot libdir)
 - #52615 (Added new lines to .gitignore.)
This commit is contained in:
bors 2018-07-22 18:51:46 +00:00
commit 3b7720399a
36 changed files with 165 additions and 109 deletions

View file

@ -966,7 +966,9 @@ impl Step for Compiletest {
builder.ensure(compile::Rustc { compiler, target });
}
builder.ensure(compile::Test { compiler, target });
if builder.no_std(target) != Some(true) {
builder.ensure(compile::Test { compiler, target });
}
builder.ensure(native::TestHelpers { target });
builder.ensure(RemoteCopyLibs { compiler, target });

View file

@ -275,7 +275,7 @@ pub fn prepare_tool_cargo(
macro_rules! tool {
($($name:ident, $path:expr, $tool_name:expr, $mode:expr $(,llvm_tools = $llvm:expr)*;)+) => {
#[derive(Copy, Clone)]
#[derive(Copy, PartialEq, Eq, Clone)]
pub enum Tool {
$(
$name,
@ -640,7 +640,7 @@ impl<'a> Builder<'a> {
fn prepare_tool_cmd(&self, compiler: Compiler, tool: Tool, cmd: &mut Command) {
let host = &compiler.host;
let mut lib_paths: Vec<PathBuf> = vec![
if compiler.stage == 0 {
if compiler.stage == 0 && tool != Tool::ErrorIndex {
self.build.rustc_snapshot_libdir()
} else {
PathBuf::from(&self.sysroot_libdir(compiler, compiler.host))

View file

@ -80,6 +80,11 @@ RUN \
echo "# a" >> /usr/local/mips-linux-musl/bin/mips-openwrt-linux-musl-wrapper.sh && \
echo "# b" >> /usr/local/mipsel-linux-musl/bin/mipsel-openwrt-linux-musl-wrapper.sh
ENV RUN_MAKE_TARGETS=thumbv6m-none-eabi
ENV RUN_MAKE_TARGETS=$RUN_MAKE_TARGETS,thumbv7m-none-eabi
ENV RUN_MAKE_TARGETS=$RUN_MAKE_TARGETS,thumbv7em-none-eabi
ENV RUN_MAKE_TARGETS=$RUN_MAKE_TARGETS,thumbv7em-none-eabihf
ENV TARGETS=asmjs-unknown-emscripten
ENV TARGETS=$TARGETS,wasm32-unknown-emscripten
ENV TARGETS=$TARGETS,x86_64-rumprun-netbsd
@ -120,7 +125,9 @@ ENV RUST_CONFIGURE_ARGS \
--enable-emscripten \
--disable-docs
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
ENV SCRIPT \
python2.7 ../x.py test --target $RUN_MAKE_TARGETS src/test/run-make && \
python2.7 ../x.py dist --target $TARGETS
# sccache
COPY scripts/sccache.sh /scripts/

View file

@ -5,8 +5,8 @@ Rustdoc has a concept called "passes". These are transformations that
In addition to the passes below, check out the docs for these flags:
* [`--passes`](command-line-arguments.html#--passes-add-more-rustdoc-passes)
* [`--no-defaults`](command-line-arguments.html#--no-defaults-dont-run-default-passes)
* [`--passes`](command-line-arguments.html#a--passes-add-more-rustdoc-passes)
* [`--no-defaults`](command-line-arguments.html#a--no-defaults-dont-run-default-passes)
## Default passes

View file

@ -268,11 +268,11 @@ impl str {
let mut result = String::new();
let mut last_end = 0;
for (start, part) in self.match_indices(from) {
result.push_str(unsafe { self.slice_unchecked(last_end, start) });
result.push_str(unsafe { self.get_unchecked(last_end..start) });
result.push_str(to);
last_end = start + part.len();
}
result.push_str(unsafe { self.slice_unchecked(last_end, self.len()) });
result.push_str(unsafe { self.get_unchecked(last_end..self.len()) });
result
}
@ -309,11 +309,11 @@ impl str {
let mut result = String::with_capacity(32);
let mut last_end = 0;
for (start, part) in self.match_indices(pat).take(count) {
result.push_str(unsafe { self.slice_unchecked(last_end, start) });
result.push_str(unsafe { self.get_unchecked(last_end..start) });
result.push_str(to);
last_end = start + part.len();
}
result.push_str(unsafe { self.slice_unchecked(last_end, self.len()) });
result.push_str(unsafe { self.get_unchecked(last_end..self.len()) });
result
}

View file

@ -1222,7 +1222,7 @@ impl String {
while idx < len {
let ch = unsafe {
self.slice_unchecked(idx, len).chars().next().unwrap()
self.get_unchecked(idx..len).chars().next().unwrap()
};
let ch_len = ch.len_utf8();

View file

@ -177,9 +177,9 @@ fn test_join_for_different_lengths_with_long_separator() {
#[test]
fn test_unsafe_slice() {
assert_eq!("ab", unsafe {"abc".slice_unchecked(0, 2)});
assert_eq!("bc", unsafe {"abc".slice_unchecked(1, 3)});
assert_eq!("", unsafe {"abc".slice_unchecked(1, 1)});
assert_eq!("ab", unsafe {"abc".get_unchecked(0..2)});
assert_eq!("bc", unsafe {"abc".get_unchecked(1..3)});
assert_eq!("", unsafe {"abc".get_unchecked(1..1)});
fn a_million_letter_a() -> String {
let mut i = 0;
let mut rs = String::new();
@ -200,7 +200,7 @@ fn test_unsafe_slice() {
}
let letters = a_million_letter_a();
assert_eq!(half_a_million_letter_a(),
unsafe { letters.slice_unchecked(0, 500000)});
unsafe { letters.get_unchecked(0..500000)});
}
#[test]

View file

@ -543,6 +543,7 @@ macro_rules! unimplemented {
/// into libsyntax itself.
///
/// For more information, see documentation for `std`'s macros.
#[cfg(dox)]
mod builtin {
/// Unconditionally causes compilation to fail with the given error message when encountered.
@ -551,8 +552,7 @@ mod builtin {
///
/// [`std::compile_error!`]: ../std/macro.compile_error.html
#[stable(feature = "compile_error_macro", since = "1.20.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! compile_error {
($msg:expr) => ({ /* compiler built-in */ });
($msg:expr,) => ({ /* compiler built-in */ });
@ -564,8 +564,7 @@ mod builtin {
///
/// [`std::format_args!`]: ../std/macro.format_args.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! format_args {
($fmt:expr) => ({ /* compiler built-in */ });
($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ });
@ -577,8 +576,7 @@ mod builtin {
///
/// [`std::env!`]: ../std/macro.env.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! env {
($name:expr) => ({ /* compiler built-in */ });
($name:expr,) => ({ /* compiler built-in */ });
@ -590,8 +588,7 @@ mod builtin {
///
/// [`std::option_env!`]: ../std/macro.option_env.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! option_env {
($name:expr) => ({ /* compiler built-in */ });
($name:expr,) => ({ /* compiler built-in */ });
@ -603,8 +600,7 @@ mod builtin {
///
/// [`std::concat_idents!`]: ../std/macro.concat_idents.html
#[unstable(feature = "concat_idents_macro", issue = "29599")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! concat_idents {
($($e:ident),+) => ({ /* compiler built-in */ });
($($e:ident,)+) => ({ /* compiler built-in */ });
@ -616,8 +612,7 @@ mod builtin {
///
/// [`std::concat!`]: ../std/macro.concat.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! concat {
($($e:expr),*) => ({ /* compiler built-in */ });
($($e:expr,)*) => ({ /* compiler built-in */ });
@ -629,8 +624,7 @@ mod builtin {
///
/// [`std::line!`]: ../std/macro.line.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! line { () => ({ /* compiler built-in */ }) }
/// A macro which expands to the column number on which it was invoked.
@ -639,8 +633,7 @@ mod builtin {
///
/// [`std::column!`]: ../std/macro.column.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! column { () => ({ /* compiler built-in */ }) }
/// A macro which expands to the file name from which it was invoked.
@ -649,8 +642,7 @@ mod builtin {
///
/// [`std::file!`]: ../std/macro.file.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! file { () => ({ /* compiler built-in */ }) }
/// A macro which stringifies its arguments.
@ -659,8 +651,7 @@ mod builtin {
///
/// [`std::stringify!`]: ../std/macro.stringify.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! stringify { ($($t:tt)*) => ({ /* compiler built-in */ }) }
/// Includes a utf8-encoded file as a string.
@ -669,8 +660,7 @@ mod builtin {
///
/// [`std::include_str!`]: ../std/macro.include_str.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! include_str {
($file:expr) => ({ /* compiler built-in */ });
($file:expr,) => ({ /* compiler built-in */ });
@ -682,8 +672,7 @@ mod builtin {
///
/// [`std::include_bytes!`]: ../std/macro.include_bytes.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! include_bytes {
($file:expr) => ({ /* compiler built-in */ });
($file:expr,) => ({ /* compiler built-in */ });
@ -695,8 +684,7 @@ mod builtin {
///
/// [`std::module_path!`]: ../std/macro.module_path.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! module_path { () => ({ /* compiler built-in */ }) }
/// Boolean evaluation of configuration flags, at compile-time.
@ -705,8 +693,7 @@ mod builtin {
///
/// [`std::cfg!`]: ../std/macro.cfg.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! cfg { ($($cfg:tt)*) => ({ /* compiler built-in */ }) }
/// Parse a file as an expression or an item according to the context.
@ -715,8 +702,7 @@ mod builtin {
///
/// [`std::include!`]: ../std/macro.include.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! include {
($file:expr) => ({ /* compiler built-in */ });
($file:expr,) => ({ /* compiler built-in */ });
@ -727,9 +713,8 @@ mod builtin {
/// For more information, see the documentation for [`std::assert!`].
///
/// [`std::assert!`]: ../std/macro.assert.html
#[macro_export]
#[rustc_doc_only_macro]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg(dox)]
macro_rules! assert {
($cond:expr) => ({ /* compiler built-in */ });
($cond:expr,) => ({ /* compiler built-in */ });

View file

@ -638,7 +638,7 @@ pub unsafe fn uninitialized<T>() -> T {
#[stable(feature = "rust1", since = "1.0.0")]
pub fn swap<T>(x: &mut T, y: &mut T) {
unsafe {
ptr::swap_nonoverlapping(x, y, 1);
ptr::swap_nonoverlapping_one(x, y);
}
}

View file

@ -187,6 +187,19 @@ pub unsafe fn swap_nonoverlapping<T>(x: *mut T, y: *mut T, count: usize) {
swap_nonoverlapping_bytes(x, y, len)
}
#[inline]
pub(crate) unsafe fn swap_nonoverlapping_one<T>(x: *mut T, y: *mut T) {
// For types smaller than the block optimization below,
// just swap directly to avoid pessimizing codegen.
if mem::size_of::<T>() < 32 {
let z = read(x);
copy_nonoverlapping(y, x, 1);
write(y, z);
} else {
swap_nonoverlapping(x, y, 1);
}
}
#[inline]
unsafe fn swap_nonoverlapping_bytes(x: *mut u8, y: *mut u8, len: usize) {
// The approach here is to utilize simd to swap x & y efficiently. Testing reveals
@ -2703,6 +2716,11 @@ impl<T: Sized> Unique<T> {
///
/// This is useful for initializing types which lazily allocate, like
/// `Vec::new` does.
///
/// Note that the pointer value may potentially represent a valid pointer to
/// a `T`, which means this must not be used as a "not yet initialized"
/// sentinel value. Types that lazily allocate must track initialization by
/// some other means.
// FIXME: rename to dangling() to match NonNull?
pub const fn empty() -> Self {
unsafe {
@ -2834,6 +2852,11 @@ impl<T: Sized> NonNull<T> {
///
/// This is useful for initializing types which lazily allocate, like
/// `Vec::new` does.
///
/// Note that the pointer value may potentially represent a valid pointer to
/// a `T`, which means this must not be used as a "not yet initialized"
/// sentinel value. Types that lazily allocate must track initialization by
/// some other means.
#[stable(feature = "nonnull", since = "1.25.0")]
pub fn dangling() -> Self {
unsafe {

View file

@ -1055,7 +1055,7 @@ impl<'a, P: Pattern<'a>> SplitInternal<'a, P> {
if !self.finished && (self.allow_trailing_empty || self.end - self.start > 0) {
self.finished = true;
unsafe {
let string = self.matcher.haystack().slice_unchecked(self.start, self.end);
let string = self.matcher.haystack().get_unchecked(self.start..self.end);
Some(string)
}
} else {
@ -1070,7 +1070,7 @@ impl<'a, P: Pattern<'a>> SplitInternal<'a, P> {
let haystack = self.matcher.haystack();
match self.matcher.next_match() {
Some((a, b)) => unsafe {
let elt = haystack.slice_unchecked(self.start, a);
let elt = haystack.get_unchecked(self.start..a);
self.start = b;
Some(elt)
},
@ -1095,13 +1095,13 @@ impl<'a, P: Pattern<'a>> SplitInternal<'a, P> {
let haystack = self.matcher.haystack();
match self.matcher.next_match_back() {
Some((a, b)) => unsafe {
let elt = haystack.slice_unchecked(b, self.end);
let elt = haystack.get_unchecked(b..self.end);
self.end = a;
Some(elt)
},
None => unsafe {
self.finished = true;
Some(haystack.slice_unchecked(self.start, self.end))
Some(haystack.get_unchecked(self.start..self.end))
},
}
}
@ -1222,7 +1222,7 @@ impl<'a, P: Pattern<'a>> MatchIndicesInternal<'a, P> {
#[inline]
fn next(&mut self) -> Option<(usize, &'a str)> {
self.0.next_match().map(|(start, end)| unsafe {
(start, self.0.haystack().slice_unchecked(start, end))
(start, self.0.haystack().get_unchecked(start..end))
})
}
@ -1231,7 +1231,7 @@ impl<'a, P: Pattern<'a>> MatchIndicesInternal<'a, P> {
where P::Searcher: ReverseSearcher<'a>
{
self.0.next_match_back().map(|(start, end)| unsafe {
(start, self.0.haystack().slice_unchecked(start, end))
(start, self.0.haystack().get_unchecked(start..end))
})
}
}
@ -1274,7 +1274,7 @@ impl<'a, P: Pattern<'a>> MatchesInternal<'a, P> {
fn next(&mut self) -> Option<&'a str> {
self.0.next_match().map(|(a, b)| unsafe {
// Indices are known to be on utf8 boundaries
self.0.haystack().slice_unchecked(a, b)
self.0.haystack().get_unchecked(a..b)
})
}
@ -1284,7 +1284,7 @@ impl<'a, P: Pattern<'a>> MatchesInternal<'a, P> {
{
self.0.next_match_back().map(|(a, b)| unsafe {
// Indices are known to be on utf8 boundaries
self.0.haystack().slice_unchecked(a, b)
self.0.haystack().get_unchecked(a..b)
})
}
}
@ -2453,6 +2453,7 @@ impl str {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_deprecated(since = "1.29.0", reason = "use `get_unchecked(begin..end)` instead")]
#[inline]
pub unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &str {
(begin..end).get_unchecked(self)
@ -2483,6 +2484,7 @@ impl str {
/// * `begin` and `end` must be byte positions within the string slice.
/// * `begin` and `end` must lie on UTF-8 sequence boundaries.
#[stable(feature = "str_slice_mut", since = "1.5.0")]
#[rustc_deprecated(since = "1.29.0", reason = "use `get_unchecked_mut(begin..end)` instead")]
#[inline]
pub unsafe fn slice_mut_unchecked(&mut self, begin: usize, end: usize) -> &mut str {
(begin..end).get_unchecked_mut(self)
@ -2524,8 +2526,8 @@ impl str {
// is_char_boundary checks that the index is in [0, .len()]
if self.is_char_boundary(mid) {
unsafe {
(self.slice_unchecked(0, mid),
self.slice_unchecked(mid, self.len()))
(self.get_unchecked(0..mid),
self.get_unchecked(mid..self.len()))
}
} else {
slice_error_fail(self, 0, mid)
@ -3702,7 +3704,7 @@ impl str {
}
unsafe {
// Searcher is known to return valid indices
self.slice_unchecked(i, j)
self.get_unchecked(i..j)
}
}
@ -3741,7 +3743,7 @@ impl str {
}
unsafe {
// Searcher is known to return valid indices
self.slice_unchecked(i, self.len())
self.get_unchecked(i..self.len())
}
}
@ -3788,7 +3790,7 @@ impl str {
}
unsafe {
// Searcher is known to return valid indices
self.slice_unchecked(0, j)
self.get_unchecked(0..j)
}
}

View file

@ -354,7 +354,7 @@ unsafe impl<'a> ReverseSearcher<'a> for CharSearcher<'a> {
#[inline]
fn next_back(&mut self) -> SearchStep {
let old_finger = self.finger_back;
let slice = unsafe { self.haystack.slice_unchecked(self.finger, old_finger) };
let slice = unsafe { self.haystack.get_unchecked(self.finger..old_finger) };
let mut iter = slice.chars();
let old_len = iter.iter.len();
if let Some(ch) = iter.next_back() {

View file

@ -3191,7 +3191,8 @@ impl<'a> LoweringContext<'a> {
let mut vis = self.lower_visibility(&i.vis, None);
let attrs = self.lower_attrs(&i.attrs);
if let ItemKind::MacroDef(ref def) = i.node {
if !def.legacy || attr::contains_name(&i.attrs, "macro_export") {
if !def.legacy || attr::contains_name(&i.attrs, "macro_export") ||
attr::contains_name(&i.attrs, "rustc_doc_only_macro") {
let body = self.lower_token_stream(def.stream());
self.exported_macros.push(hir::MacroDef {
name,

View file

@ -97,7 +97,14 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
let name = self.extract_type_name(&ty);
let mut err_span = span;
let mut labels = vec![(span, format!("cannot infer type for `{}`", name))];
let mut labels = vec![(
span,
if &name == "_" {
"cannot infer type".to_string()
} else {
format!("cannot infer type for `{}`", name)
},
)];
let mut local_visitor = FindLocalByTypeVisitor {
infcx: &self,

View file

@ -57,7 +57,7 @@ pub struct UniversalRegions<'tcx> {
/// externals, then locals. So things from:
/// - `FIRST_GLOBAL_INDEX..first_extern_index` are global;
/// - `first_extern_index..first_local_index` are external; and
/// - first_local_index..num_universals` are local.
/// - `first_local_index..num_universals` are local.
first_extern_index: usize,
/// See `first_extern_index`.

View file

@ -1273,15 +1273,13 @@ fn macro_resolve(cx: &DocContext, path_str: &str) -> Option<Def> {
.resolve_macro_to_def_inner(mark, &path, MacroKind::Bang, false);
if let Ok(def) = res {
if let SyntaxExtension::DeclMacro { .. } = *resolver.get_macro(def) {
Some(def)
} else {
None
return Some(def);
}
} else if let Some(def) = resolver.all_macros.get(&Symbol::intern(path_str)) {
Some(*def)
} else {
None
}
if let Some(def) = resolver.all_macros.get(&Symbol::intern(path_str)) {
return Some(*def);
}
None
}
#[derive(Debug)]

View file

@ -317,7 +317,7 @@ macro_rules! assert_approx_eq {
/// macro, but are documented here. Their implementations can be found hardcoded
/// into libsyntax itself.
#[cfg(dox)]
pub mod builtin {
mod builtin {
/// Unconditionally causes compilation to fail with the given error message when encountered.
///
@ -355,7 +355,7 @@ pub mod builtin {
///
/// [`panic!`]: ../std/macro.panic.html
#[stable(feature = "compile_error_macro", since = "1.20.0")]
#[macro_export]
#[rustc_doc_only_macro]
macro_rules! compile_error {
($msg:expr) => ({ /* compiler built-in */ });
($msg:expr,) => ({ /* compiler built-in */ });
@ -407,7 +407,7 @@ pub mod builtin {
/// assert_eq!(s, format!("hello {}", "world"));
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[rustc_doc_only_macro]
macro_rules! format_args {
($fmt:expr) => ({ /* compiler built-in */ });
($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ });
@ -445,7 +445,7 @@ pub mod builtin {
/// error: what's that?!
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[rustc_doc_only_macro]
macro_rules! env {
($name:expr) => ({ /* compiler built-in */ });
($name:expr,) => ({ /* compiler built-in */ });
@ -471,7 +471,7 @@ pub mod builtin {
/// println!("the secret key might be: {:?}", key);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[rustc_doc_only_macro]
macro_rules! option_env {
($name:expr) => ({ /* compiler built-in */ });
($name:expr,) => ({ /* compiler built-in */ });
@ -502,7 +502,7 @@ pub mod builtin {
/// # }
/// ```
#[unstable(feature = "concat_idents_macro", issue = "29599")]
#[macro_export]
#[rustc_doc_only_macro]
macro_rules! concat_idents {
($($e:ident),+) => ({ /* compiler built-in */ });
($($e:ident,)+) => ({ /* compiler built-in */ });
@ -524,7 +524,7 @@ pub mod builtin {
/// assert_eq!(s, "test10btrue");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[rustc_doc_only_macro]
macro_rules! concat {
($($e:expr),*) => ({ /* compiler built-in */ });
($($e:expr,)*) => ({ /* compiler built-in */ });
@ -552,7 +552,7 @@ pub mod builtin {
/// println!("defined on line: {}", current_line);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[rustc_doc_only_macro]
macro_rules! line { () => ({ /* compiler built-in */ }) }
/// A macro which expands to the column number on which it was invoked.
@ -577,7 +577,7 @@ pub mod builtin {
/// println!("defined on column: {}", current_col);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[rustc_doc_only_macro]
macro_rules! column { () => ({ /* compiler built-in */ }) }
/// A macro which expands to the file name from which it was invoked.
@ -601,7 +601,7 @@ pub mod builtin {
/// println!("defined in file: {}", this_file);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[rustc_doc_only_macro]
macro_rules! file { () => ({ /* compiler built-in */ }) }
/// A macro which stringifies its arguments.
@ -620,7 +620,7 @@ pub mod builtin {
/// assert_eq!(one_plus_one, "1 + 1");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[rustc_doc_only_macro]
macro_rules! stringify { ($($t:tt)*) => ({ /* compiler built-in */ }) }
/// Includes a utf8-encoded file as a string.
@ -654,7 +654,7 @@ pub mod builtin {
///
/// Compiling 'main.rs' and running the resulting binary will print "adiós".
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[rustc_doc_only_macro]
macro_rules! include_str {
($file:expr) => ({ /* compiler built-in */ });
($file:expr,) => ({ /* compiler built-in */ });
@ -691,7 +691,7 @@ pub mod builtin {
///
/// Compiling 'main.rs' and running the resulting binary will print "adiós".
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[rustc_doc_only_macro]
macro_rules! include_bytes {
($file:expr) => ({ /* compiler built-in */ });
($file:expr,) => ({ /* compiler built-in */ });
@ -715,7 +715,7 @@ pub mod builtin {
/// test::foo();
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[rustc_doc_only_macro]
macro_rules! module_path { () => ({ /* compiler built-in */ }) }
/// Boolean evaluation of configuration flags, at compile-time.
@ -737,7 +737,7 @@ pub mod builtin {
/// };
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[rustc_doc_only_macro]
macro_rules! cfg { ($($cfg:tt)*) => ({ /* compiler built-in */ }) }
/// Parse a file as an expression or an item according to the context.
@ -780,7 +780,7 @@ pub mod builtin {
/// Compiling 'main.rs' and running the resulting binary will print
/// "🙈🙊🙉🙈🙊🙉".
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[rustc_doc_only_macro]
macro_rules! include {
($file:expr) => ({ /* compiler built-in */ });
($file:expr,) => ({ /* compiler built-in */ });
@ -833,7 +833,7 @@ pub mod builtin {
/// assert!(a + b == 30, "a = {}, b = {}", a, b);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[rustc_doc_only_macro]
macro_rules! assert {
($cond:expr) => ({ /* compiler built-in */ });
($cond:expr,) => ({ /* compiler built-in */ });

View file

@ -1836,7 +1836,7 @@ impl Path {
/// * On Unix, a path has a root if it begins with `/`.
///
/// * On Windows, a path has a root if it:
/// * has no prefix and begins with a separator, e.g. `\\windows`
/// * has no prefix and begins with a separator, e.g. `\windows`
/// * has a prefix followed by a separator, e.g. `c:\windows` but not `c:windows`
/// * has any non-disk prefix, e.g. `\\server\share`
///

View file

@ -687,7 +687,8 @@ pub fn deprecated_attributes() -> Vec<&'static (&'static str, AttributeType, Att
}
pub fn is_builtin_attr(attr: &ast::Attribute) -> bool {
BUILTIN_ATTRIBUTES.iter().any(|&(builtin_name, _, _)| attr.check_name(builtin_name))
BUILTIN_ATTRIBUTES.iter().any(|&(builtin_name, _, _)| attr.check_name(builtin_name)) ||
attr.name().as_str().starts_with("rustc_")
}
// Attributes that have a special meaning to rustc or rustdoc

View file

@ -0,0 +1,27 @@
// 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.
// compile-flags: -O
// only-x86_64
#![crate_type = "lib"]
use std::mem::swap;
type RGB48 = [u16; 3];
// CHECK-LABEL: @swap_rgb48
#[no_mangle]
pub fn swap_rgb48(x: &mut RGB48, y: &mut RGB48) {
// CHECK-NOT: alloca
// CHECK: load i48
// CHECK: store i48
swap(x, y)
}

View file

@ -4,7 +4,7 @@ error[E0282]: type annotations needed
LL | let x = "hello".chars().rev().collect(); //~ ERROR E0282
| ^
| |
| cannot infer type for `_`
| cannot infer type
| consider giving `x` a type
error: aborting due to previous error

View file

@ -4,7 +4,7 @@ error[E0282]: type annotations needed
LL | let &v = new();
| -^
| ||
| |cannot infer type for `_`
| |cannot infer type
| consider giving the pattern a type
error: aborting due to previous error

View file

@ -4,7 +4,7 @@ error[E0282]: type annotations needed
LL | let &v = new();
| -^
| ||
| |cannot infer type for `_`
| |cannot infer type
| consider giving the pattern a type
error: aborting due to previous error

View file

@ -4,7 +4,7 @@ error[E0282]: type annotations needed
LL | / { return () }
LL | | //~^ ERROR type annotations needed [E0282]
LL | | ()
| |______^ cannot infer type for `_`
| |______^ cannot infer type
|
= note: type must be known at this point

View file

@ -4,7 +4,7 @@ error[E0282]: type annotations needed
LL | let x; //~ ERROR type annotations needed
| ^
| |
| cannot infer type for `_`
| cannot infer type
| consider giving `x` a type
error: aborting due to previous error

View file

@ -4,7 +4,7 @@ error[E0282]: type annotations needed
LL | for (ref i,) in [].iter() {
| --------- the element type for this iterator is not specified
LL | i.clone();
| ^^^^^ cannot infer type for `_`
| ^^^^^ cannot infer type
|
= note: type must be known at this point

View file

@ -4,7 +4,7 @@ error[E0282]: type annotations needed
LL | let x = panic!();
| - consider giving `x` a type
LL | x.clone(); //~ ERROR type annotations needed
| ^ cannot infer type for `_`
| ^ cannot infer type
|
= note: type must be known at this point

View file

@ -2,7 +2,7 @@ error[E0282]: type annotations needed
--> $DIR/issue-23041.rs:16:22
|
LL | b.downcast_ref::<fn(_)->_>(); //~ ERROR E0282
| ^^^^^^^^ cannot infer type for `_`
| ^^^^^^^^ cannot infer type
error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error[E0282]: type annotations needed
--> $DIR/issue-24013.rs:15:20
|
LL | unsafe {swap::<&mut _>(transmute(&a), transmute(&b))};
| ^^^^^^ cannot infer type for `_`
| ^^^^^^ cannot infer type
error: aborting due to previous error

View file

@ -15,7 +15,7 @@ fn main() {
//~^ NOTE the element type for this iterator is not specified
*tile = 0;
//~^ ERROR type annotations needed
//~| NOTE cannot infer type for `_`
//~| NOTE cannot infer type
//~| NOTE type must be known at this point
}
}

View file

@ -5,7 +5,7 @@ LL | for tile in row {
| --- the element type for this iterator is not specified
LL | //~^ NOTE the element type for this iterator is not specified
LL | *tile = 0;
| ^^^^^ cannot infer type for `_`
| ^^^^^ cannot infer type
|
= note: type must be known at this point

View file

@ -2,7 +2,7 @@ error[E0282]: type annotations needed
--> $DIR/issue-7813.rs:12:13
|
LL | let v = &[]; //~ ERROR type annotations needed
| - ^^^ cannot infer type for `_`
| - ^^^ cannot infer type
| |
| consider giving `v` a type

View file

@ -13,7 +13,7 @@ error[E0282]: type annotations needed
|
LL | / data.iter() //~ ERROR 22:5: 23:20: type annotations needed
LL | | .sum::<_>()
| |___________________^ cannot infer type for `_`
| |___________________^ cannot infer type
|
= note: type must be known at this point

View file

@ -4,7 +4,7 @@ error[E0282]: type annotations needed
LL | let mut x = Default::default();
| ----- consider giving `x` a type
LL | x.0;
| ^ cannot infer type for `_`
| ^ cannot infer type
|
= note: type must be known at this point
@ -14,7 +14,7 @@ error[E0282]: type annotations needed
LL | let mut x = Default::default();
| ----- consider giving `x` a type
LL | x[0];
| ^ cannot infer type for `_`
| ^ cannot infer type
|
= note: type must be known at this point

View file

@ -2,7 +2,7 @@ error[E0282]: type annotations needed
--> $DIR/cannot_infer_local_or_array.rs:12:13
|
LL | let x = []; //~ ERROR type annotations needed
| - ^^ cannot infer type for `_`
| - ^^ cannot infer type
| |
| consider giving `x` a type