diff options
470 files changed, 2501 insertions, 1625 deletions
diff --git a/Cargo.lock b/Cargo.lock index 9c359b464ef..c081f2fbf20 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1642,9 +1642,9 @@ dependencies = [ [[package]] name = "jobserver" -version = "0.1.19" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b06c1b455f1cf4269a8cfc320ab930a810e2375a42af5075eb8a8b36405ce0" +checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2" dependencies = [ "libc", ] @@ -3540,8 +3540,8 @@ dependencies = [ "rustc_data_structures", "rustc_span", "serialize", - "term_size", "termcolor", + "termize", "unicode-width", "winapi 0.3.8", ] @@ -4581,6 +4581,16 @@ dependencies = [ ] [[package]] +name = "termize" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1706be6b564323ce7092f5f7e6b118a14c8ef7ed0e69c8c5329c914a9f101295" +dependencies = [ + "libc", + "winapi 0.3.8", +] + +[[package]] name = "test" version = "0.0.0" dependencies = [ diff --git a/Cargo.toml b/Cargo.toml index 9d5c27b96df..2f5a708e8dc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,13 +31,6 @@ exclude = [ "obj", ] -# Curiously, LLVM 7.0 will segfault if compiled with opt-level=3 -# See issue https://github.com/rust-lang/rust/issues/52378 -[profile.release] -opt-level = 2 -[profile.bench] -opt-level = 2 - # These options are controlled from our rustc wrapper script, so turn them off # here and have them controlled elsewhere. [profile.dev] diff --git a/RELEASES.md b/RELEASES.md index 02edb0cf83c..10e485c1a40 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -62,9 +62,9 @@ Cargo - [Cargo.lock now uses a more git friendly format that should help to reduce merge conflicts.][cargo/7579] - [You can now override specific dependencies's build settings][cargo/7591] E.g. - `[profile.dev.overrides.image] opt-level = 2` sets the `image` crate's + `[profile.dev.package.image] opt-level = 2` sets the `image` crate's optimisation level to `2` for debug builds. You can also use - `[profile.<profile>.build_overrides]` to override build scripts and + `[profile.<profile>.build-override]` to override build scripts and their dependencies. Misc diff --git a/src/doc/unstable-book/src/compiler-flags/sanitizer.md b/src/doc/unstable-book/src/compiler-flags/sanitizer.md index cbb90bd3bb3..64bff2a6fe0 100644 --- a/src/doc/unstable-book/src/compiler-flags/sanitizer.md +++ b/src/doc/unstable-book/src/compiler-flags/sanitizer.md @@ -93,6 +93,80 @@ Shadow byte legend (one shadow byte represents 8 application bytes): ==10029==ABORTING ``` +Use of a stack object after its scope has already ended: + +```shell +$ cat b.rs +static mut P: *mut usize = std::ptr::null_mut(); + +fn main() { + unsafe { + { + let mut x = 0; + P = &mut x; + } + std::ptr::write_volatile(P, 123); + } +} +$ rustc -Zsanitizer=address b.rs +$./b +================================================================= +==424427==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7fff67be6be0 at pc 0x5647a3ea4658 bp 0x7fff67be6b90 sp 0x7fff67be6b88 +WRITE of size 8 at 0x7fff67be6be0 thread T0 + #0 0x5647a3ea4657 in core::ptr::write_volatile::h4b04601757d0376d (/tmp/b+0xb8657) + #1 0x5647a3ea4432 in b::main::h5574a756e615c9cf (/tmp/b+0xb8432) + #2 0x5647a3ea480b in std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::hd57e7ee01866077e (/tmp/b+0xb880b) + #3 0x5647a3eab412 in std::panicking::try::do_call::he0421ca82dd11ba3 (.llvm.8083791802951296215) (/tmp/b+0xbf412) + #4 0x5647a3eacb26 in __rust_maybe_catch_panic (/tmp/b+0xc0b26) + #5 0x5647a3ea5b66 in std::rt::lang_start_internal::h19bc96b28f670a64 (/tmp/b+0xb9b66) + #6 0x5647a3ea4788 in std::rt::lang_start::h642d10b4b6965fb8 (/tmp/b+0xb8788) + #7 0x5647a3ea449a in main (/tmp/b+0xb849a) + #8 0x7fd1d18b3bba in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x26bba) + #9 0x5647a3df7299 in _start (/tmp/b+0xb299) + +Address 0x7fff67be6be0 is located in stack of thread T0 at offset 32 in frame + #0 0x5647a3ea433f in b::main::h5574a756e615c9cf (/tmp/b+0xb833f) + + This frame has 1 object(s): + [32, 40) 'x' <== Memory access at offset 32 is inside this variable +HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork + (longjmp and C++ exceptions *are* supported) +SUMMARY: AddressSanitizer: stack-use-after-scope (/tmp/b+0xb8657) in core::ptr::write_volatile::h4b04601757d0376d +Shadow bytes around the buggy address: + 0x10006cf74d20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 0x10006cf74d30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 0x10006cf74d40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 0x10006cf74d50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 0x10006cf74d60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +=>0x10006cf74d70: 00 00 00 00 00 00 00 00 f1 f1 f1 f1[f8]f3 f3 f3 + 0x10006cf74d80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 0x10006cf74d90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 0x10006cf74da0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 0x10006cf74db0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 0x10006cf74dc0: f1 f1 f1 f1 00 f3 f3 f3 00 00 00 00 00 00 00 00 +Shadow byte legend (one shadow byte represents 8 application bytes): + Addressable: 00 + Partially addressable: 01 02 03 04 05 06 07 + Heap left redzone: fa + Freed heap region: fd + Stack left redzone: f1 + Stack mid redzone: f2 + Stack right redzone: f3 + Stack after return: f5 + Stack use after scope: f8 + Global redzone: f9 + Global init order: f6 + Poisoned by user: f7 + Container overflow: fc + Array cookie: ac + Intra object redzone: bb + ASan internal: fe + Left alloca redzone: ca + Right alloca redzone: cb + Shadow gap: cc +==424427==ABORTING +``` + ## MemorySanitizer Use of uninitialized memory. Note that we are using `-Zbuild-std` to instrument diff --git a/src/liballoc/collections/btree/map.rs b/src/liballoc/collections/btree/map.rs index 4dc004864fd..8eabc177304 100644 --- a/src/liballoc/collections/btree/map.rs +++ b/src/liballoc/collections/btree/map.rs @@ -6,10 +6,11 @@ use core::iter::{FromIterator, FusedIterator, Peekable}; use core::marker::PhantomData; use core::ops::Bound::{Excluded, Included, Unbounded}; use core::ops::{Index, RangeBounds}; -use core::{fmt, intrinsics, mem, ptr}; +use core::{fmt, mem, ptr}; use super::node::{self, marker, ForceResult::*, Handle, InsertResult::*, NodeRef}; use super::search::{self, SearchResult::*}; +use super::unwrap_unchecked; use Entry::*; use UnderflowResult::*; @@ -207,6 +208,60 @@ impl<K: Clone, V: Clone> Clone for BTreeMap<K, V> { clone_subtree(self.root.as_ref()) } } + + fn clone_from(&mut self, other: &Self) { + BTreeClone::clone_from(self, other); + } +} + +trait BTreeClone { + fn clone_from(&mut self, other: &Self); +} + +impl<K: Clone, V: Clone> BTreeClone for BTreeMap<K, V> { + default fn clone_from(&mut self, other: &Self) { + *self = other.clone(); + } +} + +impl<K: Clone + Ord, V: Clone> BTreeClone for BTreeMap<K, V> { + fn clone_from(&mut self, other: &Self) { + // This truncates `self` to `other.len()` by calling `split_off` on + // the first key after `other.len()` elements if it exists + let split_off_key = if self.len() > other.len() { + let diff = self.len() - other.len(); + if diff <= other.len() { + self.iter().nth_back(diff - 1).map(|pair| (*pair.0).clone()) + } else { + self.iter().nth(other.len()).map(|pair| (*pair.0).clone()) + } + } else { + None + }; + if let Some(key) = split_off_key { + self.split_off(&key); + } + + let mut siter = self.range_mut(..); + let mut oiter = other.iter(); + // After truncation, `self` is at most as long as `other` so this loop + // replaces every key-value pair in `self`. Since `oiter` is in sorted + // order and the structure of the `BTreeMap` stays the same, + // the BTree invariants are maintained at the end of the loop + while !siter.is_empty() { + if let Some((ok, ov)) = oiter.next() { + // SAFETY: This is safe because the `siter.front != siter.back` check + // ensures that `siter` is nonempty + let (sk, sv) = unsafe { siter.next_unchecked() }; + sk.clone_from(ok); + sv.clone_from(ov); + } else { + break; + } + } + // If `other` is longer than `self`, the remaining elements are inserted + self.extend(oiter.map(|(k, v)| ((*k).clone(), (*v).clone()))); + } } impl<K, Q: ?Sized> super::Recover<Q> for BTreeMap<K, ()> @@ -591,7 +646,7 @@ impl<K: Ord, V> BTreeMap<K, V> { T: Ord, K: Borrow<T>, { - let front = first_leaf_edge(self.root.as_ref()); + let front = self.root.as_ref().first_leaf_edge(); front.right_kv().ok().map(Handle::into_kv) } @@ -652,7 +707,7 @@ impl<K: Ord, V> BTreeMap<K, V> { T: Ord, K: Borrow<T>, { - let back = last_leaf_edge(self.root.as_ref()); + let back = self.root.as_ref().last_leaf_edge(); back.left_kv().ok().map(Handle::into_kv) } @@ -1019,7 +1074,7 @@ impl<K: Ord, V> BTreeMap<K, V> { fn from_sorted_iter<I: Iterator<Item = (K, V)>>(&mut self, iter: I) { self.ensure_root_is_owned(); - let mut cur_node = last_leaf_edge(self.root.as_mut()).into_node(); + let mut cur_node = self.root.as_mut().last_leaf_edge().into_node(); // Iterate through all key-value pairs, pushing them into nodes at the right level. for (key, value) in iter { // Try to push key-value pair into the current leaf node. @@ -1059,7 +1114,7 @@ impl<K: Ord, V> BTreeMap<K, V> { open_node.push(key, value, right_tree); // Go down to the right-most leaf again. - cur_node = last_leaf_edge(open_node.forget_type()).into_node(); + cur_node = open_node.forget_type().last_leaf_edge().into_node(); } self.length += 1; @@ -1357,7 +1412,8 @@ impl<'a, K: 'a, V: 'a> Iterator for IterMut<'a, K, V> { None } else { self.length -= 1; - unsafe { Some(self.range.next_unchecked()) } + let (k, v) = unsafe { self.range.next_unchecked() }; + Some((k, v)) // coerce k from `&mut K` to `&K` } } @@ -1377,7 +1433,8 @@ impl<'a, K: 'a, V: 'a> DoubleEndedIterator for IterMut<'a, K, V> { None } else { self.length -= 1; - unsafe { Some(self.range.next_back_unchecked()) } + let (k, v) = unsafe { self.range.next_back_unchecked() }; + Some((k, v)) // coerce k from `&mut K` to `&K` } } } @@ -1403,7 +1460,7 @@ impl<K, V> IntoIterator for BTreeMap<K, V> { let len = self.length; mem::forget(self); - IntoIter { front: first_leaf_edge(root1), back: last_leaf_edge(root2), length: len } + IntoIter { front: root1.first_leaf_edge(), back: root2.last_leaf_edge(), length: len } } } @@ -1418,9 +1475,9 @@ impl<K, V> Drop for IntoIter<K, V> { } if let Some(first_parent) = leaf_node.deallocate_and_ascend() { - let mut cur_node = first_parent.into_node(); - while let Some(parent) = cur_node.deallocate_and_ascend() { - cur_node = parent.into_node() + let mut cur_internal_node = first_parent.into_node(); + while let Some(parent) = cur_internal_node.deallocate_and_ascend() { + cur_internal_node = parent.into_node() } } } @@ -1433,37 +1490,10 @@ impl<K, V> Iterator for IntoIter<K, V> { fn next(&mut self) -> Option<(K, V)> { if self.length == 0 { - return None; + None } else { self.length -= 1; - } - - let handle = unsafe { ptr::read(&self.front) }; - - let mut cur_handle = match handle.right_kv() { - Ok(kv) => { - let k = unsafe { ptr::read(kv.reborrow().into_kv().0) }; - let v = unsafe { ptr::read(kv.reborrow().into_kv().1) }; - self.front = kv.right_edge(); - return Some((k, v)); - } - Err(last_edge) => unsafe { - unwrap_unchecked(last_edge.into_node().deallocate_and_ascend()) - }, - }; - - loop { - match cur_handle.right_kv() { - Ok(kv) => { - let k = unsafe { ptr::read(kv.reborrow().into_kv().0) }; - let v = unsafe { ptr::read(kv.reborrow().into_kv().1) }; - self.front = first_leaf_edge(kv.right_edge().descend()); - return Some((k, v)); - } - Err(last_edge) => unsafe { - cur_handle = unwrap_unchecked(last_edge.into_node().deallocate_and_ascend()); - }, - } + Some(unsafe { self.front.next_unchecked() }) } } @@ -1476,37 +1506,10 @@ impl<K, V> Iterator for IntoIter<K, V> { impl<K, V> DoubleEndedIterator for IntoIter<K, V> { fn next_back(&mut self) -> Option<(K, V)> { if self.length == 0 { - return None; + None } else { self.length -= 1; - } - - let handle = unsafe { ptr::read(&self.back) }; - - let mut cur_handle = match handle.left_kv() { - Ok(kv) => { - let k = unsafe { ptr::read(kv.reborrow().into_kv().0) }; - let v = unsafe { ptr::read(kv.reborrow().into_kv().1) }; - self.back = kv.left_edge(); - return Some((k, v)); - } - Err(last_edge) => unsafe { - unwrap_unchecked(last_edge.into_node().deallocate_and_ascend()) - }, - }; - - loop { - match cur_handle.left_kv() { - Ok(kv) => { - let k = unsafe { ptr::read(kv.reborrow().into_kv().0) }; - let v = unsafe { ptr::read(kv.reborrow().into_kv().1) }; - self.back = last_leaf_edge(kv.left_edge().descend()); - return Some((k, v)); - } - Err(last_edge) => unsafe { - cur_handle = unwrap_unchecked(last_edge.into_node().deallocate_and_ascend()); - }, - } + Some(unsafe { self.back.next_back_unchecked() }) } } } @@ -1608,7 +1611,7 @@ impl<'a, K, V> Iterator for Range<'a, K, V> { type Item = (&'a K, &'a V); fn next(&mut self) -> Option<(&'a K, &'a V)> { - if self.front == self.back { None } else { unsafe { Some(self.next_unchecked()) } } + if self.is_empty() { None } else { unsafe { Some(self.next_unchecked()) } } } fn last(mut self) -> Option<(&'a K, &'a V)> { @@ -1651,73 +1654,25 @@ impl<K, V> ExactSizeIterator for ValuesMut<'_, K, V> { impl<K, V> FusedIterator for ValuesMut<'_, K, V> {} impl<'a, K, V> Range<'a, K, V> { - unsafe fn next_unchecked(&mut self) -> (&'a K, &'a V) { - let handle = self.front; - - let mut cur_handle = match handle.right_kv() { - Ok(kv) => { - let ret = kv.into_kv(); - self.front = kv.right_edge(); - return ret; - } - Err(last_edge) => { - let next_level = last_edge.into_node().ascend().ok(); - unwrap_unchecked(next_level) - } - }; + fn is_empty(&self) -> bool { + self.front == self.back + } - loop { - match cur_handle.right_kv() { - Ok(kv) => { - let ret = kv.into_kv(); - self.front = first_leaf_edge(kv.right_edge().descend()); - return ret; - } - Err(last_edge) => { - let next_level = last_edge.into_node().ascend().ok(); - cur_handle = unwrap_unchecked(next_level); - } - } - } + unsafe fn next_unchecked(&mut self) -> (&'a K, &'a V) { + self.front.next_unchecked() } } #[stable(feature = "btree_range", since = "1.17.0")] impl<'a, K, V> DoubleEndedIterator for Range<'a, K, V> { fn next_back(&mut self) -> Option<(&'a K, &'a V)> { - if self.front == self.back { None } else { unsafe { Some(self.next_back_unchecked()) } } + if self.is_empty() { None } else { Some(unsafe { self.next_back_unchecked() }) } } } impl<'a, K, V> Range<'a, K, V> { unsafe fn next_back_unchecked(&mut self) -> (&'a K, &'a V) { - let handle = self.back; - - let mut cur_handle = match handle.left_kv() { - Ok(kv) => { - let ret = kv.into_kv(); - self.back = kv.left_edge(); - return ret; - } - Err(last_edge) => { - let next_level = last_edge.into_node().ascend().ok(); - unwrap_unchecked(next_level) - } - }; - - loop { - match cur_handle.left_kv() { - Ok(kv) => { - let ret = kv.into_kv(); - self.back = last_leaf_edge(kv.left_edge().descend()); - return ret; - } - Err(last_edge) => { - let next_level = last_edge.into_node().ascend().ok(); - cur_handle = unwrap_unchecked(next_level); - } - } - } + self.back.next_back_unchecked() } } @@ -1736,7 +1691,12 @@ impl<'a, K, V> Iterator for RangeMut<'a, K, V> { type Item = (&'a K, &'a mut V); fn next(&mut self) -> Option<(&'a K, &'a mut V)> { - if self.front == self.back { None } else { unsafe { Some(self.next_unchecked()) } } + if self.is_empty() { + None + } else { + let (k, v) = unsafe { self.next_unchecked() }; + Some((k, v)) // coerce k from `&mut K` to `&K` + } } fn last(mut self) -> Option<(&'a K, &'a mut V)> { @@ -1745,45 +1705,24 @@ impl<'a, K, V> Iterator for RangeMut<'a, K, V> { } impl<'a, K, V> RangeMut<'a, K, V> { - unsafe fn next_unchecked(&mut self) -> (&'a K, &'a mut V) { - let handle = ptr::read(&self.front); - - let mut cur_handle = match handle.right_kv() { - Ok(kv) => { - self.front = ptr::read(&kv).right_edge(); - // Doing the descend invalidates the references returned by `into_kv_mut`, - // so we have to do this last. - let (k, v) = kv.into_kv_mut(); - return (k, v); // coerce k from `&mut K` to `&K` - } - Err(last_edge) => { - let next_level = last_edge.into_node().ascend().ok(); - unwrap_unchecked(next_level) - } - }; + fn is_empty(&self) -> bool { + self.front == self.back + } - loop { - match cur_handle.right_kv() { - Ok(kv) => { - self.front = first_leaf_edge(ptr::read(&kv).right_edge().descend()); - // Doing the descend invalidates the references returned by `into_kv_mut`, - // so we have to do this last. - let (k, v) = kv.into_kv_mut(); - return (k, v); // coerce k from `&mut K` to `&K` - } - Err(last_edge) => { - let next_level = last_edge.into_node().ascend().ok(); - cur_handle = unwrap_unchecked(next_level); - } - } - } + unsafe fn next_unchecked(&mut self) -> (&'a mut K, &'a mut V) { + self.front.next_unchecked() } } #[stable(feature = "btree_range", since = "1.17.0")] impl<'a, K, V> DoubleEndedIterator for RangeMut<'a, K, V> { fn next_back(&mut self) -> Option<(&'a K, &'a mut V)> { - if self.front == self.back { None } else { unsafe { Some(self.next_back_unchecked()) } } + if self.is_empty() { + None + } else { + let (k, v) = unsafe { self.next_back_unchecked() }; + Some((k, v)) // coerce k from `&mut K` to `&K` + } } } @@ -1791,38 +1730,8 @@ impl<'a, K, V> DoubleEndedIterator for RangeMut<'a, K, V> { impl<K, V> FusedIterator for RangeMut<'_, K, V> {} impl<'a, K, V> RangeMut<'a, K, V> { - unsafe fn next_back_unchecked(&mut self) -> (&'a K, &'a mut V) { - let handle = ptr::read(&self.back); - - let mut cur_handle = match handle.left_kv() { - Ok(kv) => { - self.back = ptr::read(&kv).left_edge(); - // Doing the descend invalidates the references returned by `into_kv_mut`, - // so we have to do this last. - let (k, v) = kv.into_kv_mut(); - return (k, v); // coerce k from `&mut K` to `&K` - } - Err(last_edge) => { - let next_level = last_edge.into_node().ascend().ok(); - unwrap_unchecked(next_level) - } - }; - - loop { - match cur_handle.left_kv() { - Ok(kv) => { - self.back = last_leaf_edge(ptr::read(&kv).left_edge().descend()); - // Doing the descend invalidates the references returned by `into_kv_mut`, - // so we have to do this last. - let (k, v) = kv.into_kv_mut(); - return (k, v); // coerce k from `&mut K` to `&K` - } - Err(last_edge) => { - let next_level = last_edge.into_node().ascend().ok(); - cur_handle = unwrap_unchecked(next_level); - } - } - } + unsafe fn next_back_unchecked(&mut self) -> (&'a mut K, &'a mut V) { + self.back.next_back_unchecked() } } @@ -1921,32 +1830,6 @@ where } } -fn first_leaf_edge<BorrowType, K, V>( - mut node: NodeRef<BorrowType, K, V, marker::LeafOrInternal>, -) -> Handle<NodeRef<BorrowType, K, V, marker::Leaf>, marker::Edge> { - loop { - match node.force() { - Leaf(leaf) => return leaf.first_edge(), - Internal(internal) => { - node = internal.first_edge().descend(); - } - } - } -} - -fn last_leaf_edge<BorrowType, K, V>( - mut node: NodeRef<BorrowType, K, V, marker::LeafOrInternal>, -) -> Handle<NodeRef<BorrowType, K, V, marker::Leaf>, marker::Edge> { - loop { - match node.force() { - Leaf(leaf) => return leaf.last_edge(), - Internal(internal) => { - node = internal.last_edge().descend(); - } - } - } -} - fn range_search<BorrowType, K, V, Q: ?Sized, R: RangeBounds<Q>>( root1: NodeRef<BorrowType, K, V, marker::LeafOrInternal>, root2: NodeRef<BorrowType, K, V, marker::LeafOrInternal>, @@ -2030,8 +1913,13 @@ where } } - let front = Handle::new_edge(min_node, min_edge); - let back = Handle::new_edge(max_node, max_edge); + // Safety guarantee: `min_edge` is always in range for `min_node`, because + // `min_edge` is unconditionally calculated for each iteration's value of `min_node`, + // either (if not found) as the edge index returned by `search_linear`, + // or (if found) as the KV index returned by `search_linear`, possibly + 1. + // Likewise for `max_node` versus `max_edge`. + let front = unsafe { Handle::new_edge(min_node, min_edge) }; + let back = unsafe { Handle::new_edge(max_node, max_edge) }; match (front.force(), back.force()) { (Leaf(f), Leaf(b)) => { return (f, b); @@ -2045,17 +1933,6 @@ where } } -#[inline(always)] -unsafe fn unwrap_unchecked<T>(val: Option<T>) -> T { - val.unwrap_or_else(|| { - if cfg!(debug_assertions) { - panic!("'unchecked' unwrap on None in BTreeMap"); - } else { - intrinsics::unreachable(); - } - }) -} - impl<K, V> BTreeMap<K, V> { /// Gets an iterator over the entries of the map, sorted by key. /// @@ -2082,8 +1959,8 @@ impl<K, V> BTreeMap<K, V> { pub fn iter(&self) -> Iter<'_, K, V> { Iter { range: Range { - front: first_leaf_edge(self.root.as_ref()), - back: last_leaf_edge(self.root.as_ref()), + front: self.root.as_ref().first_leaf_edge(), + back: self.root.as_ref().last_leaf_edge(), }, length: self.length, } @@ -2116,8 +1993,8 @@ impl<K, V> BTreeMap<K, V> { let root2 = unsafe { ptr::read(&root1) }; IterMut { range: RangeMut { - front: first_leaf_edge(root1), - back: last_leaf_edge(root2), + front: root1.first_leaf_edge(), + back: root2.last_leaf_edge(), _marker: PhantomData, }, length: self.length, @@ -2620,7 +2497,7 @@ impl<'a, K: Ord, V> OccupiedEntry<'a, K, V> { let key_loc = internal.kv_mut().0 as *mut K; let val_loc = internal.kv_mut().1 as *mut V; - let to_remove = first_leaf_edge(internal.right_edge().descend()).right_kv().ok(); + let to_remove = internal.right_edge().descend().first_leaf_edge().right_kv().ok(); let to_remove = unsafe { unwrap_unchecked(to_remove) }; let (hole, key, val) = to_remove.remove(); diff --git a/src/liballoc/collections/btree/mod.rs b/src/liballoc/collections/btree/mod.rs index f73a24d0991..fb5825ee21a 100644 --- a/src/liballoc/collections/btree/mod.rs +++ b/src/liballoc/collections/btree/mod.rs @@ -1,4 +1,5 @@ pub mod map; +mod navigate; mod node; mod search; pub mod set; @@ -11,3 +12,14 @@ trait Recover<Q: ?Sized> { fn take(&mut self, key: &Q) -> Option<Self::Key>; fn replace(&mut self, key: Self::Key) -> Option<Self::Key>; } + +#[inline(always)] +pub unsafe fn unwrap_unchecked<T>(val: Option<T>) -> T { + val.unwrap_or_else(|| { + if cfg!(debug_assertions) { + panic!("'unchecked' unwrap on None in BTreeMap"); + } else { + core::intrinsics::unreachable(); + } + }) +} diff --git a/src/liballoc/collections/btree/navigate.rs b/src/liballoc/collections/btree/navigate.rs new file mode 100644 index 00000000000..65321897231 --- /dev/null +++ b/src/liballoc/collections/btree/navigate.rs @@ -0,0 +1,244 @@ +use core::ptr; + +use super::node::{marker, ForceResult::*, Handle, NodeRef}; +use super::unwrap_unchecked; + +macro_rules! def_next { + { unsafe fn $name:ident : $next_kv:ident $next_edge:ident $initial_leaf_edge:ident } => { + /// Given a leaf edge handle into an immutable tree, returns a handle to the next + /// leaf edge and references to the key and value between these edges. + /// Unsafe because the caller must ensure that the given leaf edge has a successor. + unsafe fn $name <'a, K: 'a, V: 'a>( + leaf_edge: Handle<NodeRef<marker::Immut<'a>, K, V, marker::Leaf>, marker::Edge>, + ) -> (Handle<NodeRef<marker::Immut<'a>, K, V, marker::Leaf>, marker::Edge>, &'a K, &'a V) { + let mut cur_handle = match leaf_edge.$next_kv() { + Ok(leaf_kv) => { + let (k, v) = leaf_kv.into_kv(); + let next_leaf_edge = leaf_kv.$next_edge(); + return (next_leaf_edge, k, v); + } + Err(last_edge) => { + let next_level = last_edge.into_node().ascend().ok(); + unwrap_unchecked(next_level) + } + }; + + loop { + cur_handle = match cur_handle.$next_kv() { + Ok(internal_kv) => { + let (k, v) = internal_kv.into_kv(); + let next_internal_edge = internal_kv.$next_edge(); + let next_leaf_edge = next_internal_edge.descend().$initial_leaf_edge(); + return (next_leaf_edge, k, v); + } + Err(last_edge) => { + let next_level = last_edge.into_node().ascend().ok(); + unwrap_unchecked(next_level) + } + } + } + } + }; +} + +macro_rules! def_next_mut { + { unsafe fn $name:ident : $next_kv:ident $next_edge:ident $initial_leaf_edge:ident } => { + /// Given a leaf edge handle into a mutable tree, returns handles to the next + /// leaf edge and to the KV between these edges. + /// Unsafe for two reasons: + /// - the caller must ensure that the given leaf edge has a successor; + /// - both returned handles represent mutable references into the same tree + /// that can easily invalidate each other, even on immutable use. + unsafe fn $name <'a, K: 'a, V: 'a>( + leaf_edge: Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge>, + ) -> (Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge>, + Handle<NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal>, marker::KV>) { + let mut cur_handle = match leaf_edge.$next_kv() { + Ok(leaf_kv) => { + let next_leaf_edge = ptr::read(&leaf_kv).$next_edge(); + return (next_leaf_edge, leaf_kv.forget_node_type()); + } + Err(last_edge) => { + let next_level = last_edge.into_node().ascend().ok(); + unwrap_unchecked(next_level) + } + }; + + loop { + cur_handle = match cur_handle.$next_kv() { + Ok(internal_kv) => { + let next_internal_edge = ptr::read(&internal_kv).$next_edge(); + let next_leaf_edge = next_internal_edge.descend().$initial_leaf_edge(); + return (next_leaf_edge, internal_kv.forget_node_type()); + } + Err(last_edge) => { + let next_level = last_edge.into_node().ascend().ok(); + unwrap_unchecked(next_level) + } + } + } + } + }; +} + +macro_rules! def_next_dealloc { + { unsafe fn $name:ident : $next_kv:ident $next_edge:ident $initial_leaf_edge:ident } => { + /// Given a leaf edge handle into an owned tree, returns a handle to the next + /// leaf edge and the key and value between these edges, while deallocating + /// any node left behind. + /// Unsafe for two reasons: + /// - the caller must ensure that the given leaf edge has a successor; + /// - the node pointed at by the given handle, and its ancestors, may be deallocated, + /// while the reference to those nodes in the surviving ancestors is left dangling; + /// thus using the returned handle is dangerous. + unsafe fn $name <K, V>( + leaf_edge: Handle<NodeRef<marker::Owned, K, V, marker::Leaf>, marker::Edge>, + ) -> (Handle<NodeRef<marker::Owned, K, V, marker::Leaf>, marker::Edge>, K, V) { + let mut cur_handle = match leaf_edge.$next_kv() { + Ok(leaf_kv) => { + let k = ptr::read(leaf_kv.reborrow().into_kv().0); + let v = ptr::read(leaf_kv.reborrow().into_kv().1); + let next_leaf_edge = leaf_kv.$next_edge(); + return (next_leaf_edge, k, v); + } + Err(last_edge) => { + unwrap_unchecked(last_edge.into_node().deallocate_and_ascend()) + } + }; + + loop { + cur_handle = match cur_handle.$next_kv() { + Ok(internal_kv) => { + let k = ptr::read(internal_kv.reborrow().into_kv().0); + let v = ptr::read(internal_kv.reborrow().into_kv().1); + let next_internal_edge = internal_kv.$next_edge(); + let next_leaf_edge = next_internal_edge.descend().$initial_leaf_edge(); + return (next_leaf_edge, k, v); + } + Err(last_edge) => { + unwrap_unchecked(last_edge.into_node().deallocate_and_ascend()) + } + } + } + } + }; +} + +def_next! {unsafe fn next_unchecked: right_kv right_edge first_leaf_edge} +def_next! {unsafe fn next_back_unchecked: left_kv left_edge last_leaf_edge} +def_next_mut! {unsafe fn next_unchecked_mut: right_kv right_edge first_leaf_edge} +def_next_mut! {unsafe fn next_back_unchecked_mut: left_kv left_edge last_leaf_edge} +def_next_dealloc! {unsafe fn next_unchecked_deallocating: right_kv right_edge first_leaf_edge} +def_next_dealloc! {unsafe fn next_back_unchecked_deallocating: left_kv left_edge last_leaf_edge} + +impl<'a, K, V> Handle<NodeRef<marker::Immut<'a>, K, V, marker::Leaf>, marker::Edge> { + /// Moves the leaf edge handle to the next leaf edge and returns references to the + /// key and value in between. + /// Unsafe because the caller must ensure that the leaf edge is not the last one in the tree. + pub unsafe fn next_unchecked(&mut self) -> (&'a K, &'a V) { + let (next_edge, k, v) = next_unchecked(*self); + *self = next_edge; + (k, v) + } + + /// Moves the leaf edge handle to the previous leaf edge and returns references to the + /// key and value in between. + /// Unsafe because the caller must ensure that the leaf edge is not the first one in the tree. + pub unsafe fn next_back_unchecked(&mut self) -> (&'a K, &'a V) { + let (next_edge, k, v) = next_back_unchecked(*self); + *self = next_edge; + (k, v) + } +} + +impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge> { + /// Moves the leaf edge handle to the next leaf edge and returns references to the + /// key and value in between. + /// Unsafe for two reasons: + /// - The caller must ensure that the leaf edge is not the last one in the tree. + /// - Using the updated handle may well invalidate the returned references. + pub unsafe fn next_unchecked(&mut self) -> (&'a mut K, &'a mut V) { + let (next_edge, kv) = next_unchecked_mut(ptr::read(self)); + *self = next_edge; + // Doing the descend (and perhaps another move) invalidates the references + // returned by `into_kv_mut`, so we have to do this last. + kv.into_kv_mut() + } + + /// Moves the leaf edge handle to the previous leaf and returns references to the + /// key and value in between. + /// Unsafe for two reasons: + /// - The caller must ensure that the leaf edge is not the first one in the tree. + /// - Using the updated handle may well invalidate the returned references. + pub unsafe fn next_back_unchecked(&mut self) -> (&'a mut K, &'a mut V) { + let (next_edge, kv) = next_back_unchecked_mut(ptr::read(self)); + *self = next_edge; + // Doing the descend (and perhaps another move) invalidates the references + // returned by `into_kv_mut`, so we have to do this last. + kv.into_kv_mut() + } +} + +impl<K, V> Handle<NodeRef<marker::Owned, K, V, marker::Leaf>, marker::Edge> { + /// Moves the leaf edge handle to the next leaf edge and returns the key and value + /// in between, while deallocating any node left behind. + /// Unsafe for three reasons: + /// - The caller must ensure that the leaf edge is not the last one in the tree + /// and is not a handle previously resulting from counterpart `next_back_unchecked`. + /// - If the leaf edge is the last edge of a node, that node and possibly ancestors + /// will be deallocated, while the reference to those nodes in the surviving ancestor + /// is left dangling; thus further use of the leaf edge handle is dangerous. + /// It is, however, safe to call this method again on the updated handle. + /// if the two preconditions above hold. + /// - Using the updated handle may well invalidate the returned references. + pub unsafe fn next_unchecked(&mut self) -> (K, V) { + let (next_edge, k, v) = next_unchecked_deallocating(ptr::read(self)); + *self = next_edge; + (k, v) + } + + /// Moves the leaf edge handle to the previous leaf edge and returns the key + /// and value in between, while deallocating any node left behind. + /// Unsafe for three reasons: + /// - The caller must ensure that the leaf edge is not the first one in the tree + /// and is not a handle previously resulting from counterpart `next_unchecked`. + /// - If the lead edge is the first edge of a node, that node and possibly ancestors + /// will be deallocated, while the reference to those nodes in the surviving ancestor + /// is left dangling; thus further use of the leaf edge handle is dangerous. + /// It is, however, safe to call this method again on the updated handle. + /// if the two preconditions above hold. + /// - Using the updated handle may well invalidate the returned references. + pub unsafe fn next_back_unchecked(&mut self) -> (K, V) { + let (next_edge, k, v) = next_back_unchecked_deallocating(ptr::read(self)); + *self = next_edge; + (k, v) + } +} + +impl<BorrowType, K, V> NodeRef<BorrowType, K, V, marker::LeafOrInternal> { + /// Returns the leftmost leaf edge in or underneath a node - in other words, the edge + /// you need first when navigating forward (or last when navigating backward). + #[inline] + pub fn first_leaf_edge(self) -> Handle<NodeRef<BorrowType, K, V, marker::Leaf>, marker::Edge> { + let mut node = self; + loop { + match node.force() { + Leaf(leaf) => return leaf.first_edge(), + Internal(internal) => node = internal.first_edge().descend(), + } + } + } + + /// Returns the rightmost leaf edge in or underneath a node - in other words, the edge + /// you need last when navigating forward (or first when navigating backward). + #[inline] + pub fn last_leaf_edge(self) -> Handle<NodeRef<BorrowType, K, V, marker::Leaf>, marker::Edge> { + let mut node = self; + loop { + match node.force() { + Leaf(leaf) => return leaf.last_edge(), + Internal(internal) => node = internal.last_edge().descend(), + } + } + } +} diff --git a/src/liballoc/collections/btree/node.rs b/src/liballoc/collections/btree/node.rs index c0a96e89366..e4123c9a20b 100644 --- a/src/liballoc/collections/btree/node.rs +++ b/src/liballoc/collections/btree/node.rs @@ -263,10 +263,10 @@ impl<K, V> Root<K, V> { /// Removes the root node, using its first child as the new root. This cannot be called when /// the tree consists only of a leaf node. As it is intended only to be called when the root - /// has only one edge, no cleanup is done on any of the other children are elements of the root. + /// has only one edge, no cleanup is done on any of the other children of the root. /// This decreases the height by 1 and is the opposite of `push_level`. pub fn pop_level(&mut self) { - debug_assert!(self.height > 0); + assert!(self.height > 0); let top = self.node.ptr; @@ -344,6 +344,9 @@ impl<'a, K, V> NodeRef<marker::Mut<'a>, K, V, marker::Internal> { impl<BorrowType, K, V, Type> NodeRef<BorrowType, K, V, Type> { /// Finds the length of the node. This is the number of keys or values. In an /// internal node, the number of edges is `len() + 1`. + /// For any node, the number of possible edge handles is also `len() + 1`. + /// Note that, despite being safe, calling this function can have the side effect + /// of invalidating mutable references that unsafe code has created. pub fn len(&self) -> usize { self.as_header().len as usize } @@ -369,7 +372,8 @@ impl<BorrowType, K, V, Type> NodeRef<BorrowType, K, V, Type> { /// If the node is a leaf, this function simply opens up its data. /// If the node is an internal node, so not a leaf, it does have all the data a leaf has /// (header, keys and values), and this function exposes that. - /// See `NodeRef` on why the node may not be a shared root. + /// Unsafe because the node must not be the shared root. For more information, + /// see the `NodeRef` comments. unsafe fn as_leaf(&self) -> &LeafNode<K, V> { debug_assert!(!self.is_shared_root()); self.node.as_ref() @@ -385,14 +389,14 @@ impl<BorrowType, K, V, Type> NodeRef<BorrowType, K, V, Type> { } /// Borrows a view into the keys stored in the node. - /// The caller must ensure that the node is not the shared root. + /// Unsafe because the caller must ensure that the node is not the shared root. pub unsafe fn keys(&self) -> &[K] { self.reborrow().into_key_slice() } /// Borrows a view into the values stored in the node. - /// The caller must ensure that the node is not the shared root. - fn vals(&self) -> &[V] { + /// Unsafe because the caller must ensure that the node is not the shared root. + unsafe fn vals(&self) -> &[V] { self.reborrow().into_val_slice() } @@ -424,25 +428,26 @@ impl<BorrowType, K, V, Type> NodeRef<BorrowType, K, V, Type> { } pub fn first_edge(self) -> Handle<Self, marker::Edge> { - Handle::new_edge(self, 0) + unsafe { Handle::new_edge(self, 0) } } pub fn last_edge(self) -> Handle<Self, marker::Edge> { let len = self.len(); - Handle::new_edge(self, len) + unsafe { Handle::new_edge(self, len) } } /// Note that `self` must be nonempty. pub fn first_kv(self) -> Handle<Self, marker::KV> { - debug_assert!(self.len() > 0); - Handle::new_kv(self, 0) + let len = self.len(); + assert!(len > 0); + unsafe { Handle::new_kv(self, 0) } } /// Note that `self` must be nonempty. pub fn last_kv(self) -> Handle<Self, marker::KV> { let len = self.len(); - debug_assert!(len > 0); - Handle::new_kv(self, len - 1) + assert!(len > 0); + unsafe { Handle::new_kv(self, len - 1) } } } @@ -453,7 +458,7 @@ impl<K, V> NodeRef<marker::Owned, K, V, marker::Leaf> { pub unsafe fn deallocate_and_ascend( self, ) -> Option<Handle<NodeRef<marker::Owned, K, V, marker::Internal>, marker::Edge>> { - debug_assert!(!self.is_shared_root()); + assert!(!self.is_shared_root()); let node = self.node; let ret = self.ascend().ok(); Global.dealloc(node.cast(), Layout::new::<LeafNode<K, V>>()); @@ -508,36 +513,36 @@ impl<'a, K, V, Type> NodeRef<marker::Mut<'a>, K, V, Type> { self.node.as_ptr() } - /// The caller must ensure that the node is not the shared root. - fn keys_mut(&mut self) -> &mut [K] { - unsafe { self.reborrow_mut().into_key_slice_mut() } + /// Unsafe because the caller must ensure that the node is not the shared root. + unsafe fn keys_mut(&mut self) -> &mut [K] { + self.reborrow_mut().into_key_slice_mut() } - /// The caller must ensure that the node is not the shared root. - fn vals_mut(&mut self) -> &mut [V] { - unsafe { self.reborrow_mut().into_val_slice_mut() } + /// Unsafe because the caller must ensure that the node is not the shared root. + unsafe fn vals_mut(&mut self) -> &mut [V] { + self.reborrow_mut().into_val_slice_mut() } } impl<'a, K: 'a, V: 'a, Type> NodeRef<marker::Immut<'a>, K, V, Type> { - /// The caller must ensure that the node is not the shared root. + /// Unsafe because the caller must ensure that the node is not the shared root. unsafe fn into_key_slice(self) -> &'a [K] { debug_assert!(!self.is_shared_root()); // We cannot be the shared root, so `as_leaf` is okay. slice::from_raw_parts(MaybeUninit::first_ptr(&self.as_leaf().keys), self.len()) } - /// The caller must ensure that the node is not the shared root. - fn into_val_slice(self) -> &'a [V] { + /// Unsafe because the caller must ensure that the node is not the shared root. + unsafe fn into_val_slice(self) -> &'a [V] { debug_assert!(!self.is_shared_root()); // We cannot be the shared root, so `as_leaf` is okay. - unsafe { slice::from_raw_parts(MaybeUninit::first_ptr(&self.as_leaf().vals), self.len()) } + slice::from_raw_parts(MaybeUninit::first_ptr(&self.as_leaf().vals), self.len()) } - /// The caller must ensure that the node is not the shared root. - fn into_slices(self) -> (&'a [K], &'a [V]) { - let k = unsafe { ptr::read(&self) }; - (unsafe { k.into_key_slice() }, self.into_val_slice()) + /// Unsafe because the caller must ensure that the node is not the shared root. + unsafe fn into_slices(self) -> (&'a [K], &'a [V]) { + let k = ptr::read(&self); + (k.into_key_slice(), self.into_val_slice()) } } @@ -548,54 +553,45 @@ impl<'a, K: 'a, V: 'a, Type> NodeRef<marker::Mut<'a>, K, V, Type> { unsafe { &mut *(self.root as *mut Root<K, V>) } } - /// The caller must ensure that the node is not the shared root. - fn into_key_slice_mut(mut self) -> &'a mut [K] { + /// Unsafe because the caller must ensure that the node is not the shared root. + unsafe fn into_key_slice_mut(mut self) -> &'a mut [K] { debug_assert!(!self.is_shared_root()); // We cannot be the shared root, so `as_leaf_mut` is okay. - unsafe { - slice::from_raw_parts_mut( - MaybeUninit::first_ptr_mut(&mut (*self.as_leaf_mut()).keys), - self.len(), - ) - } + slice::from_raw_parts_mut( + MaybeUninit::first_ptr_mut(&mut (*self.as_leaf_mut()).keys), + self.len(), + ) } - /// The caller must ensure that the node is not the shared root. - fn into_val_slice_mut(mut self) -> &'a mut [V] { + /// Unsafe because the caller must ensure that the node is not the shared root. + unsafe fn into_val_slice_mut(mut self) -> &'a mut [V] { debug_assert!(!self.is_shared_root()); - unsafe { - slice::from_raw_parts_mut( - MaybeUninit::first_ptr_mut(&mut (*self.as_leaf_mut()).vals), - self.len(), - ) - } + slice::from_raw_parts_mut( + MaybeUninit::first_ptr_mut(&mut (*self.as_leaf_mut()).vals), + self.len(), + ) } - /// The caller must ensure that the node is not the shared root. - fn into_slices_mut(mut self) -> (&'a mut [K], &'a mut [V]) { + /// Unsafe because the caller must ensure that the node is not the shared root. + unsafe fn into_slices_mut(mut self) -> (&'a mut [K], &'a mut [V]) { debug_assert!(!self.is_shared_root()); // We cannot use the getters here, because calling the second one // invalidates the reference returned by the first. // More precisely, it is the call to `len` that is the culprit, // because that creates a shared reference to the header, which *can* // overlap with the keys (and even the values, for ZST keys). - unsafe { - let len = self.len(); - let leaf = self.as_leaf_mut(); - let keys = - slice::from_raw_parts_mut(MaybeUninit::first_ptr_mut(&mut (*leaf).keys), len); - let vals = - slice::from_raw_parts_mut(MaybeUninit::first_ptr_mut(&mut (*leaf).vals), len); - (keys, vals) - } + let len = self.len(); + let leaf = self.as_leaf_mut(); + let keys = slice::from_raw_parts_mut(MaybeUninit::first_ptr_mut(&mut (*leaf).keys), len); + let vals = slice::from_raw_parts_mut(MaybeUninit::first_ptr_mut(&mut (*leaf).vals), len); + (keys, vals) } } impl<'a, K, V> NodeRef<marker::Mut<'a>, K, V, marker::Leaf> { /// Adds a key/value pair the end of the node. pub fn push(&mut self, key: K, val: V) { - // Necessary for correctness, but this is an internal module - debug_assert!(self.len() < CAPACITY); + assert!(self.len() < CAPACITY); debug_assert!(!self.is_shared_root()); let idx = self.len(); @@ -610,8 +606,7 @@ impl<'a, K, V> NodeRef<marker::Mut<'a>, K, V, marker::Leaf> { /// Adds a key/value pair to the beginning of the node. pub fn push_front(&mut self, key: K, val: V) { - // Necessary for correctness, but this is an internal module - debug_assert!(self.len() < CAPACITY); + assert!(self.len() < CAPACITY); debug_assert!(!self.is_shared_root()); unsafe { @@ -627,9 +622,8 @@ impl<'a, K, V> NodeRef<marker::Mut<'a>, K, V, marker::Internal> { /// Adds a key/value pair and an edge to go to the right of that pair to /// the end of the node. pub fn push(&mut self, key: K, val: V, edge: Root<K, V>) { - // Necessary for correctness, but this is an internal module - debug_assert!(edge.height == self.height - 1); - debug_assert!(self.len() < CAPACITY); + assert!(edge.height == self.height - 1); + assert!(self.len() < CAPACITY); debug_assert!(!self.is_shared_root()); let idx = self.len(); @@ -645,23 +639,25 @@ impl<'a, K, V> NodeRef<marker::Mut<'a>, K, V, marker::Internal> { } } - fn correct_childrens_parent_links(&mut self, first: usize, after_last: usize) { + // Unsafe because 'first' and 'after_last' must be in range + unsafe fn correct_childrens_parent_links(&mut self, first: usize, after_last: usize) { + debug_assert!(first <= self.len()); + debug_assert!(after_last <= self.len() + 1); for i in first..after_last { - Handle::new_edge(unsafe { self.reborrow_mut() }, i).correct_parent_link(); + Handle::new_edge(self.reborrow_mut(), i).correct_parent_link(); } } fn correct_all_childrens_parent_links(&mut self) { let len = self.len(); - self.correct_childrens_parent_links(0, len + 1); + unsafe { self.correct_childrens_parent_links(0, len + 1) }; } /// Adds a key/value pair and an edge to go to the left of that pair to /// the beginning of the node. pub fn push_front(&mut self, key: K, val: V, edge: Root<K, V>) { - // Necessary for correctness, but this is an internal module - debug_assert!(edge.height == self.height - 1); - debug_assert!(self.len() < CAPACITY); + assert!(edge.height == self.height - 1); + assert!(self.len() < CAPACITY); debug_assert!(!self.is_shared_root()); unsafe { @@ -687,8 +683,7 @@ impl<'a, K, V> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> { /// Removes a key/value pair from the end of this node. If this is an internal node, /// also removes the edge that was to the right of that pair. pub fn pop(&mut self) -> (K, V, Option<Root<K, V>>) { - // Necessary for correctness, but this is an internal module - debug_assert!(self.len() > 0); + assert!(self.len() > 0); let idx = self.len() - 1; @@ -714,8 +709,7 @@ impl<'a, K, V> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> { /// Removes a key/value pair from the beginning of this node. If this is an internal node, /// also removes the edge that was to the left of that pair. pub fn pop_front(&mut self) -> (K, V, Option<Root<K, V>>) { - // Necessary for correctness, but this is an internal module - debug_assert!(self.len() > 0); + assert!(self.len() > 0); let old_len = self.len(); @@ -750,8 +744,8 @@ impl<'a, K, V> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> { } } - /// The caller must ensure that the node is not the shared root. - fn into_kv_pointers_mut(mut self) -> (*mut K, *mut V) { + /// Unsafe because the caller must ensure that the node is not the shared root. + unsafe fn into_kv_pointers_mut(mut self) -> (*mut K, *mut V) { (self.keys_mut().as_mut_ptr(), self.vals_mut().as_mut_ptr()) } } @@ -813,20 +807,20 @@ impl<Node, Type> Handle<Node, Type> { } impl<BorrowType, K, V, NodeType> Handle<NodeRef<BorrowType, K, V, NodeType>, marker::KV> { - /// Creates a new handle to a key/value pair in `node`. `idx` must be less than `node.len()`. - pub fn new_kv(node: NodeRef<BorrowType, K, V, NodeType>, idx: usize) -> Self { - // Necessary for correctness, but in a private module + /// Creates a new handle to a key/value pair in `node`. + /// Unsafe because the caller must ensure that `idx < node.len()`. + pub unsafe fn new_kv(node: NodeRef<BorrowType, K, V, NodeType>, idx: usize) -> Self { debug_assert!(idx < node.len()); Handle { node, idx, _marker: PhantomData } } pub fn left_edge(self) -> Handle<NodeRef<BorrowType, K, V, NodeType>, marker::Edge> { - Handle::new_edge(self.node, self.idx) + unsafe { Handle::new_edge(self.node, self.idx) } } pub fn right_edge(self) -> Handle<NodeRef<BorrowType, K, V, NodeType>, marker::Edge> { - Handle::new_edge(self.node, self.idx + 1) + unsafe { Handle::new_edge(self.node, self.idx + 1) } } } @@ -868,21 +862,28 @@ impl<'a, K, V, NodeType, HandleType> Handle<NodeRef<marker::Mut<'a>, K, V, NodeT } impl<BorrowType, K, V, NodeType> Handle<NodeRef<BorrowType, K, V, NodeType>, marker::Edge> { - /// Creates a new handle to an edge in `node`. `idx` must be less than or equal to - /// `node.len()`. - pub fn new_edge(node: NodeRef<BorrowType, K, V, NodeType>, idx: usize) -> Self { - // Necessary for correctness, but in a private module + /// Creates a new handle to an edge in `node`. + /// Unsafe because the caller must ensure that `idx <= node.len()`. + pub unsafe fn new_edge(node: NodeRef<BorrowType, K, V, NodeType>, idx: usize) -> Self { debug_assert!(idx <= node.len()); Handle { node, idx, _marker: PhantomData } } pub fn left_kv(self) -> Result<Handle<NodeRef<BorrowType, K, V, NodeType>, marker::KV>, Self> { - if self.idx > 0 { Ok(Handle::new_kv(self.node, self.idx - 1)) } else { Err(self) } + if self.idx > 0 { + Ok(unsafe { Handle::new_kv(self.node, self.idx - 1) }) + } else { + Err(self) + } } pub fn right_kv(self) -> Result<Handle<NodeRef<BorrowType, K, V, NodeType>, marker::KV>, Self> { - if self.idx < self.node.len() { Ok(Handle::new_kv(self.node, self.idx)) } else { Err(self) } + if self.idx < self.node.len() { + Ok(unsafe { Handle::new_kv(self.node, self.idx) }) + } else { + Err(self) + } } } @@ -914,9 +915,10 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge pub fn insert(mut self, key: K, val: V) -> (InsertResult<'a, K, V, marker::Leaf>, *mut V) { if self.node.len() < CAPACITY { let ptr = self.insert_fit(key, val); - (InsertResult::Fit(Handle::new_kv(self.node, self.idx)), ptr) + let kv = unsafe { Handle::new_kv(self.node, self.idx) }; + (InsertResult::Fit(kv), ptr) } else { - let middle = Handle::new_kv(self.node, B); + let middle = unsafe { Handle::new_kv(self.node, B) }; let (mut left, k, v, mut right) = middle.split(); let ptr = if self.idx <= B { unsafe { Handle::new_edge(left.reborrow_mut(), self.idx).insert_fit(key, val) } @@ -991,14 +993,14 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker:: val: V, edge: Root<K, V>, ) -> InsertResult<'a, K, V, marker::Internal> { - // Necessary for correctness, but this is an internal module - debug_assert!(edge.height == self.node.height - 1); + assert!(edge.height == self.node.height - 1); if self.node.len() < CAPACITY { self.insert_fit(key, val, edge); - InsertResult::Fit(Handle::new_kv(self.node, self.idx)) + let kv = unsafe { Handle::new_kv(self.node, self.idx) }; + InsertResult::Fit(kv) } else { - let middle = Handle::new_kv(self.node, B); + let middle = unsafe { Handle::new_kv(self.node, B) }; let (mut left, k, v, mut right) = middle.split(); if self.idx <= B { unsafe { @@ -1037,15 +1039,19 @@ impl<BorrowType, K, V> Handle<NodeRef<BorrowType, K, V, marker::Internal>, marke impl<'a, K: 'a, V: 'a, NodeType> Handle<NodeRef<marker::Immut<'a>, K, V, NodeType>, marker::KV> { pub fn into_kv(self) -> (&'a K, &'a V) { - let (keys, vals) = self.node.into_slices(); - unsafe { (keys.get_unchecked(self.idx), vals.get_unchecked(self.idx)) } + unsafe { + let (keys, vals) = self.node.into_slices(); + (keys.get_unchecked(self.idx), vals.get_unchecked(self.idx)) + } } } impl<'a, K: 'a, V: 'a, NodeType> Handle<NodeRef<marker::Mut<'a>, K, V, NodeType>, marker::KV> { pub fn into_kv_mut(self) -> (&'a mut K, &'a mut V) { - let (keys, vals) = self.node.into_slices_mut(); - unsafe { (keys.get_unchecked_mut(self.idx), vals.get_unchecked_mut(self.idx)) } + unsafe { + let (keys, vals) = self.node.into_slices_mut(); + (keys.get_unchecked_mut(self.idx), vals.get_unchecked_mut(self.idx)) + } } } @@ -1067,7 +1073,7 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::KV> /// - All the key/value pairs to the right of this handle are put into a newly /// allocated node. pub fn split(mut self) -> (NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, K, V, Root<K, V>) { - debug_assert!(!self.node.is_shared_root()); + assert!(!self.node.is_shared_root()); unsafe { let mut new_node = Box::new(LeafNode::new()); @@ -1099,7 +1105,7 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::KV> pub fn remove( mut self, ) -> (Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge>, K, V) { - debug_assert!(!self.node.is_shared_root()); + assert!(!self.node.is_shared_root()); unsafe { let k = slice_remove(self.node.keys_mut(), self.idx); let v = slice_remove(self.node.vals_mut(), self.idx); @@ -1182,7 +1188,7 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker:: let right_len = right_node.len(); // necessary for correctness, but in a private module - debug_assert!(left_len + right_len + 1 <= CAPACITY); + assert!(left_len + right_len + 1 <= CAPACITY); unsafe { ptr::write( @@ -1281,8 +1287,8 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker:: let right_len = right_node.len(); // Make sure that we may steal safely. - debug_assert!(right_len + count <= CAPACITY); - debug_assert!(left_len >= count); + assert!(right_len + count <= CAPACITY); + assert!(left_len >= count); let new_left_len = left_len - count; @@ -1338,8 +1344,8 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker:: let right_len = right_node.len(); // Make sure that we may steal safely. - debug_assert!(left_len + count <= CAPACITY); - debug_assert!(right_len >= count); + assert!(left_len + count <= CAPACITY); + assert!(right_len >= count); let new_right_len = right_len - count; @@ -1412,6 +1418,22 @@ unsafe fn move_edges<K, V>( dest.correct_childrens_parent_links(dest_offset, dest_offset + count); } +impl<BorrowType, K, V> Handle<NodeRef<BorrowType, K, V, marker::Leaf>, marker::KV> { + pub fn forget_node_type( + self, + ) -> Handle<NodeRef<BorrowType, K, V, marker::LeafOrInternal>, marker::KV> { + unsafe { Handle::new_kv(self.node.forget_type(), self.idx) } + } +} + +impl<BorrowType, K, V> Handle<NodeRef<BorrowType, K, V, marker::Internal>, marker::KV> { + pub fn forget_node_type( + self, + ) -> Handle<NodeRef<BorrowType, K, V, marker::LeafOrInternal>, marker::KV> { + unsafe { Handle::new_kv(self.node.forget_type(), self.idx) } + } +} + impl<BorrowType, K, V, HandleType> Handle<NodeRef<BorrowType, K, V, marker::LeafOrInternal>, HandleType> { @@ -1447,24 +1469,26 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal>, ma let right_new_len = left_node.len() - left_new_len; let mut right_node = right.reborrow_mut(); - debug_assert!(right_node.len() == 0); - debug_assert!(left_node.height == right_node.height); + assert!(right_node.len() == 0); + assert!(left_node.height == right_node.height); - let left_kv = left_node.reborrow_mut().into_kv_pointers_mut(); - let right_kv = right_node.reborrow_mut().into_kv_pointers_mut(); + if right_new_len > 0 { + let left_kv = left_node.reborrow_mut().into_kv_pointers_mut(); + let right_kv = right_node.reborrow_mut().into_kv_pointers_mut(); - move_kv(left_kv, left_new_len, right_kv, 0, right_new_len); + move_kv(left_kv, left_new_len, right_kv, 0, right_new_len); - (*left_node.reborrow_mut().as_leaf_mut()).len = left_new_len as u16; - (*right_node.reborrow_mut().as_leaf_mut()).len = right_new_len as u16; + (*left_node.reborrow_mut().as_leaf_mut()).len = left_new_len as u16; + (*right_node.reborrow_mut().as_leaf_mut()).len = right_new_len as u16; - match (left_node.force(), right_node.force()) { - (ForceResult::Internal(left), ForceResult::Internal(right)) => { - move_edges(left, left_new_len + 1, right, 1, right_new_len); - } - (ForceResult::Leaf(_), ForceResult::Leaf(_)) => {} - _ => { - unreachable!(); + match (left_node.force(), right_node.force()) { + (ForceResult::Internal(left), ForceResult::Internal(right)) => { + move_edges(left, left_new_len + 1, right, 1, right_new_len); + } + (ForceResult::Leaf(_), ForceResult::Leaf(_)) => {} + _ => { + unreachable!(); + } } } } diff --git a/src/liballoc/collections/btree/search.rs b/src/liballoc/collections/btree/search.rs index 579624cdd2b..e680e364147 100644 --- a/src/liballoc/collections/btree/search.rs +++ b/src/liballoc/collections/btree/search.rs @@ -41,8 +41,8 @@ where K: Borrow<Q>, { match search_linear(&node, key) { - (idx, true) => Found(Handle::new_kv(node, idx)), - (idx, false) => SearchResult::GoDown(Handle::new_edge(node, idx)), + (idx, true) => Found(unsafe { Handle::new_kv(node, idx) }), + (idx, false) => SearchResult::GoDown(unsafe { Handle::new_edge(node, idx) }), } } diff --git a/src/liballoc/collections/btree/set.rs b/src/liballoc/collections/btree/set.rs index f5487426814..b100ce754ca 100644 --- a/src/liballoc/collections/btree/set.rs +++ b/src/liballoc/collections/btree/set.rs @@ -56,12 +56,23 @@ use crate::collections::btree_map::{self, BTreeMap, Keys}; /// println!("{}", book); /// } /// ``` -#[derive(Clone, Hash, PartialEq, Eq, Ord, PartialOrd)] +#[derive(Hash, PartialEq, Eq, Ord, PartialOrd)] #[stable(feature = "rust1", since = "1.0.0")] pub struct BTreeSet<T> { map: BTreeMap<T, ()>, } +#[stable(feature = "rust1", since = "1.0.0")] +impl<T: Clone> Clone for BTreeSet<T> { + fn clone(&self) -> Self { + BTreeSet { map: self.map.clone() } + } + + fn clone_from(&mut self, other: &Self) { + self.map.clone_from(&other.map); + } +} + /// An iterator over the items of a `BTreeSet`. /// /// This `struct` is created by the [`iter`] method on [`BTreeSet`]. diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 38c6fa91cc5..ffa4176cc79 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -60,6 +60,7 @@ #![stable(feature = "alloc", since = "1.36.0")] #![doc( html_root_url = "https://doc.rust-lang.org/nightly/", + html_playground_url = "https://play.rust-lang.org/", issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/", test(no_crate_inject, attr(allow(unused_variables), deny(warnings))) )] diff --git a/src/liballoc/tests/btree/map.rs b/src/liballoc/tests/btree/map.rs index f5be72c39b2..0d009507fc7 100644 --- a/src/liballoc/tests/btree/map.rs +++ b/src/liballoc/tests/btree/map.rs @@ -786,6 +786,26 @@ fn test_clone() { } #[test] +fn test_clone_from() { + let mut map1 = BTreeMap::new(); + let size = 30; + + for i in 0..size { + let mut map2 = BTreeMap::new(); + for j in 0..i { + let mut map1_copy = map2.clone(); + map1_copy.clone_from(&map1); + assert_eq!(map1_copy, map1); + let mut map2_copy = map1.clone(); + map2_copy.clone_from(&map2); + assert_eq!(map2_copy, map2); + map2.insert(100 * j + 1, 2 * j + 1); + } + map1.insert(i, 10 * i); + } +} + +#[test] #[allow(dead_code)] fn test_variance() { use std::collections::btree_map::{IntoIter, Iter, Keys, Range, Values}; diff --git a/src/libcore/any.rs b/src/libcore/any.rs index af02e84d3fa..97ef513cbcc 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -194,7 +194,9 @@ impl dyn Any { #[inline] pub fn downcast_ref<T: Any>(&self) -> Option<&T> { if self.is::<T>() { - // SAFETY: just checked whether we are pointing to the correct type + // SAFETY: just checked whether we are pointing to the correct type, and we can rely on + // that check for memory safety because we have implemented Any for all types; no other + // impls can exist as they would conflict with our impl. unsafe { Some(&*(self as *const dyn Any as *const T)) } } else { None @@ -228,7 +230,9 @@ impl dyn Any { #[inline] pub fn downcast_mut<T: Any>(&mut self) -> Option<&mut T> { if self.is::<T>() { - // SAFETY: just checked whether we are pointing to the correct type + // SAFETY: just checked whether we are pointing to the correct type, and we can rely on + // that check for memory safety because we have implemented Any for all types; no other + // impls can exist as they would conflict with our impl. unsafe { Some(&mut *(self as *mut dyn Any as *mut T)) } } else { None diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 3ea4baa57b4..e41a7afd3e2 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -35,7 +35,7 @@ use self::Ordering::*; /// /// This trait allows for partial equality, for types that do not have a full /// equivalence relation. For example, in floating point numbers `NaN != NaN`, -/// so floating point types implement `PartialEq` but not `Eq`. +/// so floating point types implement `PartialEq` but not [`Eq`]. /// /// Formally, the equality must be (for all `a`, `b` and `c`): /// @@ -55,12 +55,12 @@ use self::Ordering::*; /// /// ## How can I implement `PartialEq`? /// -/// PartialEq only requires the `eq` method to be implemented; `ne` is defined -/// in terms of it by default. Any manual implementation of `ne` *must* respect -/// the rule that `eq` is a strict inverse of `ne`; that is, `!(a == b)` if and +/// `PartialEq` only requires the [`eq`] method to be implemented; [`ne`] is defined +/// in terms of it by default. Any manual implementation of [`ne`] *must* respect +/// the rule that [`eq`] is a strict inverse of [`ne`]; that is, `!(a == b)` if and /// only if `a != b`. /// -/// Implementations of `PartialEq`, `PartialOrd`, and `Ord` *must* agree with +/// Implementations of `PartialEq`, [`PartialOrd`], and [`Ord`] *must* agree with /// each other. It's easy to accidentally make them disagree by deriving some /// of the traits and manually implementing others. /// @@ -190,6 +190,9 @@ use self::Ordering::*; /// assert_eq!(x == y, false); /// assert_eq!(x.eq(&y), false); /// ``` +/// +/// [`eq`]: PartialEq::eq +/// [`ne`]: PartialEq::ne #[lang = "eq"] #[stable(feature = "rust1", since = "1.0.0")] #[doc(alias = "==")] @@ -233,7 +236,7 @@ pub macro PartialEq($item:item) { /// - transitive: `a == b` and `b == c` implies `a == c`. /// /// This property cannot be checked by the compiler, and therefore `Eq` implies -/// `PartialEq`, and has no extra methods. +/// [`PartialEq`], and has no extra methods. /// /// ## Derivable /// @@ -370,6 +373,7 @@ impl Ordering { /// Chains two orderings. /// /// Returns `self` when it's not `Equal`. Otherwise returns `other`. + /// /// # Examples /// /// ``` @@ -442,10 +446,12 @@ impl Ordering { /// A helper struct for reverse ordering. /// -/// This struct is a helper to be used with functions like `Vec::sort_by_key` and +/// This struct is a helper to be used with functions like [`Vec::sort_by_key`] and /// can be used to reverse order a part of a key. /// -/// Example usage: +/// [`Vec::sort_by_key`]: ../../std/vec/struct.Vec.html#method.sort_by_key +/// +/// # Examples /// /// ``` /// use std::cmp::Reverse; @@ -506,12 +512,12 @@ impl<T: Ord> Ord for Reverse<T> { /// /// ## How can I implement `Ord`? /// -/// `Ord` requires that the type also be `PartialOrd` and `Eq` (which requires `PartialEq`). +/// `Ord` requires that the type also be [`PartialOrd`] and [`Eq`] (which requires [`PartialEq`]). /// -/// Then you must define an implementation for `cmp()`. You may find it useful to use -/// `cmp()` on your type's fields. +/// Then you must define an implementation for [`cmp`]. You may find it useful to use +/// [`cmp`] on your type's fields. /// -/// Implementations of `PartialEq`, `PartialOrd`, and `Ord` *must* +/// Implementations of [`PartialEq`], [`PartialOrd`], and `Ord` *must* /// agree with each other. That is, `a.cmp(b) == Ordering::Equal` if /// and only if `a == b` and `Some(a.cmp(b)) == a.partial_cmp(b)` for /// all `a` and `b`. It's easy to accidentally make them disagree by @@ -548,13 +554,15 @@ impl<T: Ord> Ord for Reverse<T> { /// } /// } /// ``` +/// +/// [`cmp`]: Ord::cmp #[doc(alias = "<")] #[doc(alias = ">")] #[doc(alias = "<=")] #[doc(alias = ">=")] #[stable(feature = "rust1", since = "1.0.0")] pub trait Ord: Eq + PartialOrd<Self> { - /// This method returns an `Ordering` between `self` and `other`. + /// This method returns an [`Ordering`] between `self` and `other`. /// /// By convention, `self.cmp(&other)` returns the ordering matching the expression /// `self <operator> other` if true. @@ -689,20 +697,20 @@ impl PartialOrd for Ordering { /// /// ## How can I implement `PartialOrd`? /// -/// `PartialOrd` only requires implementation of the `partial_cmp` method, with the others +/// `PartialOrd` only requires implementation of the [`partial_cmp`] method, with the others /// generated from default implementations. /// /// However it remains possible to implement the others separately for types which do not have a /// total order. For example, for floating point numbers, `NaN < 0 == false` and `NaN >= 0 == /// false` (cf. IEEE 754-2008 section 5.11). /// -/// `PartialOrd` requires your type to be `PartialEq`. +/// `PartialOrd` requires your type to be [`PartialEq`]. /// -/// Implementations of `PartialEq`, `PartialOrd`, and `Ord` *must* agree with each other. It's +/// Implementations of [`PartialEq`], `PartialOrd`, and [`Ord`] *must* agree with each other. It's /// easy to accidentally make them disagree by deriving some of the traits and manually /// implementing others. /// -/// If your type is `Ord`, you can implement `partial_cmp()` by using `cmp()`: +/// If your type is [`Ord`], you can implement [`partial_cmp`] by using [`cmp`]: /// /// ``` /// use std::cmp::Ordering; @@ -733,7 +741,7 @@ impl PartialOrd for Ordering { /// } /// ``` /// -/// You may also find it useful to use `partial_cmp()` on your type's fields. Here +/// You may also find it useful to use [`partial_cmp`] on your type's fields. Here /// is an example of `Person` types who have a floating-point `height` field that /// is the only field to be used for sorting: /// @@ -768,6 +776,9 @@ impl PartialOrd for Ordering { /// assert_eq!(x < y, true); /// assert_eq!(x.lt(&y), true); /// ``` +/// +/// [`partial_cmp`]: PartialOrd::partial_cmp +/// [`cmp`]: Ord::cmp #[lang = "partial_ord"] #[stable(feature = "rust1", since = "1.0.0")] #[doc(alias = ">")] @@ -893,7 +904,7 @@ pub macro PartialOrd($item:item) { /// /// Returns the first argument if the comparison determines them to be equal. /// -/// Internally uses an alias to `Ord::min`. +/// Internally uses an alias to [`Ord::min`]. /// /// # Examples /// @@ -956,7 +967,7 @@ pub fn min_by_key<T, F: FnMut(&T) -> K, K: Ord>(v1: T, v2: T, mut f: F) -> T { /// /// Returns the second argument if the comparison determines them to be equal. /// -/// Internally uses an alias to `Ord::max`. +/// Internally uses an alias to [`Ord::max`]. /// /// # Examples /// diff --git a/src/libcore/iter/adapters/mod.rs b/src/libcore/iter/adapters/mod.rs index 5787b9174ed..7d10ef3d282 100644 --- a/src/libcore/iter/adapters/mod.rs +++ b/src/libcore/iter/adapters/mod.rs @@ -1752,6 +1752,95 @@ where } } +/// An iterator that only accepts elements while `predicate` returns `Some(_)`. +/// +/// This `struct` is created by the [`map_while`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`map_while`]: trait.Iterator.html#method.map_while +/// [`Iterator`]: trait.Iterator.html +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[unstable(feature = "iter_map_while", reason = "recently added", issue = "68537")] +#[derive(Clone)] +pub struct MapWhile<I, P> { + iter: I, + finished: bool, + predicate: P, +} + +impl<I, P> MapWhile<I, P> { + pub(super) fn new(iter: I, predicate: P) -> MapWhile<I, P> { + MapWhile { iter, finished: false, predicate } + } +} + +#[unstable(feature = "iter_map_while", reason = "recently added", issue = "68537")] +impl<I: fmt::Debug, P> fmt::Debug for MapWhile<I, P> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("MapWhile").field("iter", &self.iter).field("flag", &self.finished).finish() + } +} + +#[unstable(feature = "iter_map_while", reason = "recently added", issue = "68537")] +impl<B, I: Iterator, P> Iterator for MapWhile<I, P> +where + P: FnMut(I::Item) -> Option<B>, +{ + type Item = B; + + #[inline] + fn next(&mut self) -> Option<B> { + if self.finished { + None + } else { + let x = self.iter.next()?; + let ret = (self.predicate)(x); + self.finished = ret.is_none(); + ret + } + } + + #[inline] + fn size_hint(&self) -> (usize, Option<usize>) { + if self.finished { + (0, Some(0)) + } else { + let (_, upper) = self.iter.size_hint(); + (0, upper) // can't know a lower bound, due to the predicate + } + } + + #[inline] + fn try_fold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> R + where + Self: Sized, + Fold: FnMut(Acc, Self::Item) -> R, + R: Try<Ok = Acc>, + { + fn check<'a, B, T, Acc, R: Try<Ok = Acc>>( + flag: &'a mut bool, + p: &'a mut impl FnMut(T) -> Option<B>, + mut fold: impl FnMut(Acc, B) -> R + 'a, + ) -> impl FnMut(Acc, T) -> LoopState<Acc, R> + 'a { + move |acc, x| match p(x) { + Some(item) => LoopState::from_try(fold(acc, item)), + None => { + *flag = true; + LoopState::Break(Try::from_ok(acc)) + } + } + } + + if self.finished { + Try::from_ok(init) + } else { + let flag = &mut self.finished; + let p = &mut self.predicate; + self.iter.try_fold(init, check(flag, p, fold)).into_try() + } + } +} + #[stable(feature = "fused", since = "1.26.0")] impl<I, P> FusedIterator for TakeWhile<I, P> where diff --git a/src/libcore/iter/mod.rs b/src/libcore/iter/mod.rs index 0d5af3986fb..d8a56cb3ae5 100644 --- a/src/libcore/iter/mod.rs +++ b/src/libcore/iter/mod.rs @@ -351,6 +351,8 @@ pub use self::adapters::Cloned; pub use self::adapters::Copied; #[stable(feature = "iterator_flatten", since = "1.29.0")] pub use self::adapters::Flatten; +#[unstable(feature = "iter_map_while", reason = "recently added", issue = "68537")] +pub use self::adapters::MapWhile; #[stable(feature = "iterator_step_by", since = "1.28.0")] pub use self::adapters::StepBy; #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libcore/iter/traits/iterator.rs b/src/libcore/iter/traits/iterator.rs index 21a569867b1..1d055676c77 100644 --- a/src/libcore/iter/traits/iterator.rs +++ b/src/libcore/iter/traits/iterator.rs @@ -1,4 +1,6 @@ // ignore-tidy-filelength +// This file almost exclusively consists of the definition of `Iterator`. We +// can't split that into multiple files. use crate::cmp::{self, Ordering}; use crate::ops::{Add, Try}; @@ -7,7 +9,9 @@ use super::super::LoopState; use super::super::{Chain, Cloned, Copied, Cycle, Enumerate, Filter, FilterMap, Fuse}; use super::super::{FlatMap, Flatten}; use super::super::{FromIterator, Product, Sum, Zip}; -use super::super::{Inspect, Map, Peekable, Rev, Scan, Skip, SkipWhile, StepBy, Take, TakeWhile}; +use super::super::{ + Inspect, Map, MapWhile, Peekable, Rev, Scan, Skip, SkipWhile, StepBy, Take, TakeWhile, +}; fn _assert_is_object_safe(_: &dyn Iterator<Item = ()>) {} @@ -1026,6 +1030,102 @@ pub trait Iterator { TakeWhile::new(self, predicate) } + /// Creates an iterator that both yields elements based on a predicate and maps. + /// + /// `map_while()` takes a closure as an argument. It will call this + /// closure on each element of the iterator, and yield elements + /// while it returns [`Some(_)`][`Some`]. + /// + /// After [`None`] is returned, `map_while()`'s job is over, and the + /// rest of the elements are ignored. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// #![feature(iter_map_while)] + /// let a = [-1i32, 4, 0, 1]; + /// + /// let mut iter = a.iter().map_while(|x| 16i32.checked_div(*x)); + /// + /// assert_eq!(iter.next(), Some(-16)); + /// assert_eq!(iter.next(), Some(4)); + /// assert_eq!(iter.next(), None); + /// ``` + /// + /// Here's the same example, but with [`take_while`] and [`map`]: + /// + /// [`take_while`]: #method.take_while + /// [`map`]: #method.map + /// + /// ``` + /// let a = [-1i32, 4, 0, 1]; + /// + /// let mut iter = a.iter() + /// .map(|x| 16i32.checked_div(*x)) + /// .take_while(|x| x.is_some()) + /// .map(|x| x.unwrap()); + /// + /// assert_eq!(iter.next(), Some(-16)); + /// assert_eq!(iter.next(), Some(4)); + /// assert_eq!(iter.next(), None); + /// ``` + /// + /// Stopping after an initial [`None`]: + /// + /// ``` + /// #![feature(iter_map_while)] + /// use std::convert::TryFrom; + /// + /// let a = [0, -1, 1, -2]; + /// + /// let mut iter = a.iter().map_while(|x| u32::try_from(*x).ok()); + /// + /// assert_eq!(iter.next(), Some(0u32)); + /// + /// // We have more elements that are fit in u32, but since we already + /// // got a None, map_while() isn't used any more + /// assert_eq!(iter.next(), None); + /// ``` + /// + /// Because `map_while()` needs to look at the value in order to see if it + /// should be included or not, consuming iterators will see that it is + /// removed: + /// + /// ``` + /// #![feature(iter_map_while)] + /// use std::convert::TryFrom; + /// + /// let a = [1, 2, -3, 4]; + /// let mut iter = a.iter(); + /// + /// let result: Vec<u32> = iter.by_ref() + /// .map_while(|n| u32::try_from(*n).ok()) + /// .collect(); + /// + /// assert_eq!(result, &[1, 2]); + /// + /// let result: Vec<i32> = iter.cloned().collect(); + /// + /// assert_eq!(result, &[4]); + /// ``` + /// + /// The `-3` is no longer there, because it was consumed in order to see if + /// the iteration should stop, but wasn't placed back into the iterator. + /// + /// [`Some`]: ../../std/option/enum.Option.html#variant.Some + /// [`None`]: ../../std/option/enum.Option.html#variant.None + #[inline] + #[unstable(feature = "iter_map_while", reason = "recently added", issue = "68537")] + fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P> + where + Self: Sized, + P: FnMut(Self::Item) -> Option<B>, + { + MapWhile::new(self, predicate) + } + /// Creates an iterator that skips the first `n` elements. /// /// After they have been consumed, the rest of the elements are yielded. diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index f77b4d7461e..ce7ddffd825 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -134,6 +134,7 @@ #![feature(const_type_id)] #![feature(const_caller_location)] #![cfg_attr(bootstrap, feature(slice_patterns))] +#![feature(assoc_int_consts)] #[prelude_import] #[allow(unused)] diff --git a/src/libcore/num/dec2flt/rawfp.rs b/src/libcore/num/dec2flt/rawfp.rs index a127c6c3fa7..0ab15b23e53 100644 --- a/src/libcore/num/dec2flt/rawfp.rs +++ b/src/libcore/num/dec2flt/rawfp.rs @@ -129,15 +129,15 @@ macro_rules! other_constants { ($type: ident) => { const EXPLICIT_SIG_BITS: u8 = Self::SIG_BITS - 1; const MAX_EXP: i16 = (1 << (Self::EXP_BITS - 1)) - 1; - const MIN_EXP: i16 = -Self::MAX_EXP + 1; - const MAX_EXP_INT: i16 = Self::MAX_EXP - (Self::SIG_BITS as i16 - 1); + const MIN_EXP: i16 = -<Self as RawFloat>::MAX_EXP + 1; + const MAX_EXP_INT: i16 = <Self as RawFloat>::MAX_EXP - (Self::SIG_BITS as i16 - 1); const MAX_ENCODED_EXP: i16 = (1 << Self::EXP_BITS) - 1; - const MIN_EXP_INT: i16 = Self::MIN_EXP - (Self::SIG_BITS as i16 - 1); + const MIN_EXP_INT: i16 = <Self as RawFloat>::MIN_EXP - (Self::SIG_BITS as i16 - 1); const MAX_SIG: u64 = (1 << Self::SIG_BITS) - 1; const MIN_SIG: u64 = 1 << (Self::SIG_BITS - 1); - const INFINITY: Self = $crate::$type::INFINITY; - const NAN: Self = $crate::$type::NAN; + const INFINITY: Self = $type::INFINITY; + const NAN: Self = $type::NAN; const ZERO: Self = 0.0; }; } diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index 505484c2a49..da8dd9acd9f 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -15,14 +15,14 @@ use crate::num::FpCategory; /// The radix or base of the internal representation of `f32`. #[stable(feature = "rust1", since = "1.0.0")] -pub const RADIX: u32 = 2; +pub const RADIX: u32 = f32::RADIX; /// Number of significant digits in base 2. #[stable(feature = "rust1", since = "1.0.0")] -pub const MANTISSA_DIGITS: u32 = 24; +pub const MANTISSA_DIGITS: u32 = f32::MANTISSA_DIGITS; /// Approximate number of significant digits in base 10. #[stable(feature = "rust1", since = "1.0.0")] -pub const DIGITS: u32 = 6; +pub const DIGITS: u32 = f32::DIGITS; /// [Machine epsilon] value for `f32`. /// @@ -30,41 +30,41 @@ pub const DIGITS: u32 = 6; /// /// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon #[stable(feature = "rust1", since = "1.0.0")] -pub const EPSILON: f32 = 1.1920929e-7_f32; +pub const EPSILON: f32 = f32::EPSILON; /// Smallest finite `f32` value. #[stable(feature = "rust1", since = "1.0.0")] -pub const MIN: f32 = -3.40282347e+38_f32; +pub const MIN: f32 = f32::MIN; /// Smallest positive normal `f32` value. #[stable(feature = "rust1", since = "1.0.0")] -pub const MIN_POSITIVE: f32 = 1.17549435e-38_f32; +pub const MIN_POSITIVE: f32 = f32::MIN_POSITIVE; /// Largest finite `f32` value. #[stable(feature = "rust1", since = "1.0.0")] -pub const MAX: f32 = 3.40282347e+38_f32; +pub const MAX: f32 = f32::MAX; /// One greater than the minimum possible normal power of 2 exponent. #[stable(feature = "rust1", since = "1.0.0")] -pub const MIN_EXP: i32 = -125; +pub const MIN_EXP: i32 = f32::MIN_EXP; /// Maximum possible power of 2 exponent. #[stable(feature = "rust1", since = "1.0.0")] -pub const MAX_EXP: i32 = 128; +pub const MAX_EXP: i32 = f32::MAX_EXP; /// Minimum possible normal power of 10 exponent. #[stable(feature = "rust1", since = "1.0.0")] -pub const MIN_10_EXP: i32 = -37; +pub const MIN_10_EXP: i32 = f32::MIN_10_EXP; /// Maximum possible power of 10 exponent. #[stable(feature = "rust1", since = "1.0.0")] -pub const MAX_10_EXP: i32 = 38; +pub const MAX_10_EXP: i32 = f32::MAX_10_EXP; /// Not a Number (NaN). #[stable(feature = "rust1", since = "1.0.0")] -pub const NAN: f32 = 0.0_f32 / 0.0_f32; +pub const NAN: f32 = f32::NAN; /// Infinity (∞). #[stable(feature = "rust1", since = "1.0.0")] -pub const INFINITY: f32 = 1.0_f32 / 0.0_f32; +pub const INFINITY: f32 = f32::INFINITY; /// Negative infinity (−∞). #[stable(feature = "rust1", since = "1.0.0")] -pub const NEG_INFINITY: f32 = -1.0_f32 / 0.0_f32; +pub const NEG_INFINITY: f32 = f32::NEG_INFINITY; /// Basic mathematical constants. #[stable(feature = "rust1", since = "1.0.0")] @@ -153,6 +153,60 @@ pub mod consts { #[lang = "f32"] #[cfg(not(test))] impl f32 { + /// The radix or base of the internal representation of `f32`. + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const RADIX: u32 = 2; + + /// Number of significant digits in base 2. + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const MANTISSA_DIGITS: u32 = 24; + + /// Approximate number of significant digits in base 10. + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const DIGITS: u32 = 6; + + /// [Machine epsilon] value for `f32`. + /// + /// This is the difference between `1.0` and the next larger representable number. + /// + /// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const EPSILON: f32 = 1.19209290e-07_f32; + + /// Smallest finite `f32` value. + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const MIN: f32 = -3.40282347e+38_f32; + /// Smallest positive normal `f32` value. + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const MIN_POSITIVE: f32 = 1.17549435e-38_f32; + /// Largest finite `f32` value. + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const MAX: f32 = 3.40282347e+38_f32; + + /// One greater than the minimum possible normal power of 2 exponent. + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const MIN_EXP: i32 = -125; + /// Maximum possible power of 2 exponent. + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const MAX_EXP: i32 = 128; + + /// Minimum possible normal power of 10 exponent. + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const MIN_10_EXP: i32 = -37; + /// Maximum possible power of 10 exponent. + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const MAX_10_EXP: i32 = 38; + + /// Not a Number (NaN). + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const NAN: f32 = 0.0_f32 / 0.0_f32; + /// Infinity (∞). + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const INFINITY: f32 = 1.0_f32 / 0.0_f32; + /// Negative infinity (-∞). + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const NEG_INFINITY: f32 = -1.0_f32 / 0.0_f32; + /// Returns `true` if this value is `NaN`. /// /// ``` diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs index 8f3af42d25d..a6081f184ab 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -15,14 +15,14 @@ use crate::num::FpCategory; /// The radix or base of the internal representation of `f64`. #[stable(feature = "rust1", since = "1.0.0")] -pub const RADIX: u32 = 2; +pub const RADIX: u32 = f64::RADIX; /// Number of significant digits in base 2. #[stable(feature = "rust1", since = "1.0.0")] -pub const MANTISSA_DIGITS: u32 = 53; +pub const MANTISSA_DIGITS: u32 = f64::MANTISSA_DIGITS; /// Approximate number of significant digits in base 10. #[stable(feature = "rust1", since = "1.0.0")] -pub const DIGITS: u32 = 15; +pub const DIGITS: u32 = f64::DIGITS; /// [Machine epsilon] value for `f64`. /// @@ -30,41 +30,41 @@ pub const DIGITS: u32 = 15; /// /// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon #[stable(feature = "rust1", since = "1.0.0")] -pub const EPSILON: f64 = 2.2204460492503131e-16_f64; +pub const EPSILON: f64 = f64::EPSILON; /// Smallest finite `f64` value. #[stable(feature = "rust1", since = "1.0.0")] -pub const MIN: f64 = -1.7976931348623157e+308_f64; +pub const MIN: f64 = f64::MIN; /// Smallest positive normal `f64` value. #[stable(feature = "rust1", since = "1.0.0")] -pub const MIN_POSITIVE: f64 = 2.2250738585072014e-308_f64; +pub const MIN_POSITIVE: f64 = f64::MIN_POSITIVE; /// Largest finite `f64` value. #[stable(feature = "rust1", since = "1.0.0")] -pub const MAX: f64 = 1.7976931348623157e+308_f64; +pub const MAX: f64 = f64::MAX; /// One greater than the minimum possible normal power of 2 exponent. #[stable(feature = "rust1", since = "1.0.0")] -pub const MIN_EXP: i32 = -1021; +pub const MIN_EXP: i32 = f64::MIN_EXP; /// Maximum possible power of 2 exponent. #[stable(feature = "rust1", since = "1.0.0")] -pub const MAX_EXP: i32 = 1024; +pub const MAX_EXP: i32 = f64::MAX_EXP; /// Minimum possible normal power of 10 exponent. #[stable(feature = "rust1", since = "1.0.0")] -pub const MIN_10_EXP: i32 = -307; +pub const MIN_10_EXP: i32 = f64::MIN_10_EXP; /// Maximum possible power of 10 exponent. #[stable(feature = "rust1", since = "1.0.0")] -pub const MAX_10_EXP: i32 = 308; +pub const MAX_10_EXP: i32 = f64::MAX_10_EXP; /// Not a Number (NaN). #[stable(feature = "rust1", since = "1.0.0")] -pub const NAN: f64 = 0.0_f64 / 0.0_f64; +pub const NAN: f64 = f64::NAN; /// Infinity (∞). #[stable(feature = "rust1", since = "1.0.0")] -pub const INFINITY: f64 = 1.0_f64 / 0.0_f64; +pub const INFINITY: f64 = f64::INFINITY; /// Negative infinity (−∞). #[stable(feature = "rust1", since = "1.0.0")] -pub const NEG_INFINITY: f64 = -1.0_f64 / 0.0_f64; +pub const NEG_INFINITY: f64 = f64::NEG_INFINITY; /// Basic mathematical constants. #[stable(feature = "rust1", since = "1.0.0")] @@ -153,6 +153,59 @@ pub mod consts { #[lang = "f64"] #[cfg(not(test))] impl f64 { + /// The radix or base of the internal representation of `f64`. + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const RADIX: u32 = 2; + + /// Number of significant digits in base 2. + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const MANTISSA_DIGITS: u32 = 53; + /// Approximate number of significant digits in base 10. + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const DIGITS: u32 = 15; + + /// [Machine epsilon] value for `f64`. + /// + /// This is the difference between `1.0` and the next larger representable number. + /// + /// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const EPSILON: f64 = 2.2204460492503131e-16_f64; + + /// Smallest finite `f64` value. + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const MIN: f64 = -1.7976931348623157e+308_f64; + /// Smallest positive normal `f64` value. + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const MIN_POSITIVE: f64 = 2.2250738585072014e-308_f64; + /// Largest finite `f64` value. + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const MAX: f64 = 1.7976931348623157e+308_f64; + + /// One greater than the minimum possible normal power of 2 exponent. + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const MIN_EXP: i32 = -1021; + /// Maximum possible power of 2 exponent. + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const MAX_EXP: i32 = 1024; + + /// Minimum possible normal power of 10 exponent. + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const MIN_10_EXP: i32 = -307; + /// Maximum possible power of 10 exponent. + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const MAX_10_EXP: i32 = 308; + + /// Not a Number (NaN). + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const NAN: f64 = 0.0_f64 / 0.0_f64; + /// Infinity (∞). + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const INFINITY: f64 = 1.0_f64 / 0.0_f64; + /// Negative infinity (-∞). + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const NEG_INFINITY: f64 = -1.0_f64 / 0.0_f64; + /// Returns `true` if this value is `NaN`. /// /// ``` diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 91848abd68d..39c7d6d24ed 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -91,8 +91,12 @@ assert_eq!(size_of::<Option<core::num::", stringify!($Ty), ">>(), size_of::<", s #[stable(feature = "from_nonzero", since = "1.31.0")] impl From<$Ty> for $Int { - fn from(nonzero: $Ty) -> Self { - nonzero.0 + doc_comment! { + concat!( +"Converts a `", stringify!($Ty), "` into an `", stringify!($Int), "`"), + fn from(nonzero: $Ty) -> Self { + nonzero.0 + } } } @@ -245,42 +249,56 @@ macro_rules! int_impl { $reversed:expr, $le_bytes:expr, $be_bytes:expr, $to_xe_bytes_doc:expr, $from_xe_bytes_doc:expr) => { doc_comment! { - concat!("Returns the smallest value that can be represented by this integer type. + concat!("The smallest value that can be represented by this integer type. # Examples Basic usage: ``` -", $Feature, "assert_eq!(", stringify!($SelfT), "::min_value(), ", stringify!($Min), ");", +#![feature(assoc_int_consts)] +", $Feature, "assert_eq!(", stringify!($SelfT), "::MIN, ", stringify!($Min), ");", $EndFeature, " ```"), - #[stable(feature = "rust1", since = "1.0.0")] - #[inline(always)] - #[rustc_promotable] - #[rustc_const_stable(feature = "const_min_value", since = "1.32.0")] - pub const fn min_value() -> Self { - !0 ^ ((!0 as $UnsignedT) >> 1) as Self - } + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const MIN: Self = !0 ^ ((!0 as $UnsignedT) >> 1) as Self; } doc_comment! { - concat!("Returns the largest value that can be represented by this integer type. + concat!("The largest value that can be represented by this integer type. # Examples Basic usage: ``` -", $Feature, "assert_eq!(", stringify!($SelfT), "::max_value(), ", stringify!($Max), ");", +#![feature(assoc_int_consts)] +", $Feature, "assert_eq!(", stringify!($SelfT), "::MAX, ", stringify!($Max), ");", $EndFeature, " ```"), + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const MAX: Self = !Self::MIN; + } + + doc_comment! { + "Returns the smallest value that can be represented by this integer type.", + #[stable(feature = "rust1", since = "1.0.0")] + #[inline(always)] + #[rustc_promotable] + #[rustc_const_stable(feature = "const_min_value", since = "1.32.0")] + pub const fn min_value() -> Self { + Self::MIN + } + } + + doc_comment! { + "Returns the largest value that can be represented by this integer type.", #[stable(feature = "rust1", since = "1.0.0")] #[inline(always)] #[rustc_promotable] #[rustc_const_stable(feature = "const_max_value", since = "1.32.0")] pub const fn max_value() -> Self { - !Self::min_value() + Self::MAX } } @@ -2384,38 +2402,52 @@ macro_rules! uint_impl { $reversed:expr, $le_bytes:expr, $be_bytes:expr, $to_xe_bytes_doc:expr, $from_xe_bytes_doc:expr) => { doc_comment! { - concat!("Returns the smallest value that can be represented by this integer type. + concat!("The smallest value that can be represented by this integer type. # Examples Basic usage: ``` -", $Feature, "assert_eq!(", stringify!($SelfT), "::min_value(), 0);", $EndFeature, " +#![feature(assoc_int_consts)] +", $Feature, "assert_eq!(", stringify!($SelfT), "::MIN, 0);", $EndFeature, " ```"), - #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_promotable] - #[inline(always)] - #[rustc_const_stable(feature = "const_min_value", since = "1.32.0")] - pub const fn min_value() -> Self { 0 } + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const MIN: Self = 0; } doc_comment! { - concat!("Returns the largest value that can be represented by this integer type. + concat!("The largest value that can be represented by this integer type. # Examples Basic usage: ``` -", $Feature, "assert_eq!(", stringify!($SelfT), "::max_value(), ", -stringify!($MaxV), ");", $EndFeature, " +#![feature(assoc_int_consts)] +", $Feature, "assert_eq!(", stringify!($SelfT), "::MAX, ", stringify!($MaxV), ");", +$EndFeature, " ```"), + #[unstable(feature = "assoc_int_consts", reason = "recently added", issue = "68490")] + pub const MAX: Self = !0; + } + + doc_comment! { + "Returns the smallest value that can be represented by this integer type.", + #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_promotable] + #[inline(always)] + #[rustc_const_stable(feature = "const_max_value", since = "1.32.0")] + pub const fn min_value() -> Self { Self::MIN } + } + + doc_comment! { + "Returns the largest value that can be represented by this integer type.", #[stable(feature = "rust1", since = "1.0.0")] #[rustc_promotable] #[inline(always)] #[rustc_const_stable(feature = "const_max_value", since = "1.32.0")] - pub const fn max_value() -> Self { !0 } + pub const fn max_value() -> Self { Self::MAX } } doc_comment! { diff --git a/src/libcore/tests/iter.rs b/src/libcore/tests/iter.rs index 8b8dc941534..bd3218ec27f 100644 --- a/src/libcore/tests/iter.rs +++ b/src/libcore/tests/iter.rs @@ -1477,6 +1477,7 @@ fn test_iterator_size_hint() { assert_eq!(c.clone().take(5).size_hint(), (5, Some(5))); assert_eq!(c.clone().skip(5).size_hint().1, None); assert_eq!(c.clone().take_while(|_| false).size_hint(), (0, None)); + assert_eq!(c.clone().map_while(|_| None::<()>).size_hint(), (0, None)); assert_eq!(c.clone().skip_while(|_| false).size_hint(), (0, None)); assert_eq!(c.clone().enumerate().size_hint(), (usize::MAX, None)); assert_eq!(c.clone().chain(vi.clone().cloned()).size_hint(), (usize::MAX, None)); @@ -1491,6 +1492,7 @@ fn test_iterator_size_hint() { assert_eq!(vi.clone().skip(3).size_hint(), (7, Some(7))); assert_eq!(vi.clone().skip(12).size_hint(), (0, Some(0))); assert_eq!(vi.clone().take_while(|_| false).size_hint(), (0, Some(10))); + assert_eq!(vi.clone().map_while(|_| None::<()>).size_hint(), (0, Some(10))); assert_eq!(vi.clone().skip_while(|_| false).size_hint(), (0, Some(10))); assert_eq!(vi.clone().enumerate().size_hint(), (10, Some(10))); assert_eq!(vi.clone().chain(v2).size_hint(), (13, Some(13))); diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index 567c840b01a..8fd19ef67fc 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -36,6 +36,7 @@ #![feature(iter_is_partitioned)] #![feature(iter_order_by)] #![feature(cmp_min_max_by)] +#![feature(iter_map_while)] #![feature(const_slice_from_raw_parts)] #![feature(const_raw_ptr_deref)] #![feature(never_type)] diff --git a/src/librustc/hir/check_attr.rs b/src/librustc/hir/check_attr.rs index 86eab3d92d3..db5e31981c0 100644 --- a/src/librustc/hir/check_attr.rs +++ b/src/librustc/hir/check_attr.rs @@ -4,32 +4,19 @@ //! conflicts between multiple such attributes attached to the same //! item. -use crate::hir::map::Map; -use crate::ty::query::Providers; -use crate::ty::TyCtxt; - -use rustc_errors::struct_span_err; use rustc_hir as hir; -use rustc_hir::def_id::DefId; -use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor}; -use rustc_hir::DUMMY_HIR_ID; -use rustc_hir::{self, HirId, Item, ItemKind, TraitItem, TraitItemKind}; -use rustc_session::lint::builtin::UNUSED_ATTRIBUTES; -use rustc_span::symbol::sym; -use rustc_span::Span; -use syntax::ast::Attribute; -use syntax::attr; +use rustc_hir::{Item, ItemKind, TraitItem, TraitItemKind}; use std::fmt::{self, Display}; #[derive(Copy, Clone, PartialEq)] -pub(crate) enum MethodKind { +pub enum MethodKind { Trait { body: bool }, Inherent, } #[derive(Copy, Clone, PartialEq)] -pub(crate) enum Target { +pub enum Target { ExternCrate, Use, Static, @@ -94,7 +81,7 @@ impl Display for Target { } impl Target { - pub(crate) fn from_item(item: &Item<'_>) -> Target { + pub fn from_item(item: &Item<'_>) -> Target { match item.kind { ItemKind::ExternCrate(..) => Target::ExternCrate, ItemKind::Use(..) => Target::Use, @@ -115,7 +102,7 @@ impl Target { } } - fn from_trait_item(trait_item: &TraitItem<'_>) -> Target { + pub fn from_trait_item(trait_item: &TraitItem<'_>) -> Target { match trait_item.kind { TraitItemKind::Const(..) => Target::AssocConst, TraitItemKind::Method(_, hir::TraitMethod::Required(_)) => { @@ -128,457 +115,11 @@ impl Target { } } - fn from_foreign_item(foreign_item: &hir::ForeignItem<'_>) -> Target { + pub fn from_foreign_item(foreign_item: &hir::ForeignItem<'_>) -> Target { match foreign_item.kind { hir::ForeignItemKind::Fn(..) => Target::ForeignFn, hir::ForeignItemKind::Static(..) => Target::ForeignStatic, hir::ForeignItemKind::Type => Target::ForeignTy, } } - - fn from_impl_item<'tcx>(tcx: TyCtxt<'tcx>, impl_item: &hir::ImplItem<'_>) -> Target { - match impl_item.kind { - hir::ImplItemKind::Const(..) => Target::AssocConst, - hir::ImplItemKind::Method(..) => { - let parent_hir_id = tcx.hir().get_parent_item(impl_item.hir_id); - let containing_item = tcx.hir().expect_item(parent_hir_id); - let containing_impl_is_for_trait = match &containing_item.kind { - hir::ItemKind::Impl { ref of_trait, .. } => of_trait.is_some(), - _ => bug!("parent of an ImplItem must be an Impl"), - }; - if containing_impl_is_for_trait { - Target::Method(MethodKind::Trait { body: true }) - } else { - Target::Method(MethodKind::Inherent) - } - } - hir::ImplItemKind::TyAlias(..) | hir::ImplItemKind::OpaqueTy(..) => Target::AssocTy, - } - } -} - -struct CheckAttrVisitor<'tcx> { - tcx: TyCtxt<'tcx>, -} - -impl CheckAttrVisitor<'tcx> { - /// Checks any attribute. - fn check_attributes( - &self, - hir_id: HirId, - attrs: &'hir [Attribute], - span: &Span, - target: Target, - item: Option<&Item<'_>>, - ) { - let mut is_valid = true; - for attr in attrs { - is_valid &= if attr.check_name(sym::inline) { - self.check_inline(hir_id, attr, span, target) - } else if attr.check_name(sym::non_exhaustive) { - self.check_non_exhaustive(attr, span, target) - } else if attr.check_name(sym::marker) { - self.check_marker(attr, span, target) - } else if attr.check_name(sym::target_feature) { - self.check_target_feature(attr, span, target) - } else if attr.check_name(sym::track_caller) { - self.check_track_caller(&attr.span, attrs, span, target) - } else { - true - }; - } - - if !is_valid { - return; - } - - if target == Target::Fn { - self.tcx.codegen_fn_attrs(self.tcx.hir().local_def_id(hir_id)); - } - - self.check_repr(attrs, span, target, item); - self.check_used(attrs, target); - } - - /// Checks if an `#[inline]` is applied to a function or a closure. Returns `true` if valid. - fn check_inline(&self, hir_id: HirId, attr: &Attribute, span: &Span, target: Target) -> bool { - match target { - Target::Fn - | Target::Closure - | Target::Method(MethodKind::Trait { body: true }) - | Target::Method(MethodKind::Inherent) => true, - Target::Method(MethodKind::Trait { body: false }) | Target::ForeignFn => { - self.tcx - .struct_span_lint_hir( - UNUSED_ATTRIBUTES, - hir_id, - attr.span, - "`#[inline]` is ignored on function prototypes", - ) - .emit(); - true - } - // FIXME(#65833): We permit associated consts to have an `#[inline]` attribute with - // just a lint, because we previously erroneously allowed it and some crates used it - // accidentally, to to be compatible with crates depending on them, we can't throw an - // error here. - Target::AssocConst => { - self.tcx - .struct_span_lint_hir( - UNUSED_ATTRIBUTES, - hir_id, - attr.span, - "`#[inline]` is ignored on constants", - ) - .warn( - "this was previously accepted by the compiler but is \ - being phased out; it will become a hard error in \ - a future release!", - ) - .note( - "for more information, see issue #65833 \ - <https://github.com/rust-lang/rust/issues/65833>", - ) - .emit(); - true - } - _ => { - struct_span_err!( - self.tcx.sess, - attr.span, - E0518, - "attribute should be applied to function or closure", - ) - .span_label(*span, "not a function or closure") - .emit(); - false - } - } - } - - /// Checks if a `#[track_caller]` is applied to a non-naked function. Returns `true` if valid. - fn check_track_caller( - &self, - attr_span: &Span, - attrs: &'hir [Attribute], - span: &Span, - target: Target, - ) -> bool { - match target { - Target::Fn if attr::contains_name(attrs, sym::naked) => { - struct_span_err!( - self.tcx.sess, - *attr_span, - E0736, - "cannot use `#[track_caller]` with `#[naked]`", - ) - .emit(); - false - } - Target::Fn | Target::Method(MethodKind::Inherent) => true, - Target::Method(_) => { - struct_span_err!( - self.tcx.sess, - *attr_span, - E0738, - "`#[track_caller]` may not be used on trait methods", - ) - .emit(); - false - } - _ => { - struct_span_err!( - self.tcx.sess, - *attr_span, - E0739, - "attribute should be applied to function" - ) - .span_label(*span, "not a function") - .emit(); - false - } - } - } - - /// Checks if the `#[non_exhaustive]` attribute on an `item` is valid. Returns `true` if valid. - fn check_non_exhaustive(&self, attr: &Attribute, span: &Span, target: Target) -> bool { - match target { - Target::Struct | Target::Enum => true, - _ => { - struct_span_err!( - self.tcx.sess, - attr.span, - E0701, - "attribute can only be applied to a struct or enum" - ) - .span_label(*span, "not a struct or enum") - .emit(); - false - } - } - } - - /// Checks if the `#[marker]` attribute on an `item` is valid. Returns `true` if valid. - fn check_marker(&self, attr: &Attribute, span: &Span, target: Target) -> bool { - match target { - Target::Trait => true, - _ => { - self.tcx - .sess - .struct_span_err(attr.span, "attribute can only be applied to a trait") - .span_label(*span, "not a trait") - .emit(); - false - } - } - } - - /// Checks if the `#[target_feature]` attribute on `item` is valid. Returns `true` if valid. - fn check_target_feature(&self, attr: &Attribute, span: &Span, target: Target) -> bool { - match target { - Target::Fn - | Target::Method(MethodKind::Trait { body: true }) - | Target::Method(MethodKind::Inherent) => true, - _ => { - self.tcx - .sess - .struct_span_err(attr.span, "attribute should be applied to a function") - .span_label(*span, "not a function") - .emit(); - false - } - } - } - - /// Checks if the `#[repr]` attributes on `item` are valid. - fn check_repr( - &self, - attrs: &'hir [Attribute], - span: &Span, - target: Target, - item: Option<&Item<'_>>, - ) { - // Extract the names of all repr hints, e.g., [foo, bar, align] for: - // ``` - // #[repr(foo)] - // #[repr(bar, align(8))] - // ``` - let hints: Vec<_> = attrs - .iter() - .filter(|attr| attr.check_name(sym::repr)) - .filter_map(|attr| attr.meta_item_list()) - .flatten() - .collect(); - - let mut int_reprs = 0; - let mut is_c = false; - let mut is_simd = false; - let mut is_transparent = false; - - for hint in &hints { - let (article, allowed_targets) = match hint.name_or_empty() { - name @ sym::C | name @ sym::align => { - is_c |= name == sym::C; - match target { - Target::Struct | Target::Union | Target::Enum => continue, - _ => ("a", "struct, enum, or union"), - } - } - sym::packed => { - if target != Target::Struct && target != Target::Union { - ("a", "struct or union") - } else { - continue; - } - } - sym::simd => { - is_simd = true; - if target != Target::Struct { ("a", "struct") } else { continue } - } - sym::transparent => { - is_transparent = true; - match target { - Target::Struct | Target::Union | Target::Enum => continue, - _ => ("a", "struct, enum, or union"), - } - } - sym::i8 - | sym::u8 - | sym::i16 - | sym::u16 - | sym::i32 - | sym::u32 - | sym::i64 - | sym::u64 - | sym::isize - | sym::usize => { - int_reprs += 1; - if target != Target::Enum { ("an", "enum") } else { continue } - } - _ => continue, - }; - self.emit_repr_error( - hint.span(), - *span, - &format!("attribute should be applied to {}", allowed_targets), - &format!("not {} {}", article, allowed_targets), - ) - } - - // Just point at all repr hints if there are any incompatibilities. - // This is not ideal, but tracking precisely which ones are at fault is a huge hassle. - let hint_spans = hints.iter().map(|hint| hint.span()); - - // Error on repr(transparent, <anything else>). - if is_transparent && hints.len() > 1 { - let hint_spans: Vec<_> = hint_spans.clone().collect(); - struct_span_err!( - self.tcx.sess, - hint_spans, - E0692, - "transparent {} cannot have other repr hints", - target - ) - .emit(); - } - // Warn on repr(u8, u16), repr(C, simd), and c-like-enum-repr(C, u8) - if (int_reprs > 1) - || (is_simd && is_c) - || (int_reprs == 1 && is_c && item.map_or(false, |item| is_c_like_enum(item))) - { - struct_span_err!( - self.tcx.sess, - hint_spans.collect::<Vec<Span>>(), - E0566, - "conflicting representation hints", - ) - .emit(); - } - } - - fn emit_repr_error( - &self, - hint_span: Span, - label_span: Span, - hint_message: &str, - label_message: &str, - ) { - struct_span_err!(self.tcx.sess, hint_span, E0517, "{}", hint_message) - .span_label(label_span, label_message) - .emit(); - } - - fn check_stmt_attributes(&self, stmt: &hir::Stmt<'_>) { - // When checking statements ignore expressions, they will be checked later - if let hir::StmtKind::Local(ref l) = stmt.kind { - for attr in l.attrs.iter() { - if attr.check_name(sym::inline) { - self.check_inline(DUMMY_HIR_ID, attr, &stmt.span, Target::Statement); - } - if attr.check_name(sym::repr) { - self.emit_repr_error( - attr.span, - stmt.span, - "attribute should not be applied to a statement", - "not a struct, enum, or union", - ); - } - } - } - } - - fn check_expr_attributes(&self, expr: &hir::Expr<'_>) { - let target = match expr.kind { - hir::ExprKind::Closure(..) => Target::Closure, - _ => Target::Expression, - }; - for attr in expr.attrs.iter() { - if attr.check_name(sym::inline) { - self.check_inline(DUMMY_HIR_ID, attr, &expr.span, target); - } - if attr.check_name(sym::repr) { - self.emit_repr_error( - attr.span, - expr.span, - "attribute should not be applied to an expression", - "not defining a struct, enum, or union", - ); - } - } - } - - fn check_used(&self, attrs: &'hir [Attribute], target: Target) { - for attr in attrs { - if attr.check_name(sym::used) && target != Target::Static { - self.tcx - .sess - .span_err(attr.span, "attribute must be applied to a `static` variable"); - } - } - } -} - -impl Visitor<'tcx> for CheckAttrVisitor<'tcx> { - type Map = Map<'tcx>; - - fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> { - NestedVisitorMap::OnlyBodies(&self.tcx.hir()) - } - - fn visit_item(&mut self, item: &'tcx Item<'tcx>) { - let target = Target::from_item(item); - self.check_attributes(item.hir_id, item.attrs, &item.span, target, Some(item)); - intravisit::walk_item(self, item) - } - - fn visit_trait_item(&mut self, trait_item: &'tcx TraitItem<'tcx>) { - let target = Target::from_trait_item(trait_item); - self.check_attributes(trait_item.hir_id, &trait_item.attrs, &trait_item.span, target, None); - intravisit::walk_trait_item(self, trait_item) - } - - fn visit_foreign_item(&mut self, f_item: &'tcx hir::ForeignItem<'tcx>) { - let target = Target::from_foreign_item(f_item); - self.check_attributes(f_item.hir_id, &f_item.attrs, &f_item.span, target, None); - intravisit::walk_foreign_item(self, f_item) - } - - fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem<'tcx>) { - let target = Target::from_impl_item(self.tcx, impl_item); - self.check_attributes(impl_item.hir_id, &impl_item.attrs, &impl_item.span, target, None); - intravisit::walk_impl_item(self, impl_item) - } - - fn visit_stmt(&mut self, stmt: &'tcx hir::Stmt<'tcx>) { - self.check_stmt_attributes(stmt); - intravisit::walk_stmt(self, stmt) - } - - fn visit_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) { - self.check_expr_attributes(expr); - intravisit::walk_expr(self, expr) - } -} - -fn is_c_like_enum(item: &Item<'_>) -> bool { - if let ItemKind::Enum(ref def, _) = item.kind { - for variant in def.variants { - match variant.data { - hir::VariantData::Unit(..) => { /* continue */ } - _ => return false, - } - } - true - } else { - false - } -} - -fn check_mod_attrs(tcx: TyCtxt<'_>, module_def_id: DefId) { - tcx.hir() - .visit_item_likes_in_module(module_def_id, &mut CheckAttrVisitor { tcx }.as_deep_visitor()); -} - -pub(crate) fn provide(providers: &mut Providers<'_>) { - *providers = Providers { check_mod_attrs, ..*providers }; } diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 97c14dd7e00..6275c0aabe8 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -5,12 +5,9 @@ pub mod check_attr; pub mod exports; pub mod map; -pub mod upvars; use crate::ty::query::Providers; pub fn provide(providers: &mut Providers<'_>) { - check_attr::provide(providers); map::provide(providers); - upvars::provide(providers); } diff --git a/src/librustc/lint.rs b/src/librustc/lint.rs index 2ed6cd5283b..8c18b1368a9 100644 --- a/src/librustc/lint.rs +++ b/src/librustc/lint.rs @@ -259,7 +259,7 @@ pub fn struct_lint_level<'a>( &mut err, DiagnosticMessageId::from(lint), src, - "lint level defined here", + "the lint level is defined here", ); if lint_attr_name.as_str() != name { let level_str = level.as_str(); diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index 27b769742a9..9e33ee8da21 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -204,17 +204,17 @@ impl LanguageItemCollector<'tcx> { }, }; if let Some(span) = self.tcx.hir().span_if_local(original_def_id) { - err.span_note(span, "first defined here"); + err.span_note(span, "the lang item is first defined here"); } else { match self.tcx.extern_crate(original_def_id) { Some(ExternCrate {dependency_of, ..}) => { err.note(&format!( - "first defined in crate `{}` (which `{}` depends on)", + "the lang item is first defined in crate `{}` (which `{}` depends on)", self.tcx.crate_name(original_def_id.krate), self.tcx.crate_name(*dependency_of))); }, _ => { - err.note(&format!("first defined in crate `{}`.", + err.note(&format!("the lang item is first defined in crate `{}`.", self.tcx.crate_name(original_def_id.krate))); } } diff --git a/src/librustc_builtin_macros/deriving/generic/mod.rs b/src/librustc_builtin_macros/deriving/generic/mod.rs index f8918016c1b..9377f194dcd 100644 --- a/src/librustc_builtin_macros/deriving/generic/mod.rs +++ b/src/librustc_builtin_macros/deriving/generic/mod.rs @@ -531,13 +531,13 @@ impl<'a> TraitDef<'a> { type_ident: Ident, generics: &Generics, field_tys: Vec<P<ast::Ty>>, - methods: Vec<ast::AssocItem>, + methods: Vec<P<ast::AssocItem>>, ) -> P<ast::Item> { let trait_path = self.path.to_path(cx, self.span, type_ident, generics); // Transform associated types from `deriving::ty::Ty` into `ast::AssocItem` - let associated_types = - self.associated_types.iter().map(|&(ident, ref type_def)| ast::AssocItem { + let associated_types = self.associated_types.iter().map(|&(ident, ref type_def)| { + P(ast::AssocItem { id: ast::DUMMY_NODE_ID, span: self.span, ident, @@ -550,7 +550,8 @@ impl<'a> TraitDef<'a> { Some(type_def.to_ty(cx, self.span, type_ident, generics)), ), tokens: None, - }); + }) + }); let Generics { mut params, mut where_clause, span } = self.generics.to_generics(cx, self.span, type_ident, generics); @@ -938,7 +939,7 @@ impl<'a> MethodDef<'a> { explicit_self: Option<ast::ExplicitSelf>, arg_types: Vec<(Ident, P<ast::Ty>)>, body: P<Expr>, - ) -> ast::AssocItem { + ) -> P<ast::AssocItem> { // Create the generics that aren't for `Self`. let fn_generics = self.generics.to_generics(cx, trait_.span, type_ident, generics); @@ -968,7 +969,7 @@ impl<'a> MethodDef<'a> { }; // Create the method. - ast::AssocItem { + P(ast::AssocItem { id: ast::DUMMY_NODE_ID, attrs: self.attributes.clone(), generics: fn_generics, @@ -978,7 +979,7 @@ impl<'a> MethodDef<'a> { ident: method_ident, kind: ast::AssocItemKind::Fn(sig, Some(body_block)), tokens: None, - } + }) } /// ``` diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index 357b0b6c451..c59b81eb4cc 100644 --- a/src/librustc_codegen_llvm/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -7,7 +7,7 @@ use crate::type_of::LayoutLlvmExt; use crate::value::Value; use libc::{c_char, c_uint}; use log::debug; -use rustc::session::config; +use rustc::session::config::{self, Sanitizer}; use rustc::ty::layout::{self, Align, Size, TyLayout}; use rustc::ty::{self, Ty, TyCtxt}; use rustc_codegen_ssa::base::to_immediate; @@ -1232,12 +1232,19 @@ impl Builder<'a, 'll, 'tcx> { } fn call_lifetime_intrinsic(&mut self, intrinsic: &str, ptr: &'ll Value, size: Size) { - if self.cx.sess().opts.optimize == config::OptLevel::No { + let size = size.bytes(); + if size == 0 { return; } - let size = size.bytes(); - if size == 0 { + let opts = &self.cx.sess().opts; + let emit = match opts.debugging_opts.sanitizer { + // Some sanitizer use lifetime intrinsics. When they are in use, + // emit lifetime intrinsics regardless of optimization level. + Some(Sanitizer::Address) | Some(Sanitizer::Memory) => true, + _ => opts.optimize != config::OptLevel::No, + }; + if !emit { return; } diff --git a/src/librustc_errors/Cargo.toml b/src/librustc_errors/Cargo.toml index 01ea80659d6..b8340b1a1df 100644 --- a/src/librustc_errors/Cargo.toml +++ b/src/librustc_errors/Cargo.toml @@ -18,7 +18,7 @@ unicode-width = "0.1.4" atty = "0.2" termcolor = "1.0" annotate-snippets = "0.6.1" -term_size = "0.3.1" +termize = "0.1.1" [target.'cfg(windows)'.dependencies] winapi = { version = "0.3", features = ["handleapi", "synchapi", "winbase"] } diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index bf660d188b2..1fcb36a2a30 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -19,6 +19,7 @@ use crate::{ pluralize, CodeSuggestion, Diagnostic, DiagnosticId, Level, SubDiagnostic, SuggestionStyle, }; +use log::*; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::Lrc; use rustc_span::hygiene::{ExpnKind, MacroKind}; @@ -1366,7 +1367,7 @@ impl EmitterWriter { } else if self.ui_testing { 140 } else { - term_size::dimensions() + termize::dimensions() .map(|(w, _)| w.saturating_sub(code_offset)) .unwrap_or(std::usize::MAX) }; @@ -2108,7 +2109,13 @@ impl<'a> Drop for WritableDst<'a> { /// Whether the original and suggested code are visually similar enough to warrant extra wording. pub fn is_case_difference(sm: &SourceMap, suggested: &str, sp: Span) -> bool { // FIXME: this should probably be extended to also account for `FO0` → `FOO` and unicode. - let found = sm.span_to_snippet(sp).unwrap(); + let found = match sm.span_to_snippet(sp) { + Ok(snippet) => snippet, + Err(e) => { + warn!("Invalid span {:?}. Err={:?}", sp, e); + return false; + } + }; let ascii_confusables = &['c', 'f', 'i', 'k', 'o', 's', 'u', 'v', 'w', 'x', 'y', 'z']; // All the chars that differ in capitalization are confusable (above): let confusable = found diff --git a/src/librustc_expand/base.rs b/src/librustc_expand/base.rs index 52ba14dbc3d..9debae19fa5 100644 --- a/src/librustc_expand/base.rs +++ b/src/librustc_expand/base.rs @@ -136,23 +136,23 @@ impl Annotatable { } } - pub fn expect_trait_item(self) -> ast::AssocItem { + pub fn expect_trait_item(self) -> P<ast::AssocItem> { match self { - Annotatable::TraitItem(i) => i.into_inner(), + Annotatable::TraitItem(i) => i, _ => panic!("expected Item"), } } - pub fn expect_impl_item(self) -> ast::AssocItem { + pub fn expect_impl_item(self) -> P<ast::AssocItem> { match self { - Annotatable::ImplItem(i) => i.into_inner(), + Annotatable::ImplItem(i) => i, _ => panic!("expected Item"), } } - pub fn expect_foreign_item(self) -> ast::ForeignItem { + pub fn expect_foreign_item(self) -> P<ast::ForeignItem> { match self { - Annotatable::ForeignItem(i) => i.into_inner(), + Annotatable::ForeignItem(i) => i, _ => panic!("expected foreign item"), } } @@ -382,17 +382,17 @@ pub trait MacResult { } /// Creates zero or more impl items. - fn make_impl_items(self: Box<Self>) -> Option<SmallVec<[ast::AssocItem; 1]>> { + fn make_impl_items(self: Box<Self>) -> Option<SmallVec<[P<ast::AssocItem>; 1]>> { None } /// Creates zero or more trait items. - fn make_trait_items(self: Box<Self>) -> Option<SmallVec<[ast::AssocItem; 1]>> { + fn make_trait_items(self: Box<Self>) -> Option<SmallVec<[P<ast::AssocItem>; 1]>> { None } /// Creates zero or more items in an `extern {}` block - fn make_foreign_items(self: Box<Self>) -> Option<SmallVec<[ast::ForeignItem; 1]>> { + fn make_foreign_items(self: Box<Self>) -> Option<SmallVec<[P<ast::ForeignItem>; 1]>> { None } @@ -470,9 +470,9 @@ make_MacEager! { expr: P<ast::Expr>, pat: P<ast::Pat>, items: SmallVec<[P<ast::Item>; 1]>, - impl_items: SmallVec<[ast::AssocItem; 1]>, - trait_items: SmallVec<[ast::AssocItem; 1]>, - foreign_items: SmallVec<[ast::ForeignItem; 1]>, + impl_items: SmallVec<[P<ast::AssocItem>; 1]>, + trait_items: SmallVec<[P<ast::AssocItem>; 1]>, + foreign_items: SmallVec<[P<ast::ForeignItem>; 1]>, stmts: SmallVec<[ast::Stmt; 1]>, ty: P<ast::Ty>, } @@ -486,15 +486,15 @@ impl MacResult for MacEager { self.items } - fn make_impl_items(self: Box<Self>) -> Option<SmallVec<[ast::AssocItem; 1]>> { + fn make_impl_items(self: Box<Self>) -> Option<SmallVec<[P<ast::AssocItem>; 1]>> { self.impl_items } - fn make_trait_items(self: Box<Self>) -> Option<SmallVec<[ast::AssocItem; 1]>> { + fn make_trait_items(self: Box<Self>) -> Option<SmallVec<[P<ast::AssocItem>; 1]>> { self.trait_items } - fn make_foreign_items(self: Box<Self>) -> Option<SmallVec<[ast::ForeignItem; 1]>> { + fn make_foreign_items(self: Box<Self>) -> Option<SmallVec<[P<ast::ForeignItem>; 1]>> { self.foreign_items } @@ -586,15 +586,15 @@ impl MacResult for DummyResult { Some(SmallVec::new()) } - fn make_impl_items(self: Box<DummyResult>) -> Option<SmallVec<[ast::AssocItem; 1]>> { + fn make_impl_items(self: Box<DummyResult>) -> Option<SmallVec<[P<ast::AssocItem>; 1]>> { Some(SmallVec::new()) } - fn make_trait_items(self: Box<DummyResult>) -> Option<SmallVec<[ast::AssocItem; 1]>> { + fn make_trait_items(self: Box<DummyResult>) -> Option<SmallVec<[P<ast::AssocItem>; 1]>> { Some(SmallVec::new()) } - fn make_foreign_items(self: Box<Self>) -> Option<SmallVec<[ast::ForeignItem; 1]>> { + fn make_foreign_items(self: Box<Self>) -> Option<SmallVec<[P<ast::ForeignItem>; 1]>> { Some(SmallVec::new()) } diff --git a/src/librustc_expand/expand.rs b/src/librustc_expand/expand.rs index f915f44c17a..ea459064b09 100644 --- a/src/librustc_expand/expand.rs +++ b/src/librustc_expand/expand.rs @@ -152,13 +152,13 @@ ast_fragments! { Items(SmallVec<[P<ast::Item>; 1]>) { "item"; many fn flat_map_item; fn visit_item; fn make_items; } - TraitItems(SmallVec<[ast::AssocItem; 1]>) { + TraitItems(SmallVec<[P<ast::AssocItem>; 1]>) { "trait item"; many fn flat_map_trait_item; fn visit_trait_item; fn make_trait_items; } - ImplItems(SmallVec<[ast::AssocItem; 1]>) { + ImplItems(SmallVec<[P<ast::AssocItem>; 1]>) { "impl item"; many fn flat_map_impl_item; fn visit_impl_item; fn make_impl_items; } - ForeignItems(SmallVec<[ast::ForeignItem; 1]>) { + ForeignItems(SmallVec<[P<ast::ForeignItem>; 1]>) { "foreign item"; many fn flat_map_foreign_item; fn visit_foreign_item; @@ -554,15 +554,15 @@ impl<'a, 'b> MacroExpander<'a, 'b> { // we know that fold result vector will contain exactly one element match item { Annotatable::Item(item) => Annotatable::Item(cfg.flat_map_item(item).pop().unwrap()), - Annotatable::TraitItem(item) => Annotatable::TraitItem( - item.map(|item| cfg.flat_map_trait_item(item).pop().unwrap()), - ), + Annotatable::TraitItem(item) => { + Annotatable::TraitItem(cfg.flat_map_trait_item(item).pop().unwrap()) + } Annotatable::ImplItem(item) => { - Annotatable::ImplItem(item.map(|item| cfg.flat_map_impl_item(item).pop().unwrap())) + Annotatable::ImplItem(cfg.flat_map_impl_item(item).pop().unwrap()) + } + Annotatable::ForeignItem(item) => { + Annotatable::ForeignItem(cfg.flat_map_foreign_item(item).pop().unwrap()) } - Annotatable::ForeignItem(item) => Annotatable::ForeignItem( - item.map(|item| cfg.flat_map_foreign_item(item).pop().unwrap()), - ), Annotatable::Stmt(stmt) => { Annotatable::Stmt(stmt.map(|stmt| cfg.flat_map_stmt(stmt).pop().unwrap())) } @@ -643,11 +643,9 @@ impl<'a, 'b> MacroExpander<'a, 'b> { let item_tok = TokenTree::token( token::Interpolated(Lrc::new(match item { Annotatable::Item(item) => token::NtItem(item), - Annotatable::TraitItem(item) => token::NtTraitItem(item.into_inner()), - Annotatable::ImplItem(item) => token::NtImplItem(item.into_inner()), - Annotatable::ForeignItem(item) => { - token::NtForeignItem(item.into_inner()) - } + Annotatable::TraitItem(item) => token::NtTraitItem(item), + Annotatable::ImplItem(item) => token::NtImplItem(item), + Annotatable::ForeignItem(item) => token::NtForeignItem(item), Annotatable::Stmt(stmt) => token::NtStmt(stmt.into_inner()), Annotatable::Expr(expr) => token::NtExpr(expr), Annotatable::Arm(..) @@ -1411,7 +1409,7 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { } } - fn flat_map_trait_item(&mut self, item: ast::AssocItem) -> SmallVec<[ast::AssocItem; 1]> { + fn flat_map_trait_item(&mut self, item: P<ast::AssocItem>) -> SmallVec<[P<ast::AssocItem>; 1]> { let mut item = configure!(self, item); let (attr, traits, after_derive) = self.classify_item(&mut item); @@ -1420,7 +1418,7 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { .collect_attr( attr, traits, - Annotatable::TraitItem(P(item)), + Annotatable::TraitItem(item), AstFragmentKind::TraitItems, after_derive, ) @@ -1428,16 +1426,20 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { } match item.kind { - ast::AssocItemKind::Macro(mac) => { - let ast::AssocItem { attrs, span, .. } = item; - self.check_attributes(&attrs); - self.collect_bang(mac, span, AstFragmentKind::TraitItems).make_trait_items() + ast::AssocItemKind::Macro(..) => { + self.check_attributes(&item.attrs); + item.and_then(|item| match item.kind { + ast::AssocItemKind::Macro(mac) => self + .collect_bang(mac, item.span, AstFragmentKind::TraitItems) + .make_trait_items(), + _ => unreachable!(), + }) } _ => noop_flat_map_assoc_item(item, self), } } - fn flat_map_impl_item(&mut self, item: ast::AssocItem) -> SmallVec<[ast::AssocItem; 1]> { + fn flat_map_impl_item(&mut self, item: P<ast::AssocItem>) -> SmallVec<[P<ast::AssocItem>; 1]> { let mut item = configure!(self, item); let (attr, traits, after_derive) = self.classify_item(&mut item); @@ -1446,7 +1448,7 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { .collect_attr( attr, traits, - Annotatable::ImplItem(P(item)), + Annotatable::ImplItem(item), AstFragmentKind::ImplItems, after_derive, ) @@ -1454,10 +1456,14 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { } match item.kind { - ast::AssocItemKind::Macro(mac) => { - let ast::AssocItem { attrs, span, .. } = item; - self.check_attributes(&attrs); - self.collect_bang(mac, span, AstFragmentKind::ImplItems).make_impl_items() + ast::AssocItemKind::Macro(..) => { + self.check_attributes(&item.attrs); + item.and_then(|item| match item.kind { + ast::AssocItemKind::Macro(mac) => self + .collect_bang(mac, item.span, AstFragmentKind::ImplItems) + .make_impl_items(), + _ => unreachable!(), + }) } _ => noop_flat_map_assoc_item(item, self), } @@ -1482,8 +1488,8 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { fn flat_map_foreign_item( &mut self, - mut foreign_item: ast::ForeignItem, - ) -> SmallVec<[ast::ForeignItem; 1]> { + mut foreign_item: P<ast::ForeignItem>, + ) -> SmallVec<[P<ast::ForeignItem>; 1]> { let (attr, traits, after_derive) = self.classify_item(&mut foreign_item); if attr.is_some() || !traits.is_empty() { @@ -1491,21 +1497,25 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { .collect_attr( attr, traits, - Annotatable::ForeignItem(P(foreign_item)), + Annotatable::ForeignItem(foreign_item), AstFragmentKind::ForeignItems, after_derive, ) .make_foreign_items(); } - if let ast::ForeignItemKind::Macro(mac) = foreign_item.kind { - self.check_attributes(&foreign_item.attrs); - return self - .collect_bang(mac, foreign_item.span, AstFragmentKind::ForeignItems) - .make_foreign_items(); + match foreign_item.kind { + ast::ForeignItemKind::Macro(..) => { + self.check_attributes(&foreign_item.attrs); + foreign_item.and_then(|item| match item.kind { + ast::ForeignItemKind::Macro(mac) => self + .collect_bang(mac, item.span, AstFragmentKind::ForeignItems) + .make_foreign_items(), + _ => unreachable!(), + }) + } + _ => noop_flat_map_foreign_item(foreign_item, self), } - - noop_flat_map_foreign_item(foreign_item, self) } fn visit_item_kind(&mut self, item: &mut ast::ItemKind) { diff --git a/src/librustc_expand/mbe/macro_parser.rs b/src/librustc_expand/mbe/macro_parser.rs index 246f66084b8..6e7a4a556b8 100644 --- a/src/librustc_expand/mbe/macro_parser.rs +++ b/src/librustc_expand/mbe/macro_parser.rs @@ -81,6 +81,7 @@ use rustc_parse::Directory; use rustc_span::symbol::{kw, sym, Symbol}; use syntax::ast::{Ident, Name}; use syntax::print::pprust; +use syntax::ptr::P; use syntax::sess::ParseSess; use syntax::token::{self, DocComment, Nonterminal, Token}; use syntax::tokenstream::TokenStream; @@ -914,7 +915,7 @@ fn parse_nt_inner<'a>(p: &mut Parser<'a>, sp: Span, name: Symbol) -> PResult<'a, } } sym::path => token::NtPath(p.parse_path(PathStyle::Type)?), - sym::meta => token::NtMeta(p.parse_attr_item()?), + sym::meta => token::NtMeta(P(p.parse_attr_item()?)), sym::vis => token::NtVis(p.parse_visibility(FollowedByType::Yes)?), sym::lifetime => { if p.check_lifetime() { diff --git a/src/librustc_expand/placeholders.rs b/src/librustc_expand/placeholders.rs index 8b18a5dc4bb..6bcb8f45f00 100644 --- a/src/librustc_expand/placeholders.rs +++ b/src/librustc_expand/placeholders.rs @@ -51,7 +51,7 @@ pub fn placeholder( kind: ast::ItemKind::Mac(mac_placeholder()), tokens: None, })]), - AstFragmentKind::TraitItems => AstFragment::TraitItems(smallvec![ast::AssocItem { + AstFragmentKind::TraitItems => AstFragment::TraitItems(smallvec![P(ast::AssocItem { id, span, ident, @@ -61,8 +61,8 @@ pub fn placeholder( kind: ast::AssocItemKind::Macro(mac_placeholder()), defaultness: ast::Defaultness::Final, tokens: None, - }]), - AstFragmentKind::ImplItems => AstFragment::ImplItems(smallvec![ast::AssocItem { + })]), + AstFragmentKind::ImplItems => AstFragment::ImplItems(smallvec![P(ast::AssocItem { id, span, ident, @@ -72,16 +72,18 @@ pub fn placeholder( kind: ast::AssocItemKind::Macro(mac_placeholder()), defaultness: ast::Defaultness::Final, tokens: None, - }]), - AstFragmentKind::ForeignItems => AstFragment::ForeignItems(smallvec![ast::ForeignItem { - id, - span, - ident, - vis, - attrs, - kind: ast::ForeignItemKind::Macro(mac_placeholder()), - tokens: None, - }]), + })]), + AstFragmentKind::ForeignItems => { + AstFragment::ForeignItems(smallvec![P(ast::ForeignItem { + id, + span, + ident, + vis, + attrs, + kind: ast::ForeignItemKind::Macro(mac_placeholder()), + tokens: None, + })]) + } AstFragmentKind::Pat => { AstFragment::Pat(P(ast::Pat { id, span, kind: ast::PatKind::Mac(mac_placeholder()) })) } @@ -250,21 +252,24 @@ impl<'a, 'b> MutVisitor for PlaceholderExpander<'a, 'b> { noop_flat_map_item(item, self) } - fn flat_map_trait_item(&mut self, item: ast::AssocItem) -> SmallVec<[ast::AssocItem; 1]> { + fn flat_map_trait_item(&mut self, item: P<ast::AssocItem>) -> SmallVec<[P<ast::AssocItem>; 1]> { match item.kind { ast::AssocItemKind::Macro(_) => self.remove(item.id).make_trait_items(), _ => noop_flat_map_assoc_item(item, self), } } - fn flat_map_impl_item(&mut self, item: ast::AssocItem) -> SmallVec<[ast::AssocItem; 1]> { + fn flat_map_impl_item(&mut self, item: P<ast::AssocItem>) -> SmallVec<[P<ast::AssocItem>; 1]> { match item.kind { ast::AssocItemKind::Macro(_) => self.remove(item.id).make_impl_items(), _ => noop_flat_map_assoc_item(item, self), } } - fn flat_map_foreign_item(&mut self, item: ast::ForeignItem) -> SmallVec<[ast::ForeignItem; 1]> { + fn flat_map_foreign_item( + &mut self, + item: P<ast::ForeignItem>, + ) -> SmallVec<[P<ast::ForeignItem>; 1]> { match item.kind { ast::ForeignItemKind::Macro(_) => self.remove(item.id).make_foreign_items(), _ => noop_flat_map_foreign_item(item, self), diff --git a/src/librustc_interface/util.rs b/src/librustc_interface/util.rs index 3e65da9c47b..00528eca923 100644 --- a/src/librustc_interface/util.rs +++ b/src/librustc_interface/util.rs @@ -682,7 +682,7 @@ impl<'a> MutVisitor for ReplaceBodyWithLoop<'a, '_> { self.run(is_const, |s| noop_visit_item_kind(i, s)) } - fn flat_map_trait_item(&mut self, i: ast::AssocItem) -> SmallVec<[ast::AssocItem; 1]> { + fn flat_map_trait_item(&mut self, i: P<ast::AssocItem>) -> SmallVec<[P<ast::AssocItem>; 1]> { let is_const = match i.kind { ast::AssocItemKind::Const(..) => true, ast::AssocItemKind::Fn(ref sig, _) => Self::is_sig_const(sig), @@ -691,7 +691,7 @@ impl<'a> MutVisitor for ReplaceBodyWithLoop<'a, '_> { self.run(is_const, |s| noop_flat_map_assoc_item(i, s)) } - fn flat_map_impl_item(&mut self, i: ast::AssocItem) -> SmallVec<[ast::AssocItem; 1]> { + fn flat_map_impl_item(&mut self, i: P<ast::AssocItem>) -> SmallVec<[P<ast::AssocItem>; 1]> { self.flat_map_trait_item(i) } diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 674a82b6196..d96ba59d9a3 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -894,7 +894,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { diag.note(note); if let ty::Adt(def, _) = ty.kind { if let Some(sp) = self.cx.tcx.hir().span_if_local(def.did) { - diag.span_note(sp, "type defined here"); + diag.span_note(sp, "the type is defined here"); } } diag.emit(); diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs index 351e72d4678..4c4383aa603 100644 --- a/src/librustc_metadata/creader.rs +++ b/src/librustc_metadata/creader.rs @@ -694,7 +694,7 @@ impl<'a> CrateLoader<'a> { self.sess .struct_span_err(*span2, "cannot define multiple global allocators") .span_label(*span2, "cannot define a new global allocator") - .span_label(*span1, "previous global allocator is defined here") + .span_label(*span1, "previous global allocator defined here") .emit(); true } diff --git a/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs b/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs index f49ddbced2e..a8e534a9f65 100644 --- a/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs +++ b/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs @@ -1267,7 +1267,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { err.span_label( upvar_span, - format!("`{}` is declared here, outside of the {} body", upvar_name, escapes_from), + format!("`{}` declared here, outside of the {} body", upvar_name, escapes_from), ); err.span_label(borrow_span, format!("borrow is only valid in the {} body", escapes_from)); diff --git a/src/librustc_mir/borrow_check/diagnostics/region_errors.rs b/src/librustc_mir/borrow_check/diagnostics/region_errors.rs index b999dfa3031..0e040ec7827 100644 --- a/src/librustc_mir/borrow_check/diagnostics/region_errors.rs +++ b/src/librustc_mir/borrow_check/diagnostics/region_errors.rs @@ -457,7 +457,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { diag.span_label( outlived_fr_span, format!( - "`{}` is declared here, outside of the {} body", + "`{}` declared here, outside of the {} body", outlived_fr_name, escapes_from ), ); diff --git a/src/librustc_mir/interpret/step.rs b/src/librustc_mir/interpret/step.rs index a99abc4cbf4..7d59c0181a8 100644 --- a/src/librustc_mir/interpret/step.rs +++ b/src/librustc_mir/interpret/step.rs @@ -38,6 +38,9 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { /// Returns `true` as long as there are more things to do. /// /// This is used by [priroda](https://github.com/oli-obk/priroda) + /// + /// This is marked `#inline(always)` to work around adverserial codegen when `opt-level = 3` + #[inline(always)] pub fn step(&mut self) -> InterpResult<'tcx, bool> { if self.stack.is_empty() { return Ok(false); diff --git a/src/librustc_mir/transform/check_consts/validation.rs b/src/librustc_mir/transform/check_consts/validation.rs index 6f109a060df..91dd68fd177 100644 --- a/src/librustc_mir/transform/check_consts/validation.rs +++ b/src/librustc_mir/transform/check_consts/validation.rs @@ -625,7 +625,7 @@ fn check_short_circuiting_in_const_local(item: &Item<'_, 'tcx>) { } for local in locals { let span = body.local_decls[local].source_info.span; - error.span_note(span, "more locals defined here"); + error.span_note(span, "more locals are defined here"); } error.emit(); } diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index cf9a5479afb..8dc185cd82b 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -148,16 +148,10 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { let cast_out = CastTy::from_ty(cast_ty).expect("bad output type for cast"); match (cast_in, cast_out) { (CastTy::Ptr(_), CastTy::Int(_)) | (CastTy::FnPtr, CastTy::Int(_)) => { - self.register_violations( - &[UnsafetyViolation { - source_info: self.source_info, - description: Symbol::intern("cast of pointer to int"), - details: Symbol::intern( - "casting pointers to integers in constants", - ), - kind: UnsafetyViolationKind::General, - }], - &[], + self.require_unsafe( + "cast of pointer to int", + "casting pointers to integers in constants", + UnsafetyViolationKind::General, ); } _ => {} @@ -171,14 +165,10 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { if self.const_context && self.tcx.features().const_compare_raw_pointers => { if let ty::RawPtr(_) | ty::FnPtr(..) = lhs.ty(self.body, self.tcx).kind { - self.register_violations( - &[UnsafetyViolation { - source_info: self.source_info, - description: Symbol::intern("pointer operation"), - details: Symbol::intern("operations on pointers in constants"), - kind: UnsafetyViolationKind::General, - }], - &[], + self.require_unsafe( + "pointer operation", + "operations on pointers in constants", + UnsafetyViolationKind::General, ); } } @@ -199,18 +189,12 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { .as_ref() .assert_crate_local() .lint_root; - self.register_violations( - &[UnsafetyViolation { - source_info, - description: Symbol::intern("borrow of packed field"), - details: Symbol::intern( - "fields of packed structs might be misaligned: dereferencing a \ - misaligned pointer or even just creating a misaligned reference \ - is undefined behavior", - ), - kind: UnsafetyViolationKind::BorrowPacked(lint_root), - }], - &[], + self.require_unsafe( + "borrow of packed field", + "fields of packed structs might be misaligned: dereferencing a \ + misaligned pointer or even just creating a misaligned reference \ + is undefined behavior", + UnsafetyViolationKind::BorrowPacked(lint_root), ); } } @@ -434,15 +418,10 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> { the field can be changed to invalid values", ) }; - let source_info = self.source_info; - self.register_violations( - &[UnsafetyViolation { - source_info, - description: Symbol::intern(description), - details: Symbol::intern(details), - kind: UnsafetyViolationKind::GeneralAndConstFn, - }], - &[], + self.require_unsafe( + description, + details, + UnsafetyViolationKind::GeneralAndConstFn, ); } }, diff --git a/src/librustc_parse/config.rs b/src/librustc_parse/config.rs index bf696faf2f3..da158e17f25 100644 --- a/src/librustc_parse/config.rs +++ b/src/librustc_parse/config.rs @@ -531,11 +531,11 @@ impl<'a> MutVisitor for StripUnconfigured<'a> { noop_flat_map_item(configure!(self, item), self) } - fn flat_map_impl_item(&mut self, item: ast::AssocItem) -> SmallVec<[ast::AssocItem; 1]> { + fn flat_map_impl_item(&mut self, item: P<ast::AssocItem>) -> SmallVec<[P<ast::AssocItem>; 1]> { noop_flat_map_assoc_item(configure!(self, item), self) } - fn flat_map_trait_item(&mut self, item: ast::AssocItem) -> SmallVec<[ast::AssocItem; 1]> { + fn flat_map_trait_item(&mut self, item: P<ast::AssocItem>) -> SmallVec<[P<ast::AssocItem>; 1]> { noop_flat_map_assoc_item(configure!(self, item), self) } diff --git a/src/librustc_parse/parser/attr.rs b/src/librustc_parse/parser/attr.rs index 3d40b91a7bd..1869389dbd9 100644 --- a/src/librustc_parse/parser/attr.rs +++ b/src/librustc_parse/parser/attr.rs @@ -177,7 +177,7 @@ impl<'a> Parser<'a> { pub fn parse_attr_item(&mut self) -> PResult<'a, ast::AttrItem> { let item = match self.token.kind { token::Interpolated(ref nt) => match **nt { - Nonterminal::NtMeta(ref item) => Some(item.clone()), + Nonterminal::NtMeta(ref item) => Some(item.clone().into_inner()), _ => None, }, _ => None, diff --git a/src/librustc_parse/parser/item.rs b/src/librustc_parse/parser/item.rs index b55756d8129..66116611323 100644 --- a/src/librustc_parse/parser/item.rs +++ b/src/librustc_parse/parser/item.rs @@ -661,7 +661,7 @@ impl<'a> Parser<'a> { Ok((Ident::invalid(), item_kind, Some(attrs))) } - fn parse_impl_body(&mut self) -> PResult<'a, (Vec<AssocItem>, Vec<Attribute>)> { + fn parse_impl_body(&mut self) -> PResult<'a, (Vec<P<AssocItem>>, Vec<Attribute>)> { self.expect(&token::OpenDelim(token::Brace))?; let attrs = self.parse_inner_attributes()?; @@ -786,12 +786,12 @@ impl<'a> Parser<'a> { } } - pub fn parse_impl_item(&mut self, at_end: &mut bool) -> PResult<'a, AssocItem> { + pub fn parse_impl_item(&mut self, at_end: &mut bool) -> PResult<'a, P<AssocItem>> { maybe_whole!(self, NtImplItem, |x| x); self.parse_assoc_item(at_end, |_| true) } - pub fn parse_trait_item(&mut self, at_end: &mut bool) -> PResult<'a, AssocItem> { + pub fn parse_trait_item(&mut self, at_end: &mut bool) -> PResult<'a, P<AssocItem>> { maybe_whole!(self, NtTraitItem, |x| x); // This is somewhat dubious; We don't want to allow // param names to be left off if there is a definition... @@ -805,7 +805,7 @@ impl<'a> Parser<'a> { &mut self, at_end: &mut bool, is_name_required: fn(&token::Token) -> bool, - ) -> PResult<'a, AssocItem> { + ) -> PResult<'a, P<AssocItem>> { let attrs = self.parse_outer_attributes()?; let mut unclosed_delims = vec![]; let (mut item, tokens) = self.collect_tokens(|this| { @@ -818,7 +818,7 @@ impl<'a> Parser<'a> { if !item.attrs.iter().any(|attr| attr.style == AttrStyle::Inner) { item.tokens = Some(tokens); } - Ok(item) + Ok(P(item)) } fn parse_assoc_item_( @@ -1064,7 +1064,7 @@ impl<'a> Parser<'a> { } /// Parses a foreign item. - pub fn parse_foreign_item(&mut self, extern_sp: Span) -> PResult<'a, ForeignItem> { + pub fn parse_foreign_item(&mut self, extern_sp: Span) -> PResult<'a, P<ForeignItem>> { maybe_whole!(self, NtForeignItem, |ni| ni); let attrs = self.parse_outer_attributes()?; @@ -1112,7 +1112,7 @@ impl<'a> Parser<'a> { } match self.parse_assoc_macro_invoc("extern", Some(&visibility), &mut false)? { - Some(mac) => Ok(ForeignItem { + Some(mac) => Ok(P(ForeignItem { ident: Ident::invalid(), span: lo.to(self.prev_span), id: DUMMY_NODE_ID, @@ -1120,7 +1120,7 @@ impl<'a> Parser<'a> { vis: visibility, kind: ForeignItemKind::Macro(mac), tokens: None, - }), + })), None => { if !attrs.is_empty() { self.expected_item_err(&attrs)?; @@ -1138,14 +1138,14 @@ impl<'a> Parser<'a> { vis: ast::Visibility, lo: Span, attrs: Vec<Attribute>, - ) -> PResult<'a, ForeignItem> { + ) -> PResult<'a, P<ForeignItem>> { let mutbl = self.parse_mutability(); let ident = self.parse_ident()?; self.expect(&token::Colon)?; let ty = self.parse_ty()?; let hi = self.token.span; self.expect_semi()?; - Ok(ForeignItem { + Ok(P(ForeignItem { ident, attrs, kind: ForeignItemKind::Static(ty, mutbl), @@ -1153,7 +1153,7 @@ impl<'a> Parser<'a> { span: lo.to(hi), vis, tokens: None, - }) + })) } /// Parses a type from a foreign module. @@ -1162,13 +1162,13 @@ impl<'a> Parser<'a> { vis: ast::Visibility, lo: Span, attrs: Vec<Attribute>, - ) -> PResult<'a, ForeignItem> { + ) -> PResult<'a, P<ForeignItem>> { self.expect_keyword(kw::Type)?; let ident = self.parse_ident()?; let hi = self.token.span; self.expect_semi()?; - Ok(ast::ForeignItem { + Ok(P(ast::ForeignItem { ident, attrs, kind: ForeignItemKind::Ty, @@ -1176,7 +1176,7 @@ impl<'a> Parser<'a> { span: lo.to(hi), vis, tokens: None, - }) + })) } fn is_static_global(&mut self) -> bool { @@ -1746,13 +1746,13 @@ impl<'a> Parser<'a> { lo: Span, attrs: Vec<Attribute>, extern_sp: Span, - ) -> PResult<'a, ForeignItem> { + ) -> PResult<'a, P<ForeignItem>> { self.expect_keyword(kw::Fn)?; let (ident, decl, generics) = self.parse_fn_sig(ParamCfg { is_self_allowed: false, is_name_required: |_| true })?; let span = lo.to(self.token.span); self.parse_semi_or_incorrect_foreign_fn_body(&ident, extern_sp)?; - Ok(ast::ForeignItem { + Ok(P(ast::ForeignItem { ident, attrs, kind: ForeignItemKind::Fn(decl, generics), @@ -1760,7 +1760,7 @@ impl<'a> Parser<'a> { span, vis, tokens: None, - }) + })) } fn parse_assoc_fn( diff --git a/src/librustc_parse/parser/stmt.rs b/src/librustc_parse/parser/stmt.rs index a94d8228bbe..ae8f1e4db1b 100644 --- a/src/librustc_parse/parser/stmt.rs +++ b/src/librustc_parse/parser/stmt.rs @@ -7,13 +7,13 @@ use crate::maybe_whole; use crate::DirectoryOwnership; use rustc_errors::{Applicability, PResult}; -use rustc_span::source_map::{respan, Span}; +use rustc_span::source_map::{respan, BytePos, Span}; use rustc_span::symbol::{kw, sym, Symbol}; use syntax::ast; use syntax::ast::{AttrStyle, AttrVec, Attribute, Mac, MacStmtStyle, VisibilityKind}; use syntax::ast::{Block, BlockCheckMode, Expr, ExprKind, Local, Stmt, StmtKind, DUMMY_NODE_ID}; use syntax::ptr::P; -use syntax::token; +use syntax::token::{self, TokenKind}; use syntax::util::classify; use std::mem; @@ -431,6 +431,23 @@ impl<'a> Parser<'a> { if let Err(mut e) = self.expect_one_of(&[], &[token::Semi, token::CloseDelim(token::Brace)]) { + if let TokenKind::DocComment(..) = self.token.kind { + if let Ok(snippet) = self.span_to_snippet(self.token.span) { + let sp = self.token.span; + let marker = &snippet[..3]; + let (comment_marker, doc_comment_marker) = marker.split_at(2); + + e.span_suggestion( + sp.with_hi(sp.lo() + BytePos(marker.len() as u32)), + &format!( + "add a space before `{}` to use a regular comment", + doc_comment_marker, + ), + format!("{} {}", comment_marker, doc_comment_marker), + Applicability::MaybeIncorrect, + ); + } + } e.emit(); self.recover_stmt(); // Don't complain about type errors in body tail after parse error (#57383). diff --git a/src/librustc_passes/check_attr.rs b/src/librustc_passes/check_attr.rs new file mode 100644 index 00000000000..3ff1ba3bbfc --- /dev/null +++ b/src/librustc_passes/check_attr.rs @@ -0,0 +1,471 @@ +//! This module implements some validity checks for attributes. +//! In particular it verifies that `#[inline]` and `#[repr]` attributes are +//! attached to items that actually support them and if there are +//! conflicts between multiple such attributes attached to the same +//! item. + +use rustc::hir::check_attr::{MethodKind, Target}; +use rustc::hir::map::Map; +use rustc::ty::query::Providers; +use rustc::ty::TyCtxt; + +use rustc_errors::struct_span_err; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; +use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor}; +use rustc_hir::DUMMY_HIR_ID; +use rustc_hir::{self, HirId, Item, ItemKind, TraitItem}; +use rustc_session::lint::builtin::{CONFLICTING_REPR_HINTS, UNUSED_ATTRIBUTES}; +use rustc_span::symbol::sym; +use rustc_span::Span; +use syntax::ast::Attribute; +use syntax::attr; + +fn target_from_impl_item<'tcx>(tcx: TyCtxt<'tcx>, impl_item: &hir::ImplItem<'_>) -> Target { + match impl_item.kind { + hir::ImplItemKind::Const(..) => Target::AssocConst, + hir::ImplItemKind::Method(..) => { + let parent_hir_id = tcx.hir().get_parent_item(impl_item.hir_id); + let containing_item = tcx.hir().expect_item(parent_hir_id); + let containing_impl_is_for_trait = match &containing_item.kind { + hir::ItemKind::Impl { ref of_trait, .. } => of_trait.is_some(), + _ => bug!("parent of an ImplItem must be an Impl"), + }; + if containing_impl_is_for_trait { + Target::Method(MethodKind::Trait { body: true }) + } else { + Target::Method(MethodKind::Inherent) + } + } + hir::ImplItemKind::TyAlias(..) | hir::ImplItemKind::OpaqueTy(..) => Target::AssocTy, + } +} + +struct CheckAttrVisitor<'tcx> { + tcx: TyCtxt<'tcx>, +} + +impl CheckAttrVisitor<'tcx> { + /// Checks any attribute. + fn check_attributes( + &self, + hir_id: HirId, + attrs: &'hir [Attribute], + span: &Span, + target: Target, + item: Option<&Item<'_>>, + ) { + let mut is_valid = true; + for attr in attrs { + is_valid &= if attr.check_name(sym::inline) { + self.check_inline(hir_id, attr, span, target) + } else if attr.check_name(sym::non_exhaustive) { + self.check_non_exhaustive(attr, span, target) + } else if attr.check_name(sym::marker) { + self.check_marker(attr, span, target) + } else if attr.check_name(sym::target_feature) { + self.check_target_feature(attr, span, target) + } else if attr.check_name(sym::track_caller) { + self.check_track_caller(&attr.span, attrs, span, target) + } else { + true + }; + } + + if !is_valid { + return; + } + + if target == Target::Fn { + self.tcx.codegen_fn_attrs(self.tcx.hir().local_def_id(hir_id)); + } + + self.check_repr(attrs, span, target, item, hir_id); + self.check_used(attrs, target); + } + + /// Checks if an `#[inline]` is applied to a function or a closure. Returns `true` if valid. + fn check_inline(&self, hir_id: HirId, attr: &Attribute, span: &Span, target: Target) -> bool { + match target { + Target::Fn + | Target::Closure + | Target::Method(MethodKind::Trait { body: true }) + | Target::Method(MethodKind::Inherent) => true, + Target::Method(MethodKind::Trait { body: false }) | Target::ForeignFn => { + self.tcx + .struct_span_lint_hir( + UNUSED_ATTRIBUTES, + hir_id, + attr.span, + "`#[inline]` is ignored on function prototypes", + ) + .emit(); + true + } + // FIXME(#65833): We permit associated consts to have an `#[inline]` attribute with + // just a lint, because we previously erroneously allowed it and some crates used it + // accidentally, to to be compatible with crates depending on them, we can't throw an + // error here. + Target::AssocConst => { + self.tcx + .struct_span_lint_hir( + UNUSED_ATTRIBUTES, + hir_id, + attr.span, + "`#[inline]` is ignored on constants", + ) + .warn( + "this was previously accepted by the compiler but is \ + being phased out; it will become a hard error in \ + a future release!", + ) + .note( + "for more information, see issue #65833 \ + <https://github.com/rust-lang/rust/issues/65833>", + ) + .emit(); + true + } + _ => { + struct_span_err!( + self.tcx.sess, + attr.span, + E0518, + "attribute should be applied to function or closure", + ) + .span_label(*span, "not a function or closure") + .emit(); + false + } + } + } + + /// Checks if a `#[track_caller]` is applied to a non-naked function. Returns `true` if valid. + fn check_track_caller( + &self, + attr_span: &Span, + attrs: &'hir [Attribute], + span: &Span, + target: Target, + ) -> bool { + match target { + Target::Fn if attr::contains_name(attrs, sym::naked) => { + struct_span_err!( + self.tcx.sess, + *attr_span, + E0736, + "cannot use `#[track_caller]` with `#[naked]`", + ) + .emit(); + false + } + Target::Fn | Target::Method(MethodKind::Inherent) => true, + Target::Method(_) => { + struct_span_err!( + self.tcx.sess, + *attr_span, + E0738, + "`#[track_caller]` may not be used on trait methods", + ) + .emit(); + false + } + _ => { + struct_span_err!( + self.tcx.sess, + *attr_span, + E0739, + "attribute should be applied to function" + ) + .span_label(*span, "not a function") + .emit(); + false + } + } + } + + /// Checks if the `#[non_exhaustive]` attribute on an `item` is valid. Returns `true` if valid. + fn check_non_exhaustive(&self, attr: &Attribute, span: &Span, target: Target) -> bool { + match target { + Target::Struct | Target::Enum => true, + _ => { + struct_span_err!( + self.tcx.sess, + attr.span, + E0701, + "attribute can only be applied to a struct or enum" + ) + .span_label(*span, "not a struct or enum") + .emit(); + false + } + } + } + + /// Checks if the `#[marker]` attribute on an `item` is valid. Returns `true` if valid. + fn check_marker(&self, attr: &Attribute, span: &Span, target: Target) -> bool { + match target { + Target::Trait => true, + _ => { + self.tcx + .sess + .struct_span_err(attr.span, "attribute can only be applied to a trait") + .span_label(*span, "not a trait") + .emit(); + false + } + } + } + + /// Checks if the `#[target_feature]` attribute on `item` is valid. Returns `true` if valid. + fn check_target_feature(&self, attr: &Attribute, span: &Span, target: Target) -> bool { + match target { + Target::Fn + | Target::Method(MethodKind::Trait { body: true }) + | Target::Method(MethodKind::Inherent) => true, + _ => { + self.tcx + .sess + .struct_span_err(attr.span, "attribute should be applied to a function") + .span_label(*span, "not a function") + .emit(); + false + } + } + } + + /// Checks if the `#[repr]` attributes on `item` are valid. + fn check_repr( + &self, + attrs: &'hir [Attribute], + span: &Span, + target: Target, + item: Option<&Item<'_>>, + hir_id: HirId, + ) { + // Extract the names of all repr hints, e.g., [foo, bar, align] for: + // ``` + // #[repr(foo)] + // #[repr(bar, align(8))] + // ``` + let hints: Vec<_> = attrs + .iter() + .filter(|attr| attr.check_name(sym::repr)) + .filter_map(|attr| attr.meta_item_list()) + .flatten() + .collect(); + + let mut int_reprs = 0; + let mut is_c = false; + let mut is_simd = false; + let mut is_transparent = false; + + for hint in &hints { + let (article, allowed_targets) = match hint.name_or_empty() { + name @ sym::C | name @ sym::align => { + is_c |= name == sym::C; + match target { + Target::Struct | Target::Union | Target::Enum => continue, + _ => ("a", "struct, enum, or union"), + } + } + sym::packed => { + if target != Target::Struct && target != Target::Union { + ("a", "struct or union") + } else { + continue; + } + } + sym::simd => { + is_simd = true; + if target != Target::Struct { ("a", "struct") } else { continue } + } + sym::transparent => { + is_transparent = true; + match target { + Target::Struct | Target::Union | Target::Enum => continue, + _ => ("a", "struct, enum, or union"), + } + } + sym::i8 + | sym::u8 + | sym::i16 + | sym::u16 + | sym::i32 + | sym::u32 + | sym::i64 + | sym::u64 + | sym::isize + | sym::usize => { + int_reprs += 1; + if target != Target::Enum { ("an", "enum") } else { continue } + } + _ => continue, + }; + self.emit_repr_error( + hint.span(), + *span, + &format!("attribute should be applied to {}", allowed_targets), + &format!("not {} {}", article, allowed_targets), + ) + } + + // Just point at all repr hints if there are any incompatibilities. + // This is not ideal, but tracking precisely which ones are at fault is a huge hassle. + let hint_spans = hints.iter().map(|hint| hint.span()); + + // Error on repr(transparent, <anything else>). + if is_transparent && hints.len() > 1 { + let hint_spans: Vec<_> = hint_spans.clone().collect(); + struct_span_err!( + self.tcx.sess, + hint_spans, + E0692, + "transparent {} cannot have other repr hints", + target + ) + .emit(); + } + // Warn on repr(u8, u16), repr(C, simd), and c-like-enum-repr(C, u8) + if (int_reprs > 1) + || (is_simd && is_c) + || (int_reprs == 1 && is_c && item.map_or(false, |item| is_c_like_enum(item))) + { + self.tcx + .struct_span_lint_hir( + CONFLICTING_REPR_HINTS, + hir_id, + hint_spans.collect::<Vec<Span>>(), + "conflicting representation hints", + ) + .code(rustc_errors::error_code!(E0566)) + .emit(); + } + } + + fn emit_repr_error( + &self, + hint_span: Span, + label_span: Span, + hint_message: &str, + label_message: &str, + ) { + struct_span_err!(self.tcx.sess, hint_span, E0517, "{}", hint_message) + .span_label(label_span, label_message) + .emit(); + } + + fn check_stmt_attributes(&self, stmt: &hir::Stmt<'_>) { + // When checking statements ignore expressions, they will be checked later + if let hir::StmtKind::Local(ref l) = stmt.kind { + for attr in l.attrs.iter() { + if attr.check_name(sym::inline) { + self.check_inline(DUMMY_HIR_ID, attr, &stmt.span, Target::Statement); + } + if attr.check_name(sym::repr) { + self.emit_repr_error( + attr.span, + stmt.span, + "attribute should not be applied to a statement", + "not a struct, enum, or union", + ); + } + } + } + } + + fn check_expr_attributes(&self, expr: &hir::Expr<'_>) { + let target = match expr.kind { + hir::ExprKind::Closure(..) => Target::Closure, + _ => Target::Expression, + }; + for attr in expr.attrs.iter() { + if attr.check_name(sym::inline) { + self.check_inline(DUMMY_HIR_ID, attr, &expr.span, target); + } + if attr.check_name(sym::repr) { + self.emit_repr_error( + attr.span, + expr.span, + "attribute should not be applied to an expression", + "not defining a struct, enum, or union", + ); + } + } + } + + fn check_used(&self, attrs: &'hir [Attribute], target: Target) { + for attr in attrs { + if attr.check_name(sym::used) && target != Target::Static { + self.tcx + .sess + .span_err(attr.span, "attribute must be applied to a `static` variable"); + } + } + } +} + +impl Visitor<'tcx> for CheckAttrVisitor<'tcx> { + type Map = Map<'tcx>; + + fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> { + NestedVisitorMap::OnlyBodies(&self.tcx.hir()) + } + + fn visit_item(&mut self, item: &'tcx Item<'tcx>) { + let target = Target::from_item(item); + self.check_attributes(item.hir_id, item.attrs, &item.span, target, Some(item)); + intravisit::walk_item(self, item) + } + + fn visit_trait_item(&mut self, trait_item: &'tcx TraitItem<'tcx>) { + let target = Target::from_trait_item(trait_item); + self.check_attributes(trait_item.hir_id, &trait_item.attrs, &trait_item.span, target, None); + intravisit::walk_trait_item(self, trait_item) + } + + fn visit_foreign_item(&mut self, f_item: &'tcx hir::ForeignItem<'tcx>) { + let target = Target::from_foreign_item(f_item); + self.check_attributes(f_item.hir_id, &f_item.attrs, &f_item.span, target, None); + intravisit::walk_foreign_item(self, f_item) + } + + fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem<'tcx>) { + let target = target_from_impl_item(self.tcx, impl_item); + self.check_attributes(impl_item.hir_id, &impl_item.attrs, &impl_item.span, target, None); + intravisit::walk_impl_item(self, impl_item) + } + + fn visit_stmt(&mut self, stmt: &'tcx hir::Stmt<'tcx>) { + self.check_stmt_attributes(stmt); + intravisit::walk_stmt(self, stmt) + } + + fn visit_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) { + self.check_expr_attributes(expr); + intravisit::walk_expr(self, expr) + } +} + +fn is_c_like_enum(item: &Item<'_>) -> bool { + if let ItemKind::Enum(ref def, _) = item.kind { + for variant in def.variants { + match variant.data { + hir::VariantData::Unit(..) => { /* continue */ } + _ => return false, + } + } + true + } else { + false + } +} + +fn check_mod_attrs(tcx: TyCtxt<'_>, module_def_id: DefId) { + tcx.hir() + .visit_item_likes_in_module(module_def_id, &mut CheckAttrVisitor { tcx }.as_deep_visitor()); +} + +pub(crate) fn provide(providers: &mut Providers<'_>) { + *providers = Providers { check_mod_attrs, ..*providers }; +} diff --git a/src/librustc_passes/diagnostic_items.rs b/src/librustc_passes/diagnostic_items.rs index 8d220a3f695..5e831b558a3 100644 --- a/src/librustc_passes/diagnostic_items.rs +++ b/src/librustc_passes/diagnostic_items.rs @@ -73,10 +73,10 @@ fn collect_item( )), }; if let Some(span) = tcx.hir().span_if_local(original_def_id) { - err.span_note(span, "first defined here"); + err.span_note(span, "the diagnostic item is first defined here"); } else { err.note(&format!( - "first defined in crate `{}`.", + "the diagnostic item is first defined in crate `{}`.", tcx.crate_name(original_def_id.krate) )); } diff --git a/src/librustc_passes/lib.rs b/src/librustc_passes/lib.rs index d746f097928..4c0fd903db0 100644 --- a/src/librustc_passes/lib.rs +++ b/src/librustc_passes/lib.rs @@ -17,6 +17,7 @@ extern crate log; use rustc::ty::query::Providers; +mod check_attr; mod check_const; pub mod dead; mod diagnostic_items; @@ -30,8 +31,10 @@ pub mod loops; mod reachable; mod region; pub mod stability; +mod upvars; pub fn provide(providers: &mut Providers<'_>) { + check_attr::provide(providers); check_const::provide(providers); diagnostic_items::provide(providers); entry::provide(providers); @@ -42,4 +45,5 @@ pub fn provide(providers: &mut Providers<'_>) { reachable::provide(providers); region::provide(providers); stability::provide(providers); + upvars::provide(providers); } diff --git a/src/librustc/hir/upvars.rs b/src/librustc_passes/upvars.rs index 4ca294f4861..a2397f27338 100644 --- a/src/librustc/hir/upvars.rs +++ b/src/librustc_passes/upvars.rs @@ -1,8 +1,8 @@ //! Upvar (closure capture) collection from cross-body HIR uses of `Res::Local`s. -use crate::hir::map::Map; -use crate::ty::query::Providers; -use crate::ty::TyCtxt; +use rustc::hir::map::Map; +use rustc::ty::query::Providers; +use rustc::ty::TyCtxt; use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; use rustc_hir as hir; use rustc_hir::def::Res; diff --git a/src/librustc_resolve/late.rs b/src/librustc_resolve/late.rs index faa9eb3bc2f..f1622af130e 100644 --- a/src/librustc_resolve/late.rs +++ b/src/librustc_resolve/late.rs @@ -1007,7 +1007,7 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> { /// When evaluating a `trait` use its associated types' idents for suggestionsa in E0412. fn with_trait_items<T>( &mut self, - trait_items: &Vec<AssocItem>, + trait_items: &Vec<P<AssocItem>>, f: impl FnOnce(&mut Self) -> T, ) -> T { let trait_assoc_types = replace( @@ -1084,7 +1084,7 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> { opt_trait_reference: &'ast Option<TraitRef>, self_type: &'ast Ty, item_id: NodeId, - impl_items: &'ast [AssocItem], + impl_items: &'ast [P<AssocItem>], ) { debug!("resolve_implementation"); // If applicable, create a rib for the type parameters. diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index d252fc542c3..2e3e06c36f2 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -650,7 +650,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { generics: &'l ast::Generics, trait_ref: &'l Option<ast::TraitRef>, typ: &'l ast::Ty, - impl_items: &'l [ast::AssocItem], + impl_items: &'l [P<ast::AssocItem>], ) { if let Some(impl_data) = self.save_ctxt.get_item_data(item) { if !self.span.filter_generated(item.span) { @@ -681,7 +681,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { item: &'l ast::Item, generics: &'l ast::Generics, trait_refs: &'l ast::GenericBounds, - methods: &'l [ast::AssocItem], + methods: &'l [P<ast::AssocItem>], ) { let name = item.ident.to_string(); let qualname = format!( diff --git a/src/librustc_session/lint/builtin.rs b/src/librustc_session/lint/builtin.rs index 3e8503ef661..c326061100b 100644 --- a/src/librustc_session/lint/builtin.rs +++ b/src/librustc_session/lint/builtin.rs @@ -19,6 +19,16 @@ declare_lint! { } declare_lint! { + pub CONFLICTING_REPR_HINTS, + Deny, + "conflicts between `#[repr(..)]` hints that were previously accepted and used in practice", + @future_incompatible = FutureIncompatibleInfo { + reference: "issue #68585 <https://github.com/rust-lang/rust/issues/68585>", + edition: None, + }; +} + +declare_lint! { pub META_VARIABLE_MISUSE, Allow, "possible meta-variable misuse at macro definition" @@ -520,6 +530,7 @@ declare_lint_pass! { MACRO_USE_EXTERN_CRATE, MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS, ILL_FORMED_ATTRIBUTE_INPUT, + CONFLICTING_REPR_HINTS, META_VARIABLE_MISUSE, DEPRECATED_IN_FUTURE, AMBIGUOUS_ASSOCIATED_ITEMS, diff --git a/src/librustc_target/spec/windows_msvc_base.rs b/src/librustc_target/spec/windows_msvc_base.rs index 63a443cd07a..52b166df939 100644 --- a/src/librustc_target/spec/windows_msvc_base.rs +++ b/src/librustc_target/spec/windows_msvc_base.rs @@ -1,9 +1,11 @@ -use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions}; +use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, TargetOptions}; use std::default::Default; pub fn opts() -> TargetOptions { + let pre_args = vec!["/NOLOGO".to_string(), "/NXCOMPAT".to_string()]; let mut args = LinkArgs::new(); - args.insert(LinkerFlavor::Msvc, vec!["/NOLOGO".to_string(), "/NXCOMPAT".to_string()]); + args.insert(LinkerFlavor::Msvc, pre_args.clone()); + args.insert(LinkerFlavor::Lld(LldFlavor::Link), pre_args); TargetOptions { function_sections: true, @@ -21,6 +23,7 @@ pub fn opts() -> TargetOptions { // language packs, and avoid generating Non-UTF-8 error // messages if a link error occurred. link_env: vec![("VSLANG".to_string(), "1033".to_string())], + lld_flavor: LldFlavor::Link, pre_link_args: args, crt_static_allows_dylibs: true, crt_static_respected: true, diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 89eeed8d11e..c2123876b67 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -2220,7 +2220,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { let mut could_refer_to = |kind: DefKind, def_id, also| { let note_msg = format!( - "`{}` could{} refer to {} defined here", + "`{}` could{} refer to the {} defined here", assoc_ident, also, kind.descr(def_id) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index ec881d25dd2..44fd8b929f3 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -1895,21 +1895,23 @@ function getSearchElement() { var implementors = document.getElementById("implementors-list"); var synthetic_implementors = document.getElementById("synthetic-implementors-list"); - // This `inlined_types` variable is used to avoid having the same implementation showing - // up twice. For example "String" in the "Sync" doc page. - // - // By the way, this is only used by and useful for traits implemented automatically (like - // "Send" and "Sync"). - var inlined_types = new Set(); - onEachLazy(synthetic_implementors.getElementsByClassName("impl"), function(el) { - var aliases = el.getAttribute("aliases"); - if (!aliases) { - return; - } - aliases.split(",").forEach(function(alias) { - inlined_types.add(alias); + if (synthetic_implementors) { + // This `inlined_types` variable is used to avoid having the same implementation + // showing up twice. For example "String" in the "Sync" doc page. + // + // By the way, this is only used by and useful for traits implemented automatically + // (like "Send" and "Sync"). + var inlined_types = new Set(); + onEachLazy(synthetic_implementors.getElementsByClassName("impl"), function(el) { + var aliases = el.getAttribute("aliases"); + if (!aliases) { + return; + } + aliases.split(",").forEach(function(alias) { + inlined_types.add(alias); + }); }); - }); + } var libs = Object.getOwnPropertyNames(imp); var llength = libs.length; diff --git a/src/libserialize/opaque.rs b/src/libserialize/opaque.rs index e808d981998..39f3abb7527 100644 --- a/src/libserialize/opaque.rs +++ b/src/libserialize/opaque.rs @@ -192,7 +192,7 @@ impl<'a> Decoder<'a> { } macro_rules! read_uleb128 { - ($dec:expr, $t:ty, $fun:ident) => {{ + ($dec:expr, $fun:ident) => {{ let (value, bytes_read) = leb128::$fun(&$dec.data[$dec.position..]); $dec.position += bytes_read; Ok(value) @@ -217,22 +217,22 @@ impl<'a> serialize::Decoder for Decoder<'a> { #[inline] fn read_u128(&mut self) -> Result<u128, Self::Error> { - read_uleb128!(self, u128, read_u128_leb128) + read_uleb128!(self, read_u128_leb128) } #[inline] fn read_u64(&mut self) -> Result<u64, Self::Error> { - read_uleb128!(self, u64, read_u64_leb128) + read_uleb128!(self, read_u64_leb128) } #[inline] fn read_u32(&mut self) -> Result<u32, Self::Error> { - read_uleb128!(self, u32, read_u32_leb128) + read_uleb128!(self, read_u32_leb128) } #[inline] fn read_u16(&mut self) -> Result<u16, Self::Error> { - read_uleb128!(self, u16, read_u16_leb128) + read_uleb128!(self, read_u16_leb128) } #[inline] @@ -244,7 +244,7 @@ impl<'a> serialize::Decoder for Decoder<'a> { #[inline] fn read_usize(&mut self) -> Result<usize, Self::Error> { - read_uleb128!(self, usize, read_usize_leb128) + read_uleb128!(self, read_usize_leb128) } #[inline] diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 95c8934b3d6..67b382c7a84 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -1327,6 +1327,8 @@ pub trait Write { /// not of [`ErrorKind::Interrupted`] kind generated from this method will be /// returned. /// + /// If the buffer contains no data, this will never call [`write`]. + /// /// # Errors /// /// This function will return the first error of diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index dc93ac90482..bc07c6b487b 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -237,6 +237,7 @@ #![feature(arbitrary_self_types)] #![feature(array_error_internals)] #![feature(asm)] +#![feature(assoc_int_consts)] #![feature(associated_type_bounds)] #![feature(box_syntax)] #![feature(c_variadic)] diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index 6410a4f2b65..200b00b1195 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -813,6 +813,20 @@ impl fmt::Display for IpAddr { #[stable(feature = "ip_from_ip", since = "1.16.0")] impl From<Ipv4Addr> for IpAddr { + /// Copies this address to a new `IpAddr::V4`. + /// + /// # Examples + /// + /// ``` + /// use std::net::{IpAddr, Ipv4Addr}; + /// + /// let addr = Ipv4Addr::new(127, 0, 0, 1); + /// + /// assert_eq!( + /// IpAddr::V4(addr), + /// IpAddr::from(addr) + /// ) + /// ``` fn from(ipv4: Ipv4Addr) -> IpAddr { IpAddr::V4(ipv4) } @@ -820,6 +834,20 @@ impl From<Ipv4Addr> for IpAddr { #[stable(feature = "ip_from_ip", since = "1.16.0")] impl From<Ipv6Addr> for IpAddr { + /// Copies this address to a new `IpAddr::V6`. + /// + /// # Examples + /// + /// ``` + /// use std::net::{IpAddr, Ipv6Addr}; + /// + /// let addr = Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff); + /// + /// assert_eq!( + /// IpAddr::V6(addr), + /// IpAddr::from(addr) + /// ); + /// ``` fn from(ipv6: Ipv6Addr) -> IpAddr { IpAddr::V6(ipv6) } @@ -975,6 +1003,8 @@ impl From<u32> for Ipv4Addr { #[stable(feature = "from_slice_v4", since = "1.9.0")] impl From<[u8; 4]> for Ipv4Addr { + /// Creates an `Ipv4Addr` from a four element byte array. + /// /// # Examples /// /// ``` @@ -1734,6 +1764,27 @@ impl From<u128> for Ipv6Addr { #[stable(feature = "ipv6_from_octets", since = "1.9.0")] impl From<[u8; 16]> for Ipv6Addr { + /// Creates an `Ipv6Addr` from a sixteen element byte array. + /// + /// # Examples + /// + /// ``` + /// use std::net::Ipv6Addr; + /// + /// let addr = Ipv6Addr::from([ + /// 25u8, 24u8, 23u8, 22u8, 21u8, 20u8, 19u8, 18u8, + /// 17u8, 16u8, 15u8, 14u8, 13u8, 12u8, 11u8, 10u8, + /// ]); + /// assert_eq!( + /// Ipv6Addr::new( + /// 0x1918, 0x1716, + /// 0x1514, 0x1312, + /// 0x1110, 0x0f0e, + /// 0x0d0c, 0x0b0a + /// ), + /// addr + /// ); + /// ``` fn from(octets: [u8; 16]) -> Ipv6Addr { let inner = c::in6_addr { s6_addr: octets }; Ipv6Addr::from_inner(inner) @@ -1742,6 +1793,27 @@ impl From<[u8; 16]> for Ipv6Addr { #[stable(feature = "ipv6_from_segments", since = "1.16.0")] impl From<[u16; 8]> for Ipv6Addr { + /// Creates an `Ipv6Addr` from an eight element 16-bit array. + /// + /// # Examples + /// + /// ``` + /// use std::net::Ipv6Addr; + /// + /// let addr = Ipv6Addr::from([ + /// 525u16, 524u16, 523u16, 522u16, + /// 521u16, 520u16, 519u16, 518u16, + /// ]); + /// assert_eq!( + /// Ipv6Addr::new( + /// 0x20d, 0x20c, + /// 0x20b, 0x20a, + /// 0x209, 0x208, + /// 0x207, 0x206 + /// ), + /// addr + /// ); + /// ``` fn from(segments: [u16; 8]) -> Ipv6Addr { let [a, b, c, d, e, f, g, h] = segments; Ipv6Addr::new(a, b, c, d, e, f, g, h) diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index a5b34eeec28..3ca778354e4 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -426,8 +426,8 @@ pub mod guard { } // glibc >= 2.15 has a __pthread_get_minstack() function that returns -// PTHREAD_STACK_MIN plus however many bytes are needed for thread-local -// storage. We need that information to avoid blowing up when a small stack +// PTHREAD_STACK_MIN plus bytes needed for thread-local storage. +// We need that information to avoid blowing up when a small stack // is created in an application with big thread-local storage requirements. // See #6233 for rationale and details. #[cfg(target_os = "linux")] diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 5c64cc440ce..db4fd53fe16 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -2243,7 +2243,7 @@ pub struct Mod { #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct ForeignMod { pub abi: Option<StrLit>, - pub items: Vec<ForeignItem>, + pub items: Vec<P<ForeignItem>>, } /// Global inline assembly. @@ -2605,7 +2605,7 @@ pub enum ItemKind { /// A trait declaration (`trait`). /// /// E.g., `trait Foo { .. }`, `trait Foo<T> { .. }` or `auto trait Foo {}`. - Trait(IsAuto, Unsafety, Generics, GenericBounds, Vec<AssocItem>), + Trait(IsAuto, Unsafety, Generics, GenericBounds, Vec<P<AssocItem>>), /// Trait alias /// /// E.g., `trait Foo = Bar + Quux;`. @@ -2624,7 +2624,7 @@ pub enum ItemKind { of_trait: Option<TraitRef>, self_ty: P<Ty>, - items: Vec<AssocItem>, + items: Vec<P<AssocItem>>, }, /// A macro invocation. /// diff --git a/src/libsyntax/attr/builtin.rs b/src/libsyntax/attr/builtin.rs index 6cfe4f2de1e..1da005d70d4 100644 --- a/src/libsyntax/attr/builtin.rs +++ b/src/libsyntax/attr/builtin.rs @@ -371,6 +371,7 @@ where let mut feature = None; let mut reason = None; let mut issue = None; + let mut issue_num = None; let mut is_soft = false; for meta in metas { if let Some(mi) = meta.meta_item() { @@ -389,6 +390,37 @@ where if !get(mi, &mut issue) { continue 'outer; } + + // These unwraps are safe because `get` ensures the meta item + // is a name/value pair string literal. + issue_num = match &*issue.unwrap().as_str() { + "none" => None, + issue => { + match issue.parse() { + Ok(num) => { + // FIXME(rossmacarthur): disallow 0 + // Disallowing this requires updates to + // some submodules + NonZeroU32::new(num) + } + Err(err) => { + struct_span_err!( + diagnostic, + mi.span, + E0545, + "`issue` must be a numeric string \ + or \"none\"", + ) + .span_label( + mi.name_value_literal().unwrap().span, + &err.to_string(), + ) + .emit(); + continue 'outer; + } + } + } + }; } sym::soft => { if !mi.is_word() { @@ -420,27 +452,8 @@ where } match (feature, reason, issue) { - (Some(feature), reason, Some(issue)) => { - let issue = match &*issue.as_str() { - "none" => None, - issue => { - if let Ok(num) = issue.parse() { - // FIXME(rossmacarthur): disallow 0 - // Disallowing this requires updates to some submodules - NonZeroU32::new(num) - } else { - struct_span_err!( - diagnostic, - attr.span, - E0545, - "incorrect 'issue'" - ) - .emit(); - continue; - } - } - }; - let level = Unstable { reason, issue, is_soft }; + (Some(feature), reason, Some(_)) => { + let level = Unstable { reason, issue: issue_num, is_soft }; if sym::unstable == meta_name { stab = Some(Stability { level, feature, rustc_depr: None }); } else { diff --git a/src/libsyntax/mut_visit.rs b/src/libsyntax/mut_visit.rs index 4a460c5d7b2..3bcdf8fe286 100644 --- a/src/libsyntax/mut_visit.rs +++ b/src/libsyntax/mut_visit.rs @@ -82,7 +82,7 @@ pub trait MutVisitor: Sized { noop_visit_use_tree(use_tree, self); } - fn flat_map_foreign_item(&mut self, ni: ForeignItem) -> SmallVec<[ForeignItem; 1]> { + fn flat_map_foreign_item(&mut self, ni: P<ForeignItem>) -> SmallVec<[P<ForeignItem>; 1]> { noop_flat_map_foreign_item(ni, self) } @@ -102,11 +102,11 @@ pub trait MutVisitor: Sized { noop_visit_item_kind(i, self); } - fn flat_map_trait_item(&mut self, i: AssocItem) -> SmallVec<[AssocItem; 1]> { + fn flat_map_trait_item(&mut self, i: P<AssocItem>) -> SmallVec<[P<AssocItem>; 1]> { noop_flat_map_assoc_item(i, self) } - fn flat_map_impl_item(&mut self, i: AssocItem) -> SmallVec<[AssocItem; 1]> { + fn flat_map_impl_item(&mut self, i: P<AssocItem>) -> SmallVec<[P<AssocItem>; 1]> { noop_flat_map_assoc_item(i, self) } @@ -704,7 +704,8 @@ pub fn noop_visit_interpolated<T: MutVisitor>(nt: &mut token::Nonterminal, vis: token::NtIdent(ident, _is_raw) => vis.visit_ident(ident), token::NtLifetime(ident) => vis.visit_ident(ident), token::NtLiteral(expr) => vis.visit_expr(expr), - token::NtMeta(AttrItem { path, args }) => { + token::NtMeta(item) => { + let AttrItem { path, args } = item.deref_mut(); vis.visit_path(path); visit_mac_args(args, vis); } @@ -947,11 +948,11 @@ pub fn noop_visit_item_kind<T: MutVisitor>(kind: &mut ItemKind, vis: &mut T) { } pub fn noop_flat_map_assoc_item<T: MutVisitor>( - mut item: AssocItem, + mut item: P<AssocItem>, visitor: &mut T, -) -> SmallVec<[AssocItem; 1]> { +) -> SmallVec<[P<AssocItem>; 1]> { let AssocItem { id, ident, vis, defaultness: _, attrs, generics, kind, span, tokens: _ } = - &mut item; + item.deref_mut(); visitor.visit_id(id); visitor.visit_ident(ident); visitor.visit_vis(vis); @@ -1036,10 +1037,10 @@ pub fn noop_flat_map_item<T: MutVisitor>( } pub fn noop_flat_map_foreign_item<T: MutVisitor>( - mut item: ForeignItem, + mut item: P<ForeignItem>, visitor: &mut T, -) -> SmallVec<[ForeignItem; 1]> { - let ForeignItem { ident, attrs, id, kind, vis, span, tokens: _ } = &mut item; +) -> SmallVec<[P<ForeignItem>; 1]> { + let ForeignItem { ident, attrs, id, kind, vis, span, tokens: _ } = item.deref_mut(); visitor.visit_ident(ident); visit_attrs(attrs, visitor); match kind { diff --git a/src/libsyntax/token.rs b/src/libsyntax/token.rs index 14279561cbb..3045f147698 100644 --- a/src/libsyntax/token.rs +++ b/src/libsyntax/token.rs @@ -673,18 +673,22 @@ pub enum Nonterminal { NtLifetime(ast::Ident), NtLiteral(P<ast::Expr>), /// Stuff inside brackets for attributes - NtMeta(ast::AttrItem), + NtMeta(P<ast::AttrItem>), NtPath(ast::Path), NtVis(ast::Visibility), NtTT(TokenTree), // Used only for passing items to proc macro attributes (they are not // strictly necessary for that, `Annotatable` can be converted into // tokens directly, but doing that naively regresses pretty-printing). - NtTraitItem(ast::AssocItem), - NtImplItem(ast::AssocItem), - NtForeignItem(ast::ForeignItem), + NtTraitItem(P<ast::AssocItem>), + NtImplItem(P<ast::AssocItem>), + NtForeignItem(P<ast::ForeignItem>), } +// `Nonterminal` is used a lot. Make sure it doesn't unintentionally get bigger. +#[cfg(target_arch = "x86_64")] +rustc_data_structures::static_assert_size!(Nonterminal, 40); + impl PartialEq for Nonterminal { fn eq(&self, rhs: &Self) -> bool { match (self, rhs) { diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp index eaa845a279f..fad70369807 100644 --- a/src/rustllvm/PassWrapper.cpp +++ b/src/rustllvm/PassWrapper.cpp @@ -87,8 +87,9 @@ extern "C" LLVMPassRef LLVMRustFindAndCreatePass(const char *PassName) { extern "C" LLVMPassRef LLVMRustCreateAddressSanitizerFunctionPass(bool Recover) { const bool CompileKernel = false; + const bool UseAfterScope = true; - return wrap(createAddressSanitizerFunctionPass(CompileKernel, Recover)); + return wrap(createAddressSanitizerFunctionPass(CompileKernel, Recover, UseAfterScope)); } extern "C" LLVMPassRef LLVMRustCreateModuleAddressSanitizerPass(bool Recover) { diff --git a/src/test/run-make/wasm-stringify-ints-small/Makefile b/src/test/run-make/wasm-stringify-ints-small/Makefile index 26de6a0c689..01e1c6b0ce8 100644 --- a/src/test/run-make/wasm-stringify-ints-small/Makefile +++ b/src/test/run-make/wasm-stringify-ints-small/Makefile @@ -4,7 +4,7 @@ ifeq ($(TARGET),wasm32-unknown-unknown) all: $(RUSTC) foo.rs -C lto -O --target wasm32-unknown-unknown wc -c < $(TMPDIR)/foo.wasm - [ "`wc -c < $(TMPDIR)/foo.wasm`" -lt "20500" ] + [ "`wc -c < $(TMPDIR)/foo.wasm`" -lt "25000" ] else all: endif diff --git a/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr b/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr index b432bfbf20f..bc21cfd47c5 100644 --- a/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr +++ b/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr @@ -4,7 +4,7 @@ error: `[v2]` cannot be resolved, ignoring it. LL | /// [v2] | ^^ cannot be resolved, ignoring | -note: lint level defined here +note: the lint level is defined here --> $DIR/deny-intra-link-resolution-failure.rs:1:9 | LL | #![deny(intra_doc_link_resolution_failure)] diff --git a/src/test/rustdoc-ui/deny-missing-docs-crate.stderr b/src/test/rustdoc-ui/deny-missing-docs-crate.stderr index 9cd50d26766..f0a13b70b97 100644 --- a/src/test/rustdoc-ui/deny-missing-docs-crate.stderr +++ b/src/test/rustdoc-ui/deny-missing-docs-crate.stderr @@ -6,7 +6,7 @@ LL | | LL | | pub struct Foo; | |_______________^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/deny-missing-docs-crate.rs:1:9 | LL | #![deny(missing_docs)] diff --git a/src/test/rustdoc-ui/deny-missing-docs-macro.stderr b/src/test/rustdoc-ui/deny-missing-docs-macro.stderr index ef15bf05d54..a564006e74f 100644 --- a/src/test/rustdoc-ui/deny-missing-docs-macro.stderr +++ b/src/test/rustdoc-ui/deny-missing-docs-macro.stderr @@ -4,7 +4,7 @@ error: missing documentation for macro LL | macro_rules! foo { | ^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/deny-missing-docs-macro.rs:3:9 | LL | #![deny(missing_docs)] diff --git a/src/test/rustdoc-ui/doc-without-codeblock.stderr b/src/test/rustdoc-ui/doc-without-codeblock.stderr index bf65fcf19a0..f2b2328322a 100644 --- a/src/test/rustdoc-ui/doc-without-codeblock.stderr +++ b/src/test/rustdoc-ui/doc-without-codeblock.stderr @@ -10,7 +10,7 @@ LL | | pub fn bar() {} LL | | } | |_^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/doc-without-codeblock.rs:1:9 | LL | #![deny(missing_doc_code_examples)] diff --git a/src/test/rustdoc-ui/intra-doc-alias-ice.stderr b/src/test/rustdoc-ui/intra-doc-alias-ice.stderr index d4d3e5fea3e..cf266751630 100644 --- a/src/test/rustdoc-ui/intra-doc-alias-ice.stderr +++ b/src/test/rustdoc-ui/intra-doc-alias-ice.stderr @@ -4,7 +4,7 @@ error: `[TypeAlias::hoge]` cannot be resolved, ignoring it. LL | /// [broken cross-reference](TypeAlias::hoge) | ^^^^^^^^^^^^^^^ cannot be resolved, ignoring | -note: lint level defined here +note: the lint level is defined here --> $DIR/intra-doc-alias-ice.rs:1:9 | LL | #![deny(intra_doc_link_resolution_failure)] diff --git a/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr b/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr index edd5b8b92f2..ce31eb3a8a3 100644 --- a/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr +++ b/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr @@ -4,7 +4,7 @@ error: `[i]` cannot be resolved, ignoring it. LL | /// (arr[i]) | ^ cannot be resolved, ignoring | -note: lint level defined here +note: the lint level is defined here --> $DIR/intra-link-span-ice-55723.rs:1:9 | LL | #![deny(intra_doc_link_resolution_failure)] diff --git a/src/test/rustdoc-ui/intra-links-ambiguity.stderr b/src/test/rustdoc-ui/intra-links-ambiguity.stderr index 9ee3ff57fb5..7b9821b3d04 100644 --- a/src/test/rustdoc-ui/intra-links-ambiguity.stderr +++ b/src/test/rustdoc-ui/intra-links-ambiguity.stderr @@ -4,7 +4,7 @@ error: `ambiguous` is both a struct and a function LL | /// [`ambiguous`] is ambiguous. | ^^^^^^^^^^^ ambiguous link | -note: lint level defined here +note: the lint level is defined here --> $DIR/intra-links-ambiguity.rs:1:9 | LL | #![deny(intra_doc_link_resolution_failure)] diff --git a/src/test/rustdoc-ui/intra-links-anchors.stderr b/src/test/rustdoc-ui/intra-links-anchors.stderr index 5fead8e4c35..11dee5547db 100644 --- a/src/test/rustdoc-ui/intra-links-anchors.stderr +++ b/src/test/rustdoc-ui/intra-links-anchors.stderr @@ -4,7 +4,7 @@ error: `[Foo::f#hola]` has an issue with the link anchor. LL | /// Or maybe [Foo::f#hola]. | ^^^^^^^^^^^ struct fields cannot be followed by anchors | -note: lint level defined here +note: the lint level is defined here --> $DIR/intra-links-anchors.rs:1:9 | LL | #![deny(intra_doc_link_resolution_failure)] diff --git a/src/test/rustdoc-ui/lint-group.stderr b/src/test/rustdoc-ui/lint-group.stderr index dca98cf58df..852c9120e0b 100644 --- a/src/test/rustdoc-ui/lint-group.stderr +++ b/src/test/rustdoc-ui/lint-group.stderr @@ -8,7 +8,7 @@ LL | | /// println!("sup"); LL | | /// ``` | |_______^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-group.rs:7:9 | LL | #![deny(rustdoc)] @@ -21,7 +21,7 @@ error: `[error]` cannot be resolved, ignoring it. LL | /// what up, let's make an [error] | ^^^^^ cannot be resolved, ignoring | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-group.rs:7:9 | LL | #![deny(rustdoc)] @@ -35,7 +35,7 @@ error: missing code example in this documentation LL | /// wait, this doesn't have a doctest? | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-group.rs:7:9 | LL | #![deny(rustdoc)] diff --git a/src/test/rustdoc-ui/lint-missing-doc-code-example.stderr b/src/test/rustdoc-ui/lint-missing-doc-code-example.stderr index 179dba17c6d..3fcfc1808e0 100644 --- a/src/test/rustdoc-ui/lint-missing-doc-code-example.stderr +++ b/src/test/rustdoc-ui/lint-missing-doc-code-example.stderr @@ -5,7 +5,7 @@ LL | / mod module1 { LL | | } | |_^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-missing-doc-code-example.rs:2:9 | LL | #![deny(missing_doc_code_examples)] diff --git a/src/test/rustdoc-ui/private-item-doc-test.stderr b/src/test/rustdoc-ui/private-item-doc-test.stderr index 8abbdb31ec9..70b6638b237 100644 --- a/src/test/rustdoc-ui/private-item-doc-test.stderr +++ b/src/test/rustdoc-ui/private-item-doc-test.stderr @@ -8,7 +8,7 @@ LL | | /// assert!(false); LL | | /// ``` | |___________^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/private-item-doc-test.rs:1:9 | LL | #![deny(private_doc_tests)] diff --git a/src/test/rustdoc/show-const-contents.rs b/src/test/rustdoc/show-const-contents.rs index e84f6e52c75..064c026e6a0 100644 --- a/src/test/rustdoc/show-const-contents.rs +++ b/src/test/rustdoc/show-const-contents.rs @@ -47,9 +47,9 @@ pub struct MyTypeWithStr(&'static str); // @!has show_const_contents/constant.MY_TYPE_WITH_STR.html '; //' pub const MY_TYPE_WITH_STR: MyTypeWithStr = MyTypeWithStr("show this"); -// @has show_const_contents/constant.EPSILON.html '1.1920929e-7f32;' -// @!has show_const_contents/constant.EPSILON.html '; //' -pub use std::f32::EPSILON; +// @has show_const_contents/constant.PI.html '= 3.14159265358979323846264338327950288f32;' +// @has show_const_contents/constant.PI.html '; // 3.14159274f32' +pub use std::f32::consts::PI; // @has show_const_contents/constant.MAX.html '= i32::max_value(); // 2_147_483_647i32' pub use std::i32::MAX; diff --git a/src/test/ui-fulldeps/internal-lints/default_hash_types.stderr b/src/test/ui-fulldeps/internal-lints/default_hash_types.stderr index c1762d31323..4f78f51b676 100644 --- a/src/test/ui-fulldeps/internal-lints/default_hash_types.stderr +++ b/src/test/ui-fulldeps/internal-lints/default_hash_types.stderr @@ -4,7 +4,7 @@ error: Prefer FxHashMap over HashMap, it has better performance LL | let _map: HashMap<String, String> = HashMap::default(); | ^^^^^^^ help: use: `FxHashMap` | -note: lint level defined here +note: the lint level is defined here --> $DIR/default_hash_types.rs:10:8 | LL | #[deny(rustc::default_hash_types)] diff --git a/src/test/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr b/src/test/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr index 39ac0019aac..966a747a1c9 100644 --- a/src/test/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr +++ b/src/test/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr @@ -4,7 +4,7 @@ error: implementing `LintPass` by hand LL | impl LintPass for Foo { | ^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint_pass_impl_without_macro.rs:4:9 | LL | #![deny(rustc::lint_pass_impl_without_macro)] diff --git a/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref.stderr b/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref.stderr index d2ed6b6a19c..2751a37f741 100644 --- a/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref.stderr +++ b/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref.stderr @@ -4,7 +4,7 @@ error: passing `Ty<'_>` by reference LL | ty_ref: &Ty<'_>, | ^^^^^^^ help: try passing by value: `Ty<'_>` | -note: lint level defined here +note: the lint level is defined here --> $DIR/pass_ty_by_ref.rs:4:9 | LL | #![deny(rustc::ty_pass_by_reference)] diff --git a/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr b/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr index 72c23f8cd3c..59732cd84e5 100644 --- a/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr +++ b/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr @@ -4,7 +4,7 @@ error: usage of qualified `ty::Ty<'_>` LL | ty_q: ty::Ty<'_>, | ^^^^^^^^^^ help: try using it unqualified: `Ty<'_>` | -note: lint level defined here +note: the lint level is defined here --> $DIR/qualified_ty_ty_ctxt.rs:4:9 | LL | #![deny(rustc::usage_of_qualified_ty)] diff --git a/src/test/ui-fulldeps/internal-lints/ty_tykind_usage.stderr b/src/test/ui-fulldeps/internal-lints/ty_tykind_usage.stderr index 28c837adac3..ee9f1ff10f8 100644 --- a/src/test/ui-fulldeps/internal-lints/ty_tykind_usage.stderr +++ b/src/test/ui-fulldeps/internal-lints/ty_tykind_usage.stderr @@ -4,7 +4,7 @@ error: usage of `ty::TyKind::<kind>` LL | let kind = TyKind::Bool; | ^^^^^^ help: try using ty::<kind> directly: `ty` | -note: lint level defined here +note: the lint level is defined here --> $DIR/ty_tykind_usage.rs:9:8 | LL | #[deny(rustc::usage_of_ty_tykind)] diff --git a/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr b/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr index c611023e549..a0081b15f53 100644 --- a/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr +++ b/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr @@ -12,7 +12,7 @@ error: item is named 'lintme' LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-plugin-deny-attr.rs:7:9 | LL | #![deny(test_lint)] diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr index f93a0a0de53..df92bc70a79 100644 --- a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr +++ b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr @@ -30,7 +30,7 @@ error: item is named 'lintme' LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-plugin-forbid-attrs.rs:7:11 | LL | #![forbid(test_lint)] diff --git a/src/test/ui-fulldeps/lint-tool-test.stderr b/src/test/ui-fulldeps/lint-tool-test.stderr index 809b9ac1620..31d25652d5d 100644 --- a/src/test/ui-fulldeps/lint-tool-test.stderr +++ b/src/test/ui-fulldeps/lint-tool-test.stderr @@ -70,7 +70,7 @@ error: item is named 'lintme' LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-tool-test.rs:13:9 | LL | #![deny(clippy_group)] @@ -83,7 +83,7 @@ error: item is named 'lintmetoo' LL | fn lintmetoo() { } | ^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-tool-test.rs:13:9 | LL | #![deny(clippy_group)] diff --git a/src/test/ui/allocator/two-allocators.stderr b/src/test/ui/allocator/two-allocators.stderr index 35d9f0f42f0..da636a5a567 100644 --- a/src/test/ui/allocator/two-allocators.stderr +++ b/src/test/ui/allocator/two-allocators.stderr @@ -2,7 +2,7 @@ error: cannot define multiple global allocators --> $DIR/two-allocators.rs:6:1 | LL | static A: System = System; - | -------------------------- previous global allocator is defined here + | -------------------------- previous global allocator defined here LL | #[global_allocator] LL | static B: System = System; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot define a new global allocator diff --git a/src/test/ui/anon-params-deprecated.stderr b/src/test/ui/anon-params-deprecated.stderr index 8e4fa70d342..4520559845f 100644 --- a/src/test/ui/anon-params-deprecated.stderr +++ b/src/test/ui/anon-params-deprecated.stderr @@ -4,7 +4,7 @@ warning: anonymous parameters are deprecated and will be removed in the next edi LL | fn foo(i32); | ^^^ help: try naming the parameter or explicitly ignoring it: `_: i32` | -note: lint level defined here +note: the lint level is defined here --> $DIR/anon-params-deprecated.rs:1:9 | LL | #![warn(anonymous_parameters)] diff --git a/src/test/ui/associated-const/associated-const-dead-code.stderr b/src/test/ui/associated-const/associated-const-dead-code.stderr index 8c6d76bbdf6..172aed733fc 100644 --- a/src/test/ui/associated-const/associated-const-dead-code.stderr +++ b/src/test/ui/associated-const/associated-const-dead-code.stderr @@ -4,7 +4,7 @@ error: associated const is never used: `BAR` LL | const BAR: u32 = 1; | ^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/associated-const-dead-code.rs:1:9 | LL | #![deny(dead_code)] diff --git a/src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.stderr b/src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.stderr index f1a22cda51b..474c09d79df 100644 --- a/src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.stderr +++ b/src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.stderr @@ -4,7 +4,7 @@ error: `await` is a keyword in the 2018 edition LL | pub mod await { | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` | -note: lint level defined here +note: the lint level is defined here --> $DIR/2015-edition-error-various-positions.rs:2:9 | LL | #![deny(keyword_idents)] diff --git a/src/test/ui/async-await/await-keyword/2015-edition-warning.stderr b/src/test/ui/async-await/await-keyword/2015-edition-warning.stderr index d9ae1b9a167..0c558eb12f0 100644 --- a/src/test/ui/async-await/await-keyword/2015-edition-warning.stderr +++ b/src/test/ui/async-await/await-keyword/2015-edition-warning.stderr @@ -4,7 +4,7 @@ error: `await` is a keyword in the 2018 edition LL | pub mod await { | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` | -note: lint level defined here +note: the lint level is defined here --> $DIR/2015-edition-warning.rs:4:9 | LL | #![deny(keyword_idents)] diff --git a/src/test/ui/async-await/unreachable-lint-1.stderr b/src/test/ui/async-await/unreachable-lint-1.stderr index 382581bf945..e9325788961 100644 --- a/src/test/ui/async-await/unreachable-lint-1.stderr +++ b/src/test/ui/async-await/unreachable-lint-1.stderr @@ -6,7 +6,7 @@ LL | return; bar().await; | | | any code following this expression is unreachable | -note: lint level defined here +note: the lint level is defined here --> $DIR/unreachable-lint-1.rs:2:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/async-await/unused-lifetime.stderr b/src/test/ui/async-await/unused-lifetime.stderr index 885cdc04cfa..2a7a12a3643 100644 --- a/src/test/ui/async-await/unused-lifetime.stderr +++ b/src/test/ui/async-await/unused-lifetime.stderr @@ -4,7 +4,7 @@ error: lifetime parameter `'a` never used LL | pub async fn func_with_unused_lifetime<'a>(s: &'a str) { | ^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused-lifetime.rs:7:9 | LL | #![deny(unused_lifetimes)] diff --git a/src/test/ui/attributes/register-attr-tool-unused.stderr b/src/test/ui/attributes/register-attr-tool-unused.stderr index 0756c572c35..85a4fa4a748 100644 --- a/src/test/ui/attributes/register-attr-tool-unused.stderr +++ b/src/test/ui/attributes/register-attr-tool-unused.stderr @@ -4,7 +4,7 @@ error: unused attribute LL | #[register_attr(attr)] | ^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/register-attr-tool-unused.rs:1:9 | LL | #![deny(unused)] diff --git a/src/test/ui/bad/bad-lint-cap2.stderr b/src/test/ui/bad/bad-lint-cap2.stderr index 75e257893fa..3f3affe5a98 100644 --- a/src/test/ui/bad/bad-lint-cap2.stderr +++ b/src/test/ui/bad/bad-lint-cap2.stderr @@ -4,7 +4,7 @@ error: unused import: `std::option` LL | use std::option; | ^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/bad-lint-cap2.rs:4:9 | LL | #![deny(warnings)] diff --git a/src/test/ui/bad/bad-lint-cap3.stderr b/src/test/ui/bad/bad-lint-cap3.stderr index 96b40c98c0e..a4e399b1fac 100644 --- a/src/test/ui/bad/bad-lint-cap3.stderr +++ b/src/test/ui/bad/bad-lint-cap3.stderr @@ -4,7 +4,7 @@ warning: unused import: `std::option` LL | use std::option; | ^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/bad-lint-cap3.rs:5:9 | LL | #![deny(warnings)] diff --git a/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.rs b/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.rs index a6f3905bebd..51f2ff75da8 100644 --- a/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.rs +++ b/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.rs @@ -9,8 +9,8 @@ // borrowck=migrate`. // revisions: zflag edition -// [zflag]compile-flags: -Z borrowck=migrate -// [edition]edition:2018 +//[zflag]compile-flags: -Z borrowck=migrate +//[edition]edition:2018 #![feature(nll)] diff --git a/src/test/ui/borrowck/issue-45983.nll.stderr b/src/test/ui/borrowck/issue-45983.nll.stderr index 49d6c2473f6..51bb4dee676 100644 --- a/src/test/ui/borrowck/issue-45983.nll.stderr +++ b/src/test/ui/borrowck/issue-45983.nll.stderr @@ -2,7 +2,7 @@ error[E0521]: borrowed data escapes outside of closure --> $DIR/issue-45983.rs:20:18 | LL | let x = None; - | - `x` is declared here, outside of the closure body + | - `x` declared here, outside of the closure body LL | give_any(|y| x = Some(y)); | - ^^^^^^^^^^^ `y` escapes the closure body here | | diff --git a/src/test/ui/borrowck/issue-7573.nll.stderr b/src/test/ui/borrowck/issue-7573.nll.stderr index 0da715bbdb7..20afecfe5de 100644 --- a/src/test/ui/borrowck/issue-7573.nll.stderr +++ b/src/test/ui/borrowck/issue-7573.nll.stderr @@ -2,7 +2,7 @@ error[E0521]: borrowed data escapes outside of closure --> $DIR/issue-7573.rs:21:9 | LL | let mut lines_to_use: Vec<&CrateId> = Vec::new(); - | ---------------- `lines_to_use` is declared here, outside of the closure body + | ---------------- `lines_to_use` declared here, outside of the closure body LL | LL | let push_id = |installed_id: &CrateId| { | ------------ `installed_id` is a reference that is only valid in the closure body diff --git a/src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr b/src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr index 4797a9d456c..68a0fe0b4f0 100644 --- a/src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr +++ b/src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr @@ -2,7 +2,7 @@ error[E0521]: borrowed data escapes outside of closure --> $DIR/regions-escape-bound-fn-2.rs:8:18 | LL | let mut x = None; - | ----- `x` is declared here, outside of the closure body + | ----- `x` declared here, outside of the closure body LL | with_int(|y| x = Some(y)); | - ^^^^^^^^^^^ `y` escapes the closure body here | | diff --git a/src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr b/src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr index 2b3a9816e45..d304de92c7e 100644 --- a/src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr +++ b/src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr @@ -2,7 +2,7 @@ error[E0521]: borrowed data escapes outside of closure --> $DIR/regions-escape-bound-fn.rs:8:18 | LL | let mut x: Option<&isize> = None; - | ----- `x` is declared here, outside of the closure body + | ----- `x` declared here, outside of the closure body LL | with_int(|y| x = Some(y)); | - ^^^^^^^^^^^ `y` escapes the closure body here | | diff --git a/src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr b/src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr index 8ceefd25344..d9931302f75 100644 --- a/src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr +++ b/src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr @@ -2,7 +2,7 @@ error[E0521]: borrowed data escapes outside of closure --> $DIR/regions-escape-unboxed-closure.rs:6:23 | LL | let mut x: Option<&isize> = None; - | ----- `x` is declared here, outside of the closure body + | ----- `x` declared here, outside of the closure body LL | with_int(&mut |y| x = Some(y)); | - ^^^^^^^^^^^ `y` escapes the closure body here | | diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-future-compat-lint.stderr b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-future-compat-lint.stderr index 77fbfb37add..85779e53437 100644 --- a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-future-compat-lint.stderr +++ b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-future-compat-lint.stderr @@ -9,7 +9,7 @@ LL | v.push(shared.len()); | | | mutable borrow occurs here | -note: lint level defined here +note: the lint level is defined here --> $DIR/two-phase-reservation-sharing-interference-future-compat-lint.rs:18:13 | LL | #![warn(mutable_borrow_reservation_conflict)] @@ -28,7 +28,7 @@ LL | v.push(shared.len()); | | | mutable borrow occurs here | -note: lint level defined here +note: the lint level is defined here --> $DIR/two-phase-reservation-sharing-interference-future-compat-lint.rs:31:13 | LL | #![deny(mutable_borrow_reservation_conflict)] diff --git a/src/test/ui/cast-char.stderr b/src/test/ui/cast-char.stderr index 1729e5cbf09..211937c9d6f 100644 --- a/src/test/ui/cast-char.stderr +++ b/src/test/ui/cast-char.stderr @@ -4,7 +4,7 @@ error: only `u8` can be cast into `char` LL | const XYZ: char = 0x1F888 as char; | ^^^^^^^^^^^^^^^ help: use a `char` literal instead: `'\u{1F888}'` | -note: lint level defined here +note: the lint level is defined here --> $DIR/cast-char.rs:1:9 | LL | #![deny(overflowing_literals)] diff --git a/src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr b/src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr index f816f27a892..d7d716ed4cb 100644 --- a/src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr +++ b/src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr @@ -2,7 +2,7 @@ error[E0521]: borrowed data escapes outside of closure --> $DIR/expect-region-supply-region.rs:18:9 | LL | let mut f: Option<&u32> = None; - | ----- `f` is declared here, outside of the closure body + | ----- `f` declared here, outside of the closure body LL | closure_expecting_bound(|x| { | - `x` is a reference that is only valid in the closure body LL | f = Some(x); @@ -12,7 +12,7 @@ error[E0521]: borrowed data escapes outside of closure --> $DIR/expect-region-supply-region.rs:28:9 | LL | let mut f: Option<&u32> = None; - | ----- `f` is declared here, outside of the closure body + | ----- `f` declared here, outside of the closure body LL | closure_expecting_bound(|x: &u32| { | - `x` is a reference that is only valid in the closure body LL | f = Some(x); diff --git a/src/test/ui/conditional-compilation/cfg-attr-empty-is-unused.stderr b/src/test/ui/conditional-compilation/cfg-attr-empty-is-unused.stderr index 046defd5561..67cb6530e38 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-empty-is-unused.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-empty-is-unused.stderr @@ -4,7 +4,7 @@ error: unused attribute LL | #[cfg_attr(FALSE,)] | ^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/cfg-attr-empty-is-unused.rs:5:9 | LL | #![deny(unused)] diff --git a/src/test/ui/conditional-compilation/cfg-attr-multi-true.stderr b/src/test/ui/conditional-compilation/cfg-attr-multi-true.stderr index f55671f6bba..d2c613845a0 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-multi-true.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-multi-true.stderr @@ -30,7 +30,7 @@ warning: unused `MustUseDeprecated` that must be used LL | MustUseDeprecated::new(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/cfg-attr-multi-true.rs:7:9 | LL | #![warn(unused_must_use)] diff --git a/src/test/ui/conflicting-repr-hints.rs b/src/test/ui/conflicting-repr-hints.rs index 8e9c11690a8..09dade20992 100644 --- a/src/test/ui/conflicting-repr-hints.rs +++ b/src/test/ui/conflicting-repr-hints.rs @@ -11,11 +11,13 @@ enum B { } #[repr(C, u64)] //~ ERROR conflicting representation hints +//~^ WARN this was previously accepted enum C { C, } #[repr(u32, u64)] //~ ERROR conflicting representation hints +//~^ WARN this was previously accepted enum D { D, } diff --git a/src/test/ui/conflicting-repr-hints.stderr b/src/test/ui/conflicting-repr-hints.stderr index 0dfe360dbb3..43b76bf6497 100644 --- a/src/test/ui/conflicting-repr-hints.stderr +++ b/src/test/ui/conflicting-repr-hints.stderr @@ -3,45 +3,52 @@ error[E0566]: conflicting representation hints | LL | #[repr(C, u64)] | ^ ^^^ + | + = note: `#[deny(conflicting_repr_hints)]` on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585> error[E0566]: conflicting representation hints - --> $DIR/conflicting-repr-hints.rs:18:8 + --> $DIR/conflicting-repr-hints.rs:19:8 | LL | #[repr(u32, u64)] | ^^^ ^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585> error[E0587]: type has conflicting packed and align representation hints - --> $DIR/conflicting-repr-hints.rs:27:1 + --> $DIR/conflicting-repr-hints.rs:29:1 | LL | struct F(i32); | ^^^^^^^^^^^^^^ error[E0587]: type has conflicting packed and align representation hints - --> $DIR/conflicting-repr-hints.rs:31:1 + --> $DIR/conflicting-repr-hints.rs:33:1 | LL | struct G(i32); | ^^^^^^^^^^^^^^ error[E0587]: type has conflicting packed and align representation hints - --> $DIR/conflicting-repr-hints.rs:35:1 + --> $DIR/conflicting-repr-hints.rs:37:1 | LL | struct H(i32); | ^^^^^^^^^^^^^^ error[E0634]: type has conflicting packed representation hints - --> $DIR/conflicting-repr-hints.rs:38:1 + --> $DIR/conflicting-repr-hints.rs:40:1 | LL | struct I(i32); | ^^^^^^^^^^^^^^ error[E0634]: type has conflicting packed representation hints - --> $DIR/conflicting-repr-hints.rs:42:1 + --> $DIR/conflicting-repr-hints.rs:44:1 | LL | struct J(i32); | ^^^^^^^^^^^^^^ error[E0587]: type has conflicting packed and align representation hints - --> $DIR/conflicting-repr-hints.rs:48:1 + --> $DIR/conflicting-repr-hints.rs:50:1 | LL | / union X { LL | | @@ -50,7 +57,7 @@ LL | | } | |_^ error[E0587]: type has conflicting packed and align representation hints - --> $DIR/conflicting-repr-hints.rs:55:1 + --> $DIR/conflicting-repr-hints.rs:57:1 | LL | / union Y { LL | | @@ -59,7 +66,7 @@ LL | | } | |_^ error[E0587]: type has conflicting packed and align representation hints - --> $DIR/conflicting-repr-hints.rs:62:1 + --> $DIR/conflicting-repr-hints.rs:64:1 | LL | / union Z { LL | | diff --git a/src/test/ui/const-generics/const-parameter-uppercase-lint.stderr b/src/test/ui/const-generics/const-parameter-uppercase-lint.stderr index 32cf8d8a01a..3fb7c8c48b9 100644 --- a/src/test/ui/const-generics/const-parameter-uppercase-lint.stderr +++ b/src/test/ui/const-generics/const-parameter-uppercase-lint.stderr @@ -12,7 +12,7 @@ error: const parameter `x` should have an upper case name LL | fn noop<const x: u32>() { | ^ help: convert the identifier to upper case (notice the capitalization): `X` | -note: lint level defined here +note: the lint level is defined here --> $DIR/const-parameter-uppercase-lint.rs:4:9 | LL | #![deny(non_upper_case_globals)] diff --git a/src/test/ui/consts/array-literal-index-oob.stderr b/src/test/ui/consts/array-literal-index-oob.stderr index e93aa324784..59e11697015 100644 --- a/src/test/ui/consts/array-literal-index-oob.stderr +++ b/src/test/ui/consts/array-literal-index-oob.stderr @@ -4,7 +4,7 @@ warning: index out of bounds: the len is 3 but the index is 4 LL | &{ [1, 2, 3][4] }; | ^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/array-literal-index-oob.rs:4:9 | LL | #![warn(const_err)] diff --git a/src/test/ui/consts/assoc_const_generic_impl.stderr b/src/test/ui/consts/assoc_const_generic_impl.stderr index 4b13f52e762..104197fa17f 100644 --- a/src/test/ui/consts/assoc_const_generic_impl.stderr +++ b/src/test/ui/consts/assoc_const_generic_impl.stderr @@ -6,7 +6,7 @@ LL | const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::<Self>()]; | | | index out of bounds: the len is 1 but the index is 4 | -note: lint level defined here +note: the lint level is defined here --> $DIR/assoc_const_generic_impl.rs:3:9 | LL | #![warn(const_err)] diff --git a/src/test/ui/consts/const-err-early.stderr b/src/test/ui/consts/const-err-early.stderr index 9b0ef94a5b8..b78ac38d7e7 100644 --- a/src/test/ui/consts/const-err-early.stderr +++ b/src/test/ui/consts/const-err-early.stderr @@ -6,7 +6,7 @@ LL | pub const A: i8 = -std::i8::MIN; | | | attempt to negate with overflow | -note: lint level defined here +note: the lint level is defined here --> $DIR/const-err-early.rs:1:9 | LL | #![deny(const_err)] diff --git a/src/test/ui/consts/const-err-multi.stderr b/src/test/ui/consts/const-err-multi.stderr index c647f13fc75..65427b8a1b2 100644 --- a/src/test/ui/consts/const-err-multi.stderr +++ b/src/test/ui/consts/const-err-multi.stderr @@ -6,7 +6,7 @@ LL | pub const A: i8 = -std::i8::MIN; | | | attempt to negate with overflow | -note: lint level defined here +note: the lint level is defined here --> $DIR/const-err-multi.rs:1:9 | LL | #![deny(const_err)] diff --git a/src/test/ui/consts/const-err.stderr b/src/test/ui/consts/const-err.stderr index 495b221d7d7..069521e6e45 100644 --- a/src/test/ui/consts/const-err.stderr +++ b/src/test/ui/consts/const-err.stderr @@ -6,7 +6,7 @@ LL | const FOO: u8 = [5u8][1]; | | | index out of bounds: the len is 1 but the index is 1 | -note: lint level defined here +note: the lint level is defined here --> $DIR/const-err.rs:5:9 | LL | #![warn(const_err)] diff --git a/src/test/ui/consts/const-err2.stderr b/src/test/ui/consts/const-err2.stderr index 2ca1019d494..a76b6d1775f 100644 --- a/src/test/ui/consts/const-err2.stderr +++ b/src/test/ui/consts/const-err2.stderr @@ -4,7 +4,7 @@ error: this expression will panic at runtime LL | let a = -std::i8::MIN; | ^^^^^^^^^^^^^ attempt to negate with overflow | -note: lint level defined here +note: the lint level is defined here --> $DIR/const-err2.rs:11:9 | LL | #![deny(const_err)] diff --git a/src/test/ui/consts/const-err3.stderr b/src/test/ui/consts/const-err3.stderr index c374637bec2..02b912e928c 100644 --- a/src/test/ui/consts/const-err3.stderr +++ b/src/test/ui/consts/const-err3.stderr @@ -4,7 +4,7 @@ error: attempt to negate with overflow LL | let a = -std::i8::MIN; | ^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/const-err3.rs:11:9 | LL | #![deny(const_err)] diff --git a/src/test/ui/consts/const-eval/conditional_array_execution.stderr b/src/test/ui/consts/const-eval/conditional_array_execution.stderr index b5f5f84cf38..c72a1ed40c5 100644 --- a/src/test/ui/consts/const-eval/conditional_array_execution.stderr +++ b/src/test/ui/consts/const-eval/conditional_array_execution.stderr @@ -6,7 +6,7 @@ LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; | | | attempt to subtract with overflow | -note: lint level defined here +note: the lint level is defined here --> $DIR/conditional_array_execution.rs:3:9 | LL | #![warn(const_err)] diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2.stderr index 419b3d52dbf..6f823005572 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow2.stderr @@ -8,7 +8,7 @@ LL | | i8::MIN - 1, LL | | ); | |_______- | -note: lint level defined here +note: the lint level is defined here --> $DIR/const-eval-overflow2.rs:8:9 | LL | #![deny(const_err)] diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr index 2cfd34c9fc3..f9a4e5aa968 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr @@ -8,7 +8,7 @@ LL | | i8::MAX + 1, LL | | ); | |_______- | -note: lint level defined here +note: the lint level is defined here --> $DIR/const-eval-overflow2b.rs:8:9 | LL | #![deny(const_err)] diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr index 5e63286c594..6b906178026 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr @@ -8,7 +8,7 @@ LL | | i8::MIN * 2, LL | | ); | |_______- | -note: lint level defined here +note: the lint level is defined here --> $DIR/const-eval-overflow2c.rs:8:9 | LL | #![deny(const_err)] diff --git a/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.stderr b/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.stderr index e664a4aab3c..8fadfabe41c 100644 --- a/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.stderr +++ b/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.stderr @@ -6,7 +6,7 @@ LL | const VOID: ! = { let x = 0 * std::mem::size_of::<T>(); [][x] }; | | | index out of bounds: the len is 0 but the index is 0 | -note: lint level defined here +note: the lint level is defined here --> $DIR/index-out-of-bounds-never-type.rs:4:9 | LL | #![warn(const_err)] diff --git a/src/test/ui/consts/const-eval/issue-43197.stderr b/src/test/ui/consts/const-eval/issue-43197.stderr index 23b54d954c6..668d061b799 100644 --- a/src/test/ui/consts/const-eval/issue-43197.stderr +++ b/src/test/ui/consts/const-eval/issue-43197.stderr @@ -6,7 +6,7 @@ LL | const X: u32 = 0 - 1; | | | attempt to subtract with overflow | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-43197.rs:3:9 | LL | #![warn(const_err)] diff --git a/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr b/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr index 575c3648b70..d09a295264c 100644 --- a/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr +++ b/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr @@ -6,7 +6,7 @@ LL | const VOID: ! = panic!(); | | | the evaluated program panicked at 'explicit panic', $DIR/panic-assoc-never-type.rs:11:21 | -note: lint level defined here +note: the lint level is defined here --> $DIR/panic-assoc-never-type.rs:4:9 | LL | #![warn(const_err)] diff --git a/src/test/ui/consts/const-eval/panic-never-type.stderr b/src/test/ui/consts/const-eval/panic-never-type.stderr index 4d1686a8d8f..3daad0a2fdd 100644 --- a/src/test/ui/consts/const-eval/panic-never-type.stderr +++ b/src/test/ui/consts/const-eval/panic-never-type.stderr @@ -6,7 +6,7 @@ LL | const VOID: ! = panic!(); | | | the evaluated program panicked at 'explicit panic', $DIR/panic-never-type.rs:8:17 | -note: lint level defined here +note: the lint level is defined here --> $DIR/panic-never-type.rs:4:9 | LL | #![warn(const_err)] diff --git a/src/test/ui/consts/const-eval/promoted_errors.stderr b/src/test/ui/consts/const-eval/promoted_errors.stderr index b4330deb3ef..08ae5c7a32b 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors.stderr @@ -4,7 +4,7 @@ warning: this expression will panic at runtime LL | let _x = 0u32 - 1; | ^^^^^^^^ attempt to subtract with overflow | -note: lint level defined here +note: the lint level is defined here --> $DIR/promoted_errors.rs:5:9 | LL | #![warn(const_err)] diff --git a/src/test/ui/consts/const-eval/promoted_errors2.stderr b/src/test/ui/consts/const-eval/promoted_errors2.stderr index a4dad295edd..d1a9cb958e1 100644 --- a/src/test/ui/consts/const-eval/promoted_errors2.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors2.stderr @@ -4,7 +4,7 @@ warning: attempt to subtract with overflow LL | println!("{}", 0u32 - 1); | ^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/promoted_errors2.rs:5:9 | LL | #![warn(const_err)] diff --git a/src/test/ui/consts/const-eval/pub_const_err.stderr b/src/test/ui/consts/const-eval/pub_const_err.stderr index bd262b69da8..ded2df4e013 100644 --- a/src/test/ui/consts/const-eval/pub_const_err.stderr +++ b/src/test/ui/consts/const-eval/pub_const_err.stderr @@ -6,7 +6,7 @@ LL | pub const Z: u32 = 0 - 1; | | | attempt to subtract with overflow | -note: lint level defined here +note: the lint level is defined here --> $DIR/pub_const_err.rs:2:9 | LL | #![warn(const_err)] diff --git a/src/test/ui/consts/const-eval/pub_const_err_bin.stderr b/src/test/ui/consts/const-eval/pub_const_err_bin.stderr index 866d1753edb..570a8e49319 100644 --- a/src/test/ui/consts/const-eval/pub_const_err_bin.stderr +++ b/src/test/ui/consts/const-eval/pub_const_err_bin.stderr @@ -6,7 +6,7 @@ LL | pub const Z: u32 = 0 - 1; | | | attempt to subtract with overflow | -note: lint level defined here +note: the lint level is defined here --> $DIR/pub_const_err_bin.rs:2:9 | LL | #![warn(const_err)] diff --git a/src/test/ui/consts/const-eval/ub-nonnull.stderr b/src/test/ui/consts/const-eval/ub-nonnull.stderr index c2446d14040..4d9d258f808 100644 --- a/src/test/ui/consts/const-eval/ub-nonnull.stderr +++ b/src/test/ui/consts/const-eval/ub-nonnull.stderr @@ -18,7 +18,7 @@ LL | | mem::transmute(out_of_bounds_ptr) LL | | } }; | |____- | -note: lint level defined here +note: the lint level is defined here --> $DIR/ub-nonnull.rs:14:8 | LL | #[deny(const_err)] // this triggers a `const_err` so validation does not even happen diff --git a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.stderr b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.stderr index 51e80bb8b11..c98e206e88c 100644 --- a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.stderr +++ b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.stderr @@ -10,7 +10,7 @@ LL | unsafe { std::mem::transmute(()) } LL | const FOO: [Empty; 3] = [foo(); 3]; | ----------------------------------- | -note: lint level defined here +note: the lint level is defined here --> $DIR/validate_uninhabited_zsts.rs:13:8 | LL | #[warn(const_err)] diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr index 243efbbaa76..15e13942481 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr @@ -64,7 +64,7 @@ LL | | LL | | }; | |__- | -note: lint level defined here +note: the lint level is defined here --> $DIR/const_refers_to_static.rs:2:9 | LL | #![warn(const_err)] diff --git a/src/test/ui/consts/miri_unleashed/mutable_const.stderr b/src/test/ui/consts/miri_unleashed/mutable_const.stderr index 9daca765c7c..86f27784701 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_const.stderr +++ b/src/test/ui/consts/miri_unleashed/mutable_const.stderr @@ -16,7 +16,7 @@ LL | | } LL | | }; | |__- | -note: lint level defined here +note: the lint level is defined here --> $DIR/mutable_const.rs:5:9 | LL | #![deny(const_err)] diff --git a/src/test/ui/consts/miri_unleashed/non_const_fn.stderr b/src/test/ui/consts/miri_unleashed/non_const_fn.stderr index 6a7df858feb..dcd37345fdd 100644 --- a/src/test/ui/consts/miri_unleashed/non_const_fn.stderr +++ b/src/test/ui/consts/miri_unleashed/non_const_fn.stderr @@ -12,7 +12,7 @@ LL | const C: () = foo(); | | | calling non-const function `foo` | -note: lint level defined here +note: the lint level is defined here --> $DIR/non_const_fn.rs:4:9 | LL | #![warn(const_err)] diff --git a/src/test/ui/deprecation/deprecation-lint-2.stderr b/src/test/ui/deprecation/deprecation-lint-2.stderr index f90ca798601..e8c2156742f 100644 --- a/src/test/ui/deprecation/deprecation-lint-2.stderr +++ b/src/test/ui/deprecation/deprecation-lint-2.stderr @@ -4,7 +4,7 @@ error: use of deprecated item 'deprecation_lint::deprecated': text LL | macro_test!(); | ^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/deprecation-lint-2.rs:4:9 | LL | #![deny(deprecated)] diff --git a/src/test/ui/deprecation/deprecation-lint-3.stderr b/src/test/ui/deprecation/deprecation-lint-3.stderr index fb90a63b0fb..7cc06a23b0f 100644 --- a/src/test/ui/deprecation/deprecation-lint-3.stderr +++ b/src/test/ui/deprecation/deprecation-lint-3.stderr @@ -4,7 +4,7 @@ error: use of deprecated item 'deprecation_lint::deprecated_text': text LL | macro_test_arg_nested!(deprecated_text); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/deprecation-lint-3.rs:4:9 | LL | #![deny(deprecated)] diff --git a/src/test/ui/deprecation/deprecation-lint-nested.stderr b/src/test/ui/deprecation/deprecation-lint-nested.stderr index 206e12cfb3e..b71f90014fe 100644 --- a/src/test/ui/deprecation/deprecation-lint-nested.stderr +++ b/src/test/ui/deprecation/deprecation-lint-nested.stderr @@ -4,7 +4,7 @@ error: use of deprecated item 'loud::DeprecatedType' LL | struct Foo(DeprecatedType); | ^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/deprecation-lint-nested.rs:1:9 | LL | #![deny(deprecated)] diff --git a/src/test/ui/deprecation/deprecation-lint.stderr b/src/test/ui/deprecation/deprecation-lint.stderr index ffbcb259754..362a901d77d 100644 --- a/src/test/ui/deprecation/deprecation-lint.stderr +++ b/src/test/ui/deprecation/deprecation-lint.stderr @@ -4,7 +4,7 @@ error: use of deprecated item 'deprecation_lint::deprecated': text LL | deprecated(); | ^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/deprecation-lint.rs:4:9 | LL | #![deny(deprecated)] diff --git a/src/test/ui/deprecation/rustc_deprecation-in-future.stderr b/src/test/ui/deprecation/rustc_deprecation-in-future.stderr index 4bbe79b55b3..4aff11ad66f 100644 --- a/src/test/ui/deprecation/rustc_deprecation-in-future.stderr +++ b/src/test/ui/deprecation/rustc_deprecation-in-future.stderr @@ -4,7 +4,7 @@ error: use of item 'S' that will be deprecated in future version 99.99.99: effec LL | let _ = S; | ^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/rustc_deprecation-in-future.rs:3:9 | LL | #![deny(deprecated_in_future)] diff --git a/src/test/ui/deprecation/suggestion.stderr b/src/test/ui/deprecation/suggestion.stderr index 6aaabfe9575..b60d420b546 100644 --- a/src/test/ui/deprecation/suggestion.stderr +++ b/src/test/ui/deprecation/suggestion.stderr @@ -4,7 +4,7 @@ error: use of deprecated item 'Foo::deprecated': replaced by `replacement` LL | foo.deprecated(); | ^^^^^^^^^^ help: replace the use of the deprecated item: `replacement` | -note: lint level defined here +note: the lint level is defined here --> $DIR/suggestion.rs:7:9 | LL | #![deny(deprecated)] diff --git a/src/test/ui/derives/deriving-meta-empty-trait-list.stderr b/src/test/ui/derives/deriving-meta-empty-trait-list.stderr index b5d3670b5f3..1fd7d58c86a 100644 --- a/src/test/ui/derives/deriving-meta-empty-trait-list.stderr +++ b/src/test/ui/derives/deriving-meta-empty-trait-list.stderr @@ -4,7 +4,7 @@ error: unused attribute LL | #[derive()] | ^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/deriving-meta-empty-trait-list.rs:1:9 | LL | #![deny(unused)] diff --git a/src/test/ui/derives/deriving-with-repr-packed.stderr b/src/test/ui/derives/deriving-with-repr-packed.stderr index 8093c58a67e..8ab2e4cba74 100644 --- a/src/test/ui/derives/deriving-with-repr-packed.stderr +++ b/src/test/ui/derives/deriving-with-repr-packed.stderr @@ -4,7 +4,7 @@ error: `#[derive]` can't be used on a `#[repr(packed)]` struct with type or cons LL | #[derive(Copy, Clone, PartialEq, Eq)] | ^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/deriving-with-repr-packed.rs:1:9 | LL | #![deny(safe_packed_borrows)] diff --git a/src/test/ui/duplicate_entry_error.stderr b/src/test/ui/duplicate_entry_error.stderr index 46b137b2cf9..2d52ea3f6c2 100644 --- a/src/test/ui/duplicate_entry_error.stderr +++ b/src/test/ui/duplicate_entry_error.stderr @@ -7,7 +7,7 @@ LL | | loop {} LL | | } | |_^ | - = note: first defined in crate `std` (which `duplicate_entry_error` depends on) + = note: the lang item is first defined in crate `std` (which `duplicate_entry_error` depends on) error: aborting due to previous error diff --git a/src/test/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.stderr b/src/test/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.stderr index 361727733bc..32f06b62bb4 100644 --- a/src/test/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.stderr +++ b/src/test/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.stderr @@ -4,7 +4,7 @@ error: `dyn` is a keyword in the 2018 edition LL | pub mod dyn { | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` | -note: lint level defined here +note: the lint level is defined here --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:10:9 | LL | #![deny(keyword_idents)] diff --git a/src/test/ui/editions/edition-extern-crate-allowed.stderr b/src/test/ui/editions/edition-extern-crate-allowed.stderr index 45b46794be2..dd39847d49a 100644 --- a/src/test/ui/editions/edition-extern-crate-allowed.stderr +++ b/src/test/ui/editions/edition-extern-crate-allowed.stderr @@ -4,7 +4,7 @@ warning: unused extern crate LL | extern crate edition_extern_crate_allowed; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it | -note: lint level defined here +note: the lint level is defined here --> $DIR/edition-extern-crate-allowed.rs:5:9 | LL | #![warn(rust_2018_idioms)] diff --git a/src/test/ui/editions/edition-raw-pointer-method-2015.stderr b/src/test/ui/editions/edition-raw-pointer-method-2015.stderr index 6a8861ba67b..1df582ee06c 100644 --- a/src/test/ui/editions/edition-raw-pointer-method-2015.stderr +++ b/src/test/ui/editions/edition-raw-pointer-method-2015.stderr @@ -4,7 +4,7 @@ error: type annotations needed LL | let _ = y.is_null(); | ^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/edition-raw-pointer-method-2015.rs:5:8 | LL | #[deny(warnings)] diff --git a/src/test/ui/enable-unstable-lib-feature.stderr b/src/test/ui/enable-unstable-lib-feature.stderr index d5b8c0efaad..bb4e928ad15 100644 --- a/src/test/ui/enable-unstable-lib-feature.stderr +++ b/src/test/ui/enable-unstable-lib-feature.stderr @@ -4,7 +4,7 @@ error: function `BOGUS` should have a snake case name LL | pub fn BOGUS() { } | ^^^^^ help: convert the identifier to snake case: `bogus` | -note: lint level defined here +note: the lint level is defined here --> $DIR/enable-unstable-lib-feature.rs:6:9 | LL | #![deny(non_snake_case)] // To trigger a hard error diff --git a/src/test/ui/enum/enum-discrim-too-small2.stderr b/src/test/ui/enum/enum-discrim-too-small2.stderr index f7220044ba4..3aa88df29f1 100644 --- a/src/test/ui/enum/enum-discrim-too-small2.stderr +++ b/src/test/ui/enum/enum-discrim-too-small2.stderr @@ -4,7 +4,7 @@ error: literal out of range for `i8` LL | Ci8 = 223, | ^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/enum-discrim-too-small2.rs:1:9 | LL | #![deny(overflowing_literals)] diff --git a/src/test/ui/enum/enum-size-variance.stderr b/src/test/ui/enum/enum-size-variance.stderr index 1ebd9b6806f..cf8321d5f3a 100644 --- a/src/test/ui/enum/enum-size-variance.stderr +++ b/src/test/ui/enum/enum-size-variance.stderr @@ -4,7 +4,7 @@ warning: enum variant is more than three times larger (32 bytes) than the next l LL | L(i64, i64, i64, i64), | ^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/enum-size-variance.rs:3:9 | LL | #![warn(variant_size_differences)] diff --git a/src/test/ui/error-codes/E0001.stderr b/src/test/ui/error-codes/E0001.stderr index 99234515182..577c49032d7 100644 --- a/src/test/ui/error-codes/E0001.stderr +++ b/src/test/ui/error-codes/E0001.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | _ => {/* ... */} | ^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/E0001.rs:1:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/error-codes/E0152.stderr b/src/test/ui/error-codes/E0152.stderr index c41a0430150..29981991ee0 100644 --- a/src/test/ui/error-codes/E0152.stderr +++ b/src/test/ui/error-codes/E0152.stderr @@ -4,7 +4,7 @@ error[E0152]: found duplicate lang item `arc` LL | struct Foo; | ^^^^^^^^^^^ | - = note: first defined in crate `alloc` (which `std` depends on) + = note: the lang item is first defined in crate `alloc` (which `std` depends on) error: aborting due to previous error diff --git a/src/test/ui/expr_attr_paren_order.stderr b/src/test/ui/expr_attr_paren_order.stderr index 57a9350c089..c6b373e3f13 100644 --- a/src/test/ui/expr_attr_paren_order.stderr +++ b/src/test/ui/expr_attr_paren_order.stderr @@ -4,7 +4,7 @@ error: variable `X` should have a snake case name LL | let X = 0; | ^ help: convert the identifier to snake case (notice the capitalization): `x` | -note: lint level defined here +note: the lint level is defined here --> $DIR/expr_attr_paren_order.rs:17:17 | LL | #![deny(non_snake_case)] diff --git a/src/test/ui/extern-flag/public-and-private.stderr b/src/test/ui/extern-flag/public-and-private.stderr index 72f1bb2d26f..94c7deaa80d 100644 --- a/src/test/ui/extern-flag/public-and-private.stderr +++ b/src/test/ui/extern-flag/public-and-private.stderr @@ -4,7 +4,7 @@ error: type `somedep::S` from private dependency 'somedep' in public interface LL | pub field: somedep::S, | ^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/public-and-private.rs:5:9 | LL | #![deny(exported_private_dependencies)] diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr index da7d8f9bee5..96c87a675a9 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr @@ -4,7 +4,7 @@ warning: unknown lint: `x5400` LL | #![warn(x5400)] | ^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-43106-gating-of-builtin-attrs.rs:36:28 | LL | #![warn(unused_attributes, unknown_lints)] @@ -250,7 +250,7 @@ warning: unused attribute LL | #[macro_use] fn f() { } | ^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-43106-gating-of-builtin-attrs.rs:36:9 | LL | #![warn(unused_attributes, unknown_lints)] diff --git a/src/test/ui/feature-gate/unstable-attribute-allow-issue-0.rs b/src/test/ui/feature-gate/unstable-attribute-allow-issue-0.rs index c8ad0d13a14..7a2bf468f89 100644 --- a/src/test/ui/feature-gate/unstable-attribute-allow-issue-0.rs +++ b/src/test/ui/feature-gate/unstable-attribute-allow-issue-0.rs @@ -9,5 +9,5 @@ fn unstable_issue_0() {} #[unstable(feature = "unstable_test_feature", issue = "none")] fn unstable_issue_none() {} -#[unstable(feature = "unstable_test_feature", issue = "something")] //~ ERROR incorrect 'issue' -fn unstable_issue_not_allowed() {} +#[unstable(feature = "unstable_test_feature", issue = "something")] +fn unstable_issue_not_allowed() {} //~^ ERROR `issue` must be a numeric string or "none" diff --git a/src/test/ui/feature-gate/unstable-attribute-allow-issue-0.stderr b/src/test/ui/feature-gate/unstable-attribute-allow-issue-0.stderr index 10bd6f373d9..21ff12185ec 100644 --- a/src/test/ui/feature-gate/unstable-attribute-allow-issue-0.stderr +++ b/src/test/ui/feature-gate/unstable-attribute-allow-issue-0.stderr @@ -1,8 +1,10 @@ -error[E0545]: incorrect 'issue' - --> $DIR/unstable-attribute-allow-issue-0.rs:12:1 +error[E0545]: `issue` must be a numeric string or "none" + --> $DIR/unstable-attribute-allow-issue-0.rs:12:47 | LL | #[unstable(feature = "unstable_test_feature", issue = "something")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^----------- + | | + | invalid digit found in string error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-feature-gate.stderr b/src/test/ui/feature-gates/feature-gate-feature-gate.stderr index d79404263e4..ad97741dae4 100644 --- a/src/test/ui/feature-gates/feature-gate-feature-gate.stderr +++ b/src/test/ui/feature-gates/feature-gate-feature-gate.stderr @@ -4,7 +4,7 @@ error: unstable feature LL | #![feature(intrinsics)] | ^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/feature-gate-feature-gate.rs:1:11 | LL | #![forbid(unstable_features)] diff --git a/src/test/ui/feature-gates/feature-gate-no-debug-2.stderr b/src/test/ui/feature-gates/feature-gate-no-debug-2.stderr index 1f8f114d7da..9a6f898f2a5 100644 --- a/src/test/ui/feature-gates/feature-gate-no-debug-2.stderr +++ b/src/test/ui/feature-gates/feature-gate-no-debug-2.stderr @@ -4,7 +4,7 @@ error: use of deprecated attribute `no_debug`: the `#[no_debug]` attribute was a LL | #[no_debug] | ^^^^^^^^^^^ help: remove this attribute | -note: lint level defined here +note: the lint level is defined here --> $DIR/feature-gate-no-debug-2.rs:1:9 | LL | #![deny(deprecated)] diff --git a/src/test/ui/feature-gates/feature-gate-repr-simd.rs b/src/test/ui/feature-gates/feature-gate-repr-simd.rs index 1e4a404fa25..c527404f572 100644 --- a/src/test/ui/feature-gates/feature-gate-repr-simd.rs +++ b/src/test/ui/feature-gates/feature-gate-repr-simd.rs @@ -2,6 +2,7 @@ struct Foo(u64, u64); #[repr(C)] //~ ERROR conflicting representation hints +//~^ WARN this was previously accepted #[repr(simd)] //~ error: SIMD types are experimental struct Bar(u64, u64); diff --git a/src/test/ui/feature-gates/feature-gate-repr-simd.stderr b/src/test/ui/feature-gates/feature-gate-repr-simd.stderr index 37a7bd0b129..013bad069d8 100644 --- a/src/test/ui/feature-gates/feature-gate-repr-simd.stderr +++ b/src/test/ui/feature-gates/feature-gate-repr-simd.stderr @@ -8,7 +8,7 @@ LL | #[repr(simd)] = help: add `#![feature(repr_simd)]` to the crate attributes to enable error[E0658]: SIMD types are experimental and possibly buggy - --> $DIR/feature-gate-repr-simd.rs:5:1 + --> $DIR/feature-gate-repr-simd.rs:6:1 | LL | #[repr(simd)] | ^^^^^^^^^^^^^ @@ -21,8 +21,13 @@ error[E0566]: conflicting representation hints | LL | #[repr(C)] | ^ +LL | LL | #[repr(simd)] | ^^^^ + | + = note: `#[deny(conflicting_repr_hints)]` on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585> error: aborting due to 3 previous errors diff --git a/src/test/ui/fn_must_use.stderr b/src/test/ui/fn_must_use.stderr index 5a1a4e36e06..64f865e5b70 100644 --- a/src/test/ui/fn_must_use.stderr +++ b/src/test/ui/fn_must_use.stderr @@ -4,7 +4,7 @@ warning: unused return value of `need_to_use_this_value` that must be used LL | need_to_use_this_value(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/fn_must_use.rs:3:9 | LL | #![warn(unused_must_use)] diff --git a/src/test/ui/future-incompatible-lint-group.stderr b/src/test/ui/future-incompatible-lint-group.stderr index 1d958e5bfeb..a19051e8bc0 100644 --- a/src/test/ui/future-incompatible-lint-group.stderr +++ b/src/test/ui/future-incompatible-lint-group.stderr @@ -4,7 +4,7 @@ error: anonymous parameters are deprecated and will be removed in the next editi LL | fn f(u8) {} | ^^ help: try naming the parameter or explicitly ignoring it: `_: u8` | -note: lint level defined here +note: the lint level is defined here --> $DIR/future-incompatible-lint-group.rs:1:9 | LL | #![deny(future_incompatible)] diff --git a/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr b/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr index de533e4d5ff..9986220218e 100644 --- a/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr +++ b/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr @@ -2,7 +2,7 @@ error[E0521]: borrowed data escapes outside of generator --> $DIR/ref-escapes-but-not-over-yield.rs:11:9 | LL | let mut a = &3; - | ----- `a` is declared here, outside of the generator body + | ----- `a` declared here, outside of the generator body ... LL | a = &b; | ^^^^-- diff --git a/src/test/ui/generic/generic-no-mangle.stderr b/src/test/ui/generic/generic-no-mangle.stderr index f055a3ab83f..ab2ad541e86 100644 --- a/src/test/ui/generic/generic-no-mangle.stderr +++ b/src/test/ui/generic/generic-no-mangle.stderr @@ -6,7 +6,7 @@ LL | #[no_mangle] LL | pub fn foo<T>() {} | ^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/generic-no-mangle.rs:1:9 | LL | #![deny(no_mangle_generic_items)] diff --git a/src/test/ui/imports/extern-crate-used.stderr b/src/test/ui/imports/extern-crate-used.stderr index 397bfa02902..1b9a2e4720d 100644 --- a/src/test/ui/imports/extern-crate-used.stderr +++ b/src/test/ui/imports/extern-crate-used.stderr @@ -4,7 +4,7 @@ error: unused extern crate LL | extern crate core; | ^^^^^^^^^^^^^^^^^^ help: remove it | -note: lint level defined here +note: the lint level is defined here --> $DIR/extern-crate-used.rs:6:9 | LL | #![deny(unused_extern_crates)] diff --git a/src/test/ui/imports/reexports.stderr b/src/test/ui/imports/reexports.stderr index b173884080f..7b0d63574ec 100644 --- a/src/test/ui/imports/reexports.stderr +++ b/src/test/ui/imports/reexports.stderr @@ -40,7 +40,7 @@ warning: glob import doesn't reexport anything because no candidate is public en LL | pub use super::*; | ^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/reexports.rs:1:9 | LL | #![warn(unused_imports)] diff --git a/src/test/ui/imports/unresolved-imports-used.stderr b/src/test/ui/imports/unresolved-imports-used.stderr index d7280d2583a..69765b9227d 100644 --- a/src/test/ui/imports/unresolved-imports-used.stderr +++ b/src/test/ui/imports/unresolved-imports-used.stderr @@ -52,7 +52,7 @@ error: unused import: `qux::quy` LL | use qux::quy; | ^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/unresolved-imports-used.rs:2:9 | LL | #![deny(unused_imports)] diff --git a/src/test/ui/imports/unused-macro-use.stderr b/src/test/ui/imports/unused-macro-use.stderr index b7fb532c67c..7137a90e459 100644 --- a/src/test/ui/imports/unused-macro-use.stderr +++ b/src/test/ui/imports/unused-macro-use.stderr @@ -4,7 +4,7 @@ error: unused `#[macro_use]` import LL | #[macro_use] | ^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused-macro-use.rs:1:9 | LL | #![deny(unused)] diff --git a/src/test/ui/imports/unused.stderr b/src/test/ui/imports/unused.stderr index 0366b52ef6a..08128d79425 100644 --- a/src/test/ui/imports/unused.stderr +++ b/src/test/ui/imports/unused.stderr @@ -4,7 +4,7 @@ error: unused import: `super::f` LL | pub(super) use super::f; | ^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused.rs:1:9 | LL | #![deny(unused)] diff --git a/src/test/ui/in-band-lifetimes/elided-lifetimes.fixed b/src/test/ui/in-band-lifetimes/elided-lifetimes.fixed index 29c570daefd..2998f05efba 100644 --- a/src/test/ui/in-band-lifetimes/elided-lifetimes.fixed +++ b/src/test/ui/in-band-lifetimes/elided-lifetimes.fixed @@ -3,7 +3,7 @@ #![allow(unused)] #![deny(elided_lifetimes_in_paths)] -//~^ NOTE lint level defined here +//~^ NOTE the lint level is defined here use std::cell::{RefCell, Ref}; diff --git a/src/test/ui/in-band-lifetimes/elided-lifetimes.rs b/src/test/ui/in-band-lifetimes/elided-lifetimes.rs index e59c9b4367f..b729a15a29e 100644 --- a/src/test/ui/in-band-lifetimes/elided-lifetimes.rs +++ b/src/test/ui/in-band-lifetimes/elided-lifetimes.rs @@ -3,7 +3,7 @@ #![allow(unused)] #![deny(elided_lifetimes_in_paths)] -//~^ NOTE lint level defined here +//~^ NOTE the lint level is defined here use std::cell::{RefCell, Ref}; diff --git a/src/test/ui/in-band-lifetimes/elided-lifetimes.stderr b/src/test/ui/in-band-lifetimes/elided-lifetimes.stderr index 5c50d7e2aac..1184f51680a 100644 --- a/src/test/ui/in-band-lifetimes/elided-lifetimes.stderr +++ b/src/test/ui/in-band-lifetimes/elided-lifetimes.stderr @@ -4,7 +4,7 @@ error: hidden lifetime parameters in types are deprecated LL | fn foo(x: &Foo) { | ^^^- help: indicate the anonymous lifetime: `<'_>` | -note: lint level defined here +note: the lint level is defined here --> $DIR/elided-lifetimes.rs:5:9 | LL | #![deny(elided_lifetimes_in_paths)] diff --git a/src/test/ui/invalid/invalid-plugin-attr.stderr b/src/test/ui/invalid/invalid-plugin-attr.stderr index 0d7315dd887..9d07eafcc8f 100644 --- a/src/test/ui/invalid/invalid-plugin-attr.stderr +++ b/src/test/ui/invalid/invalid-plugin-attr.stderr @@ -12,7 +12,7 @@ error: unused attribute LL | #[plugin(bla)] | ^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/invalid-plugin-attr.rs:1:9 | LL | #![deny(unused_attributes)] diff --git a/src/test/ui/issues/issue-10656.stderr b/src/test/ui/issues/issue-10656.stderr index 818457f5079..2e91a598dce 100644 --- a/src/test/ui/issues/issue-10656.stderr +++ b/src/test/ui/issues/issue-10656.stderr @@ -5,7 +5,7 @@ LL | / #![deny(missing_docs)] LL | | #![crate_type="lib"] | |____________________^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-10656.rs:1:9 | LL | #![deny(missing_docs)] diff --git a/src/test/ui/issues/issue-12116.stderr b/src/test/ui/issues/issue-12116.stderr index 10db4f1c031..4d162eb77e7 100644 --- a/src/test/ui/issues/issue-12116.stderr +++ b/src/test/ui/issues/issue-12116.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | &IntList::Cons(val, box IntList::Nil) => IntList::Cons(val, box IntList::Nil), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-12116.rs:5:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/issues/issue-12369.stderr b/src/test/ui/issues/issue-12369.stderr index 754b94bab75..aab2be78c9a 100644 --- a/src/test/ui/issues/issue-12369.stderr +++ b/src/test/ui/issues/issue-12369.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | &[10,a, ref rest @ ..] => 10 | ^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-12369.rs:1:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/issues/issue-13727.stderr b/src/test/ui/issues/issue-13727.stderr index 4d106651624..07ca56a566f 100644 --- a/src/test/ui/issues/issue-13727.stderr +++ b/src/test/ui/issues/issue-13727.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | 512 => print!("0b1111\n"), | ^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-13727.rs:2:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/issues/issue-14221.stderr b/src/test/ui/issues/issue-14221.stderr index 9864c0840d8..63680f6ca56 100644 --- a/src/test/ui/issues/issue-14221.stderr +++ b/src/test/ui/issues/issue-14221.stderr @@ -21,7 +21,7 @@ LL | LL | B => "B", | ^ unreachable pattern | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-14221.rs:1:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/issues/issue-14309.stderr b/src/test/ui/issues/issue-14309.stderr index f598e1f9e2f..799991f7ee4 100644 --- a/src/test/ui/issues/issue-14309.stderr +++ b/src/test/ui/issues/issue-14309.stderr @@ -4,14 +4,14 @@ error: `extern` block uses type `A`, which is not FFI-safe LL | fn foo(x: A); | ^ not FFI-safe | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-14309.rs:1:9 | LL | #![deny(improper_ctypes)] | ^^^^^^^^^^^^^^^ = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout -note: type defined here +note: the type is defined here --> $DIR/issue-14309.rs:4:1 | LL | / struct A { @@ -27,7 +27,7 @@ LL | fn bar(x: B); | = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout -note: type defined here +note: the type is defined here --> $DIR/issue-14309.rs:4:1 | LL | / struct A { @@ -43,7 +43,7 @@ LL | fn qux(x: A2); | = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout -note: type defined here +note: the type is defined here --> $DIR/issue-14309.rs:4:1 | LL | / struct A { @@ -59,7 +59,7 @@ LL | fn quux(x: B2); | = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout -note: type defined here +note: the type is defined here --> $DIR/issue-14309.rs:4:1 | LL | / struct A { @@ -75,7 +75,7 @@ LL | fn fred(x: D); | = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout -note: type defined here +note: the type is defined here --> $DIR/issue-14309.rs:4:1 | LL | / struct A { diff --git a/src/test/ui/issues/issue-16250.stderr b/src/test/ui/issues/issue-16250.stderr index 5686ac37742..45f854f93ec 100644 --- a/src/test/ui/issues/issue-16250.stderr +++ b/src/test/ui/issues/issue-16250.stderr @@ -4,7 +4,7 @@ error: `extern` block uses type `Foo`, which is not FFI-safe LL | pub fn foo(x: (Foo)); | ^^^ not FFI-safe | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-16250.rs:1:9 | LL | #![deny(warnings)] @@ -12,7 +12,7 @@ LL | #![deny(warnings)] = note: `#[deny(improper_ctypes)]` implied by `#[deny(warnings)]` = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout -note: type defined here +note: the type is defined here --> $DIR/issue-16250.rs:3:1 | LL | pub struct Foo; diff --git a/src/test/ui/issues/issue-17337.stderr b/src/test/ui/issues/issue-17337.stderr index 8973afb8068..4a8116b1ffd 100644 --- a/src/test/ui/issues/issue-17337.stderr +++ b/src/test/ui/issues/issue-17337.stderr @@ -4,7 +4,7 @@ error: use of deprecated item 'Foo::foo': text LL | .foo(); | ^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-17337.rs:2:9 | LL | #![deny(deprecated)] diff --git a/src/test/ui/issues/issue-17718-const-naming.stderr b/src/test/ui/issues/issue-17718-const-naming.stderr index e320c436f5b..4c0aa0553eb 100644 --- a/src/test/ui/issues/issue-17718-const-naming.stderr +++ b/src/test/ui/issues/issue-17718-const-naming.stderr @@ -4,7 +4,7 @@ error: constant item is never used: `foo` LL | const foo: isize = 3; | ^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-17718-const-naming.rs:2:9 | LL | #![deny(warnings)] @@ -17,7 +17,7 @@ error: constant `foo` should have an upper case name LL | const foo: isize = 3; | ^^^ help: convert the identifier to upper case (notice the capitalization): `FOO` | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-17718-const-naming.rs:2:9 | LL | #![deny(warnings)] diff --git a/src/test/ui/issues/issue-17999.stderr b/src/test/ui/issues/issue-17999.stderr index b9ae03356e9..448208ef033 100644 --- a/src/test/ui/issues/issue-17999.stderr +++ b/src/test/ui/issues/issue-17999.stderr @@ -4,7 +4,7 @@ error: unused variable: `x` LL | let x = (); | ^ help: consider prefixing with an underscore: `_x` | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-17999.rs:1:9 | LL | #![deny(unused_variables)] diff --git a/src/test/ui/issues/issue-2150.stderr b/src/test/ui/issues/issue-2150.stderr index 6e102ecb62f..3f370255106 100644 --- a/src/test/ui/issues/issue-2150.stderr +++ b/src/test/ui/issues/issue-2150.stderr @@ -6,7 +6,7 @@ LL | panic!(); LL | for x in &v { i += 1; } | ^^^^^^^^^^^^^^^^^^^^^^^ unreachable statement | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-2150.rs:1:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/issues/issue-22599.stderr b/src/test/ui/issues/issue-22599.stderr index 12234293ac9..9c3b2cbe6c7 100644 --- a/src/test/ui/issues/issue-22599.stderr +++ b/src/test/ui/issues/issue-22599.stderr @@ -4,7 +4,7 @@ error: unused variable: `a` LL | v = match 0 { a => 0 }; | ^ help: consider prefixing with an underscore: `_a` | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-22599.rs:1:9 | LL | #![deny(unused_variables)] diff --git a/src/test/ui/issues/issue-22933-3.rs b/src/test/ui/issues/issue-22933-3.rs deleted file mode 100644 index fbcce4b8344..00000000000 --- a/src/test/ui/issues/issue-22933-3.rs +++ /dev/null @@ -1,4 +0,0 @@ -const FOO: [u32; u8::MIN as usize] = []; -//~^ ERROR no associated item named `MIN` found - -fn main() {} diff --git a/src/test/ui/issues/issue-22933-3.stderr b/src/test/ui/issues/issue-22933-3.stderr deleted file mode 100644 index 72bca3b0408..00000000000 --- a/src/test/ui/issues/issue-22933-3.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0599]: no associated item named `MIN` found for type `u8` in the current scope - --> $DIR/issue-22933-3.rs:1:22 - | -LL | const FOO: [u32; u8::MIN as usize] = []; - | ^^^ associated item not found in `u8` - | -help: you are looking for the module in `std`, not the primitive type - | -LL | const FOO: [u32; std::u8::MIN as usize] = []; - | ^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/issues/issue-27060.stderr b/src/test/ui/issues/issue-27060.stderr index bc44c1a4ac5..6bf6348631a 100644 --- a/src/test/ui/issues/issue-27060.stderr +++ b/src/test/ui/issues/issue-27060.stderr @@ -4,7 +4,7 @@ error: borrow of packed field is unsafe and requires unsafe function or block (e LL | let _ = &good.data; | ^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-27060.rs:13:8 | LL | #[deny(safe_packed_borrows)] diff --git a/src/test/ui/issues/issue-30240-b.stderr b/src/test/ui/issues/issue-30240-b.stderr index e0dd4794db5..59d64bc256b 100644 --- a/src/test/ui/issues/issue-30240-b.stderr +++ b/src/test/ui/issues/issue-30240-b.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | "hello" => {} | ^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-30240-b.rs:1:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/issues/issue-30302.stderr b/src/test/ui/issues/issue-30302.stderr index ac1b5235f44..770ed3d4f01 100644 --- a/src/test/ui/issues/issue-30302.stderr +++ b/src/test/ui/issues/issue-30302.stderr @@ -15,7 +15,7 @@ LL | LL | _ => false | ^ unreachable pattern | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-30302.rs:4:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/issues/issue-30730.stderr b/src/test/ui/issues/issue-30730.stderr index fcbab77b007..b299e99a3a9 100644 --- a/src/test/ui/issues/issue-30730.stderr +++ b/src/test/ui/issues/issue-30730.stderr @@ -4,7 +4,7 @@ error: unused import: `std::thread` LL | use std::thread; | ^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-30730.rs:2:9 | LL | #![deny(warnings)] diff --git a/src/test/ui/issues/issue-31221.stderr b/src/test/ui/issues/issue-31221.stderr index 0f3b4ba7d97..7d349144456 100644 --- a/src/test/ui/issues/issue-31221.stderr +++ b/src/test/ui/issues/issue-31221.stderr @@ -6,7 +6,7 @@ LL | Var3 => (), LL | Var2 => (), | ^^^^ unreachable pattern | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-31221.rs:4:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/issues/issue-33140-traitobject-crate.stderr b/src/test/ui/issues/issue-33140-traitobject-crate.stderr index f31ea9391ab..efa77f5ceb8 100644 --- a/src/test/ui/issues/issue-33140-traitobject-crate.stderr +++ b/src/test/ui/issues/issue-33140-traitobject-crate.stderr @@ -6,7 +6,7 @@ LL | unsafe impl Trait for dyn (::std::marker::Send) + Sync { } LL | unsafe impl Trait for dyn (::std::marker::Send) + Send + Sync { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-33140-traitobject-crate.rs:3:9 | LL | #![warn(order_dependent_trait_objects)] diff --git a/src/test/ui/issues/issue-37515.stderr b/src/test/ui/issues/issue-37515.stderr index f0840959698..1aafa512d83 100644 --- a/src/test/ui/issues/issue-37515.stderr +++ b/src/test/ui/issues/issue-37515.stderr @@ -4,7 +4,7 @@ warning: type alias is never used: `Z` LL | type Z = dyn for<'x> Send; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-37515.rs:3:9 | LL | #![warn(unused)] diff --git a/src/test/ui/issues/issue-41255.stderr b/src/test/ui/issues/issue-41255.stderr index 1ff58153c88..b6e57afcd12 100644 --- a/src/test/ui/issues/issue-41255.stderr +++ b/src/test/ui/issues/issue-41255.stderr @@ -4,7 +4,7 @@ error: floating-point types cannot be used in patterns LL | 5.0 => {}, | ^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-41255.rs:6:11 | LL | #![forbid(illegal_floating_point_literal_pattern)] diff --git a/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.stderr b/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.stderr index 71fbba562ca..321698e7636 100644 --- a/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.stderr +++ b/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.stderr @@ -7,7 +7,7 @@ LL | let f = |v: &mut Vec<_>| { LL | unsafe { | ^^^^^^ unnecessary `unsafe` block | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:1:8 | LL | #[deny(unused_unsafe)] diff --git a/src/test/ui/issues/issue-46576.stderr b/src/test/ui/issues/issue-46576.stderr index 4b66219dd3d..1e5e730ee64 100644 --- a/src/test/ui/issues/issue-46576.stderr +++ b/src/test/ui/issues/issue-46576.stderr @@ -4,7 +4,7 @@ error: unused import: `BufRead` LL | use std::io::{BufRead, BufReader, Read}; | ^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-46576.rs:4:9 | LL | #![deny(unused_imports)] diff --git a/src/test/ui/issues/issue-47094.rs b/src/test/ui/issues/issue-47094.rs index 3258ee92a74..c5d37feb144 100644 --- a/src/test/ui/issues/issue-47094.rs +++ b/src/test/ui/issues/issue-47094.rs @@ -1,10 +1,12 @@ #[repr(C, u8)] //~ ERROR conflicting representation hints +//~^ WARN this was previously accepted enum Foo { A, B, } #[repr(C)] //~ ERROR conflicting representation hints +//~^ WARN this was previously accepted #[repr(u8)] enum Bar { A, diff --git a/src/test/ui/issues/issue-47094.stderr b/src/test/ui/issues/issue-47094.stderr index c807f644fd3..e323ce66029 100644 --- a/src/test/ui/issues/issue-47094.stderr +++ b/src/test/ui/issues/issue-47094.stderr @@ -3,14 +3,22 @@ error[E0566]: conflicting representation hints | LL | #[repr(C, u8)] | ^ ^^ + | + = note: `#[deny(conflicting_repr_hints)]` on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585> error[E0566]: conflicting representation hints - --> $DIR/issue-47094.rs:7:8 + --> $DIR/issue-47094.rs:8:8 | LL | #[repr(C)] | ^ +LL | LL | #[repr(u8)] | ^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585> error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-48131.stderr b/src/test/ui/issues/issue-48131.stderr index 6df065b9807..5acc4f16e9f 100644 --- a/src/test/ui/issues/issue-48131.stderr +++ b/src/test/ui/issues/issue-48131.stderr @@ -4,7 +4,7 @@ error: unnecessary `unsafe` block LL | unsafe { /* unnecessary */ } | ^^^^^^ unnecessary `unsafe` block | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-48131.rs:3:9 | LL | #![deny(unused_unsafe)] diff --git a/src/test/ui/issues/issue-49934.rs b/src/test/ui/issues/issue-49934.rs index 262f4931d42..5b253750db0 100644 --- a/src/test/ui/issues/issue-49934.rs +++ b/src/test/ui/issues/issue-49934.rs @@ -1,7 +1,7 @@ // check-pass #![feature(stmt_expr_attributes)] -#![warn(unused_attributes)] //~ NOTE lint level defined here +#![warn(unused_attributes)] //~ NOTE the lint level is defined here fn main() { // fold_stmt (Item) diff --git a/src/test/ui/issues/issue-49934.stderr b/src/test/ui/issues/issue-49934.stderr index dbec379e3c5..64bf5214e6d 100644 --- a/src/test/ui/issues/issue-49934.stderr +++ b/src/test/ui/issues/issue-49934.stderr @@ -12,7 +12,7 @@ warning: unused attribute LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-49934.rs:4:9 | LL | #![warn(unused_attributes)] diff --git a/src/test/ui/issues/issue-50781.stderr b/src/test/ui/issues/issue-50781.stderr index 02475ea97e3..cb6ca24c712 100644 --- a/src/test/ui/issues/issue-50781.stderr +++ b/src/test/ui/issues/issue-50781.stderr @@ -4,7 +4,7 @@ error: the trait `X` cannot be made into an object LL | fn foo(&self) where Self: Trait; | ^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-50781.rs:1:9 | LL | #![deny(where_clauses_object_safety)] diff --git a/src/test/ui/issues/issue-55511.stderr b/src/test/ui/issues/issue-55511.stderr index e094256f5c8..91b81ba6943 100644 --- a/src/test/ui/issues/issue-55511.stderr +++ b/src/test/ui/issues/issue-55511.stderr @@ -4,7 +4,7 @@ warning: to use a constant of type `std::cell::Cell` in a pattern, `std::cell::C LL | <() as Foo<'static>>::C => { } | ^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-55511.rs:1:9 | LL | #![warn(indirect_structural_match)] diff --git a/src/test/ui/issues/issue-56685.stderr b/src/test/ui/issues/issue-56685.stderr index 30fedbe1653..2cef3126b9e 100644 --- a/src/test/ui/issues/issue-56685.stderr +++ b/src/test/ui/issues/issue-56685.stderr @@ -4,7 +4,7 @@ error: unused variable: `x` LL | E::A(x) | E::B(x) => {} | ^ ^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-56685.rs:2:9 | LL | #![deny(unused_variables)] diff --git a/src/test/ui/issues/issue-57472.stderr b/src/test/ui/issues/issue-57472.stderr index b6dd7e24941..26efdf6dbaf 100644 --- a/src/test/ui/issues/issue-57472.stderr +++ b/src/test/ui/issues/issue-57472.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | Punned { bar: [_], .. } => println!("bar"), | ^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-57472.rs:2:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/issues/issue-59896.stderr b/src/test/ui/issues/issue-59896.stderr index ef78f27fa69..95b7938ae03 100644 --- a/src/test/ui/issues/issue-59896.stderr +++ b/src/test/ui/issues/issue-59896.stderr @@ -7,7 +7,7 @@ LL | struct S; LL | use S; | ^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-59896.rs:1:9 | LL | #![deny(unused_imports)] diff --git a/src/test/ui/issues/issue-60622.stderr b/src/test/ui/issues/issue-60622.stderr index da0ae1541bb..79cb6cfc354 100644 --- a/src/test/ui/issues/issue-60622.stderr +++ b/src/test/ui/issues/issue-60622.stderr @@ -7,7 +7,7 @@ LL | fn a(&self) {} LL | b.a::<'_, T>(); | ^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-60622.rs:3:9 | LL | #![deny(warnings)] diff --git a/src/test/ui/issues/issue-6804.stderr b/src/test/ui/issues/issue-6804.stderr index f4188dc3566..c7411e27c25 100644 --- a/src/test/ui/issues/issue-6804.stderr +++ b/src/test/ui/issues/issue-6804.stderr @@ -4,7 +4,7 @@ error: floating-point types cannot be used in patterns LL | NAN => {}, | ^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-6804.rs:4:9 | LL | #![deny(illegal_floating_point_literal_pattern)] diff --git a/src/test/ui/issues/issue-7246.stderr b/src/test/ui/issues/issue-7246.stderr index a11ce1654ca..bb0221ecb86 100644 --- a/src/test/ui/issues/issue-7246.stderr +++ b/src/test/ui/issues/issue-7246.stderr @@ -6,7 +6,7 @@ LL | return; LL | if *ptr::null() {}; | ^^^^^^^^^^^^^^^^^^^ unreachable statement | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-7246.rs:1:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/issues/issue-8460-const.stderr b/src/test/ui/issues/issue-8460-const.stderr index 170747f8402..6b1d74094a1 100644 --- a/src/test/ui/issues/issue-8460-const.stderr +++ b/src/test/ui/issues/issue-8460-const.stderr @@ -4,7 +4,7 @@ error: attempt to divide with overflow LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-8460-const.rs:4:9 | LL | #![deny(const_err)] diff --git a/src/test/ui/issues/issue-8460-const2.stderr b/src/test/ui/issues/issue-8460-const2.stderr index 6ad186fb21c..63b9123e950 100644 --- a/src/test/ui/issues/issue-8460-const2.stderr +++ b/src/test/ui/issues/issue-8460-const2.stderr @@ -4,7 +4,7 @@ error: attempt to divide with overflow LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-8460-const2.rs:4:9 | LL | #![deny(const_err)] diff --git a/src/test/ui/lint/dead-code/basic.stderr b/src/test/ui/lint/dead-code/basic.stderr index 194398e5a07..f7b9b9c613a 100644 --- a/src/test/ui/lint/dead-code/basic.stderr +++ b/src/test/ui/lint/dead-code/basic.stderr @@ -4,7 +4,7 @@ error: function is never used: `foo` LL | fn foo() { | ^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/basic.rs:1:9 | LL | #![deny(dead_code)] diff --git a/src/test/ui/lint/dead-code/empty-unused-enum.stderr b/src/test/ui/lint/dead-code/empty-unused-enum.stderr index 44b0a8f613e..ed9a7ccd14b 100644 --- a/src/test/ui/lint/dead-code/empty-unused-enum.stderr +++ b/src/test/ui/lint/dead-code/empty-unused-enum.stderr @@ -4,7 +4,7 @@ error: enum is never used: `E` LL | enum E {} | ^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/empty-unused-enum.rs:1:9 | LL | #![deny(unused)] diff --git a/src/test/ui/lint/dead-code/impl-trait.stderr b/src/test/ui/lint/dead-code/impl-trait.stderr index f2a78cc65e2..09b6d08eb8f 100644 --- a/src/test/ui/lint/dead-code/impl-trait.stderr +++ b/src/test/ui/lint/dead-code/impl-trait.stderr @@ -4,7 +4,7 @@ error: type alias is never used: `Unused` LL | type Unused = (); | ^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/impl-trait.rs:1:9 | LL | #![deny(dead_code)] diff --git a/src/test/ui/lint/dead-code/lint-dead-code-1.stderr b/src/test/ui/lint/dead-code/lint-dead-code-1.stderr index bac46a2e843..0a08aa6da9a 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-1.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-1.stderr @@ -4,7 +4,7 @@ error: struct is never constructed: `Bar` LL | pub struct Bar; | ^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-dead-code-1.rs:5:9 | LL | #![deny(dead_code)] diff --git a/src/test/ui/lint/dead-code/lint-dead-code-2.stderr b/src/test/ui/lint/dead-code/lint-dead-code-2.stderr index a578a76d9a0..b01ba57f985 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-2.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-2.stderr @@ -4,7 +4,7 @@ error: function is never used: `dead_fn` LL | fn dead_fn() {} | ^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-dead-code-2.rs:2:9 | LL | #![deny(dead_code)] diff --git a/src/test/ui/lint/dead-code/lint-dead-code-3.stderr b/src/test/ui/lint/dead-code/lint-dead-code-3.stderr index 569196fffdd..aab25c481e6 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-3.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-3.stderr @@ -4,7 +4,7 @@ error: struct is never constructed: `Foo` LL | struct Foo; | ^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-dead-code-3.rs:3:9 | LL | #![deny(dead_code)] diff --git a/src/test/ui/lint/dead-code/lint-dead-code-4.stderr b/src/test/ui/lint/dead-code/lint-dead-code-4.stderr index cc00fa4e42a..3905d1a06bd 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-4.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-4.stderr @@ -4,7 +4,7 @@ error: field is never read: `b` LL | b: bool, | ^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-dead-code-4.rs:3:9 | LL | #![deny(dead_code)] diff --git a/src/test/ui/lint/dead-code/lint-dead-code-5.stderr b/src/test/ui/lint/dead-code/lint-dead-code-5.stderr index 9670d8e7a32..c0de4691020 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-5.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-5.stderr @@ -4,7 +4,7 @@ error: variant is never constructed: `Variant2` LL | Variant2 | ^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-dead-code-5.rs:2:9 | LL | #![deny(dead_code)] diff --git a/src/test/ui/lint/dead-code/newline-span.stderr b/src/test/ui/lint/dead-code/newline-span.stderr index c5d0d605067..fd74405f2b6 100644 --- a/src/test/ui/lint/dead-code/newline-span.stderr +++ b/src/test/ui/lint/dead-code/newline-span.stderr @@ -4,7 +4,7 @@ error: function is never used: `unused` LL | fn unused() { | ^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/newline-span.rs:1:9 | LL | #![deny(dead_code)] diff --git a/src/test/ui/lint/dead-code/type-alias.stderr b/src/test/ui/lint/dead-code/type-alias.stderr index 82df23bd944..b2acd5d4213 100644 --- a/src/test/ui/lint/dead-code/type-alias.stderr +++ b/src/test/ui/lint/dead-code/type-alias.stderr @@ -4,7 +4,7 @@ error: type alias is never used: `Unused` LL | type Unused = u8; | ^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/type-alias.rs:1:9 | LL | #![deny(dead_code)] diff --git a/src/test/ui/lint/dead-code/unused-enum.stderr b/src/test/ui/lint/dead-code/unused-enum.stderr index 142c2ccb99b..9f368fdd2f8 100644 --- a/src/test/ui/lint/dead-code/unused-enum.stderr +++ b/src/test/ui/lint/dead-code/unused-enum.stderr @@ -4,7 +4,7 @@ error: struct is never constructed: `F` LL | struct F; | ^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused-enum.rs:1:9 | LL | #![deny(unused)] diff --git a/src/test/ui/lint/dead-code/unused-struct-variant.stderr b/src/test/ui/lint/dead-code/unused-struct-variant.stderr index 0037592e3de..b93d6d4ac18 100644 --- a/src/test/ui/lint/dead-code/unused-struct-variant.stderr +++ b/src/test/ui/lint/dead-code/unused-struct-variant.stderr @@ -4,7 +4,7 @@ error: variant is never constructed: `Bar` LL | Bar(B), | ^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused-struct-variant.rs:1:9 | LL | #![deny(unused)] diff --git a/src/test/ui/lint/dead-code/unused-variant.stderr b/src/test/ui/lint/dead-code/unused-variant.stderr index 2167b9d910d..a547f5af4b0 100644 --- a/src/test/ui/lint/dead-code/unused-variant.stderr +++ b/src/test/ui/lint/dead-code/unused-variant.stderr @@ -4,7 +4,7 @@ error: variant is never constructed: `Variant1` LL | Variant1, | ^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused-variant.rs:1:9 | LL | #![deny(dead_code)] diff --git a/src/test/ui/lint/dead-code/with-core-crate.stderr b/src/test/ui/lint/dead-code/with-core-crate.stderr index 0b6ab67d9bf..2c63e60d676 100644 --- a/src/test/ui/lint/dead-code/with-core-crate.stderr +++ b/src/test/ui/lint/dead-code/with-core-crate.stderr @@ -4,7 +4,7 @@ error: function is never used: `foo` LL | fn foo() { | ^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/with-core-crate.rs:1:9 | LL | #![deny(dead_code)] diff --git a/src/test/ui/lint/inclusive-range-pattern-syntax.stderr b/src/test/ui/lint/inclusive-range-pattern-syntax.stderr index 7ad92a4bc5e..f5768626136 100644 --- a/src/test/ui/lint/inclusive-range-pattern-syntax.stderr +++ b/src/test/ui/lint/inclusive-range-pattern-syntax.stderr @@ -4,7 +4,7 @@ warning: `...` range patterns are deprecated LL | 1...2 => {} | ^^^ help: use `..=` for an inclusive range | -note: lint level defined here +note: the lint level is defined here --> $DIR/inclusive-range-pattern-syntax.rs:4:9 | LL | #![warn(ellipsis_inclusive_range_patterns)] diff --git a/src/test/ui/lint/inline-trait-and-foreign-items.stderr b/src/test/ui/lint/inline-trait-and-foreign-items.stderr index 6c94f88f139..5a999a4fa0d 100644 --- a/src/test/ui/lint/inline-trait-and-foreign-items.stderr +++ b/src/test/ui/lint/inline-trait-and-foreign-items.stderr @@ -20,7 +20,7 @@ warning: `#[inline]` is ignored on constants LL | #[inline] | ^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/inline-trait-and-foreign-items.rs:4:9 | LL | #![warn(unused_attributes)] diff --git a/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.stderr b/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.stderr index 0e18abc03fa..b07474bb486 100644 --- a/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.stderr +++ b/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.stderr @@ -4,7 +4,7 @@ warning: unused variable: `i_think_continually` LL | let i_think_continually = 2; | ^^^^^^^^^^^^^^^^^^^ help: consider prefixing with an underscore: `_i_think_continually` | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:5:9 | LL | #![warn(unused)] // UI tests pass `-A unused` (#43896) @@ -49,7 +49,7 @@ warning: value assigned to `hours_are_suns` is never read LL | hours_are_suns = false; | ^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:5:9 | LL | #![warn(unused)] // UI tests pass `-A unused` (#43896) @@ -107,7 +107,7 @@ LL | let mut mut_unused_var = 1; | | | help: remove this `mut` | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:5:9 | LL | #![warn(unused)] // UI tests pass `-A unused` (#43896) diff --git a/src/test/ui/lint/issue-54180-unused-ref-field.stderr b/src/test/ui/lint/issue-54180-unused-ref-field.stderr index 817d9a46e83..840ecc0ce09 100644 --- a/src/test/ui/lint/issue-54180-unused-ref-field.stderr +++ b/src/test/ui/lint/issue-54180-unused-ref-field.stderr @@ -6,7 +6,7 @@ LL | E::Variant { ref field } => (), | | | help: try ignoring the field: `field: _` | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-54180-unused-ref-field.rs:3:9 | LL | #![deny(unused)] diff --git a/src/test/ui/lint/issue-54538-unused-parens-lint.stderr b/src/test/ui/lint/issue-54538-unused-parens-lint.stderr index 675dd4f07de..b6d532c3101 100644 --- a/src/test/ui/lint/issue-54538-unused-parens-lint.stderr +++ b/src/test/ui/lint/issue-54538-unused-parens-lint.stderr @@ -12,7 +12,7 @@ error: unnecessary parentheses around pattern LL | let (a) = 0; | ^^^ help: remove these parentheses | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-54538-unused-parens-lint.rs:9:9 | LL | #![deny(unused_parens)] diff --git a/src/test/ui/lint/issue-66362-no-snake-case-warning-for-field-puns.stderr b/src/test/ui/lint/issue-66362-no-snake-case-warning-for-field-puns.stderr index 68956f21e8f..09dc3640f99 100644 --- a/src/test/ui/lint/issue-66362-no-snake-case-warning-for-field-puns.stderr +++ b/src/test/ui/lint/issue-66362-no-snake-case-warning-for-field-puns.stderr @@ -4,7 +4,7 @@ error: structure field `lowerCamelCaseName` should have a snake case name LL | lowerCamelCaseName: bool, | ^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `lower_camel_case_name` | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-66362-no-snake-case-warning-for-field-puns.rs:1:9 | LL | #![deny(non_snake_case)] diff --git a/src/test/ui/lint/lint-attr-non-item-node.stderr b/src/test/ui/lint/lint-attr-non-item-node.stderr index 0d428c256e7..58357914096 100644 --- a/src/test/ui/lint/lint-attr-non-item-node.stderr +++ b/src/test/ui/lint/lint-attr-non-item-node.stderr @@ -6,7 +6,7 @@ LL | break; LL | "unreachable"; | ^^^^^^^^^^^^^^ unreachable statement | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-attr-non-item-node.rs:4:12 | LL | #[deny(unreachable_code)] diff --git a/src/test/ui/lint/lint-change-warnings.stderr b/src/test/ui/lint/lint-change-warnings.stderr index 336cb7ea84f..0926dada05d 100644 --- a/src/test/ui/lint/lint-change-warnings.stderr +++ b/src/test/ui/lint/lint-change-warnings.stderr @@ -4,7 +4,7 @@ error: denote infinite loops with `loop { ... }` LL | while true {} | ^^^^^^^^^^ help: use `loop` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-change-warnings.rs:1:9 | LL | #![deny(warnings)] @@ -25,7 +25,7 @@ error: denote infinite loops with `loop { ... }` LL | while true {} | ^^^^^^^^^^ help: use `loop` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-change-warnings.rs:18:10 | LL | #[forbid(warnings)] diff --git a/src/test/ui/lint/lint-ctypes-enum.stderr b/src/test/ui/lint/lint-ctypes-enum.stderr index 81939e6ee20..297ac2237a5 100644 --- a/src/test/ui/lint/lint-ctypes-enum.stderr +++ b/src/test/ui/lint/lint-ctypes-enum.stderr @@ -4,14 +4,14 @@ error: `extern` block uses type `U`, which is not FFI-safe LL | fn uf(x: U); | ^ not FFI-safe | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-ctypes-enum.rs:3:9 | LL | #![deny(improper_ctypes)] | ^^^^^^^^^^^^^^^ = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint -note: type defined here +note: the type is defined here --> $DIR/lint-ctypes-enum.rs:9:1 | LL | enum U { A } @@ -25,7 +25,7 @@ LL | fn bf(x: B); | = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint -note: type defined here +note: the type is defined here --> $DIR/lint-ctypes-enum.rs:10:1 | LL | enum B { C, D } @@ -39,7 +39,7 @@ LL | fn tf(x: T); | = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint -note: type defined here +note: the type is defined here --> $DIR/lint-ctypes-enum.rs:11:1 | LL | enum T { E, F, G } diff --git a/src/test/ui/lint/lint-ctypes.stderr b/src/test/ui/lint/lint-ctypes.stderr index e6bb49afb88..9821f858d9c 100644 --- a/src/test/ui/lint/lint-ctypes.stderr +++ b/src/test/ui/lint/lint-ctypes.stderr @@ -4,14 +4,14 @@ error: `extern` block uses type `Foo`, which is not FFI-safe LL | pub fn ptr_type1(size: *const Foo); | ^^^^^^^^^^ not FFI-safe | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-ctypes.rs:4:9 | LL | #![deny(improper_ctypes)] | ^^^^^^^^^^^^^^^ = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout -note: type defined here +note: the type is defined here --> $DIR/lint-ctypes.rs:24:1 | LL | pub struct Foo; @@ -25,7 +25,7 @@ LL | pub fn ptr_type2(size: *const Foo); | = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout -note: type defined here +note: the type is defined here --> $DIR/lint-ctypes.rs:24:1 | LL | pub struct Foo; @@ -117,7 +117,7 @@ LL | pub fn zero_size(p: ZeroSize); | = help: consider adding a member to this struct = note: this struct has no fields -note: type defined here +note: the type is defined here --> $DIR/lint-ctypes.rs:20:1 | LL | pub struct ZeroSize; @@ -130,7 +130,7 @@ LL | pub fn zero_size_phantom(p: ZeroSizeWithPhantomData); | ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe | = note: composed only of `PhantomData` -note: type defined here +note: the type is defined here --> $DIR/lint-ctypes.rs:43:1 | LL | pub struct ZeroSizeWithPhantomData(::std::marker::PhantomData<i32>); diff --git a/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr b/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr index 020591ccff7..ccb139e0ed6 100644 --- a/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr +++ b/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr @@ -4,7 +4,7 @@ error: unused import: `a::x` LL | use a::x; | ^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-directives-on-use-items-issue-10534.rs:1:9 | LL | #![deny(unused_imports)] @@ -16,7 +16,7 @@ error: unused import: `a::y` LL | use a::y; | ^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-directives-on-use-items-issue-10534.rs:20:12 | LL | #[deny(unused_imports)] diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.stderr b/src/test/ui/lint/lint-exceeding-bitshifts.stderr index 203cb741539..658577213b3 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts.stderr +++ b/src/test/ui/lint/lint-exceeding-bitshifts.stderr @@ -4,7 +4,7 @@ error: attempt to shift left with overflow LL | let n = 1u8 << 8; | ^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-exceeding-bitshifts.rs:4:9 | LL | #![deny(exceeding_bitshifts, const_err)] diff --git a/src/test/ui/lint/lint-exceeding-bitshifts2.stderr b/src/test/ui/lint/lint-exceeding-bitshifts2.stderr index 49ac54ab834..ac9f3b1e56b 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts2.stderr +++ b/src/test/ui/lint/lint-exceeding-bitshifts2.stderr @@ -4,7 +4,7 @@ error: attempt to shift left with overflow LL | let n = 1u8 << (4+4); | ^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-exceeding-bitshifts2.rs:4:9 | LL | #![deny(exceeding_bitshifts, const_err)] diff --git a/src/test/ui/lint/lint-forbid-internal-unsafe.stderr b/src/test/ui/lint/lint-forbid-internal-unsafe.stderr index 59dab119682..e31c003985e 100644 --- a/src/test/ui/lint/lint-forbid-internal-unsafe.stderr +++ b/src/test/ui/lint/lint-forbid-internal-unsafe.stderr @@ -4,7 +4,7 @@ error: `allow_internal_unsafe` allows defining macros using unsafe without trigg LL | #[allow_internal_unsafe] | ^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-forbid-internal-unsafe.rs:1:11 | LL | #![forbid(unsafe_code)] diff --git a/src/test/ui/lint/lint-group-nonstandard-style.stderr b/src/test/ui/lint/lint-group-nonstandard-style.stderr index 1cc973d32c2..4ba49bf1ba7 100644 --- a/src/test/ui/lint/lint-group-nonstandard-style.stderr +++ b/src/test/ui/lint/lint-group-nonstandard-style.stderr @@ -4,7 +4,7 @@ warning: type `snake_case` should have an upper camel case name LL | struct snake_case; | ^^^^^^^^^^ help: convert the identifier to upper camel case: `SnakeCase` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-group-nonstandard-style.rs:18:17 | LL | #![warn(nonstandard_style)] @@ -17,7 +17,7 @@ error: function `CamelCase` should have a snake case name LL | fn CamelCase() {} | ^^^^^^^^^ help: convert the identifier to snake case: `camel_case` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-group-nonstandard-style.rs:1:9 | LL | #![deny(nonstandard_style)] @@ -30,7 +30,7 @@ error: function `CamelCase` should have a snake case name LL | fn CamelCase() {} | ^^^^^^^^^ help: convert the identifier to snake case: `camel_case` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-group-nonstandard-style.rs:10:14 | LL | #[forbid(nonstandard_style)] @@ -43,7 +43,7 @@ error: static variable `bad` should have an upper case name LL | static bad: isize = 1; | ^^^ help: convert the identifier to upper case: `BAD` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-group-nonstandard-style.rs:10:14 | LL | #[forbid(nonstandard_style)] @@ -56,7 +56,7 @@ warning: function `CamelCase` should have a snake case name LL | fn CamelCase() {} | ^^^^^^^^^ help: convert the identifier to snake case: `camel_case` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-group-nonstandard-style.rs:18:17 | LL | #![warn(nonstandard_style)] diff --git a/src/test/ui/lint/lint-impl-fn.stderr b/src/test/ui/lint/lint-impl-fn.stderr index 2c9a264287c..24ec9c7e4f3 100644 --- a/src/test/ui/lint/lint-impl-fn.stderr +++ b/src/test/ui/lint/lint-impl-fn.stderr @@ -4,7 +4,7 @@ error: denote infinite loops with `loop { ... }` LL | fn bar(&self) { while true {} } | ^^^^^^^^^^ help: use `loop` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-impl-fn.rs:9:12 | LL | #[deny(while_true)] @@ -16,7 +16,7 @@ error: denote infinite loops with `loop { ... }` LL | fn foo(&self) { while true {} } | ^^^^^^^^^^ help: use `loop` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-impl-fn.rs:13:8 | LL | #[deny(while_true)] @@ -28,7 +28,7 @@ error: denote infinite loops with `loop { ... }` LL | while true {} | ^^^^^^^^^^ help: use `loop` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-impl-fn.rs:25:8 | LL | #[deny(while_true)] diff --git a/src/test/ui/lint/lint-lowercase-static-const-pattern.stderr b/src/test/ui/lint/lint-lowercase-static-const-pattern.stderr index d95510ccd2d..8780fac05b1 100644 --- a/src/test/ui/lint/lint-lowercase-static-const-pattern.stderr +++ b/src/test/ui/lint/lint-lowercase-static-const-pattern.stderr @@ -4,7 +4,7 @@ error: constant in pattern `a` should have an upper case name LL | (0, a) => 0, | ^ help: convert the identifier to upper case: `A` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-lowercase-static-const-pattern.rs:4:9 | LL | #![deny(non_upper_case_globals)] diff --git a/src/test/ui/lint/lint-match-arms.rs b/src/test/ui/lint/lint-match-arms.rs index 2c471a61054..5c2ccc60e1f 100644 --- a/src/test/ui/lint/lint-match-arms.rs +++ b/src/test/ui/lint/lint-match-arms.rs @@ -1,7 +1,7 @@ fn deny_on_arm() { match 0 { #[deny(unused_variables)] - //~^ NOTE lint level defined here + //~^ NOTE the lint level is defined here y => (), //~^ ERROR unused variable } diff --git a/src/test/ui/lint/lint-match-arms.stderr b/src/test/ui/lint/lint-match-arms.stderr index e4e3adab0a9..b124971f905 100644 --- a/src/test/ui/lint/lint-match-arms.stderr +++ b/src/test/ui/lint/lint-match-arms.stderr @@ -4,7 +4,7 @@ error: unused variable: `y` LL | y => (), | ^ help: consider prefixing with an underscore: `_y` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-match-arms.rs:3:16 | LL | #[deny(unused_variables)] diff --git a/src/test/ui/lint/lint-misplaced-attr.stderr b/src/test/ui/lint/lint-misplaced-attr.stderr index cd4a89f91c4..3a7ca2f83ae 100644 --- a/src/test/ui/lint/lint-misplaced-attr.stderr +++ b/src/test/ui/lint/lint-misplaced-attr.stderr @@ -4,7 +4,7 @@ error: unused attribute LL | #![crate_type = "bin"] | ^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-misplaced-attr.rs:4:9 | LL | #![deny(unused_attributes)] diff --git a/src/test/ui/lint/lint-missing-copy-implementations.stderr b/src/test/ui/lint/lint-missing-copy-implementations.stderr index 7b6674e71bf..e5f5ce20d1c 100644 --- a/src/test/ui/lint/lint-missing-copy-implementations.stderr +++ b/src/test/ui/lint/lint-missing-copy-implementations.stderr @@ -6,7 +6,7 @@ LL | | pub field: i32 LL | | } | |_____^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-missing-copy-implementations.rs:3:9 | LL | #![deny(missing_copy_implementations)] diff --git a/src/test/ui/lint/lint-missing-doc.stderr b/src/test/ui/lint/lint-missing-doc.stderr index 3532c9315d8..a18a97e5f7f 100644 --- a/src/test/ui/lint/lint-missing-doc.stderr +++ b/src/test/ui/lint/lint-missing-doc.stderr @@ -4,7 +4,7 @@ error: missing documentation for a type alias LL | pub type PubTypedef = String; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-missing-doc.rs:3:9 | LL | #![deny(missing_docs)] diff --git a/src/test/ui/lint/lint-non-camel-case-types.stderr b/src/test/ui/lint/lint-non-camel-case-types.stderr index f82eefed436..875380b5dab 100644 --- a/src/test/ui/lint/lint-non-camel-case-types.stderr +++ b/src/test/ui/lint/lint-non-camel-case-types.stderr @@ -4,7 +4,7 @@ error: type `ONE_TWO_THREE` should have an upper camel case name LL | struct ONE_TWO_THREE; | ^^^^^^^^^^^^^ help: convert the identifier to upper camel case: `OneTwoThree` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-non-camel-case-types.rs:1:11 | LL | #![forbid(non_camel_case_types)] diff --git a/src/test/ui/lint/lint-non-snake-case-crate-2.stderr b/src/test/ui/lint/lint-non-snake-case-crate-2.stderr index f3303191a06..e2951129327 100644 --- a/src/test/ui/lint/lint-non-snake-case-crate-2.stderr +++ b/src/test/ui/lint/lint-non-snake-case-crate-2.stderr @@ -1,6 +1,6 @@ error: crate `NonSnakeCase` should have a snake case name | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-non-snake-case-crate-2.rs:4:9 | LL | #![deny(non_snake_case)] diff --git a/src/test/ui/lint/lint-non-snake-case-crate.stderr b/src/test/ui/lint/lint-non-snake-case-crate.stderr index 5cfd60a76e4..da6b89c1e04 100644 --- a/src/test/ui/lint/lint-non-snake-case-crate.stderr +++ b/src/test/ui/lint/lint-non-snake-case-crate.stderr @@ -4,7 +4,7 @@ error: crate `NonSnakeCase` should have a snake case name LL | #![crate_name = "NonSnakeCase"] | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-non-snake-case-crate.rs:3:9 | LL | #![deny(non_snake_case)] diff --git a/src/test/ui/lint/lint-non-snake-case-functions.stderr b/src/test/ui/lint/lint-non-snake-case-functions.stderr index c5eca89debb..f6ac6b99b60 100644 --- a/src/test/ui/lint/lint-non-snake-case-functions.stderr +++ b/src/test/ui/lint/lint-non-snake-case-functions.stderr @@ -4,7 +4,7 @@ error: method `Foo_Method` should have a snake case name LL | fn Foo_Method() {} | ^^^^^^^^^^ help: convert the identifier to snake case: `foo_method` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-non-snake-case-functions.rs:1:9 | LL | #![deny(non_snake_case)] diff --git a/src/test/ui/lint/lint-non-snake-case-lifetimes.stderr b/src/test/ui/lint/lint-non-snake-case-lifetimes.stderr index d638626495a..d4fe26a43c2 100644 --- a/src/test/ui/lint/lint-non-snake-case-lifetimes.stderr +++ b/src/test/ui/lint/lint-non-snake-case-lifetimes.stderr @@ -4,7 +4,7 @@ error: lifetime `'FooBar` should have a snake case name LL | fn f<'FooBar>( | ^^^^^^^ help: convert the identifier to snake case: `'foo_bar` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-non-snake-case-lifetimes.rs:1:9 | LL | #![deny(non_snake_case)] diff --git a/src/test/ui/lint/lint-non-snake-case-modules.stderr b/src/test/ui/lint/lint-non-snake-case-modules.stderr index 847c43e1b04..c8b997c8707 100644 --- a/src/test/ui/lint/lint-non-snake-case-modules.stderr +++ b/src/test/ui/lint/lint-non-snake-case-modules.stderr @@ -4,7 +4,7 @@ error: module `FooBar` should have a snake case name LL | mod FooBar { | ^^^^^^ help: convert the identifier to snake case: `foo_bar` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-non-snake-case-modules.rs:1:9 | LL | #![deny(non_snake_case)] diff --git a/src/test/ui/lint/lint-non-uppercase-associated-const.stderr b/src/test/ui/lint/lint-non-uppercase-associated-const.stderr index 2185d5a0ab4..411ff51aad7 100644 --- a/src/test/ui/lint/lint-non-uppercase-associated-const.stderr +++ b/src/test/ui/lint/lint-non-uppercase-associated-const.stderr @@ -4,7 +4,7 @@ error: associated constant `not_upper` should have an upper case name LL | const not_upper: bool = true; | ^^^^^^^^^ help: convert the identifier to upper case: `NOT_UPPER` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-non-uppercase-associated-const.rs:1:9 | LL | #![deny(non_upper_case_globals)] diff --git a/src/test/ui/lint/lint-non-uppercase-statics.stderr b/src/test/ui/lint/lint-non-uppercase-statics.stderr index ceb83d08f27..c6fd0a6e0dd 100644 --- a/src/test/ui/lint/lint-non-uppercase-statics.stderr +++ b/src/test/ui/lint/lint-non-uppercase-statics.stderr @@ -4,7 +4,7 @@ error: static variable `foo` should have an upper case name LL | static foo: isize = 1; | ^^^ help: convert the identifier to upper case (notice the capitalization): `FOO` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-non-uppercase-statics.rs:1:11 | LL | #![forbid(non_upper_case_globals)] diff --git a/src/test/ui/lint/lint-owned-heap-memory.stderr b/src/test/ui/lint/lint-owned-heap-memory.stderr index c61b3d31558..2c6b47e494a 100644 --- a/src/test/ui/lint/lint-owned-heap-memory.stderr +++ b/src/test/ui/lint/lint-owned-heap-memory.stderr @@ -4,7 +4,7 @@ error: type uses owned (Box type) pointers: std::boxed::Box<isize> LL | x: Box<isize> | ^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-owned-heap-memory.rs:2:11 | LL | #![forbid(box_pointers)] diff --git a/src/test/ui/lint/lint-qualification.stderr b/src/test/ui/lint/lint-qualification.stderr index 125aeb3db03..149a782d97c 100644 --- a/src/test/ui/lint/lint-qualification.stderr +++ b/src/test/ui/lint/lint-qualification.stderr @@ -4,7 +4,7 @@ error: unnecessary qualification LL | foo::bar(); | ^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-qualification.rs:1:9 | LL | #![deny(unused_qualifications)] diff --git a/src/test/ui/lint/lint-range-endpoint-overflow.stderr b/src/test/ui/lint/lint-range-endpoint-overflow.stderr index 939451d6bc0..dff61e022eb 100644 --- a/src/test/ui/lint/lint-range-endpoint-overflow.stderr +++ b/src/test/ui/lint/lint-range-endpoint-overflow.stderr @@ -4,7 +4,7 @@ error: range endpoint is out of range for `u8` LL | let range_a = 0..256; | ^^^^^^ help: use an inclusive range instead: `0..=255` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-range-endpoint-overflow.rs:1:9 | LL | #![deny(overflowing_literals)] diff --git a/src/test/ui/lint/lint-removed-allow.stderr b/src/test/ui/lint/lint-removed-allow.stderr index 32af7389b6c..5ab95c89b9c 100644 --- a/src/test/ui/lint/lint-removed-allow.stderr +++ b/src/test/ui/lint/lint-removed-allow.stderr @@ -4,7 +4,7 @@ error: unused variable: `unused` LL | fn main() { let unused = (); } | ^^^^^^ help: consider prefixing with an underscore: `_unused` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-removed-allow.rs:7:8 | LL | #[deny(unused_variables)] diff --git a/src/test/ui/lint/lint-removed-cmdline.stderr b/src/test/ui/lint/lint-removed-cmdline.stderr index b4ab5f5ee62..a9ebd3e3271 100644 --- a/src/test/ui/lint/lint-removed-cmdline.stderr +++ b/src/test/ui/lint/lint-removed-cmdline.stderr @@ -20,7 +20,7 @@ error: unused variable: `unused` LL | fn main() { let unused = (); } | ^^^^^^ help: consider prefixing with an underscore: `_unused` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-removed-cmdline.rs:11:8 | LL | #[deny(warnings)] diff --git a/src/test/ui/lint/lint-removed.stderr b/src/test/ui/lint/lint-removed.stderr index 060ba31bced..2c043392f09 100644 --- a/src/test/ui/lint/lint-removed.stderr +++ b/src/test/ui/lint/lint-removed.stderr @@ -12,7 +12,7 @@ error: unused variable: `unused` LL | fn main() { let unused = (); } | ^^^^^^ help: consider prefixing with an underscore: `_unused` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-removed.rs:7:8 | LL | #[deny(unused_variables)] diff --git a/src/test/ui/lint/lint-renamed-allow.stderr b/src/test/ui/lint/lint-renamed-allow.stderr index 1d984cb8287..9da74f61b75 100644 --- a/src/test/ui/lint/lint-renamed-allow.stderr +++ b/src/test/ui/lint/lint-renamed-allow.stderr @@ -4,7 +4,7 @@ error: unused variable: `unused` LL | fn main() { let unused = (); } | ^^^^^^ help: consider prefixing with an underscore: `_unused` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-renamed-allow.rs:7:8 | LL | #[deny(unused)] diff --git a/src/test/ui/lint/lint-renamed-cmdline.stderr b/src/test/ui/lint/lint-renamed-cmdline.stderr index 6401d9b77e0..235215598a2 100644 --- a/src/test/ui/lint/lint-renamed-cmdline.stderr +++ b/src/test/ui/lint/lint-renamed-cmdline.stderr @@ -20,7 +20,7 @@ error: unused variable: `unused` LL | fn main() { let unused = (); } | ^^^^^^ help: consider prefixing with an underscore: `_unused` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-renamed-cmdline.rs:7:8 | LL | #[deny(unused)] diff --git a/src/test/ui/lint/lint-renamed.stderr b/src/test/ui/lint/lint-renamed.stderr index ba8eadf23ac..dc43f2e4c46 100644 --- a/src/test/ui/lint/lint-renamed.stderr +++ b/src/test/ui/lint/lint-renamed.stderr @@ -12,7 +12,7 @@ error: unused variable: `unused` LL | fn main() { let unused = (); } | ^^^^^^ help: consider prefixing with an underscore: `_unused` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-renamed.rs:3:8 | LL | #[deny(unused)] diff --git a/src/test/ui/lint/lint-shorthand-field.stderr b/src/test/ui/lint/lint-shorthand-field.stderr index 5c9b21ffdc7..2d1ca30f991 100644 --- a/src/test/ui/lint/lint-shorthand-field.stderr +++ b/src/test/ui/lint/lint-shorthand-field.stderr @@ -4,7 +4,7 @@ error: the `x:` in this pattern is redundant LL | x: x, | ^^^^ help: use shorthand field pattern: `x` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-shorthand-field.rs:4:9 | LL | #![deny(non_shorthand_field_patterns)] diff --git a/src/test/ui/lint/lint-stability-deprecated.stderr b/src/test/ui/lint/lint-stability-deprecated.stderr index 650373c90bc..734c6093e2b 100644 --- a/src/test/ui/lint/lint-stability-deprecated.stderr +++ b/src/test/ui/lint/lint-stability-deprecated.stderr @@ -4,7 +4,7 @@ warning: use of deprecated item 'lint_stability::deprecated': text LL | deprecated(); | ^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-stability-deprecated.rs:7:9 | LL | #![warn(deprecated)] diff --git a/src/test/ui/lint/lint-stability-fields-deprecated.stderr b/src/test/ui/lint/lint-stability-fields-deprecated.stderr index 488be75ae52..5210fb690e9 100644 --- a/src/test/ui/lint/lint-stability-fields-deprecated.stderr +++ b/src/test/ui/lint/lint-stability-fields-deprecated.stderr @@ -4,7 +4,7 @@ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated': LL | let x = Deprecated { | ^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-stability-fields-deprecated.rs:3:9 | LL | #![deny(deprecated)] diff --git a/src/test/ui/lint/lint-stability2.stderr b/src/test/ui/lint/lint-stability2.stderr index 6599da564f5..5bac22594d6 100644 --- a/src/test/ui/lint/lint-stability2.stderr +++ b/src/test/ui/lint/lint-stability2.stderr @@ -4,7 +4,7 @@ error: use of deprecated item 'lint_stability::deprecated': text LL | macro_test!(); | ^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-stability2.rs:4:9 | LL | #![deny(deprecated)] diff --git a/src/test/ui/lint/lint-stability3.stderr b/src/test/ui/lint/lint-stability3.stderr index 84274e64069..566734743ca 100644 --- a/src/test/ui/lint/lint-stability3.stderr +++ b/src/test/ui/lint/lint-stability3.stderr @@ -4,7 +4,7 @@ error: use of deprecated item 'lint_stability::deprecated_text': text LL | macro_test_arg_nested!(deprecated_text); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-stability3.rs:4:9 | LL | #![deny(deprecated)] diff --git a/src/test/ui/lint/lint-type-limits2.stderr b/src/test/ui/lint/lint-type-limits2.stderr index 0b3d2928567..bf510823b56 100644 --- a/src/test/ui/lint/lint-type-limits2.stderr +++ b/src/test/ui/lint/lint-type-limits2.stderr @@ -12,7 +12,7 @@ warning: literal out of range for `i8` LL | 128 > bar() | ^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-type-limits2.rs:2:9 | LL | #![warn(overflowing_literals)] diff --git a/src/test/ui/lint/lint-type-limits3.stderr b/src/test/ui/lint/lint-type-limits3.stderr index 70cd9c859ec..00441f99e60 100644 --- a/src/test/ui/lint/lint-type-limits3.stderr +++ b/src/test/ui/lint/lint-type-limits3.stderr @@ -12,7 +12,7 @@ warning: literal out of range for `i8` LL | while 200 != i { | ^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-type-limits3.rs:2:9 | LL | #![warn(overflowing_literals)] diff --git a/src/test/ui/lint/lint-type-overflow.stderr b/src/test/ui/lint/lint-type-overflow.stderr index 6fcd9b58b2d..ec15313158d 100644 --- a/src/test/ui/lint/lint-type-overflow.stderr +++ b/src/test/ui/lint/lint-type-overflow.stderr @@ -4,7 +4,7 @@ error: literal out of range for `u8` LL | let x1: u8 = 256; | ^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-type-overflow.rs:1:9 | LL | #![deny(overflowing_literals)] diff --git a/src/test/ui/lint/lint-type-overflow2.stderr b/src/test/ui/lint/lint-type-overflow2.stderr index 761b095464f..dfc691ab910 100644 --- a/src/test/ui/lint/lint-type-overflow2.stderr +++ b/src/test/ui/lint/lint-type-overflow2.stderr @@ -4,7 +4,7 @@ error: literal out of range for `i8` LL | let x2: i8 = --128; | ^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-type-overflow2.rs:3:9 | LL | #![deny(overflowing_literals)] diff --git a/src/test/ui/lint/lint-unconditional-recursion.stderr b/src/test/ui/lint/lint-unconditional-recursion.stderr index 5d2e8201b14..1770d71e2e2 100644 --- a/src/test/ui/lint/lint-unconditional-recursion.stderr +++ b/src/test/ui/lint/lint-unconditional-recursion.stderr @@ -6,7 +6,7 @@ LL | fn foo() { LL | foo(); | ----- recursive call site | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-unconditional-recursion.rs:1:9 | LL | #![deny(unconditional_recursion)] diff --git a/src/test/ui/lint/lint-unknown-lint.stderr b/src/test/ui/lint/lint-unknown-lint.stderr index b3ba6e31bc1..3a102769e85 100644 --- a/src/test/ui/lint/lint-unknown-lint.stderr +++ b/src/test/ui/lint/lint-unknown-lint.stderr @@ -4,7 +4,7 @@ error: unknown lint: `not_a_real_lint` LL | #![allow(not_a_real_lint)] | ^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-unknown-lint.rs:1:9 | LL | #![deny(unknown_lints)] diff --git a/src/test/ui/lint/lint-unnecessary-import-braces.stderr b/src/test/ui/lint/lint-unnecessary-import-braces.stderr index 41e274bc545..2d289404ded 100644 --- a/src/test/ui/lint/lint-unnecessary-import-braces.stderr +++ b/src/test/ui/lint/lint-unnecessary-import-braces.stderr @@ -4,7 +4,7 @@ error: braces around A is unnecessary LL | use test::{A}; | ^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-unnecessary-import-braces.rs:1:9 | LL | #![deny(unused_import_braces)] diff --git a/src/test/ui/lint/lint-unnecessary-parens.stderr b/src/test/ui/lint/lint-unnecessary-parens.stderr index ea58220d20c..3663f1d98bb 100644 --- a/src/test/ui/lint/lint-unnecessary-parens.stderr +++ b/src/test/ui/lint/lint-unnecessary-parens.stderr @@ -4,7 +4,7 @@ error: unnecessary parentheses around `return` value LL | return (1); | ^^^ help: remove these parentheses | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-unnecessary-parens.rs:1:9 | LL | #![deny(unused_parens)] diff --git a/src/test/ui/lint/lint-unsafe-code.stderr b/src/test/ui/lint/lint-unsafe-code.stderr index 96ad0c33691..8e56fd4139b 100644 --- a/src/test/ui/lint/lint-unsafe-code.stderr +++ b/src/test/ui/lint/lint-unsafe-code.stderr @@ -4,7 +4,7 @@ error: declaration of an `unsafe` function LL | unsafe fn baz() {} | ^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-unsafe-code.rs:3:9 | LL | #![deny(unsafe_code)] diff --git a/src/test/ui/lint/lint-unused-extern-crate.stderr b/src/test/ui/lint/lint-unused-extern-crate.stderr index aa4a8dad24c..46d8f3beeab 100644 --- a/src/test/ui/lint/lint-unused-extern-crate.stderr +++ b/src/test/ui/lint/lint-unused-extern-crate.stderr @@ -4,7 +4,7 @@ error: unused extern crate LL | extern crate lint_unused_extern_crate5; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-unused-extern-crate.rs:7:9 | LL | #![deny(unused_extern_crates)] diff --git a/src/test/ui/lint/lint-unused-imports.stderr b/src/test/ui/lint/lint-unused-imports.stderr index 96d71a228a5..0574ca4569f 100644 --- a/src/test/ui/lint/lint-unused-imports.stderr +++ b/src/test/ui/lint/lint-unused-imports.stderr @@ -4,7 +4,7 @@ error: unused import: `std::fmt::{}` LL | use std::fmt::{}; | ^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-unused-imports.rs:1:9 | LL | #![deny(unused_imports)] diff --git a/src/test/ui/lint/lint-unused-mut-self.stderr b/src/test/ui/lint/lint-unused-mut-self.stderr index b5f6b717dc3..16ad4758b92 100644 --- a/src/test/ui/lint/lint-unused-mut-self.stderr +++ b/src/test/ui/lint/lint-unused-mut-self.stderr @@ -6,7 +6,7 @@ LL | fn foo(mut self) {} | | | help: remove this `mut` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-unused-mut-self.rs:4:9 | LL | #![deny(unused_mut)] diff --git a/src/test/ui/lint/lint-unused-mut-variables.stderr b/src/test/ui/lint/lint-unused-mut-variables.stderr index c1ab0ab33d4..eda078da9a0 100644 --- a/src/test/ui/lint/lint-unused-mut-variables.stderr +++ b/src/test/ui/lint/lint-unused-mut-variables.stderr @@ -6,7 +6,7 @@ LL | mut a: i32, | | | help: remove this `mut` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-unused-mut-variables.rs:5:9 | LL | #![deny(unused_mut)] @@ -212,7 +212,7 @@ LL | let mut b = vec![2]; | | | help: remove this `mut` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-unused-mut-variables.rs:198:8 | LL | #[deny(unused_mut)] diff --git a/src/test/ui/lint/lint-unused-variables.stderr b/src/test/ui/lint/lint-unused-variables.stderr index f8419bf5066..57389f8d120 100644 --- a/src/test/ui/lint/lint-unused-variables.stderr +++ b/src/test/ui/lint/lint-unused-variables.stderr @@ -4,7 +4,7 @@ error: unused variable: `a` LL | a: i32, | ^ help: consider prefixing with an underscore: `_a` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-unused-variables.rs:5:9 | LL | #![deny(unused_variables)] diff --git a/src/test/ui/lint/lint-uppercase-variables.stderr b/src/test/ui/lint/lint-uppercase-variables.stderr index a38f3e7626b..7c2497758d9 100644 --- a/src/test/ui/lint/lint-uppercase-variables.stderr +++ b/src/test/ui/lint/lint-uppercase-variables.stderr @@ -24,7 +24,7 @@ warning: unused variable: `Foo` LL | Foo => {} | ^^^ help: consider prefixing with an underscore: `_Foo` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-uppercase-variables.rs:1:9 | LL | #![warn(unused)] @@ -49,7 +49,7 @@ error: structure field `X` should have a snake case name LL | X: usize | ^ help: convert the identifier to snake case (notice the capitalization): `x` | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-uppercase-variables.rs:3:9 | LL | #![deny(non_snake_case)] diff --git a/src/test/ui/lint/lints-in-foreign-macros.stderr b/src/test/ui/lint/lints-in-foreign-macros.stderr index 3fc3c2281f2..0d2adb2ad04 100644 --- a/src/test/ui/lint/lints-in-foreign-macros.stderr +++ b/src/test/ui/lint/lints-in-foreign-macros.stderr @@ -7,7 +7,7 @@ LL | () => {use std::string::ToString;} LL | mod a { foo!(); } | ------- in this macro invocation | -note: lint level defined here +note: the lint level is defined here --> $DIR/lints-in-foreign-macros.rs:4:9 | LL | #![warn(unused_imports)] @@ -37,7 +37,7 @@ LL | | LL | | fn main() {} | |____________^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lints-in-foreign-macros.rs:5:9 | LL | #![warn(missing_docs)] diff --git a/src/test/ui/lint/must-use-ops.stderr b/src/test/ui/lint/must-use-ops.stderr index febb4c193ef..4490d4afbd6 100644 --- a/src/test/ui/lint/must-use-ops.stderr +++ b/src/test/ui/lint/must-use-ops.stderr @@ -4,7 +4,7 @@ warning: unused comparison that must be used LL | val == 1; | ^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/must-use-ops.rs:5:9 | LL | #![warn(unused_must_use)] diff --git a/src/test/ui/lint/must_use-array.stderr b/src/test/ui/lint/must_use-array.stderr index a6dbd8e93d4..c42223b5198 100644 --- a/src/test/ui/lint/must_use-array.stderr +++ b/src/test/ui/lint/must_use-array.stderr @@ -4,7 +4,7 @@ error: unused array of `S` that must be used LL | singleton(); | ^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/must_use-array.rs:1:9 | LL | #![deny(unused_must_use)] diff --git a/src/test/ui/lint/must_use-trait.stderr b/src/test/ui/lint/must_use-trait.stderr index be74362e29d..11555d80825 100644 --- a/src/test/ui/lint/must_use-trait.stderr +++ b/src/test/ui/lint/must_use-trait.stderr @@ -4,7 +4,7 @@ error: unused implementer of `Critical` that must be used LL | get_critical(); | ^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/must_use-trait.rs:1:9 | LL | #![deny(unused_must_use)] diff --git a/src/test/ui/lint/must_use-tuple.stderr b/src/test/ui/lint/must_use-tuple.stderr index 45d2a439e52..de3c6f46c68 100644 --- a/src/test/ui/lint/must_use-tuple.stderr +++ b/src/test/ui/lint/must_use-tuple.stderr @@ -4,7 +4,7 @@ error: unused `std::result::Result` in tuple element 0 that must be used LL | (Ok::<(), ()>(()),); | ^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/must_use-tuple.rs:1:9 | LL | #![deny(unused_must_use)] diff --git a/src/test/ui/lint/must_use-unit.stderr b/src/test/ui/lint/must_use-unit.stderr index 0a9939b2015..7f25a193508 100644 --- a/src/test/ui/lint/must_use-unit.stderr +++ b/src/test/ui/lint/must_use-unit.stderr @@ -4,7 +4,7 @@ error: unused return value of `foo` that must be used LL | foo(); | ^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/must_use-unit.rs:2:9 | LL | #![deny(unused_must_use)] diff --git a/src/test/ui/lint/opaque-ty-ffi-unsafe.stderr b/src/test/ui/lint/opaque-ty-ffi-unsafe.stderr index 136d564d1ab..712095e3208 100644 --- a/src/test/ui/lint/opaque-ty-ffi-unsafe.stderr +++ b/src/test/ui/lint/opaque-ty-ffi-unsafe.stderr @@ -4,7 +4,7 @@ error: `extern` block uses type `A`, which is not FFI-safe LL | pub fn a(_: A); | ^ not FFI-safe | -note: lint level defined here +note: the lint level is defined here --> $DIR/opaque-ty-ffi-unsafe.rs:3:9 | LL | #![deny(improper_ctypes)] diff --git a/src/test/ui/lint/reasons.rs b/src/test/ui/lint/reasons.rs index 4722e85673c..34cac4968a8 100644 --- a/src/test/ui/lint/reasons.rs +++ b/src/test/ui/lint/reasons.rs @@ -3,11 +3,11 @@ #![feature(lint_reasons)] #![warn(elided_lifetimes_in_paths, - //~^ NOTE lint level defined here + //~^ NOTE the lint level is defined here reason = "explicit anonymous lifetimes aid reasoning about ownership")] #![warn( nonstandard_style, - //~^ NOTE lint level defined here + //~^ NOTE the lint level is defined here reason = r#"people shouldn't have to change their usual style habits to contribute to our project"# )] diff --git a/src/test/ui/lint/reasons.stderr b/src/test/ui/lint/reasons.stderr index 139b3f13fd6..30bb8daf48a 100644 --- a/src/test/ui/lint/reasons.stderr +++ b/src/test/ui/lint/reasons.stderr @@ -5,7 +5,7 @@ LL | fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | ^^^^^^^^^^^^^^- help: indicate the anonymous lifetime: `<'_>` | = note: explicit anonymous lifetimes aid reasoning about ownership -note: lint level defined here +note: the lint level is defined here --> $DIR/reasons.rs:5:9 | LL | #![warn(elided_lifetimes_in_paths, @@ -19,7 +19,7 @@ LL | let Social_exchange_psychology = CheaterDetectionMechanism {}; | = note: people shouldn't have to change their usual style habits to contribute to our project -note: lint level defined here +note: the lint level is defined here --> $DIR/reasons.rs:9:5 | LL | nonstandard_style, diff --git a/src/test/ui/lint/redundant-semicolon/redundant-semi-proc-macro.stderr b/src/test/ui/lint/redundant-semicolon/redundant-semi-proc-macro.stderr index 2160df51a83..8c5ee58dc12 100644 --- a/src/test/ui/lint/redundant-semicolon/redundant-semi-proc-macro.stderr +++ b/src/test/ui/lint/redundant-semicolon/redundant-semi-proc-macro.stderr @@ -5,7 +5,7 @@ error: unnecessary trailing semicolon LL | let tst = 123;; | ^ help: remove this semicolon | -note: lint level defined here +note: the lint level is defined here --> $DIR/redundant-semi-proc-macro.rs:3:9 | LL | #![deny(redundant_semicolon)] diff --git a/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-non-ascii-idents.stderr b/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-non-ascii-idents.stderr index 56925846e95..6c9f0866c01 100644 --- a/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-non-ascii-idents.stderr +++ b/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-non-ascii-idents.stderr @@ -4,7 +4,7 @@ error: identifier contains non-ASCII characters LL | const חלודה: usize = 2; | ^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-non-ascii-idents.rs:2:9 | LL | #![deny(non_ascii_idents)] diff --git a/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.stderr b/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.stderr index 4580d25665e..b270bd1f051 100644 --- a/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.stderr +++ b/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.stderr @@ -4,7 +4,7 @@ error: identifier contains uncommon Unicode codepoints LL | const µ: f64 = 0.000001; | ^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-uncommon-codepoints.rs:2:9 | LL | #![deny(uncommon_codepoints)] diff --git a/src/test/ui/lint/suggestions.stderr b/src/test/ui/lint/suggestions.stderr index e42ee0fa640..4e218ed0f1a 100644 --- a/src/test/ui/lint/suggestions.stderr +++ b/src/test/ui/lint/suggestions.stderr @@ -12,7 +12,7 @@ warning: unnecessary parentheses around assigned value LL | let mut registry_no = (format!("NX-{}", 74205)); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses | -note: lint level defined here +note: the lint level is defined here --> $DIR/suggestions.rs:3:21 | LL | #![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896 @@ -34,7 +34,7 @@ LL | let mut registry_no = (format!("NX-{}", 74205)); | | | help: remove this `mut` | -note: lint level defined here +note: the lint level is defined here --> $DIR/suggestions.rs:3:9 | LL | #![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896 diff --git a/src/test/ui/lint/trivial-casts-featuring-type-ascription.stderr b/src/test/ui/lint/trivial-casts-featuring-type-ascription.stderr index c1a4b393cd6..f7c42acb344 100644 --- a/src/test/ui/lint/trivial-casts-featuring-type-ascription.stderr +++ b/src/test/ui/lint/trivial-casts-featuring-type-ascription.stderr @@ -4,7 +4,7 @@ error: trivial numeric cast: `i32` as `i32` LL | let lugubrious = 12i32 as i32; | ^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/trivial-casts-featuring-type-ascription.rs:1:24 | LL | #![deny(trivial_casts, trivial_numeric_casts)] @@ -17,7 +17,7 @@ error: trivial cast: `&u32` as `*const u32` LL | let _ = haunted as *const u32; | ^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/trivial-casts-featuring-type-ascription.rs:1:9 | LL | #![deny(trivial_casts, trivial_numeric_casts)] diff --git a/src/test/ui/lint/trivial-casts.stderr b/src/test/ui/lint/trivial-casts.stderr index f411db1ab0e..1544f553cee 100644 --- a/src/test/ui/lint/trivial-casts.stderr +++ b/src/test/ui/lint/trivial-casts.stderr @@ -4,7 +4,7 @@ error: trivial numeric cast: `i32` as `i32` LL | let lugubrious = 12i32 as i32; | ^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/trivial-casts.rs:1:24 | LL | #![deny(trivial_casts, trivial_numeric_casts)] @@ -17,7 +17,7 @@ error: trivial cast: `&u32` as `*const u32` LL | let _ = haunted as *const u32; | ^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/trivial-casts.rs:1:9 | LL | #![deny(trivial_casts, trivial_numeric_casts)] diff --git a/src/test/ui/lint/type-overflow.stderr b/src/test/ui/lint/type-overflow.stderr index dabfb876fbb..2432eb78b87 100644 --- a/src/test/ui/lint/type-overflow.stderr +++ b/src/test/ui/lint/type-overflow.stderr @@ -4,7 +4,7 @@ warning: literal out of range for `i8` LL | let error = 255i8; | ^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/type-overflow.rs:2:9 | LL | #![warn(overflowing_literals)] diff --git a/src/test/ui/lint/uninitialized-zeroed.stderr b/src/test/ui/lint/uninitialized-zeroed.stderr index 169e77c8fa0..6d669184deb 100644 --- a/src/test/ui/lint/uninitialized-zeroed.stderr +++ b/src/test/ui/lint/uninitialized-zeroed.stderr @@ -7,7 +7,7 @@ LL | let _val: &'static T = mem::zeroed(); | this code causes undefined behavior when executed | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done | -note: lint level defined here +note: the lint level is defined here --> $DIR/uninitialized-zeroed.rs:7:9 | LL | #![deny(invalid_value)] diff --git a/src/test/ui/lint/unreachable_pub-pub_crate.stderr b/src/test/ui/lint/unreachable_pub-pub_crate.stderr index da21c2ac4ab..abe07b1c649 100644 --- a/src/test/ui/lint/unreachable_pub-pub_crate.stderr +++ b/src/test/ui/lint/unreachable_pub-pub_crate.stderr @@ -6,7 +6,7 @@ LL | pub use std::fmt; | | | help: consider restricting its visibility: `pub(crate)` | -note: lint level defined here +note: the lint level is defined here --> $DIR/unreachable_pub-pub_crate.rs:10:9 | LL | #![warn(unreachable_pub)] diff --git a/src/test/ui/lint/unreachable_pub.stderr b/src/test/ui/lint/unreachable_pub.stderr index 2cb27a770ed..6144d5bb657 100644 --- a/src/test/ui/lint/unreachable_pub.stderr +++ b/src/test/ui/lint/unreachable_pub.stderr @@ -6,7 +6,7 @@ LL | pub use std::fmt; | | | help: consider restricting its visibility: `crate` | -note: lint level defined here +note: the lint level is defined here --> $DIR/unreachable_pub.rs:6:9 | LL | #![warn(unreachable_pub)] diff --git a/src/test/ui/lint/unused_import_warning_issue_45268.stderr b/src/test/ui/lint/unused_import_warning_issue_45268.stderr index 7392e99f7ae..1d6338572f3 100644 --- a/src/test/ui/lint/unused_import_warning_issue_45268.stderr +++ b/src/test/ui/lint/unused_import_warning_issue_45268.stderr @@ -4,7 +4,7 @@ warning: unused import: `test::Unused` LL | use test::Unused; // This is really unused, so warning is OK | ^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused_import_warning_issue_45268.rs:3:9 | LL | #![warn(unused_imports)] // Warning explanation here, it's OK diff --git a/src/test/ui/lint/unused_labels.stderr b/src/test/ui/lint/unused_labels.stderr index 08f8548e049..809aad24688 100644 --- a/src/test/ui/lint/unused_labels.stderr +++ b/src/test/ui/lint/unused_labels.stderr @@ -4,7 +4,7 @@ warning: unused label LL | 'unused_while_label: while 0 == 0 { | ^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused_labels.rs:8:9 | LL | #![warn(unused_labels)] diff --git a/src/test/ui/lint/unused_parens_json_suggestion.stderr b/src/test/ui/lint/unused_parens_json_suggestion.stderr index c503c100808..09f0fc90032 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.stderr +++ b/src/test/ui/lint/unused_parens_json_suggestion.stderr @@ -4,7 +4,7 @@ LL | let _a = (1 / (2 + 3)); | ^^^^^^^^^^^^^ help: remove these parentheses | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused_parens_json_suggestion.rs:10:9 | LL | #![deny(unused_parens)] diff --git a/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr b/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr index 873f105435e..c3bf77a3a6f 100644 --- a/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr +++ b/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr @@ -4,7 +4,7 @@ LL | if (_b) { | ^^^^ help: remove these parentheses | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused_parens_remove_json_suggestion.rs:10:9 | LL | #![deny(unused_parens)] diff --git a/src/test/ui/lint/use-redundant.stderr b/src/test/ui/lint/use-redundant.stderr index fbd9f81f18f..85a5cce4dd0 100644 --- a/src/test/ui/lint/use-redundant.stderr +++ b/src/test/ui/lint/use-redundant.stderr @@ -4,7 +4,7 @@ warning: unused import: `m1::*` LL | use m1::*; | ^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/use-redundant.rs:2:9 | LL | #![warn(unused_imports)] diff --git a/src/test/ui/lint/warn-unused-inline-on-fn-prototypes.stderr b/src/test/ui/lint/warn-unused-inline-on-fn-prototypes.stderr index 006cc6c80a6..843db8ce815 100644 --- a/src/test/ui/lint/warn-unused-inline-on-fn-prototypes.stderr +++ b/src/test/ui/lint/warn-unused-inline-on-fn-prototypes.stderr @@ -4,7 +4,7 @@ error: `#[inline]` is ignored on function prototypes LL | #[inline] | ^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/warn-unused-inline-on-fn-prototypes.rs:1:9 | LL | #![deny(unused_attributes)] diff --git a/src/test/ui/liveness/liveness-dead.stderr b/src/test/ui/liveness/liveness-dead.stderr index d054b1d497e..12680ab1156 100644 --- a/src/test/ui/liveness/liveness-dead.stderr +++ b/src/test/ui/liveness/liveness-dead.stderr @@ -4,7 +4,7 @@ error: value assigned to `x` is never read LL | let mut x: isize = 3; | ^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/liveness-dead.rs:2:9 | LL | #![deny(unused_assignments)] diff --git a/src/test/ui/liveness/liveness-unused.stderr b/src/test/ui/liveness/liveness-unused.stderr index 6ea20081e50..7adb6a3295b 100644 --- a/src/test/ui/liveness/liveness-unused.stderr +++ b/src/test/ui/liveness/liveness-unused.stderr @@ -6,7 +6,7 @@ LL | continue; LL | drop(*x as i32); | ^^^^^^^^^^^^^^^^ unreachable statement | -note: lint level defined here +note: the lint level is defined here --> $DIR/liveness-unused.rs:1:9 | LL | #![warn(unused)] @@ -19,7 +19,7 @@ error: unused variable: `x` LL | fn f1(x: isize) { | ^ help: consider prefixing with an underscore: `_x` | -note: lint level defined here +note: the lint level is defined here --> $DIR/liveness-unused.rs:2:9 | LL | #![deny(unused_variables)] @@ -57,7 +57,7 @@ error: value assigned to `x` is never read LL | x += 4; | ^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/liveness-unused.rs:3:9 | LL | #![deny(unused_assignments)] diff --git a/src/test/ui/macros/issue-61053-different-kleene.stderr b/src/test/ui/macros/issue-61053-different-kleene.stderr index 86474822a0c..aa8bac13b61 100644 --- a/src/test/ui/macros/issue-61053-different-kleene.stderr +++ b/src/test/ui/macros/issue-61053-different-kleene.stderr @@ -4,7 +4,7 @@ error: meta-variable repeats with different Kleene operator LL | ( $( $i:ident = $($j:ident),+ );* ) => { $( $( $i = $j; )* )* }; | - expected repetition ^^ - conflicting repetition | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-61053-different-kleene.rs:1:9 | LL | #![deny(meta_variable_misuse)] diff --git a/src/test/ui/macros/issue-61053-duplicate-binder.stderr b/src/test/ui/macros/issue-61053-duplicate-binder.stderr index fbd67b6c1e9..5a2af45d077 100644 --- a/src/test/ui/macros/issue-61053-duplicate-binder.stderr +++ b/src/test/ui/macros/issue-61053-duplicate-binder.stderr @@ -6,7 +6,7 @@ LL | ($x:tt $x:tt) => { $x }; | | | previous declaration | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-61053-duplicate-binder.rs:1:9 | LL | #![deny(meta_variable_misuse)] diff --git a/src/test/ui/macros/issue-61053-missing-repetition.stderr b/src/test/ui/macros/issue-61053-missing-repetition.stderr index 6f89e276c16..738f711f04e 100644 --- a/src/test/ui/macros/issue-61053-missing-repetition.stderr +++ b/src/test/ui/macros/issue-61053-missing-repetition.stderr @@ -6,7 +6,7 @@ LL | ($( $i:ident = $($j:ident),+ );*) => { $( $i = $j; )* }; | | | expected repetition | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-61053-missing-repetition.rs:1:9 | LL | #![deny(meta_variable_misuse)] diff --git a/src/test/ui/macros/issue-61053-unbound.stderr b/src/test/ui/macros/issue-61053-unbound.stderr index 0fc0a7e283e..0d64effc967 100644 --- a/src/test/ui/macros/issue-61053-unbound.stderr +++ b/src/test/ui/macros/issue-61053-unbound.stderr @@ -4,7 +4,7 @@ error: unknown macro variable `k` LL | ($( $i:ident = $($j:ident),+ );*) => { $( $( $i = $k; )+ )* }; | ^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-61053-unbound.rs:1:9 | LL | #![deny(meta_variable_misuse)] diff --git a/src/test/ui/macros/macro-use-all-and-none.stderr b/src/test/ui/macros/macro-use-all-and-none.stderr index e7de7e7ad08..cbabf0672fa 100644 --- a/src/test/ui/macros/macro-use-all-and-none.stderr +++ b/src/test/ui/macros/macro-use-all-and-none.stderr @@ -4,7 +4,7 @@ warning: unused attribute LL | #[macro_use()] | ^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/macro-use-all-and-none.rs:4:9 | LL | #![warn(unused_attributes)] diff --git a/src/test/ui/match/match-no-arms-unreachable-after.stderr b/src/test/ui/match/match-no-arms-unreachable-after.stderr index 66e5c91ad20..a0a3697266d 100644 --- a/src/test/ui/match/match-no-arms-unreachable-after.stderr +++ b/src/test/ui/match/match-no-arms-unreachable-after.stderr @@ -6,7 +6,7 @@ LL | match v { } LL | let x = 2; | ^^^^^^^^^^ unreachable statement | -note: lint level defined here +note: the lint level is defined here --> $DIR/match-no-arms-unreachable-after.rs:2:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/methods/method-call-lifetime-args-lint-fail.stderr b/src/test/ui/methods/method-call-lifetime-args-lint-fail.stderr index b510a08ae37..9e07d5ea31e 100644 --- a/src/test/ui/methods/method-call-lifetime-args-lint-fail.stderr +++ b/src/test/ui/methods/method-call-lifetime-args-lint-fail.stderr @@ -7,7 +7,7 @@ LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {} LL | S.late::<'static>(&0, &0); | ^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/method-call-lifetime-args-lint-fail.rs:1:9 | LL | #![deny(late_bound_lifetime_arguments)] diff --git a/src/test/ui/methods/method-call-lifetime-args-lint.stderr b/src/test/ui/methods/method-call-lifetime-args-lint.stderr index eb1d4fe2e50..f31f510a3a7 100644 --- a/src/test/ui/methods/method-call-lifetime-args-lint.stderr +++ b/src/test/ui/methods/method-call-lifetime-args-lint.stderr @@ -7,7 +7,7 @@ LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {} LL | S.late::<'static>(&0, &0); | ^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/method-call-lifetime-args-lint.rs:1:9 | LL | #![deny(late_bound_lifetime_arguments)] diff --git a/src/test/ui/missing_debug_impls.stderr b/src/test/ui/missing_debug_impls.stderr index b9530587787..5f8adb791f6 100644 --- a/src/test/ui/missing_debug_impls.stderr +++ b/src/test/ui/missing_debug_impls.stderr @@ -4,7 +4,7 @@ error: type does not implement `fmt::Debug`; consider adding `#[derive(Debug)]` LL | pub enum A {} | ^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/missing_debug_impls.rs:2:9 | LL | #![deny(missing_debug_implementations)] diff --git a/src/test/ui/never_type/never-assign-dead-code.stderr b/src/test/ui/never_type/never-assign-dead-code.stderr index 1860150fa8b..f0a11ae1bcc 100644 --- a/src/test/ui/never_type/never-assign-dead-code.stderr +++ b/src/test/ui/never_type/never-assign-dead-code.stderr @@ -6,7 +6,7 @@ LL | let x: ! = panic!("aah"); LL | drop(x); | ^^^^^^^^ unreachable statement | -note: lint level defined here +note: the lint level is defined here --> $DIR/never-assign-dead-code.rs:6:9 | LL | #![warn(unused)] @@ -28,7 +28,7 @@ warning: unused variable: `x` LL | let x: ! = panic!("aah"); | ^ help: consider prefixing with an underscore: `_x` | -note: lint level defined here +note: the lint level is defined here --> $DIR/never-assign-dead-code.rs:6:9 | LL | #![warn(unused)] diff --git a/src/test/ui/nll/capture-mut-ref.stderr b/src/test/ui/nll/capture-mut-ref.stderr index 883b2d05a7f..95d8e874a68 100644 --- a/src/test/ui/nll/capture-mut-ref.stderr +++ b/src/test/ui/nll/capture-mut-ref.stderr @@ -6,7 +6,7 @@ LL | let mut x = &mut 0; | | | help: remove this `mut` | -note: lint level defined here +note: the lint level is defined here --> $DIR/capture-mut-ref.rs:4:9 | LL | #![deny(unused_mut)] diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr index 708e50de570..f5723ba5da5 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr @@ -19,7 +19,7 @@ error[E0521]: borrowed data escapes outside of closure LL | foo(cell, |cell_a, cell_x| { | ------ ------ `cell_x` is a reference that is only valid in the closure body | | - | `cell_a` is declared here, outside of the closure body + | `cell_a` declared here, outside of the closure body LL | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure | ^^^^^^^^^^^^^^^^^^^^^^^^ `cell_x` escapes the closure body here diff --git a/src/test/ui/nll/issue-61424.stderr b/src/test/ui/nll/issue-61424.stderr index ae336b2fe1c..41dd7254d75 100644 --- a/src/test/ui/nll/issue-61424.stderr +++ b/src/test/ui/nll/issue-61424.stderr @@ -6,7 +6,7 @@ LL | let mut x; | | | help: remove this `mut` | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-61424.rs:1:9 | LL | #![deny(unused_mut)] diff --git a/src/test/ui/nll/outlives-suggestion-simple.stderr b/src/test/ui/nll/outlives-suggestion-simple.stderr index f7603e29d48..db7f57ceccf 100644 --- a/src/test/ui/nll/outlives-suggestion-simple.stderr +++ b/src/test/ui/nll/outlives-suggestion-simple.stderr @@ -99,7 +99,7 @@ error[E0521]: borrowed data escapes outside of function LL | fn get_bar(&self) -> Bar2 { | ----- | | - | `self` is declared here, outside of the function body + | `self` declared here, outside of the function body | `self` is a reference that is only valid in the function body LL | Bar2::new(&self) | ^^^^^^^^^^^^^^^^ `self` escapes the function body here diff --git a/src/test/ui/nll/unused-mut-issue-50343.stderr b/src/test/ui/nll/unused-mut-issue-50343.stderr index 261d678db67..c86981a8dff 100644 --- a/src/test/ui/nll/unused-mut-issue-50343.stderr +++ b/src/test/ui/nll/unused-mut-issue-50343.stderr @@ -6,7 +6,7 @@ LL | vec![(42, 22)].iter().map(|(mut x, _y)| ()).count(); | | | help: remove this `mut` | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused-mut-issue-50343.rs:1:9 | LL | #![deny(unused_mut)] diff --git a/src/test/ui/no-patterns-in-args-2.stderr b/src/test/ui/no-patterns-in-args-2.stderr index ec7d2d9f0d1..905a89af4e5 100644 --- a/src/test/ui/no-patterns-in-args-2.stderr +++ b/src/test/ui/no-patterns-in-args-2.stderr @@ -10,7 +10,7 @@ error: patterns aren't allowed in methods without bodies LL | fn f1(mut arg: u8); | ^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/no-patterns-in-args-2.rs:1:9 | LL | #![deny(patterns_in_fns_without_body)] diff --git a/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr b/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr index 87f69a484bb..7f7bb929a0d 100644 --- a/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr +++ b/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | (1,) => {} | ^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/exhaustiveness-unreachable-pattern.rs:4:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/panic-handler/panic-handler-duplicate.stderr b/src/test/ui/panic-handler/panic-handler-duplicate.stderr index 9999e327646..8603ef91bef 100644 --- a/src/test/ui/panic-handler/panic-handler-duplicate.stderr +++ b/src/test/ui/panic-handler/panic-handler-duplicate.stderr @@ -6,7 +6,7 @@ LL | | loop {} LL | | } | |_^ | -note: first defined here +note: the lang item is first defined here --> $DIR/panic-handler-duplicate.rs:10:1 | LL | / fn panic(info: &PanicInfo) -> ! { diff --git a/src/test/ui/panic-handler/panic-handler-std.stderr b/src/test/ui/panic-handler/panic-handler-std.stderr index ac56513fd47..f71c28e5aa6 100644 --- a/src/test/ui/panic-handler/panic-handler-std.stderr +++ b/src/test/ui/panic-handler/panic-handler-std.stderr @@ -6,7 +6,7 @@ LL | | loop {} LL | | } | |_^ | - = note: first defined in crate `std` (which `panic_handler_std` depends on) + = note: the lang item is first defined in crate `std` (which `panic_handler_std` depends on) error: argument should be `&PanicInfo` --> $DIR/panic-handler-std.rs:7:16 diff --git a/src/test/ui/parser/doc-comment-in-stmt.rs b/src/test/ui/parser/doc-comment-in-stmt.rs new file mode 100644 index 00000000000..b02df13213f --- /dev/null +++ b/src/test/ui/parser/doc-comment-in-stmt.rs @@ -0,0 +1,20 @@ +fn foo() -> bool { + false + //!self.allow_ty_infer() + //~^ ERROR found doc comment +} + +fn bar() -> bool { + false + /*! bar */ //~ ERROR found doc comment +} + +fn baz() -> i32 { + 1 /** baz */ //~ ERROR found doc comment +} + +fn quux() -> i32 { + 2 /*! quux */ //~ ERROR found doc comment +} + +fn main() {} diff --git a/src/test/ui/parser/doc-comment-in-stmt.stderr b/src/test/ui/parser/doc-comment-in-stmt.stderr new file mode 100644 index 00000000000..5d94d6fe69b --- /dev/null +++ b/src/test/ui/parser/doc-comment-in-stmt.stderr @@ -0,0 +1,50 @@ +error: expected one of `.`, `;`, `?`, `}`, or an operator, found doc comment `//!self.allow_ty_infer()` + --> $DIR/doc-comment-in-stmt.rs:3:5 + | +LL | false + | - expected one of `.`, `;`, `?`, `}`, or an operator +LL | //!self.allow_ty_infer() + | ^^^^^^^^^^^^^^^^^^^^^^^^ unexpected token + | +help: add a space before `!` to use a regular comment + | +LL | // !self.allow_ty_infer() + | ^^^^ + +error: expected one of `.`, `;`, `?`, `}`, or an operator, found doc comment `/*! bar */` + --> $DIR/doc-comment-in-stmt.rs:9:5 + | +LL | false + | - expected one of `.`, `;`, `?`, `}`, or an operator +LL | /*! bar */ + | ^^^^^^^^^^ unexpected token + | +help: add a space before `!` to use a regular comment + | +LL | /* ! bar */ + | ^^^^ + +error: expected one of `.`, `;`, `?`, `}`, or an operator, found doc comment `/** baz */` + --> $DIR/doc-comment-in-stmt.rs:13:7 + | +LL | 1 /** baz */ + | ^^^^^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator + | +help: add a space before `*` to use a regular comment + | +LL | 1 /* * baz */ + | ^^^^ + +error: expected one of `.`, `;`, `?`, `}`, or an operator, found doc comment `/*! quux */` + --> $DIR/doc-comment-in-stmt.rs:17:7 + | +LL | 2 /*! quux */ + | ^^^^^^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator + | +help: add a space before `!` to use a regular comment + | +LL | 2 /* ! quux */ + | ^^^^ + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/parser/recover-range-pats.stderr b/src/test/ui/parser/recover-range-pats.stderr index f43f9bf3012..50bfbcec247 100644 --- a/src/test/ui/parser/recover-range-pats.stderr +++ b/src/test/ui/parser/recover-range-pats.stderr @@ -195,7 +195,7 @@ error: `...` range patterns are deprecated LL | if let 0...3 = 0 {} | ^^^ help: use `..=` for an inclusive range | -note: lint level defined here +note: the lint level is defined here --> $DIR/recover-range-pats.rs:8:9 | LL | #![deny(ellipsis_inclusive_range_patterns)] diff --git a/src/test/ui/path-lookahead.stderr b/src/test/ui/path-lookahead.stderr index caf9e8303ea..62b3b507e1d 100644 --- a/src/test/ui/path-lookahead.stderr +++ b/src/test/ui/path-lookahead.stderr @@ -4,7 +4,7 @@ warning: unnecessary parentheses around `return` value LL | return (<T as ToString>::to_string(&arg)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses | -note: lint level defined here +note: the lint level is defined here --> $DIR/path-lookahead.rs:3:9 | LL | #![warn(unused_parens)] diff --git a/src/test/ui/pattern/deny-irrefutable-let-patterns.stderr b/src/test/ui/pattern/deny-irrefutable-let-patterns.stderr index b32cf8cbb0e..308a6c7c58e 100644 --- a/src/test/ui/pattern/deny-irrefutable-let-patterns.stderr +++ b/src/test/ui/pattern/deny-irrefutable-let-patterns.stderr @@ -4,7 +4,7 @@ error: irrefutable if-let pattern LL | if let _ = 5 {} | ^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/deny-irrefutable-let-patterns.rs:1:9 | LL | #![deny(irrefutable_let_patterns)] diff --git a/src/test/ui/pattern/usefulness/exhaustive_integer_patterns.stderr b/src/test/ui/pattern/usefulness/exhaustive_integer_patterns.stderr index 0fbeb981ea0..5866df5cb1d 100644 --- a/src/test/ui/pattern/usefulness/exhaustive_integer_patterns.stderr +++ b/src/test/ui/pattern/usefulness/exhaustive_integer_patterns.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | 200 => {} | ^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/exhaustive_integer_patterns.rs:3:9 | LL | #![deny(unreachable_patterns)] @@ -88,7 +88,7 @@ LL | 0 .. 2 => {} LL | 1 ..= 2 => {} | ^^^^^^^ overlapping patterns | -note: lint level defined here +note: the lint level is defined here --> $DIR/exhaustive_integer_patterns.rs:4:9 | LL | #![deny(overlapping_patterns)] diff --git a/src/test/ui/pattern/usefulness/issue-43253.stderr b/src/test/ui/pattern/usefulness/issue-43253.stderr index cb4a0486eef..cdd3067a678 100644 --- a/src/test/ui/pattern/usefulness/issue-43253.stderr +++ b/src/test/ui/pattern/usefulness/issue-43253.stderr @@ -6,7 +6,7 @@ LL | 1..10 => {}, LL | 9..=10 => {}, | ^^^^^^ overlapping patterns | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-43253.rs:4:9 | LL | #![warn(overlapping_patterns)] @@ -18,7 +18,7 @@ warning: unreachable pattern LL | 9 => {}, | ^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-43253.rs:3:9 | LL | #![warn(unreachable_patterns)] diff --git a/src/test/ui/pattern/usefulness/match-arm-statics.stderr b/src/test/ui/pattern/usefulness/match-arm-statics.stderr index 3d9e900a4e9..a5dffebf699 100644 --- a/src/test/ui/pattern/usefulness/match-arm-statics.stderr +++ b/src/test/ui/pattern/usefulness/match-arm-statics.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | (true, true) => () | ^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/match-arm-statics.rs:2:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/pattern/usefulness/match-byte-array-patterns.stderr b/src/test/ui/pattern/usefulness/match-byte-array-patterns.stderr index 09484692fab..0c582be8df8 100644 --- a/src/test/ui/pattern/usefulness/match-byte-array-patterns.stderr +++ b/src/test/ui/pattern/usefulness/match-byte-array-patterns.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | &[0x41, 0x41, 0x41, 0x41] => {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/match-byte-array-patterns.rs:1:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/pattern/usefulness/match-empty-exhaustive_patterns.stderr b/src/test/ui/pattern/usefulness/match-empty-exhaustive_patterns.stderr index f242ecf2dae..49c38d2a9d3 100644 --- a/src/test/ui/pattern/usefulness/match-empty-exhaustive_patterns.stderr +++ b/src/test/ui/pattern/usefulness/match-empty-exhaustive_patterns.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | _ => {}, | ^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/match-empty-exhaustive_patterns.rs:3:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/pattern/usefulness/match-range-fail-dominate.stderr b/src/test/ui/pattern/usefulness/match-range-fail-dominate.stderr index 8412a113664..76a6d1d3eaa 100644 --- a/src/test/ui/pattern/usefulness/match-range-fail-dominate.stderr +++ b/src/test/ui/pattern/usefulness/match-range-fail-dominate.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | 5 ..= 6 => { } | ^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/match-range-fail-dominate.rs:1:9 | LL | #![deny(unreachable_patterns, overlapping_patterns)] diff --git a/src/test/ui/pattern/usefulness/match-ref-ice.stderr b/src/test/ui/pattern/usefulness/match-ref-ice.stderr index c4bfa0afcc2..fad0940baa4 100644 --- a/src/test/ui/pattern/usefulness/match-ref-ice.stderr +++ b/src/test/ui/pattern/usefulness/match-ref-ice.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | [1, 2, 3] => (), | ^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/match-ref-ice.rs:1:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/pattern/usefulness/match-vec-fixed.stderr b/src/test/ui/pattern/usefulness/match-vec-fixed.stderr index ae2dd87b695..e388a06cb9a 100644 --- a/src/test/ui/pattern/usefulness/match-vec-fixed.stderr +++ b/src/test/ui/pattern/usefulness/match-vec-fixed.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | [_, _, _] => {} | ^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/match-vec-fixed.rs:1:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/pattern/usefulness/match-vec-unreachable.stderr b/src/test/ui/pattern/usefulness/match-vec-unreachable.stderr index e9a751074c2..672fd92fb5e 100644 --- a/src/test/ui/pattern/usefulness/match-vec-unreachable.stderr +++ b/src/test/ui/pattern/usefulness/match-vec-unreachable.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | [(1, 2), (2, 3), b] => (), | ^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/match-vec-unreachable.rs:1:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/pattern/usefulness/slice-pattern-const-2.stderr b/src/test/ui/pattern/usefulness/slice-pattern-const-2.stderr index 0c7401269df..cd0cb2e8876 100644 --- a/src/test/ui/pattern/usefulness/slice-pattern-const-2.stderr +++ b/src/test/ui/pattern/usefulness/slice-pattern-const-2.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | FOO => (), | ^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/slice-pattern-const-2.rs:1:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/pattern/usefulness/slice-pattern-const-3.stderr b/src/test/ui/pattern/usefulness/slice-pattern-const-3.stderr index eab4fc3f086..3ba01b9eba3 100644 --- a/src/test/ui/pattern/usefulness/slice-pattern-const-3.stderr +++ b/src/test/ui/pattern/usefulness/slice-pattern-const-3.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | FOO => (), | ^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/slice-pattern-const-3.rs:1:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/pattern/usefulness/slice-pattern-const.stderr b/src/test/ui/pattern/usefulness/slice-pattern-const.stderr index d274d6d7c67..1fffb9fedbf 100644 --- a/src/test/ui/pattern/usefulness/slice-pattern-const.stderr +++ b/src/test/ui/pattern/usefulness/slice-pattern-const.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | [84, 69, 83, 84] => (), | ^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/slice-pattern-const.rs:1:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/pattern/usefulness/slice-patterns-reachability.stderr b/src/test/ui/pattern/usefulness/slice-patterns-reachability.stderr index e24d1028117..607ffb76595 100644 --- a/src/test/ui/pattern/usefulness/slice-patterns-reachability.stderr +++ b/src/test/ui/pattern/usefulness/slice-patterns-reachability.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | [true, ..] => {} | ^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/slice-patterns-reachability.rs:1:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/pattern/usefulness/struct-pattern-match-useless.stderr b/src/test/ui/pattern/usefulness/struct-pattern-match-useless.stderr index 0115fc081a9..fbee33de6f3 100644 --- a/src/test/ui/pattern/usefulness/struct-pattern-match-useless.stderr +++ b/src/test/ui/pattern/usefulness/struct-pattern-match-useless.stderr @@ -6,7 +6,7 @@ LL | Foo { x: _x, y: _y } => (), LL | Foo { .. } => () | ^^^^^^^^^^ unreachable pattern | -note: lint level defined here +note: the lint level is defined here --> $DIR/struct-pattern-match-useless.rs:1:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/pattern/usefulness/top-level-alternation.stderr b/src/test/ui/pattern/usefulness/top-level-alternation.stderr index 7c7c4fc4eba..76bc4f8d091 100644 --- a/src/test/ui/pattern/usefulness/top-level-alternation.stderr +++ b/src/test/ui/pattern/usefulness/top-level-alternation.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | while let 0..=2 | 1 = 0 {} | ^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/top-level-alternation.rs:1:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/privacy/private-in-public-non-principal.stderr b/src/test/ui/privacy/private-in-public-non-principal.stderr index 4f2a5ea45aa..2a41fae43c6 100644 --- a/src/test/ui/privacy/private-in-public-non-principal.stderr +++ b/src/test/ui/privacy/private-in-public-non-principal.stderr @@ -14,7 +14,7 @@ error: missing documentation for a method LL | pub fn check_doc_lint() {} | ^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/private-in-public-non-principal.rs:10:8 | LL | #[deny(missing_docs)] diff --git a/src/test/ui/privacy/private-in-public-warn.stderr b/src/test/ui/privacy/private-in-public-warn.stderr index 40aa47a7246..079331bffd2 100644 --- a/src/test/ui/privacy/private-in-public-warn.stderr +++ b/src/test/ui/privacy/private-in-public-warn.stderr @@ -4,7 +4,7 @@ error: private type `types::Priv` in public interface (error E0446) LL | pub type Alias = Priv; | ^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/private-in-public-warn.rs:5:9 | LL | #![deny(private_in_public)] diff --git a/src/test/ui/privacy/pub-priv-dep/pub-priv1.stderr b/src/test/ui/privacy/pub-priv-dep/pub-priv1.stderr index f21b11f5b32..010969c03af 100644 --- a/src/test/ui/privacy/pub-priv-dep/pub-priv1.stderr +++ b/src/test/ui/privacy/pub-priv-dep/pub-priv1.stderr @@ -4,7 +4,7 @@ error: type `priv_dep::OtherType` from private dependency 'priv_dep' in public i LL | pub field: OtherType, | ^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/pub-priv1.rs:3:9 | LL | #![deny(exported_private_dependencies)] diff --git a/src/test/ui/proc-macro/attributes-included.stderr b/src/test/ui/proc-macro/attributes-included.stderr index 0f74f45e102..27a215de032 100644 --- a/src/test/ui/proc-macro/attributes-included.stderr +++ b/src/test/ui/proc-macro/attributes-included.stderr @@ -4,7 +4,7 @@ warning: unused variable: `a` LL | let a: i32 = "foo"; | ^ help: consider prefixing with an underscore: `_a` | -note: lint level defined here +note: the lint level is defined here --> $DIR/attributes-included.rs:4:9 | LL | #![warn(unused)] diff --git a/src/test/ui/proc-macro/no-macro-use-attr.stderr b/src/test/ui/proc-macro/no-macro-use-attr.stderr index 50552ea7dbb..27943a3f7bf 100644 --- a/src/test/ui/proc-macro/no-macro-use-attr.stderr +++ b/src/test/ui/proc-macro/no-macro-use-attr.stderr @@ -4,7 +4,7 @@ warning: unused extern crate LL | extern crate test_macros; | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it | -note: lint level defined here +note: the lint level is defined here --> $DIR/no-macro-use-attr.rs:4:9 | LL | #![warn(unused_extern_crates)] diff --git a/src/test/ui/range/range-inclusive-pattern-precedence.stderr b/src/test/ui/range/range-inclusive-pattern-precedence.stderr index fb0cf380154..8c4ebd10fc9 100644 --- a/src/test/ui/range/range-inclusive-pattern-precedence.stderr +++ b/src/test/ui/range/range-inclusive-pattern-precedence.stderr @@ -16,7 +16,7 @@ warning: `...` range patterns are deprecated LL | &0...9 => {} | ^^^^^^ help: use `..=` for an inclusive range: `&(0..=9)` | -note: lint level defined here +note: the lint level is defined here --> $DIR/range-inclusive-pattern-precedence.rs:9:9 | LL | #![warn(ellipsis_inclusive_range_patterns)] diff --git a/src/test/ui/reachable/expr_add.stderr b/src/test/ui/reachable/expr_add.stderr index 880dea1cc35..692bd20f509 100644 --- a/src/test/ui/reachable/expr_add.stderr +++ b/src/test/ui/reachable/expr_add.stderr @@ -7,7 +7,7 @@ LL | let x = Foo + return; | | any code following this expression is unreachable | unreachable expression | -note: lint level defined here +note: the lint level is defined here --> $DIR/expr_add.rs:3:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_again.stderr b/src/test/ui/reachable/expr_again.stderr index 95006884242..a9b5832ba2c 100644 --- a/src/test/ui/reachable/expr_again.stderr +++ b/src/test/ui/reachable/expr_again.stderr @@ -6,7 +6,7 @@ LL | continue; LL | println!("hi"); | ^^^^^^^^^^^^^^^ unreachable statement | -note: lint level defined here +note: the lint level is defined here --> $DIR/expr_again.rs:3:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_array.stderr b/src/test/ui/reachable/expr_array.stderr index b3138d3c33f..e144d7184af 100644 --- a/src/test/ui/reachable/expr_array.stderr +++ b/src/test/ui/reachable/expr_array.stderr @@ -6,7 +6,7 @@ LL | let x: [usize; 2] = [return, 22]; | | | any code following this expression is unreachable | -note: lint level defined here +note: the lint level is defined here --> $DIR/expr_array.rs:4:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_assign.stderr b/src/test/ui/reachable/expr_assign.stderr index 3004da04063..c51156b3f40 100644 --- a/src/test/ui/reachable/expr_assign.stderr +++ b/src/test/ui/reachable/expr_assign.stderr @@ -7,7 +7,7 @@ LL | x = return; | | any code following this expression is unreachable | unreachable expression | -note: lint level defined here +note: the lint level is defined here --> $DIR/expr_assign.rs:5:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_block.stderr b/src/test/ui/reachable/expr_block.stderr index 44baddd1e55..8b696b7abcb 100644 --- a/src/test/ui/reachable/expr_block.stderr +++ b/src/test/ui/reachable/expr_block.stderr @@ -6,7 +6,7 @@ LL | return; LL | 22 | ^^ unreachable expression | -note: lint level defined here +note: the lint level is defined here --> $DIR/expr_block.rs:4:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_box.stderr b/src/test/ui/reachable/expr_box.stderr index b01a13e9df2..ea6472cbeab 100644 --- a/src/test/ui/reachable/expr_box.stderr +++ b/src/test/ui/reachable/expr_box.stderr @@ -7,7 +7,7 @@ LL | let x = box return; | | any code following this expression is unreachable | unreachable expression | -note: lint level defined here +note: the lint level is defined here --> $DIR/expr_box.rs:3:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_call.stderr b/src/test/ui/reachable/expr_call.stderr index ae8b4dd87b5..a5ad9a329f0 100644 --- a/src/test/ui/reachable/expr_call.stderr +++ b/src/test/ui/reachable/expr_call.stderr @@ -6,7 +6,7 @@ LL | foo(return, 22); | | | any code following this expression is unreachable | -note: lint level defined here +note: the lint level is defined here --> $DIR/expr_call.rs:5:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_cast.stderr b/src/test/ui/reachable/expr_cast.stderr index 81813d1d71c..3aa15bde995 100644 --- a/src/test/ui/reachable/expr_cast.stderr +++ b/src/test/ui/reachable/expr_cast.stderr @@ -7,7 +7,7 @@ LL | let x = {return} as !; | |any code following this expression is unreachable | unreachable expression | -note: lint level defined here +note: the lint level is defined here --> $DIR/expr_cast.rs:4:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_if.stderr b/src/test/ui/reachable/expr_if.stderr index ccd45ccec62..6ae635ae4b7 100644 --- a/src/test/ui/reachable/expr_if.stderr +++ b/src/test/ui/reachable/expr_if.stderr @@ -9,7 +9,7 @@ LL | | println!("Hello, world!"); LL | | } | |_____^ unreachable block in `if` expression | -note: lint level defined here +note: the lint level is defined here --> $DIR/expr_if.rs:4:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_loop.stderr b/src/test/ui/reachable/expr_loop.stderr index 5f279c9630d..e5d395254a0 100644 --- a/src/test/ui/reachable/expr_loop.stderr +++ b/src/test/ui/reachable/expr_loop.stderr @@ -6,7 +6,7 @@ LL | loop { return; } LL | println!("I am dead."); | ^^^^^^^^^^^^^^^^^^^^^^^ unreachable statement | -note: lint level defined here +note: the lint level is defined here --> $DIR/expr_loop.rs:4:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_match.stderr b/src/test/ui/reachable/expr_match.stderr index d39acdc2909..a8317192c2b 100644 --- a/src/test/ui/reachable/expr_match.stderr +++ b/src/test/ui/reachable/expr_match.stderr @@ -6,7 +6,7 @@ LL | match () { () => return } LL | println!("I am dead"); | ^^^^^^^^^^^^^^^^^^^^^^ unreachable statement | -note: lint level defined here +note: the lint level is defined here --> $DIR/expr_match.rs:4:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_method.stderr b/src/test/ui/reachable/expr_method.stderr index 82a0745f062..41c3b8a3906 100644 --- a/src/test/ui/reachable/expr_method.stderr +++ b/src/test/ui/reachable/expr_method.stderr @@ -6,7 +6,7 @@ LL | Foo.foo(return, 22); | | | any code following this expression is unreachable | -note: lint level defined here +note: the lint level is defined here --> $DIR/expr_method.rs:5:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_repeat.stderr b/src/test/ui/reachable/expr_repeat.stderr index 34129936fd7..defa8704610 100644 --- a/src/test/ui/reachable/expr_repeat.stderr +++ b/src/test/ui/reachable/expr_repeat.stderr @@ -7,7 +7,7 @@ LL | let x: [usize; 2] = [return; 2]; | |any code following this expression is unreachable | unreachable expression | -note: lint level defined here +note: the lint level is defined here --> $DIR/expr_repeat.rs:4:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_return.stderr b/src/test/ui/reachable/expr_return.stderr index c0a94746d08..e1bef80aeb0 100644 --- a/src/test/ui/reachable/expr_return.stderr +++ b/src/test/ui/reachable/expr_return.stderr @@ -7,7 +7,7 @@ LL | let x = {return {return {return;}}}; | | any code following this expression is unreachable | unreachable expression | -note: lint level defined here +note: the lint level is defined here --> $DIR/expr_return.rs:4:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_return_in_macro.stderr b/src/test/ui/reachable/expr_return_in_macro.stderr index 2bc6a763cfa..3c562a7ee6f 100644 --- a/src/test/ui/reachable/expr_return_in_macro.stderr +++ b/src/test/ui/reachable/expr_return_in_macro.stderr @@ -7,7 +7,7 @@ LL | return () LL | return early_return!(); | ^^^^^^^^^^^^^^^^^^^^^^ unreachable expression | -note: lint level defined here +note: the lint level is defined here --> $DIR/expr_return_in_macro.rs:4:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_struct.stderr b/src/test/ui/reachable/expr_struct.stderr index b3ca06eada3..36b070456c5 100644 --- a/src/test/ui/reachable/expr_struct.stderr +++ b/src/test/ui/reachable/expr_struct.stderr @@ -7,7 +7,7 @@ LL | let x = Foo { a: 22, b: 33, ..return }; | | any code following this expression is unreachable | unreachable expression | -note: lint level defined here +note: the lint level is defined here --> $DIR/expr_struct.rs:4:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_tup.stderr b/src/test/ui/reachable/expr_tup.stderr index aaaf6462da8..5ea6bf4abf6 100644 --- a/src/test/ui/reachable/expr_tup.stderr +++ b/src/test/ui/reachable/expr_tup.stderr @@ -6,7 +6,7 @@ LL | let x: (usize, usize) = (return, 2); | | | any code following this expression is unreachable | -note: lint level defined here +note: the lint level is defined here --> $DIR/expr_tup.rs:4:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_type.stderr b/src/test/ui/reachable/expr_type.stderr index cb6e8d7039f..c56c64be721 100644 --- a/src/test/ui/reachable/expr_type.stderr +++ b/src/test/ui/reachable/expr_type.stderr @@ -7,7 +7,7 @@ LL | let x = {return}: !; | |any code following this expression is unreachable | unreachable expression | -note: lint level defined here +note: the lint level is defined here --> $DIR/expr_type.rs:4:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_unary.stderr b/src/test/ui/reachable/expr_unary.stderr index f5c3564217b..063d841c25e 100644 --- a/src/test/ui/reachable/expr_unary.stderr +++ b/src/test/ui/reachable/expr_unary.stderr @@ -13,7 +13,7 @@ LL | let x: ! = ! { return; }; | | any code following this expression is unreachable | unreachable expression | -note: lint level defined here +note: the lint level is defined here --> $DIR/expr_unary.rs:5:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_while.stderr b/src/test/ui/reachable/expr_while.stderr index edb1dd2b9bc..83354574eaf 100644 --- a/src/test/ui/reachable/expr_while.stderr +++ b/src/test/ui/reachable/expr_while.stderr @@ -10,7 +10,7 @@ LL | | println!("Hello, world!"); LL | | } | |_____^ unreachable block in `while` expression | -note: lint level defined here +note: the lint level is defined here --> $DIR/expr_while.rs:4:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/unreachable-arm.stderr b/src/test/ui/reachable/unreachable-arm.stderr index 8e65745c7b0..1cbea8288d4 100644 --- a/src/test/ui/reachable/unreachable-arm.stderr +++ b/src/test/ui/reachable/unreachable-arm.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | Foo::A(_, 1) => { } | ^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/unreachable-arm.rs:4:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/reachable/unreachable-code.stderr b/src/test/ui/reachable/unreachable-code.stderr index 184440db5df..4b951263dbd 100644 --- a/src/test/ui/reachable/unreachable-code.stderr +++ b/src/test/ui/reachable/unreachable-code.stderr @@ -7,7 +7,7 @@ LL | LL | let a = 3; | ^^^^^^^^^^ unreachable statement | -note: lint level defined here +note: the lint level is defined here --> $DIR/unreachable-code.rs:1:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/unreachable-in-call.stderr b/src/test/ui/reachable/unreachable-in-call.stderr index 1d081d1c762..cdfa79bf899 100644 --- a/src/test/ui/reachable/unreachable-in-call.stderr +++ b/src/test/ui/reachable/unreachable-in-call.stderr @@ -6,7 +6,7 @@ LL | call(diverge(), LL | get_u8()); | ^^^^^^^^ unreachable expression | -note: lint level defined here +note: the lint level is defined here --> $DIR/unreachable-in-call.rs:2:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/unreachable-loop-patterns.stderr b/src/test/ui/reachable/unreachable-loop-patterns.stderr index bb5103320d2..680d22862d7 100644 --- a/src/test/ui/reachable/unreachable-loop-patterns.stderr +++ b/src/test/ui/reachable/unreachable-loop-patterns.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | for _ in unimplemented!() as Void {} | ^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/unreachable-loop-patterns.rs:5:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/reachable/unreachable-try-pattern.stderr b/src/test/ui/reachable/unreachable-try-pattern.stderr index 707038442a2..d141e382313 100644 --- a/src/test/ui/reachable/unreachable-try-pattern.stderr +++ b/src/test/ui/reachable/unreachable-try-pattern.stderr @@ -7,7 +7,7 @@ LL | let y = (match x { Ok(n) => Ok(n as u32), Err(e) => Err(e) })?; | unreachable expression | any code following this expression is unreachable | -note: lint level defined here +note: the lint level is defined here --> $DIR/unreachable-try-pattern.rs:3:9 | LL | #![warn(unreachable_code)] @@ -19,7 +19,7 @@ warning: unreachable pattern LL | let y = (match x { Ok(n) => Ok(n as u32), Err(e) => Err(e) })?; | ^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/unreachable-try-pattern.rs:4:9 | LL | #![warn(unreachable_patterns)] diff --git a/src/test/ui/reachable/unwarned-match-on-never.stderr b/src/test/ui/reachable/unwarned-match-on-never.stderr index 6b2fb4a33c1..a296d2a055e 100644 --- a/src/test/ui/reachable/unwarned-match-on-never.stderr +++ b/src/test/ui/reachable/unwarned-match-on-never.stderr @@ -7,7 +7,7 @@ LL | // But matches in unreachable code are warned. LL | match x {} | ^^^^^^^^^^ unreachable expression | -note: lint level defined here +note: the lint level is defined here --> $DIR/unwarned-match-on-never.rs:1:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr index d352d119a70..92a3942c916 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr @@ -4,7 +4,7 @@ error[E0521]: borrowed data escapes outside of function LL | fn caller2<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { | - - `b` is a reference that is only valid in the function body | | - | `a` is declared here, outside of the function body + | `a` declared here, outside of the function body LL | // Here the value provided for 'y is 'b, and hence 'b:'a does not hold. LL | f.method(b); | ^^^^^^^^^^^ `b` escapes the function body here diff --git a/src/test/ui/regions/regions-nested-fns.nll.stderr b/src/test/ui/regions/regions-nested-fns.nll.stderr index 305a76815ac..9d966486f98 100644 --- a/src/test/ui/regions/regions-nested-fns.nll.stderr +++ b/src/test/ui/regions/regions-nested-fns.nll.stderr @@ -2,7 +2,7 @@ error[E0521]: borrowed data escapes outside of closure --> $DIR/regions-nested-fns.rs:10:9 | LL | let mut ay = &y; - | ------ `ay` is declared here, outside of the closure body + | ------ `ay` declared here, outside of the closure body LL | LL | ignore::<Box<dyn for<'z> FnMut(&'z isize)>>(Box::new(|z| { | - `z` is a reference that is only valid in the closure body diff --git a/src/test/ui/removing-extern-crate.stderr b/src/test/ui/removing-extern-crate.stderr index 20d5564c16d..c86556c89f4 100644 --- a/src/test/ui/removing-extern-crate.stderr +++ b/src/test/ui/removing-extern-crate.stderr @@ -4,7 +4,7 @@ warning: unused extern crate LL | extern crate removing_extern_crate as foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it | -note: lint level defined here +note: the lint level is defined here --> $DIR/removing-extern-crate.rs:6:9 | LL | #![warn(rust_2018_idioms)] diff --git a/src/test/ui/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.stderr b/src/test/ui/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.stderr index 7fbf1157e56..4956226712d 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.stderr @@ -4,7 +4,7 @@ error: `extern` block uses type `types::NonExhaustiveEnum`, which is not FFI-saf LL | pub fn non_exhaustive_enum(_: NonExhaustiveEnum); | ^^^^^^^^^^^^^^^^^ not FFI-safe | -note: lint level defined here +note: the lint level is defined here --> $DIR/extern_crate_improper.rs:2:9 | LL | #![deny(improper_ctypes)] diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.stderr index f2b9983af86..f39e6ee2985 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | PartiallyInhabitedVariants::Struct { .. } => {}, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-65157-repeated-match-arm.rs:2:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.stderr index e3de94be128..8bfd6e91f4d 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | Some(_x) => (), | ^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/patterns_same_crate.rs:1:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/rfc-2565-param-attrs/param-attrs-cfg.stderr b/src/test/ui/rfc-2565-param-attrs/param-attrs-cfg.stderr index 8d9571d09a8..82099066a89 100644 --- a/src/test/ui/rfc-2565-param-attrs/param-attrs-cfg.stderr +++ b/src/test/ui/rfc-2565-param-attrs/param-attrs-cfg.stderr @@ -4,7 +4,7 @@ error: unused variable: `a` LL | #[cfg(something)] a: i32, | ^ help: consider prefixing with an underscore: `_a` | -note: lint level defined here +note: the lint level is defined here --> $DIR/param-attrs-cfg.rs:5:9 | LL | #![deny(unused_variables)] diff --git a/src/test/ui/rfc1445/cant-hide-behind-doubly-indirect-embedded.stderr b/src/test/ui/rfc1445/cant-hide-behind-doubly-indirect-embedded.stderr index 5281d576066..030deda9af6 100644 --- a/src/test/ui/rfc1445/cant-hide-behind-doubly-indirect-embedded.stderr +++ b/src/test/ui/rfc1445/cant-hide-behind-doubly-indirect-embedded.stderr @@ -4,7 +4,7 @@ warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be a LL | WRAP_DOUBLY_INDIRECT_INLINE => { panic!("WRAP_DOUBLY_INDIRECT_INLINE matched itself"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/cant-hide-behind-doubly-indirect-embedded.rs:7:9 | LL | #![warn(indirect_structural_match)] diff --git a/src/test/ui/rfc1445/cant-hide-behind-doubly-indirect-param.stderr b/src/test/ui/rfc1445/cant-hide-behind-doubly-indirect-param.stderr index 5d601c2c006..e274d8ed084 100644 --- a/src/test/ui/rfc1445/cant-hide-behind-doubly-indirect-param.stderr +++ b/src/test/ui/rfc1445/cant-hide-behind-doubly-indirect-param.stderr @@ -4,7 +4,7 @@ warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be a LL | WRAP_DOUBLY_INDIRECT_PARAM => { panic!("WRAP_DOUBLY_INDIRECT_PARAM matched itself"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/cant-hide-behind-doubly-indirect-param.rs:7:9 | LL | #![warn(indirect_structural_match)] diff --git a/src/test/ui/rfc1445/cant-hide-behind-indirect-struct-embedded.stderr b/src/test/ui/rfc1445/cant-hide-behind-indirect-struct-embedded.stderr index 4ac19afa706..067677fbfb6 100644 --- a/src/test/ui/rfc1445/cant-hide-behind-indirect-struct-embedded.stderr +++ b/src/test/ui/rfc1445/cant-hide-behind-indirect-struct-embedded.stderr @@ -4,7 +4,7 @@ warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be a LL | WRAP_INDIRECT_INLINE => { panic!("WRAP_INDIRECT_INLINE matched itself"); } | ^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/cant-hide-behind-indirect-struct-embedded.rs:7:9 | LL | #![warn(indirect_structural_match)] diff --git a/src/test/ui/rfc1445/cant-hide-behind-indirect-struct-param.stderr b/src/test/ui/rfc1445/cant-hide-behind-indirect-struct-param.stderr index 4000a479878..31b294f379c 100644 --- a/src/test/ui/rfc1445/cant-hide-behind-indirect-struct-param.stderr +++ b/src/test/ui/rfc1445/cant-hide-behind-indirect-struct-param.stderr @@ -4,7 +4,7 @@ warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be a LL | WRAP_INDIRECT_PARAM => { panic!("WRAP_INDIRECT_PARAM matched itself"); } | ^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/cant-hide-behind-indirect-struct-param.rs:7:9 | LL | #![warn(indirect_structural_match)] diff --git a/src/test/ui/rfc1445/issue-62307-match-ref-ref-forbidden-without-eq.stderr b/src/test/ui/rfc1445/issue-62307-match-ref-ref-forbidden-without-eq.stderr index 0e158c2fda5..c495c37f6a1 100644 --- a/src/test/ui/rfc1445/issue-62307-match-ref-ref-forbidden-without-eq.stderr +++ b/src/test/ui/rfc1445/issue-62307-match-ref-ref-forbidden-without-eq.stderr @@ -4,7 +4,7 @@ warning: to use a constant of type `B` in a pattern, `B` must be annotated with LL | RR_B1 => { println!("CLAIM RR0: {:?} matches {:?}", RR_B1, RR_B0); } | ^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-62307-match-ref-ref-forbidden-without-eq.rs:13:9 | LL | #![warn(indirect_structural_match)] diff --git a/src/test/ui/rust-2018/async-ident-allowed.stderr b/src/test/ui/rust-2018/async-ident-allowed.stderr index 2394bff1181..43fc3f5e334 100644 --- a/src/test/ui/rust-2018/async-ident-allowed.stderr +++ b/src/test/ui/rust-2018/async-ident-allowed.stderr @@ -4,7 +4,7 @@ error: `async` is a keyword in the 2018 edition LL | let async = 3; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | -note: lint level defined here +note: the lint level is defined here --> $DIR/async-ident-allowed.rs:3:9 | LL | #![deny(rust_2018_compatibility)] diff --git a/src/test/ui/rust-2018/async-ident.stderr b/src/test/ui/rust-2018/async-ident.stderr index b1495337756..6051c81f77c 100644 --- a/src/test/ui/rust-2018/async-ident.stderr +++ b/src/test/ui/rust-2018/async-ident.stderr @@ -4,7 +4,7 @@ error: `async` is a keyword in the 2018 edition LL | fn async() {} | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | -note: lint level defined here +note: the lint level is defined here --> $DIR/async-ident.rs:2:9 | LL | #![deny(keyword_idents)] diff --git a/src/test/ui/rust-2018/dyn-keyword.stderr b/src/test/ui/rust-2018/dyn-keyword.stderr index fa79df49fb6..0fe11168c44 100644 --- a/src/test/ui/rust-2018/dyn-keyword.stderr +++ b/src/test/ui/rust-2018/dyn-keyword.stderr @@ -4,7 +4,7 @@ error: `dyn` is a keyword in the 2018 edition LL | let dyn = (); | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` | -note: lint level defined here +note: the lint level is defined here --> $DIR/dyn-keyword.rs:5:9 | LL | #![deny(keyword_idents)] diff --git a/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.stderr b/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.stderr index 412ebe1a9c4..0b400786d35 100644 --- a/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.stderr +++ b/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.stderr @@ -4,7 +4,7 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external c LL | let _: <foo::Baz as ::foo::Foo>::Bar = (); | ^^^^^^^^^^ help: use `crate`: `crate::foo::Foo` | -note: lint level defined here +note: the lint level is defined here --> $DIR/edition-lint-fully-qualified-paths.rs:4:9 | LL | #![deny(absolute_paths_not_starting_with_crate)] diff --git a/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr b/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr index 3515d422605..45bc5dbc446 100644 --- a/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr +++ b/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr @@ -4,7 +4,7 @@ error: outlives requirements can be inferred LL | struct TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> { | ^^^^^ ^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/edition-lint-infer-outlives-multispan.rs:2:9 | LL | #![deny(explicit_outlives_requirements)] diff --git a/src/test/ui/rust-2018/edition-lint-infer-outlives.stderr b/src/test/ui/rust-2018/edition-lint-infer-outlives.stderr index cddce94254b..faa9f21e38b 100644 --- a/src/test/ui/rust-2018/edition-lint-infer-outlives.stderr +++ b/src/test/ui/rust-2018/edition-lint-infer-outlives.stderr @@ -4,7 +4,7 @@ error: outlives requirements can be inferred LL | struct TeeOutlivesAy<'a, T: 'a> { | ^^^^ help: remove this bound | -note: lint level defined here +note: the lint level is defined here --> $DIR/edition-lint-infer-outlives.rs:4:9 | LL | #![deny(explicit_outlives_requirements)] diff --git a/src/test/ui/rust-2018/edition-lint-nested-empty-paths.stderr b/src/test/ui/rust-2018/edition-lint-nested-empty-paths.stderr index 742203e9985..d554cc28621 100644 --- a/src/test/ui/rust-2018/edition-lint-nested-empty-paths.stderr +++ b/src/test/ui/rust-2018/edition-lint-nested-empty-paths.stderr @@ -4,7 +4,7 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external c LL | use foo::{bar::{baz::{}}}; | ^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{bar::{baz::{}}}` | -note: lint level defined here +note: the lint level is defined here --> $DIR/edition-lint-nested-empty-paths.rs:4:9 | LL | #![deny(absolute_paths_not_starting_with_crate)] diff --git a/src/test/ui/rust-2018/edition-lint-nested-paths.stderr b/src/test/ui/rust-2018/edition-lint-nested-paths.stderr index 6cd8e9acd10..040aa4a5480 100644 --- a/src/test/ui/rust-2018/edition-lint-nested-paths.stderr +++ b/src/test/ui/rust-2018/edition-lint-nested-paths.stderr @@ -4,7 +4,7 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external c LL | use foo::{a, b}; | ^^^^^^^^^^^ help: use `crate`: `crate::foo::{a, b}` | -note: lint level defined here +note: the lint level is defined here --> $DIR/edition-lint-nested-paths.rs:4:9 | LL | #![deny(absolute_paths_not_starting_with_crate)] diff --git a/src/test/ui/rust-2018/edition-lint-paths.stderr b/src/test/ui/rust-2018/edition-lint-paths.stderr index 4f1904a1f8a..dd36d07da56 100644 --- a/src/test/ui/rust-2018/edition-lint-paths.stderr +++ b/src/test/ui/rust-2018/edition-lint-paths.stderr @@ -4,7 +4,7 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external c LL | use ::bar::Bar; | ^^^^^^^^^^ help: use `crate`: `crate::bar::Bar` | -note: lint level defined here +note: the lint level is defined here --> $DIR/edition-lint-paths.rs:5:9 | LL | #![deny(absolute_paths_not_starting_with_crate)] diff --git a/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr b/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr index 12a6110bfb4..bb50ec3f57d 100644 --- a/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr +++ b/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr @@ -4,7 +4,7 @@ error: unused extern crate LL | extern crate edition_lint_paths; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it | -note: lint level defined here +note: the lint level is defined here --> $DIR/extern-crate-idiomatic-in-2018.rs:9:9 | LL | #![deny(rust_2018_idioms)] diff --git a/src/test/ui/rust-2018/extern-crate-rename.stderr b/src/test/ui/rust-2018/extern-crate-rename.stderr index 4e33b1e959a..6ea762ed999 100644 --- a/src/test/ui/rust-2018/extern-crate-rename.stderr +++ b/src/test/ui/rust-2018/extern-crate-rename.stderr @@ -4,7 +4,7 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external c LL | use my_crate::foo; | ^^^^^^^^^^^^^ help: use `crate`: `crate::my_crate::foo` | -note: lint level defined here +note: the lint level is defined here --> $DIR/extern-crate-rename.rs:8:9 | LL | #![deny(absolute_paths_not_starting_with_crate)] diff --git a/src/test/ui/rust-2018/extern-crate-submod.stderr b/src/test/ui/rust-2018/extern-crate-submod.stderr index e0b61dd265c..87a0d492675 100644 --- a/src/test/ui/rust-2018/extern-crate-submod.stderr +++ b/src/test/ui/rust-2018/extern-crate-submod.stderr @@ -4,7 +4,7 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external c LL | use m::edition_lint_paths::foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::m::edition_lint_paths::foo` | -note: lint level defined here +note: the lint level is defined here --> $DIR/extern-crate-submod.rs:9:9 | LL | #![deny(absolute_paths_not_starting_with_crate)] diff --git a/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr b/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr index 957a04cd980..2ef97e7f20e 100644 --- a/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr +++ b/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr @@ -7,7 +7,7 @@ LL | | extern crate edition_lint_paths; | |________________________________| | help: remove it | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-54400-unused-extern-crate-attr-span.rs:6:9 | LL | #![deny(rust_2018_idioms)] diff --git a/src/test/ui/rust-2018/macro-use-warned-against.stderr b/src/test/ui/rust-2018/macro-use-warned-against.stderr index 944b56e9577..611b9d5dac9 100644 --- a/src/test/ui/rust-2018/macro-use-warned-against.stderr +++ b/src/test/ui/rust-2018/macro-use-warned-against.stderr @@ -4,7 +4,7 @@ warning: deprecated `#[macro_use]` directive used to import macros should be rep LL | #[macro_use] | ^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/macro-use-warned-against.rs:5:9 | LL | #![warn(macro_use_extern_crate, unused)] @@ -16,7 +16,7 @@ warning: unused `#[macro_use]` import LL | #[macro_use] | ^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/macro-use-warned-against.rs:5:33 | LL | #![warn(macro_use_extern_crate, unused)] diff --git a/src/test/ui/rust-2018/remove-extern-crate.stderr b/src/test/ui/rust-2018/remove-extern-crate.stderr index 4777565452a..8df93c56e93 100644 --- a/src/test/ui/rust-2018/remove-extern-crate.stderr +++ b/src/test/ui/rust-2018/remove-extern-crate.stderr @@ -4,7 +4,7 @@ warning: unused extern crate LL | extern crate core; | ^^^^^^^^^^^^^^^^^^ help: remove it | -note: lint level defined here +note: the lint level is defined here --> $DIR/remove-extern-crate.rs:7:9 | LL | #![warn(rust_2018_idioms)] diff --git a/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr b/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr index 5add50e87f7..8495fe62575 100644 --- a/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr +++ b/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr @@ -4,7 +4,7 @@ warning: absolute paths must start with `self`, `super`, `crate`, or an external LL | #[foo] | ^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/suggestions-not-always-applicable.rs:8:9 | LL | #![warn(rust_2018_compatibility)] diff --git a/src/test/ui/rust-2018/try-ident.stderr b/src/test/ui/rust-2018/try-ident.stderr index 29cc68c439e..a5cb839ec0e 100644 --- a/src/test/ui/rust-2018/try-ident.stderr +++ b/src/test/ui/rust-2018/try-ident.stderr @@ -4,7 +4,7 @@ warning: `try` is a keyword in the 2018 edition LL | try(); | ^^^ help: you can use a raw identifier to stay compatible: `r#try` | -note: lint level defined here +note: the lint level is defined here --> $DIR/try-ident.rs:4:9 | LL | #![warn(rust_2018_compatibility)] diff --git a/src/test/ui/rust-2018/try-macro.stderr b/src/test/ui/rust-2018/try-macro.stderr index eb65d415064..b92d5048b38 100644 --- a/src/test/ui/rust-2018/try-macro.stderr +++ b/src/test/ui/rust-2018/try-macro.stderr @@ -4,7 +4,7 @@ warning: `try` is a keyword in the 2018 edition LL | try!(x); | ^^^ help: you can use a raw identifier to stay compatible: `r#try` | -note: lint level defined here +note: the lint level is defined here --> $DIR/try-macro.rs:6:9 | LL | #![warn(rust_2018_compatibility)] diff --git a/src/test/ui/sanitizer-address.rs b/src/test/ui/sanitize/address.rs index d27a30a2dc5..d27a30a2dc5 100644 --- a/src/test/ui/sanitizer-address.rs +++ b/src/test/ui/sanitize/address.rs diff --git a/src/test/ui/sanitize-cfg.rs b/src/test/ui/sanitize/cfg.rs index 9c198543a86..9c198543a86 100644 --- a/src/test/ui/sanitize-cfg.rs +++ b/src/test/ui/sanitize/cfg.rs diff --git a/src/test/ui/sanitizer-leak.rs b/src/test/ui/sanitize/leak.rs index 5c2f2cb4e86..5c2f2cb4e86 100644 --- a/src/test/ui/sanitizer-leak.rs +++ b/src/test/ui/sanitize/leak.rs diff --git a/src/test/ui/sanitizer-memory.rs b/src/test/ui/sanitize/memory.rs index 3e1cf4509a3..3e1cf4509a3 100644 --- a/src/test/ui/sanitizer-memory.rs +++ b/src/test/ui/sanitize/memory.rs diff --git a/src/test/ui/sanitizer-unsupported-target.rs b/src/test/ui/sanitize/unsupported-target.rs index 444333c3f01..444333c3f01 100644 --- a/src/test/ui/sanitizer-unsupported-target.rs +++ b/src/test/ui/sanitize/unsupported-target.rs diff --git a/src/test/ui/sanitizer-unsupported-target.stderr b/src/test/ui/sanitize/unsupported-target.stderr index 38be58dd4b3..38be58dd4b3 100644 --- a/src/test/ui/sanitizer-unsupported-target.stderr +++ b/src/test/ui/sanitize/unsupported-target.stderr diff --git a/src/test/ui/sanitize/use-after-scope.rs b/src/test/ui/sanitize/use-after-scope.rs new file mode 100644 index 00000000000..6a2067e157a --- /dev/null +++ b/src/test/ui/sanitize/use-after-scope.rs @@ -0,0 +1,18 @@ +// needs-sanitizer-support +// only-x86_64 +// +// compile-flags: -Zsanitizer=address +// run-fail +// error-pattern: ERROR: AddressSanitizer: stack-use-after-scope + +static mut P: *mut usize = std::ptr::null_mut(); + +fn main() { + unsafe { + { + let mut x = 0; + P = &mut x; + } + std::ptr::write_volatile(P, 123); + } +} diff --git a/src/test/ui/single-use-lifetime/fn-types.stderr b/src/test/ui/single-use-lifetime/fn-types.stderr index bec24be07af..584c889506b 100644 --- a/src/test/ui/single-use-lifetime/fn-types.stderr +++ b/src/test/ui/single-use-lifetime/fn-types.stderr @@ -6,7 +6,7 @@ LL | a: for<'a> fn(&'a u32), | | | this lifetime... | -note: lint level defined here +note: the lint level is defined here --> $DIR/fn-types.rs:1:9 | LL | #![deny(single_use_lifetimes)] diff --git a/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.stderr b/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.stderr index ef118a22ccb..b251e8a438a 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.stderr @@ -7,7 +7,7 @@ LL | fn a(x: &'a u32, y: &'b u32) { | this lifetime is only used here | help: elide the single-use lifetime | -note: lint level defined here +note: the lint level is defined here --> $DIR/one-use-in-fn-argument-in-band.rs:4:9 | LL | #![deny(single_use_lifetimes)] diff --git a/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr index 25aa8bb6fb0..f78970ac0a4 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr @@ -6,7 +6,7 @@ LL | fn a<'a>(x: &'a u32) { | | | this lifetime... | -note: lint level defined here +note: the lint level is defined here --> $DIR/one-use-in-fn-argument.rs:1:9 | LL | #![deny(single_use_lifetimes)] diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr index 8115a1e6401..35fd782e133 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr @@ -6,7 +6,7 @@ LL | impl<'f> Foo<'f> { | | | this lifetime... | -note: lint level defined here +note: the lint level is defined here --> $DIR/one-use-in-inherent-impl-header.rs:1:9 | LL | #![deny(single_use_lifetimes)] diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr index 48bd9f19126..10fb40b9d14 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr @@ -6,7 +6,7 @@ LL | fn inherent_a<'a>(&self, data: &'a u32) { | | | this lifetime... | -note: lint level defined here +note: the lint level is defined here --> $DIR/one-use-in-inherent-method-argument.rs:1:9 | LL | #![deny(single_use_lifetimes)] diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr index 9c93da46271..da9e2534611 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr @@ -6,7 +6,7 @@ LL | impl<'f> Foo<'f> { | | | this lifetime... | -note: lint level defined here +note: the lint level is defined here --> $DIR/one-use-in-inherent-method-return.rs:1:9 | LL | #![deny(single_use_lifetimes)] diff --git a/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr index 047e0591e4b..55d11add7b6 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr @@ -6,7 +6,7 @@ LL | fn next<'g>(&'g mut self) -> Option<Self::Item> { | | | this lifetime... | -note: lint level defined here +note: the lint level is defined here --> $DIR/one-use-in-trait-method-argument.rs:4:9 | LL | #![deny(single_use_lifetimes)] diff --git a/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr b/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr index 6f0ba02b506..c16b244fafd 100644 --- a/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr +++ b/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr @@ -6,7 +6,7 @@ LL | impl<'f> Foo<'f> { | | | this lifetime... | -note: lint level defined here +note: the lint level is defined here --> $DIR/two-uses-in-inherent-method-argument-and-return.rs:4:9 | LL | #![deny(single_use_lifetimes)] diff --git a/src/test/ui/single-use-lifetime/zero-uses-in-fn.stderr b/src/test/ui/single-use-lifetime/zero-uses-in-fn.stderr index b9c3bd89748..59c0164e324 100644 --- a/src/test/ui/single-use-lifetime/zero-uses-in-fn.stderr +++ b/src/test/ui/single-use-lifetime/zero-uses-in-fn.stderr @@ -4,7 +4,7 @@ error: lifetime parameter `'a` never used LL | fn september<'a>() {} | -^^- help: elide the unused lifetime | -note: lint level defined here +note: the lint level is defined here --> $DIR/zero-uses-in-fn.rs:5:9 | LL | #![deny(unused_lifetimes)] diff --git a/src/test/ui/single-use-lifetime/zero-uses-in-impl.stderr b/src/test/ui/single-use-lifetime/zero-uses-in-impl.stderr index 650a9b4600e..b6e42d3e717 100644 --- a/src/test/ui/single-use-lifetime/zero-uses-in-impl.stderr +++ b/src/test/ui/single-use-lifetime/zero-uses-in-impl.stderr @@ -4,7 +4,7 @@ error: lifetime parameter `'a` never used LL | impl<'a> Foo {} | -^^- help: elide the unused lifetime | -note: lint level defined here +note: the lint level is defined here --> $DIR/zero-uses-in-impl.rs:3:9 | LL | #![deny(unused_lifetimes)] diff --git a/src/test/ui/span/issue-24690.stderr b/src/test/ui/span/issue-24690.stderr index b2160e66a74..69d1150abba 100644 --- a/src/test/ui/span/issue-24690.stderr +++ b/src/test/ui/span/issue-24690.stderr @@ -4,7 +4,7 @@ warning: unused variable: `theOtherTwo` LL | let theOtherTwo = 2; | ^^^^^^^^^^^ help: consider prefixing with an underscore: `_theOtherTwo` | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-24690.rs:8:9 | LL | #![warn(unused)] diff --git a/src/test/ui/span/lint-unused-unsafe.stderr b/src/test/ui/span/lint-unused-unsafe.stderr index ac8107990c2..c35a3349121 100644 --- a/src/test/ui/span/lint-unused-unsafe.stderr +++ b/src/test/ui/span/lint-unused-unsafe.stderr @@ -4,7 +4,7 @@ error: unnecessary `unsafe` block LL | fn bad1() { unsafe {} } | ^^^^^^ unnecessary `unsafe` block | -note: lint level defined here +note: the lint level is defined here --> $DIR/lint-unused-unsafe.rs:4:9 | LL | #![deny(unused_unsafe)] diff --git a/src/test/ui/span/macro-span-replacement.stderr b/src/test/ui/span/macro-span-replacement.stderr index 8b65e798b6e..4eb775155a5 100644 --- a/src/test/ui/span/macro-span-replacement.stderr +++ b/src/test/ui/span/macro-span-replacement.stderr @@ -7,7 +7,7 @@ LL | $b $a; LL | m!(S struct); | ------------- in this macro invocation | -note: lint level defined here +note: the lint level is defined here --> $DIR/macro-span-replacement.rs:3:9 | LL | #![warn(unused)] diff --git a/src/test/ui/span/multispan-import-lint.stderr b/src/test/ui/span/multispan-import-lint.stderr index a54c86cdb0f..4faa9e128d1 100644 --- a/src/test/ui/span/multispan-import-lint.stderr +++ b/src/test/ui/span/multispan-import-lint.stderr @@ -4,7 +4,7 @@ warning: unused imports: `Eq`, `Ord`, `PartialEq`, `PartialOrd` LL | use std::cmp::{Eq, Ord, min, PartialEq, PartialOrd}; | ^^ ^^^ ^^^^^^^^^ ^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/multispan-import-lint.rs:3:9 | LL | #![warn(unused)] diff --git a/src/test/ui/span/unused-warning-point-at-identifier.stderr b/src/test/ui/span/unused-warning-point-at-identifier.stderr index a4715d4adeb..f8d38d7b4b8 100644 --- a/src/test/ui/span/unused-warning-point-at-identifier.stderr +++ b/src/test/ui/span/unused-warning-point-at-identifier.stderr @@ -4,7 +4,7 @@ warning: enum is never used: `Enum` LL | enum Enum { | ^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused-warning-point-at-identifier.rs:3:9 | LL | #![warn(unused)] diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-2.rs b/src/test/ui/stability-attribute/stability-attribute-sanity-2.rs index 5a67ca0b0c8..e74147ce900 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity-2.rs +++ b/src/test/ui/stability-attribute/stability-attribute-sanity-2.rs @@ -10,7 +10,7 @@ fn f1() { } #[stable(feature = "a", sinse = "1.0.0")] //~ ERROR unknown meta item 'sinse' fn f2() { } -#[unstable(feature = "a", issue = "no")] //~ ERROR incorrect 'issue' +#[unstable(feature = "a", issue = "no")] //~ ERROR `issue` must be a numeric string or "none" fn f3() { } fn main() { } diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr index d683d089530..541b94afe0f 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr @@ -10,11 +10,13 @@ error[E0541]: unknown meta item 'sinse' LL | #[stable(feature = "a", sinse = "1.0.0")] | ^^^^^^^^^^^^^^^ expected one of `since`, `note` -error[E0545]: incorrect 'issue' - --> $DIR/stability-attribute-sanity-2.rs:13:1 +error[E0545]: `issue` must be a numeric string or "none" + --> $DIR/stability-attribute-sanity-2.rs:13:27 | LL | #[unstable(feature = "a", issue = "no")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^---- + | | + | invalid digit found in string error: aborting due to 3 previous errors diff --git a/src/test/ui/stable-features.stderr b/src/test/ui/stable-features.stderr index 537c3f082ef..831b40b8612 100644 --- a/src/test/ui/stable-features.stderr +++ b/src/test/ui/stable-features.stderr @@ -4,7 +4,7 @@ error: the feature `test_accepted_feature` has been stable since 1.0.0 and no lo LL | #![feature(test_accepted_feature)] | ^^^^^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/stable-features.rs:4:9 | LL | #![deny(stable_features)] diff --git a/src/test/ui/suggestions/issue-61963.stderr b/src/test/ui/suggestions/issue-61963.stderr index 46943f40066..0e2eb7616cf 100644 --- a/src/test/ui/suggestions/issue-61963.stderr +++ b/src/test/ui/suggestions/issue-61963.stderr @@ -4,7 +4,7 @@ error: trait objects without an explicit `dyn` are deprecated LL | bar: Box<Bar>, | ^^^ help: use `dyn`: `dyn Bar` | -note: lint level defined here +note: the lint level is defined here --> $DIR/issue-61963.rs:3:9 | LL | #![deny(bare_trait_objects)] diff --git a/src/test/ui/suggestions/unused-closure-argument.stderr b/src/test/ui/suggestions/unused-closure-argument.stderr index 5cfdd79659b..d83ab08e71e 100644 --- a/src/test/ui/suggestions/unused-closure-argument.stderr +++ b/src/test/ui/suggestions/unused-closure-argument.stderr @@ -4,7 +4,7 @@ error: unused variable: `x` LL | .map(|Point { x, y }| y) | ^ help: try ignoring the field: `x: _` | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused-closure-argument.rs:1:9 | LL | #![deny(unused_variables)] diff --git a/src/test/ui/test-attrs/test-warns-dead-code.stderr b/src/test/ui/test-attrs/test-warns-dead-code.stderr index cb118cdb410..d3bcea29513 100644 --- a/src/test/ui/test-attrs/test-warns-dead-code.stderr +++ b/src/test/ui/test-attrs/test-warns-dead-code.stderr @@ -4,7 +4,7 @@ error: function is never used: `dead` LL | fn dead() {} | ^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/test-warns-dead-code.rs:3:9 | LL | #![deny(dead_code)] diff --git a/src/test/ui/tool_lints-fail.stderr b/src/test/ui/tool_lints-fail.stderr index a61157f21b8..16f678144a3 100644 --- a/src/test/ui/tool_lints-fail.stderr +++ b/src/test/ui/tool_lints-fail.stderr @@ -4,7 +4,7 @@ error: unknown lint: `clippy` LL | #![deny(clippy)] | ^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/tool_lints-fail.rs:4:9 | LL | #![deny(unknown_lints)] diff --git a/src/test/ui/trivial-bounds/trivial-bounds-lint.stderr b/src/test/ui/trivial-bounds/trivial-bounds-lint.stderr index 37cf6f89d67..3f2162365d9 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-lint.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-lint.stderr @@ -4,7 +4,7 @@ error: Trait bound i32: std::marker::Copy does not depend on any type or lifetim LL | struct A where i32: Copy; | ^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/trivial-bounds-lint.rs:3:9 | LL | #![deny(trivial_bounds)] diff --git a/src/test/ui/trivial_casts.stderr b/src/test/ui/trivial_casts.stderr index 8fa44372f0b..70954f00bad 100644 --- a/src/test/ui/trivial_casts.stderr +++ b/src/test/ui/trivial_casts.stderr @@ -4,7 +4,7 @@ error: trivial numeric cast: `i32` as `i32` LL | let _ = 42_i32 as i32; | ^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/trivial_casts.rs:4:24 | LL | #![deny(trivial_casts, trivial_numeric_casts)] @@ -25,7 +25,7 @@ error: trivial cast: `&u32` as `*const u32` LL | let _ = x as *const u32; | ^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/trivial_casts.rs:4:9 | LL | #![deny(trivial_casts, trivial_numeric_casts)] diff --git a/src/test/ui/try-block/try-block-unreachable-code-lint.stderr b/src/test/ui/try-block/try-block-unreachable-code-lint.stderr index 54fed04d400..c883994c876 100644 --- a/src/test/ui/try-block/try-block-unreachable-code-lint.stderr +++ b/src/test/ui/try-block/try-block-unreachable-code-lint.stderr @@ -11,7 +11,7 @@ LL | | } LL | | } | |_________^ unreachable expression | -note: lint level defined here +note: the lint level is defined here --> $DIR/try-block-unreachable-code-lint.rs:6:9 | LL | #![warn(unreachable_code)] diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr b/src/test/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr index db8767273b4..870b1eec48c 100644 --- a/src/test/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr +++ b/src/test/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr @@ -7,12 +7,12 @@ LL | fn f() -> Self::V { 0 } = note: `#[deny(ambiguous_associated_items)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #57644 <https://github.com/rust-lang/rust/issues/57644> -note: `V` could refer to variant defined here +note: `V` could refer to the variant defined here --> $DIR/enum-variant-priority-lint-ambiguous_associated_items.rs:22:5 | LL | V | ^ -note: `V` could also refer to associated type defined here +note: `V` could also refer to the associated type defined here --> $DIR/enum-variant-priority-lint-ambiguous_associated_items.rs:26:5 | LL | type V; diff --git a/src/test/ui/underscore-imports/basic.stderr b/src/test/ui/underscore-imports/basic.stderr index 9ca60e8e0a9..891730dc843 100644 --- a/src/test/ui/underscore-imports/basic.stderr +++ b/src/test/ui/underscore-imports/basic.stderr @@ -4,7 +4,7 @@ warning: unused import: `m::Tr1 as _` LL | use m::Tr1 as _; | ^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/basic.rs:4:9 | LL | #![warn(unused_imports, unused_extern_crates)] diff --git a/src/test/ui/underscore-imports/unused-2018.stderr b/src/test/ui/underscore-imports/unused-2018.stderr index 861b3f1d4fd..2afb9a10e2c 100644 --- a/src/test/ui/underscore-imports/unused-2018.stderr +++ b/src/test/ui/underscore-imports/unused-2018.stderr @@ -4,7 +4,7 @@ error: unused import: `core::any` LL | use core::any; | ^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused-2018.rs:3:9 | LL | #![deny(unused_imports)] diff --git a/src/test/ui/uninhabited/uninhabited-patterns.stderr b/src/test/ui/uninhabited/uninhabited-patterns.stderr index 3e5329cfb30..655569ad6e0 100644 --- a/src/test/ui/uninhabited/uninhabited-patterns.stderr +++ b/src/test/ui/uninhabited/uninhabited-patterns.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | &[..] => (), | ^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/uninhabited-patterns.rs:6:9 | LL | #![deny(unreachable_patterns)] diff --git a/src/test/ui/union/union-fields-1.stderr b/src/test/ui/union/union-fields-1.stderr index be145c9496c..87621cc01b1 100644 --- a/src/test/ui/union/union-fields-1.stderr +++ b/src/test/ui/union/union-fields-1.stderr @@ -4,7 +4,7 @@ error: field is never read: `c` LL | c: u8, | ^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/union-fields-1.rs:1:9 | LL | #![deny(dead_code)] diff --git a/src/test/ui/union/union-lint-dead-code.stderr b/src/test/ui/union/union-lint-dead-code.stderr index 5fe26dc2538..7de70ec3380 100644 --- a/src/test/ui/union/union-lint-dead-code.stderr +++ b/src/test/ui/union/union-lint-dead-code.stderr @@ -4,7 +4,7 @@ error: field is never read: `b` LL | b: bool, | ^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/union-lint-dead-code.rs:1:9 | LL | #![deny(dead_code)] diff --git a/src/test/ui/union/union-repr-c.stderr b/src/test/ui/union/union-repr-c.stderr index c8bc0380dee..ae84cc7811b 100644 --- a/src/test/ui/union/union-repr-c.stderr +++ b/src/test/ui/union/union-repr-c.stderr @@ -4,14 +4,14 @@ error: `extern` block uses type `W`, which is not FFI-safe LL | static FOREIGN2: W; | ^ not FFI-safe | -note: lint level defined here +note: the lint level is defined here --> $DIR/union-repr-c.rs:2:9 | LL | #![deny(improper_ctypes)] | ^^^^^^^^^^^^^^^ = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this union = note: this union has unspecified layout -note: type defined here +note: the type is defined here --> $DIR/union-repr-c.rs:9:1 | LL | / union W { diff --git a/src/test/ui/unnecessary-extern-crate.stderr b/src/test/ui/unnecessary-extern-crate.stderr index 1e6d7552343..14ba9d052f4 100644 --- a/src/test/ui/unnecessary-extern-crate.stderr +++ b/src/test/ui/unnecessary-extern-crate.stderr @@ -4,7 +4,7 @@ error: unused extern crate LL | extern crate libc; | ^^^^^^^^^^^^^^^^^^ help: remove it | -note: lint level defined here +note: the lint level is defined here --> $DIR/unnecessary-extern-crate.rs:3:9 | LL | #![deny(unused_extern_crates)] diff --git a/src/test/ui/unreachable-code-ret.stderr b/src/test/ui/unreachable-code-ret.stderr index c22342ce721..3b93ef97f32 100644 --- a/src/test/ui/unreachable-code-ret.stderr +++ b/src/test/ui/unreachable-code-ret.stderr @@ -6,7 +6,7 @@ LL | return; LL | println!("Paul is dead"); | ^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable statement | -note: lint level defined here +note: the lint level is defined here --> $DIR/unreachable-code-ret.rs:3:9 | LL | #![deny(unreachable_code)] diff --git a/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr b/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr index 28b18d50fff..0dba8496efd 100644 --- a/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr +++ b/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr @@ -4,7 +4,7 @@ error: unnecessary `unsafe` block LL | unsafe { println!("foo"); } | ^^^^^^ unnecessary `unsafe` block | -note: lint level defined here +note: the lint level is defined here --> $DIR/unsafe-around-compiler-generated-unsafe.rs:3:9 | LL | #![deny(unused_unsafe)] diff --git a/src/test/ui/unused/unused-attr.stderr b/src/test/ui/unused/unused-attr.stderr index 956b870715e..fd7412db225 100644 --- a/src/test/ui/unused/unused-attr.stderr +++ b/src/test/ui/unused/unused-attr.stderr @@ -4,7 +4,7 @@ error: unused attribute LL | #[rustc_dummy] | ^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused-attr.rs:1:9 | LL | #![deny(unused_attributes)] diff --git a/src/test/ui/unused/unused-macro-rules.stderr b/src/test/ui/unused/unused-macro-rules.stderr index 5c0b9f262b8..9bb3c3f3dec 100644 --- a/src/test/ui/unused/unused-macro-rules.stderr +++ b/src/test/ui/unused/unused-macro-rules.stderr @@ -6,7 +6,7 @@ LL | | () => {}; LL | | } | |_^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused-macro-rules.rs:1:9 | LL | #![deny(unused_macros)] @@ -31,7 +31,7 @@ LL | | () => {}; LL | | } | |_____^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused-macro-rules.rs:23:12 | LL | #[deny(unused_macros)] diff --git a/src/test/ui/unused/unused-macro.stderr b/src/test/ui/unused/unused-macro.stderr index d18fe82564e..f5eb76179bf 100644 --- a/src/test/ui/unused/unused-macro.stderr +++ b/src/test/ui/unused/unused-macro.stderr @@ -6,7 +6,7 @@ LL | | () => {} LL | | } | |_^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused-macro.rs:2:9 | LL | #![deny(unused_macros)] @@ -20,7 +20,7 @@ LL | | () => {} LL | | } | |_____^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused-macro.rs:14:12 | LL | #[deny(unused_macros)] diff --git a/src/test/ui/unused/unused-mut-warning-captured-var.stderr b/src/test/ui/unused/unused-mut-warning-captured-var.stderr index d5b731406d6..39d470e02a8 100644 --- a/src/test/ui/unused/unused-mut-warning-captured-var.stderr +++ b/src/test/ui/unused/unused-mut-warning-captured-var.stderr @@ -6,7 +6,7 @@ LL | let mut x = 1; | | | help: remove this `mut` | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused-mut-warning-captured-var.rs:1:11 | LL | #![forbid(unused_mut)] diff --git a/src/test/ui/unused/unused-result.rs b/src/test/ui/unused/unused-result.rs index 538d30943ed..a65e98990dc 100644 --- a/src/test/ui/unused/unused-result.rs +++ b/src/test/ui/unused/unused-result.rs @@ -1,7 +1,7 @@ #![allow(dead_code)] #![deny(unused_results, unused_must_use)] -//~^ NOTE: lint level defined here -//~| NOTE: lint level defined here +//~^ NOTE: the lint level is defined here +//~| NOTE: the lint level is defined here #[must_use] enum MustUse { Test } diff --git a/src/test/ui/unused/unused-result.stderr b/src/test/ui/unused/unused-result.stderr index e2aee75f3ed..1b1dcab3a1b 100644 --- a/src/test/ui/unused/unused-result.stderr +++ b/src/test/ui/unused/unused-result.stderr @@ -4,7 +4,7 @@ error: unused `MustUse` that must be used LL | foo::<MustUse>(); | ^^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused-result.rs:2:25 | LL | #![deny(unused_results, unused_must_use)] @@ -24,7 +24,7 @@ error: unused result LL | foo::<isize>(); | ^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/unused-result.rs:2:9 | LL | #![deny(unused_results, unused_must_use)] diff --git a/src/test/ui/use-module-level-int-consts.rs b/src/test/ui/use-module-level-int-consts.rs new file mode 100644 index 00000000000..758fb414ead --- /dev/null +++ b/src/test/ui/use-module-level-int-consts.rs @@ -0,0 +1,11 @@ +// run-pass + +// Make sure the module level constants are still there and accessible even after +// the corresponding associated constants have been added, and later stabilized. +use std::{u16, f32}; + +fn main() { + let _ = u16::MAX; + let _ = f32::EPSILON; + let _ = std::f64::MANTISSA_DIGITS; +} diff --git a/src/test/ui/use/use-nested-groups-unused-imports.stderr b/src/test/ui/use/use-nested-groups-unused-imports.stderr index c8df6cbc57d..987d1dcf5f0 100644 --- a/src/test/ui/use/use-nested-groups-unused-imports.stderr +++ b/src/test/ui/use/use-nested-groups-unused-imports.stderr @@ -4,7 +4,7 @@ error: unused imports: `*`, `Foo`, `baz::{}`, `foobar::*` LL | use foo::{Foo, bar::{baz::{}, foobar::*}, *}; | ^^^ ^^^^^^^ ^^^^^^^^^ ^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/use-nested-groups-unused-imports.rs:3:9 | LL | #![deny(unused_imports)] diff --git a/src/test/ui/useless-comment.stderr b/src/test/ui/useless-comment.stderr index 925e3079636..e5e4290d0e1 100644 --- a/src/test/ui/useless-comment.stderr +++ b/src/test/ui/useless-comment.stderr @@ -6,7 +6,7 @@ LL | /// foo LL | mac!(); | ------- rustdoc does not generate documentation for macro expansions | -note: lint level defined here +note: the lint level is defined here --> $DIR/useless-comment.rs:3:9 | LL | #![deny(unused_doc_comments)] diff --git a/src/test/ui/variants/variant-size-differences.stderr b/src/test/ui/variants/variant-size-differences.stderr index c82c253f610..241a757d445 100644 --- a/src/test/ui/variants/variant-size-differences.stderr +++ b/src/test/ui/variants/variant-size-differences.stderr @@ -4,7 +4,7 @@ error: enum variant is more than three times larger (1024 bytes) than the next l LL | VBig([u8; 1024]), | ^^^^^^^^^^^^^^^^ | -note: lint level defined here +note: the lint level is defined here --> $DIR/variant-size-differences.rs:1:9 | LL | #![deny(variant_size_differences)] diff --git a/src/tools/clippy b/src/tools/clippy -Subproject fa046d2e7f14cda09d14230cc8c772e1565e075 +Subproject c0f39cfb466202a1dbe8368ca177848083dc34c diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 352c00dbe41..ea92f7bee6b 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -167,7 +167,7 @@ const WHITELIST: &[Crate<'_>] = &[ Crate("termcolor"), Crate("terminon"), Crate("termion"), - Crate("term_size"), + Crate("termize"), Crate("thread_local"), Crate("ucd-util"), Crate("unicode-normalization"), |
