]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #55493 - GuillaumeGomez:doc-fixes, r=@QuietMisdreavus
authorkennytm <kennytm@gmail.com>
Tue, 30 Oct 2018 10:55:35 +0000 (18:55 +0800)
committerGitHub <noreply@github.com>
Tue, 30 Oct 2018 10:55:35 +0000 (18:55 +0800)
Doc fixes

Fixes the bug in source code page where code was below line numbers and fixed this bug too ("Expand description" is shown whereas it shouldn't):

<img width="1440" alt="screenshot 2018-10-29 at 23 11 29" src="https://user-images.githubusercontent.com/3050060/47684136-1105ad80-dbd2-11e8-9e9f-fb7f26b0f5bd.png">

r? @QuietMisdreavus

80 files changed:
src/liballoc/collections/vec_deque.rs
src/librustc/hir/lowering.rs
src/librustc/hir/map/collector.rs
src/librustc/ich/caching_codemap_view.rs [deleted file]
src/librustc/ich/caching_source_map_view.rs [new file with mode: 0644]
src/librustc/ich/mod.rs
src/librustc/infer/lexical_region_resolve/graphviz.rs
src/librustc/middle/dependency_format.rs
src/librustc/traits/util.rs
src/librustc/ty/query/on_disk_cache.rs
src/librustc/ty/steal.rs
src/librustc_data_structures/tiny_list.rs
src/librustc_errors/emitter.rs
src/librustc_errors/lib.rs
src/librustc_lint/unused.rs
src/librustc_mir/borrow_check/mod.rs
src/librustc_mir/borrow_check/mutability_errors.rs
src/librustc_mir/const_eval.rs
src/librustc_mir/interpret/validity.rs
src/librustc_target/spec/msp430_none_elf.rs
src/librustc_traits/implied_outlives_bounds.rs
src/librustc_typeck/astconv.rs
src/librustc_typeck/check/method/probe.rs
src/librustc_typeck/check/mod.rs
src/libsyntax/json.rs
src/libsyntax/parse/lexer/mod.rs
src/libsyntax/parse/mod.rs
src/libsyntax/source_map.rs
src/libsyntax/test_snippet.rs
src/libsyntax_pos/analyze_source_file.rs
src/libsyntax_pos/lib.rs
src/test/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans.rs
src/test/run-pass/issue-55376.rs [new file with mode: 0644]
src/test/ui/access-mode-in-closures.nll.stderr
src/test/ui/binop/binop-move-semantics.nll.stderr
src/test/ui/borrowck/borrowck-fn-in-const-a.ast.nll.stderr [deleted file]
src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr
src/test/ui/borrowck/borrowck-in-static.nll.stderr
src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr
src/test/ui/borrowck/borrowck-migrate-to-nll.edition.stderr
src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr
src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr
src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr
src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr
src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.nll.stderr
src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.nll.stderr
src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.nll.stderr [deleted file]
src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr
src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr
src/test/ui/borrowck/issue-51415.nll.stderr
src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.nll.stderr [deleted file]
src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr
src/test/ui/by-move-pattern-binding.nll.stderr
src/test/ui/check-static-values-constraints.nll.stderr
src/test/ui/consts/const-eval/issue-49296.rs [new file with mode: 0644]
src/test/ui/consts/const-eval/issue-49296.stderr [new file with mode: 0644]
src/test/ui/consts/const-validation-fail-55455.rs [new file with mode: 0644]
src/test/ui/consts/promoted-validation-55454.rs [new file with mode: 0644]
src/test/ui/dst/dst-index.nll.stderr
src/test/ui/dst/dst-rvalue.nll.stderr
src/test/ui/error-codes/E0507.nll.stderr [deleted file]
src/test/ui/issues/issue-12567.nll.stderr
src/test/ui/issues/issue-17718-static-move.nll.stderr
src/test/ui/issues/issue-20801.nll.stderr
src/test/ui/issues/issue-2590.nll.stderr
src/test/ui/issues/issue-30355.nll.stderr
src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr
src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr
src/test/ui/issues/issue-4335.nll.stderr
src/test/ui/lint/unused_parens_json_suggestion.rs
src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr
src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr
src/test/ui/nll/cannot-move-block-spans.nll.stderr
src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr
src/test/ui/static/static-items-cant-move.nll.stderr [deleted file]
src/test/ui/std-uncopyable-atomics.nll.stderr
src/test/ui/trivial-bounds/trivial-bounds-leak-copy.nll.stderr [deleted file]
src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr
src/test/ui/unop-move-semantics.nll.stderr
src/test/ui/unsized-locals/unsized-exprs2.nll.stderr

index 571f35a2031d2a0b9e1eb57ac1f9728ca2fb245f..88e76033f273ed5ae7fed104539ef46a17412b5b 100644 (file)
@@ -36,6 +36,8 @@
 
 const INITIAL_CAPACITY: usize = 7; // 2^3 - 1
 const MINIMUM_CAPACITY: usize = 1; // 2 - 1
+#[cfg(target_pointer_width = "16")]
+const MAXIMUM_ZST_CAPACITY: usize = 1 << (16 - 1); // Largest possible power of two
 #[cfg(target_pointer_width = "32")]
 const MAXIMUM_ZST_CAPACITY: usize = 1 << (32 - 1); // Largest possible power of two
 #[cfg(target_pointer_width = "64")]
index 9795c0cba61545a36015976b083cbae0a3d14b17..c3c65816b2615309e7080a187f043f2c16be7cab 100644 (file)
@@ -3022,8 +3022,14 @@ fn lower_use_tree(
                             hir::VisibilityKind::Inherited => hir::VisibilityKind::Inherited,
                             hir::VisibilityKind::Restricted { ref path, id: _, hir_id: _ } => {
                                 let id = this.next_id();
+                                let mut path = path.clone();
+                                for seg in path.segments.iter_mut() {
+                                    if seg.id.is_some() {
+                                        seg.id = Some(this.next_id().node_id);
+                                    }
+                                }
                                 hir::VisibilityKind::Restricted {
-                                    path: path.clone(),
+                                    path,
                                     id: id.node_id,
                                     hir_id: id.hir_id,
                                 }
index 8c701d9e4188fafa44fcebf7fdd4d536f3fb9087..4fbcd83adb555c70ce811bf61d24afbc7a62a824 100644 (file)
@@ -217,7 +217,7 @@ fn insert(&mut self, id: NodeId, node: Node<'hir>) {
                 };
 
                 bug!("inconsistent DepNode for `{}`: \
-                      current_dep_node_owner={} ({:?}), hir_id.owner={} ({:?}) {}",
+                      current_dep_node_owner={} ({:?}), hir_id.owner={} ({:?}){}",
                     node_str,
                     self.definitions
                         .def_path(self.current_dep_node_owner)
diff --git a/src/librustc/ich/caching_codemap_view.rs b/src/librustc/ich/caching_codemap_view.rs
deleted file mode 100644 (file)
index fbf4297..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use rustc_data_structures::sync::Lrc;
-use syntax::source_map::SourceMap;
-use syntax_pos::{BytePos, SourceFile};
-
-#[derive(Clone)]
-struct CacheEntry {
-    time_stamp: usize,
-    line_number: usize,
-    line_start: BytePos,
-    line_end: BytePos,
-    file: Lrc<SourceFile>,
-    file_index: usize,
-}
-
-#[derive(Clone)]
-pub struct CachingSourceMapView<'cm> {
-    source_map: &'cm SourceMap,
-    line_cache: [CacheEntry; 3],
-    time_stamp: usize,
-}
-
-impl<'cm> CachingSourceMapView<'cm> {
-    pub fn new(source_map: &'cm SourceMap) -> CachingSourceMapView<'cm> {
-        let files = source_map.files();
-        let first_file = files[0].clone();
-        let entry = CacheEntry {
-            time_stamp: 0,
-            line_number: 0,
-            line_start: BytePos(0),
-            line_end: BytePos(0),
-            file: first_file,
-            file_index: 0,
-        };
-
-        CachingSourceMapView {
-            source_map,
-            line_cache: [entry.clone(), entry.clone(), entry],
-            time_stamp: 0,
-        }
-    }
-
-    pub fn byte_pos_to_line_and_col(&mut self,
-                                    pos: BytePos)
-                                    -> Option<(Lrc<SourceFile>, usize, BytePos)> {
-        self.time_stamp += 1;
-
-        // Check if the position is in one of the cached lines
-        for cache_entry in self.line_cache.iter_mut() {
-            if pos >= cache_entry.line_start && pos < cache_entry.line_end {
-                cache_entry.time_stamp = self.time_stamp;
-
-                return Some((cache_entry.file.clone(),
-                             cache_entry.line_number,
-                             pos - cache_entry.line_start));
-            }
-        }
-
-        // No cache hit ...
-        let mut oldest = 0;
-        for index in 1 .. self.line_cache.len() {
-            if self.line_cache[index].time_stamp < self.line_cache[oldest].time_stamp {
-                oldest = index;
-            }
-        }
-
-        let cache_entry = &mut self.line_cache[oldest];
-
-        // If the entry doesn't point to the correct file, fix it up
-        if pos < cache_entry.file.start_pos || pos >= cache_entry.file.end_pos {
-            let file_valid;
-            if self.source_map.files().len() > 0 {
-                let file_index = self.source_map.lookup_source_file_idx(pos);
-                let file = self.source_map.files()[file_index].clone();
-
-                if pos >= file.start_pos && pos < file.end_pos {
-                    cache_entry.file = file;
-                    cache_entry.file_index = file_index;
-                    file_valid = true;
-                } else {
-                    file_valid = false;
-                }
-            } else {
-                file_valid = false;
-            }
-
-            if !file_valid {
-                return None;
-            }
-        }
-
-        let line_index = cache_entry.file.lookup_line(pos).unwrap();
-        let line_bounds = cache_entry.file.line_bounds(line_index);
-
-        cache_entry.line_number = line_index + 1;
-        cache_entry.line_start = line_bounds.0;
-        cache_entry.line_end = line_bounds.1;
-        cache_entry.time_stamp = self.time_stamp;
-
-        return Some((cache_entry.file.clone(),
-                     cache_entry.line_number,
-                     pos - cache_entry.line_start));
-    }
-}
diff --git a/src/librustc/ich/caching_source_map_view.rs b/src/librustc/ich/caching_source_map_view.rs
new file mode 100644 (file)
index 0000000..fbf4297
--- /dev/null
@@ -0,0 +1,113 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use rustc_data_structures::sync::Lrc;
+use syntax::source_map::SourceMap;
+use syntax_pos::{BytePos, SourceFile};
+
+#[derive(Clone)]
+struct CacheEntry {
+    time_stamp: usize,
+    line_number: usize,
+    line_start: BytePos,
+    line_end: BytePos,
+    file: Lrc<SourceFile>,
+    file_index: usize,
+}
+
+#[derive(Clone)]
+pub struct CachingSourceMapView<'cm> {
+    source_map: &'cm SourceMap,
+    line_cache: [CacheEntry; 3],
+    time_stamp: usize,
+}
+
+impl<'cm> CachingSourceMapView<'cm> {
+    pub fn new(source_map: &'cm SourceMap) -> CachingSourceMapView<'cm> {
+        let files = source_map.files();
+        let first_file = files[0].clone();
+        let entry = CacheEntry {
+            time_stamp: 0,
+            line_number: 0,
+            line_start: BytePos(0),
+            line_end: BytePos(0),
+            file: first_file,
+            file_index: 0,
+        };
+
+        CachingSourceMapView {
+            source_map,
+            line_cache: [entry.clone(), entry.clone(), entry],
+            time_stamp: 0,
+        }
+    }
+
+    pub fn byte_pos_to_line_and_col(&mut self,
+                                    pos: BytePos)
+                                    -> Option<(Lrc<SourceFile>, usize, BytePos)> {
+        self.time_stamp += 1;
+
+        // Check if the position is in one of the cached lines
+        for cache_entry in self.line_cache.iter_mut() {
+            if pos >= cache_entry.line_start && pos < cache_entry.line_end {
+                cache_entry.time_stamp = self.time_stamp;
+
+                return Some((cache_entry.file.clone(),
+                             cache_entry.line_number,
+                             pos - cache_entry.line_start));
+            }
+        }
+
+        // No cache hit ...
+        let mut oldest = 0;
+        for index in 1 .. self.line_cache.len() {
+            if self.line_cache[index].time_stamp < self.line_cache[oldest].time_stamp {
+                oldest = index;
+            }
+        }
+
+        let cache_entry = &mut self.line_cache[oldest];
+
+        // If the entry doesn't point to the correct file, fix it up
+        if pos < cache_entry.file.start_pos || pos >= cache_entry.file.end_pos {
+            let file_valid;
+            if self.source_map.files().len() > 0 {
+                let file_index = self.source_map.lookup_source_file_idx(pos);
+                let file = self.source_map.files()[file_index].clone();
+
+                if pos >= file.start_pos && pos < file.end_pos {
+                    cache_entry.file = file;
+                    cache_entry.file_index = file_index;
+                    file_valid = true;
+                } else {
+                    file_valid = false;
+                }
+            } else {
+                file_valid = false;
+            }
+
+            if !file_valid {
+                return None;
+            }
+        }
+
+        let line_index = cache_entry.file.lookup_line(pos).unwrap();
+        let line_bounds = cache_entry.file.line_bounds(line_index);
+
+        cache_entry.line_number = line_index + 1;
+        cache_entry.line_start = line_bounds.0;
+        cache_entry.line_end = line_bounds.1;
+        cache_entry.time_stamp = self.time_stamp;
+
+        return Some((cache_entry.file.clone(),
+                     cache_entry.line_number,
+                     pos - cache_entry.line_start));
+    }
+}
index a23bab6226ef31480e595273e25044cec20f3927..9751c560acd1e0535a4aa057b945bfc27188a974 100644 (file)
 //! ICH - Incremental Compilation Hash
 
 crate use rustc_data_structures::fingerprint::Fingerprint;
-pub use self::caching_codemap_view::CachingSourceMapView;
+pub use self::caching_source_map_view::CachingSourceMapView;
 pub use self::hcx::{StableHashingContextProvider, StableHashingContext, NodeIdHashingMode,
                     hash_stable_trait_impls};
-mod caching_codemap_view;
+mod caching_source_map_view;
 mod hcx;
 
 mod impls_cstore;
index 3b92d032bdc5a07716adbd662b1f96aab1cfdc08..a210d63f129e31e6527389b8b4274917f50e0ab2 100644 (file)
@@ -230,10 +230,7 @@ impl<'a, 'gcx, 'tcx> dot::GraphWalk<'a> for ConstraintGraph<'a, 'gcx, 'tcx> {
     type Node = Node;
     type Edge = Edge<'tcx>;
     fn nodes(&self) -> dot::Nodes<'_, Node> {
-        let mut set = FxHashSet::default();
-        for node in self.node_ids.keys() {
-            set.insert(*node);
-        }
+        let set = self.node_ids.keys().cloned().collect::<FxHashSet<_>>();
         debug!("constraint graph has {} nodes", set.len());
         set.into_iter().collect()
     }
index 8b5c6d147d7819bf2c6528a93a272651eb8b050f..e3f9c51a1235ee934e046c90e09046d9689097d8 100644 (file)
@@ -94,12 +94,11 @@ pub enum Linkage {
 
 pub fn calculate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
     let sess = &tcx.sess;
-    let mut fmts = FxHashMap::default();
-    for &ty in sess.crate_types.borrow().iter() {
+    let fmts = sess.crate_types.borrow().iter().map(|&ty| {
         let linkage = calculate_type(tcx, ty);
         verify_ok(tcx, &linkage);
-        fmts.insert(ty, linkage);
-    }
+        (ty, linkage)
+    }).collect::<FxHashMap<_, _>>();
     sess.abort_if_errors();
     sess.dependency_formats.set(fmts);
 }
index 0b7526dd78428d7ece38f345b521e69fd3bb5e0d..940cf736012ec0c0e2a9bde0ffdce2c34b5a0270 100644 (file)
@@ -103,11 +103,10 @@ pub fn elaborate_trait_ref<'cx, 'gcx, 'tcx>(
 
 pub fn elaborate_trait_refs<'cx, 'gcx, 'tcx>(
     tcx: TyCtxt<'cx, 'gcx, 'tcx>,
-    trait_refs: &[ty::PolyTraitRef<'tcx>])
+    trait_refs: impl Iterator<Item = ty::PolyTraitRef<'tcx>>)
     -> Elaborator<'cx, 'gcx, 'tcx>
 {
-    let predicates = trait_refs.iter()
-                               .map(|trait_ref| trait_ref.to_predicate())
+    let predicates = trait_refs.map(|trait_ref| trait_ref.to_predicate())
                                .collect();
     elaborate_predicates(tcx, predicates)
 }
@@ -271,7 +270,7 @@ pub fn supertraits<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'cx, 'gcx, 'tcx>,
 }
 
 pub fn transitive_bounds<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'cx, 'gcx, 'tcx>,
-                                          bounds: &[ty::PolyTraitRef<'tcx>])
+                                          bounds: impl Iterator<Item = ty::PolyTraitRef<'tcx>>)
                                           -> Supertraits<'cx, 'gcx, 'tcx>
 {
     elaborate_trait_refs(tcx, bounds).filter_to_traits()
index 636720bf3c47c44a74d69530f0e4b76f1e9b69d4..3dc31c517169f2a0f9708186e3315cc797e74793 100644 (file)
@@ -25,7 +25,7 @@
 use session::{CrateDisambiguator, Session};
 use std::mem;
 use syntax::ast::NodeId;
-use syntax::source_map::{SourceMap, StableFilemapId};
+use syntax::source_map::{SourceMap, StableSourceFileId};
 use syntax_pos::{BytePos, Span, DUMMY_SP, SourceFile};
 use syntax_pos::hygiene::{Mark, SyntaxContext, ExpnInfo};
 use ty;
@@ -62,7 +62,7 @@ pub struct OnDiskCache<'sess> {
     cnum_map: Once<IndexVec<CrateNum, Option<CrateNum>>>,
 
     source_map: &'sess SourceMap,
-    file_index_to_stable_id: FxHashMap<SourceFileIndex, StableFilemapId>,
+    file_index_to_stable_id: FxHashMap<SourceFileIndex, StableSourceFileId>,
 
     // These two fields caches that are populated lazily during decoding.
     file_index_to_file: Lock<FxHashMap<SourceFileIndex, Lrc<SourceFile>>>,
@@ -82,7 +82,7 @@ pub struct OnDiskCache<'sess> {
 // This type is used only for (de-)serialization.
 #[derive(RustcEncodable, RustcDecodable)]
 struct Footer {
-    file_index_to_stable_id: FxHashMap<SourceFileIndex, StableFilemapId>,
+    file_index_to_stable_id: FxHashMap<SourceFileIndex, StableSourceFileId>,
     prev_cnums: Vec<(u32, String, CrateDisambiguator)>,
     query_result_index: EncodedQueryResultIndex,
     diagnostics_index: EncodedQueryResultIndex,
@@ -174,14 +174,17 @@ pub fn serialize<'a, 'tcx, E>(&self,
         tcx.dep_graph.with_ignore(|| {
             // Allocate SourceFileIndices
             let (file_to_file_index, file_index_to_stable_id) = {
-                let mut file_to_file_index = FxHashMap::default();
-                let mut file_index_to_stable_id = FxHashMap::default();
+                let files = tcx.sess.source_map().files();
+                let mut file_to_file_index = FxHashMap::with_capacity_and_hasher(
+                    files.len(), Default::default());
+                let mut file_index_to_stable_id = FxHashMap::with_capacity_and_hasher(
+                    files.len(), Default::default());
 
-                for (index, file) in tcx.sess.source_map().files().iter().enumerate() {
+                for (index, file) in files.iter().enumerate() {
                     let index = SourceFileIndex(index as u32);
                     let file_ptr: *const SourceFile = &**file as *const _;
                     file_to_file_index.insert(file_ptr, index);
-                    file_index_to_stable_id.insert(index, StableFilemapId::new(&file));
+                    file_index_to_stable_id.insert(index, StableSourceFileId::new(&file));
                 }
 
                 (file_to_file_index, file_index_to_stable_id)
@@ -473,7 +476,7 @@ struct CacheDecoder<'a, 'tcx: 'a, 'x> {
     cnum_map: &'x IndexVec<CrateNum, Option<CrateNum>>,
     synthetic_expansion_infos: &'x Lock<FxHashMap<AbsoluteBytePos, SyntaxContext>>,
     file_index_to_file: &'x Lock<FxHashMap<SourceFileIndex, Lrc<SourceFile>>>,
-    file_index_to_stable_id: &'x FxHashMap<SourceFileIndex, StableFilemapId>,
+    file_index_to_stable_id: &'x FxHashMap<SourceFileIndex, StableSourceFileId>,
     alloc_decoding_session: AllocDecodingSession<'x>,
 }
 
index 1092e23ec3b1d4b182fd9447a7ab7c4731e15f0d..fc3353e339b4d77a27dbad8f0ce933cc656b44bc 100644 (file)
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 use rustc_data_structures::sync::{RwLock, ReadGuard, MappedReadGuard};
-use std::mem;
 
 /// The `Steal` struct is intended to used as the value for a query.
 /// Specifically, we sometimes have queries (*cough* MIR *cough*)
@@ -51,7 +50,7 @@ pub fn borrow(&self) -> MappedReadGuard<'_, T> {
 
     pub fn steal(&self) -> T {
         let value_ref = &mut *self.value.try_write().expect("stealing value which is locked");
-        let value = mem::replace(value_ref, None);
+        let value = value_ref.take();
         value.expect("attempt to read from stolen value")
     }
 }
index e1bfdf35b274e0d31ff7be040948e0319cf9d0bb..9dbf0ea9f438cb19b5b5ff4970ddf45b604e73a8 100644 (file)
@@ -22,8 +22,6 @@
 //! If you expect to store more than 1 element in the common case, steer clear
 //! and use a `Vec<T>`, `Box<[T]>`, or a `SmallVec<T>`.
 
-use std::mem;
-
 #[derive(Clone, Hash, Debug, PartialEq)]
 pub struct TinyList<T: PartialEq> {
     head: Option<Element<T>>
@@ -52,7 +50,7 @@ pub fn new_single(data: T) -> TinyList<T> {
     pub fn insert(&mut self, data: T) {
         self.head = Some(Element {
             data,
-            next: mem::replace(&mut self.head, None).map(Box::new),
+            next: self.head.take().map(Box::new)
         });
     }
 
@@ -60,7 +58,7 @@ pub fn insert(&mut self, data: T) {
     pub fn remove(&mut self, data: &T) -> bool {
         self.head = match self.head {
             Some(ref mut head) if head.data == *data => {
-                mem::replace(&mut head.next, None).map(|x| *x)
+                head.next.take().map(|x| *x)
             }
             Some(ref mut head) => return head.remove_next(data),
             None => return false,
@@ -100,7 +98,7 @@ fn remove_next(&mut self, data: &T) -> bool {
             if next.data != *data {
                 return next.remove_next(data)
             } else {
-                mem::replace(&mut next.next, None)
+                next.next.take()
             }
         } else {
             return false
index 5f275b700387360eaec802315d1fffc30a726853..720e8def5ab1c2a7d30abec1e97e67649736e39e 100644 (file)
@@ -120,7 +120,7 @@ fn to_color_choice(&self) -> ColorChoice {
 
 pub struct EmitterWriter {
     dst: Destination,
-    cm: Option<Lrc<SourceMapperDyn>>,
+    sm: Option<Lrc<SourceMapperDyn>>,
     short_message: bool,
     teach: bool,
     ui_testing: bool,
@@ -134,14 +134,14 @@ struct FileWithAnnotatedLines {
 
 impl EmitterWriter {
     pub fn stderr(color_config: ColorConfig,
-                  code_map: Option<Lrc<SourceMapperDyn>>,
+                  source_map: Option<Lrc<SourceMapperDyn>>,
                   short_message: bool,
                   teach: bool)
                   -> EmitterWriter {
         let dst = Destination::from_stderr(color_config);
         EmitterWriter {
             dst,
-            cm: code_map,
+            sm: source_map,
             short_message,
             teach,
             ui_testing: false,
@@ -149,13 +149,13 @@ pub fn stderr(color_config: ColorConfig,
     }
 
     pub fn new(dst: Box<dyn Write + Send>,
-               code_map: Option<Lrc<SourceMapperDyn>>,
+               source_map: Option<Lrc<SourceMapperDyn>>,
                short_message: bool,
                teach: bool)
                -> EmitterWriter {
         EmitterWriter {
             dst: Raw(dst),
-            cm: code_map,
+            sm: source_map,
             short_message,
             teach,
             ui_testing: false,
@@ -214,14 +214,14 @@ fn add_annotation_to_file(file_vec: &mut Vec<FileWithAnnotatedLines>,
         let mut output = vec![];
         let mut multiline_annotations = vec![];
 
-        if let Some(ref cm) = self.cm {
+        if let Some(ref sm) = self.sm {
             for span_label in msp.span_labels() {
                 if span_label.span.is_dummy() {
                     continue;
                 }
 
-                let lo = cm.lookup_char_pos(span_label.span.lo());
-                let mut hi = cm.lookup_char_pos(span_label.span.hi());
+                let lo = sm.lookup_char_pos(span_label.span.lo());
+                let mut hi = sm.lookup_char_pos(span_label.span.hi());
 
                 // Watch out for "empty spans". If we get a span like 6..6, we
                 // want to just display a `^` at 6, so convert that to
@@ -724,10 +724,10 @@ fn render_source_line(&self,
 
     fn get_multispan_max_line_num(&mut self, msp: &MultiSpan) -> usize {
         let mut max = 0;
-        if let Some(ref cm) = self.cm {
+        if let Some(ref sm) = self.sm {
             for primary_span in msp.primary_spans() {
                 if !primary_span.is_dummy() {
-                    let hi = cm.lookup_char_pos(primary_span.hi());
+                    let hi = sm.lookup_char_pos(primary_span.hi());
                     if hi.line > max {
                         max = hi.line;
                     }
@@ -736,7 +736,7 @@ fn get_multispan_max_line_num(&mut self, msp: &MultiSpan) -> usize {
             if !self.short_message {
                 for span_label in msp.span_labels() {
                     if !span_label.span.is_dummy() {
-                        let hi = cm.lookup_char_pos(span_label.span.hi());
+                        let hi = sm.lookup_char_pos(span_label.span.hi());
                         if hi.line > max {
                             max = hi.line;
                         }
@@ -768,7 +768,7 @@ fn fix_multispan_in_std_macros(&mut self,
                                    always_backtrace: bool) -> bool {
         let mut spans_updated = false;
 
-        if let Some(ref cm) = self.cm {
+        if let Some(ref sm) = self.sm {
             let mut before_after: Vec<(Span, Span)> = vec![];
             let mut new_labels: Vec<(Span, String)> = vec![];
 
@@ -777,7 +777,7 @@ fn fix_multispan_in_std_macros(&mut self,
                 if sp.is_dummy() {
                     continue;
                 }
-                let call_sp = cm.call_span_if_macro(*sp);
+                let call_sp = sm.call_span_if_macro(*sp);
                 if call_sp != *sp && !always_backtrace {
                     before_after.push((*sp, call_sp));
                 }
@@ -802,7 +802,7 @@ fn fix_multispan_in_std_macros(&mut self,
                                                      })));
                         }
                         // Check to make sure we're not in any <*macros>
-                        if !cm.span_to_filename(def_site).is_macros() &&
+                        if !sm.span_to_filename(def_site).is_macros() &&
                            !trace.macro_decl_name.starts_with("desugaring of ") &&
                            !trace.macro_decl_name.starts_with("#[") ||
                            always_backtrace {
@@ -829,7 +829,7 @@ fn fix_multispan_in_std_macros(&mut self,
                 if sp_label.span.is_dummy() {
                     continue;
                 }
-                if cm.span_to_filename(sp_label.span.clone()).is_macros() &&
+                if sm.span_to_filename(sp_label.span.clone()).is_macros() &&
                     !always_backtrace
                 {
                     let v = sp_label.span.macro_backtrace();
@@ -1000,10 +1000,10 @@ fn emit_message_default(&mut self,
         let mut annotated_files = self.preprocess_annotations(msp);
 
         // Make sure our primary file comes first
-        let (primary_lo, cm) = if let (Some(cm), Some(ref primary_span)) =
-            (self.cm.as_ref(), msp.primary_span().as_ref()) {
+        let (primary_lo, sm) = if let (Some(sm), Some(ref primary_span)) =
+            (self.sm.as_ref(), msp.primary_span().as_ref()) {
             if !primary_span.is_dummy() {
-                (cm.lookup_char_pos(primary_span.lo()), cm)
+                (sm.lookup_char_pos(primary_span.lo()), sm)
             } else {
                 emit_to_destination(&buffer.render(), level, &mut self.dst, self.short_message)?;
                 return Ok(());
@@ -1021,7 +1021,7 @@ fn emit_message_default(&mut self,
         // Print out the annotate source lines that correspond with the error
         for annotated_file in annotated_files {
             // we can't annotate anything if the source is unavailable.
-            if !cm.ensure_source_file_source_present(annotated_file.file.clone()) {
+            if !sm.ensure_source_file_source_present(annotated_file.file.clone()) {
                 continue;
             }
 
@@ -1038,7 +1038,7 @@ fn emit_message_default(&mut self,
                     buffer.append(buffer_msg_line_offset,
                                   &format!("{}:{}:{}",
                                            loc.file.name,
-                                           cm.doctest_offset_line(loc.line),
+                                           sm.doctest_offset_line(loc.line),
                                            loc.col.0 + 1),
                                   Style::LineAndColumn);
                     for _ in 0..max_line_num_len {
@@ -1048,7 +1048,7 @@ fn emit_message_default(&mut self,
                     buffer.prepend(0,
                                    &format!("{}:{}:{}: ",
                                             loc.file.name,
-                                            cm.doctest_offset_line(loc.line),
+                                            sm.doctest_offset_line(loc.line),
                                             loc.col.0 + 1),
                                    Style::LineAndColumn);
                 }
@@ -1069,7 +1069,7 @@ fn emit_message_default(&mut self,
                     };
                     format!("{}:{}{}",
                             annotated_file.file.name,
-                            cm.doctest_offset_line(first_line.line_index),
+                            sm.doctest_offset_line(first_line.line_index),
                             col)
                 } else {
                     annotated_file.file.name.to_string()
@@ -1194,7 +1194,7 @@ fn emit_suggestion_default(&mut self,
                                level: &Level,
                                max_line_num_len: usize)
                                -> io::Result<()> {
-        if let Some(ref cm) = self.cm {
+        if let Some(ref sm) = self.sm {
             let mut buffer = StyledBuffer::new();
 
             // Render the suggestion message
@@ -1210,7 +1210,7 @@ fn emit_suggestion_default(&mut self,
                                Some(Style::HeaderMsg));
 
             // Render the replacements for each suggestion
-            let suggestions = suggestion.splice_lines(&**cm);
+            let suggestions = suggestion.splice_lines(&**sm);
 
             let mut row_num = 2;
             for &(ref complete, ref parts) in suggestions.iter().take(MAX_SUGGESTIONS) {
@@ -1221,11 +1221,11 @@ fn emit_suggestion_default(&mut self,
                     && parts[0].snippet.trim() == complete.trim())
                     && complete.lines().count() == 1;
 
-                let lines = cm.span_to_lines(parts[0].span).unwrap();
+                let lines = sm.span_to_lines(parts[0].span).unwrap();
 
                 assert!(!lines.lines.is_empty());
 
-                let line_start = cm.lookup_char_pos(parts[0].span.lo()).line;
+                let line_start = sm.lookup_char_pos(parts[0].span.lo()).line;
                 draw_col_separator_no_space(&mut buffer, 1, max_line_num_len + 1);
                 let mut line_pos = 0;
                 let mut lines = complete.lines();
@@ -1250,8 +1250,8 @@ fn emit_suggestion_default(&mut self,
                 if show_underline {
                     draw_col_separator(&mut buffer, row_num, max_line_num_len + 1);
                     for part in parts {
-                        let span_start_pos = cm.lookup_char_pos(part.span.lo()).col_display;
-                        let span_end_pos = cm.lookup_char_pos(part.span.hi()).col_display;
+                        let span_start_pos = sm.lookup_char_pos(part.span.lo()).col_display;
+                        let span_end_pos = sm.lookup_char_pos(part.span.hi()).col_display;
 
                         // Do not underline the leading...
                         let start = part.snippet.len()
index 9bd95e8262fc63fd7ecfd13b683b70e371b3e9d9..0fb77a7a3ab526a59a5708fd78b51b05b353f40d 100644 (file)
@@ -129,7 +129,7 @@ pub trait SourceMapper {
     fn span_to_filename(&self, sp: Span) -> FileName;
     fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span>;
     fn call_span_if_macro(&self, sp: Span) -> Span;
-    fn ensure_source_file_source_present(&self, file_map: Lrc<SourceFile>) -> bool;
+    fn ensure_source_file_source_present(&self, source_file: Lrc<SourceFile>) -> bool;
     fn doctest_offset_line(&self, line: usize) -> usize;
 }
 
index 96d04253cc48549f3fd981e0a774ee922a21ab44..5950e19b0ee1d449562e8007ead16b09df8603dc 100644 (file)
@@ -278,10 +278,9 @@ fn check_unused_parens_expr(&self,
                                 msg: &str,
                                 followed_by_block: bool) {
         if let ast::ExprKind::Paren(ref inner) = value.node {
-            let necessary = followed_by_block && if let ast::ExprKind::Ret(_) = inner.node {
-                true
-            } else {
-                parser::contains_exterior_struct_lit(&inner)
+            let necessary = followed_by_block && match inner.node {
+                ast::ExprKind::Ret(_) | ast::ExprKind::Break(..) => true,
+                _ => parser::contains_exterior_struct_lit(&inner),
             };
             if !necessary {
                 let expr_text = if let Ok(snippet) = cx.sess().source_map()
index 6ef8b155458721e556496d62584a921c77586116..ddea7e522602492135d16e9f1001a4efec5c3e75 100644 (file)
@@ -1831,7 +1831,10 @@ fn check_access_permissions(
             | Write(wk @ WriteKind::StorageDeadOrDrop)
             | Write(wk @ WriteKind::MutableBorrow(BorrowKind::Shared))
             | Write(wk @ WriteKind::MutableBorrow(BorrowKind::Shallow)) => {
-                if let Err(_place_err) = self.is_mutable(place, is_local_mutation_allowed) {
+                if let (Err(_place_err), true) = (
+                    self.is_mutable(place, is_local_mutation_allowed),
+                    self.errors_buffer.is_empty()
+                ) {
                     if self.infcx.tcx.migrate_borrowck() {
                         // rust-lang/rust#46908: In pure NLL mode this
                         // code path should be unreachable (and thus
@@ -1855,12 +1858,11 @@ fn check_access_permissions(
                             location,
                         );
                     } else {
-                        self.infcx.tcx.sess.delay_span_bug(
+                        span_bug!(
                             span,
-                            &format!(
-                                "Accessing `{:?}` with the kind `{:?}` shouldn't be possible",
-                                place, kind
-                            ),
+                            "Accessing `{:?}` with the kind `{:?}` shouldn't be possible",
+                            place,
+                            kind,
                         );
                     }
                 }
index b71b131570d7b1133e322ada408936f56fbbdc28..7afe2c67adc9b8e5bbf26dcc892535986ec1d6bc 100644 (file)
@@ -180,9 +180,9 @@ pub(super) fn report_mutability_error(
             AccessKind::Move => {
                 err = self.infcx.tcx
                     .cannot_move_out_of(span, &(item_msg + &reason), Origin::Mir);
-                act = "move";
-                acted_on = "moved";
-                span
+                err.span_label(span, "cannot move");
+                err.buffer(&mut self.errors_buffer);
+                return;
             }
             AccessKind::Mutate => {
                 err = self.infcx.tcx
index 7db9c3f110272cd34982044c596f94825be524bb..38ab21b7c8c85bcf5728b46f2dc4ec4ab19162d8 100644 (file)
@@ -576,7 +576,11 @@ pub fn const_eval_provider<'a, 'tcx>(
         key.param_env.reveal = Reveal::UserFacing;
         match tcx.const_eval(key) {
             // try again with reveal all as requested
-            Err(ErrorHandled::TooGeneric) => {},
+            Err(ErrorHandled::TooGeneric) => {
+                // Promoteds should never be "too generic" when getting evaluated.
+                // They either don't get evaluated, or we are in a monomorphic context
+                assert!(key.value.promoted.is_none());
+            },
             // dedupliate calls
             other => return other,
         }
index 226717538a29484e9e793af4bb882751d43549cc..9d86e737dd5b6aa8acd953ce895f6f055beb1896 100644 (file)
@@ -303,7 +303,8 @@ fn validate_scalar_layout(
         let (lo, hi) = layout.valid_range.clone().into_inner();
         let max_hi = u128::max_value() >> (128 - size.bits()); // as big as the size fits
         assert!(hi <= max_hi);
-        if lo == 0 && hi == max_hi {
+        // We could also write `(hi + 1) % (max_hi + 1) == lo` but `max_hi + 1` overflows for `u128`
+        if (lo == 0 && hi == max_hi) || (hi + 1 == lo) {
             // Nothing to check
             return Ok(());
         }
index 0958a958986933d589232710c7e7fb9eda4e7e89..d9ab23844918d02c2d0e719f1c22e7eae403c53d 100644 (file)
@@ -35,9 +35,14 @@ pub fn target() -> TargetResult {
             no_integrated_as: true,
 
             // There are no atomic CAS instructions available in the MSP430
-            // instruction set
-            max_atomic_width: Some(16),
+            // instruction set, and the LLVM backend doesn't currently support
+            // compiler fences so the Atomic* API is missing on this target.
+            // When the LLVM backend gains support for compile fences uncomment
+            // the `singlethread: true` line and set `max_atomic_width` to
+            // `Some(16)`.
+            max_atomic_width: Some(0),
             atomic_cas: false,
+            // singlethread: true,
 
             // Because these devices have very little resources having an
             // unwinder is too onerous so we default to "abort" because the
index ad0a54e392f583ed55d483180a87a3d9f688ea32..cde08f6832ace274442b89c18e51996c782ed491 100644 (file)
@@ -159,14 +159,14 @@ fn implied_bounds_from_components(
 ) -> Vec<OutlivesBound<'tcx>> {
     sup_components
         .into_iter()
-        .flat_map(|component| {
+        .filter_map(|component| {
             match component {
                 Component::Region(r) =>
-                    vec![OutlivesBound::RegionSubRegion(sub_region, r)],
+                    Some(OutlivesBound::RegionSubRegion(sub_region, r)),
                 Component::Param(p) =>
-                    vec![OutlivesBound::RegionSubParam(sub_region, p)],
+                    Some(OutlivesBound::RegionSubParam(sub_region, p)),
                 Component::Projection(p) =>
-                    vec![OutlivesBound::RegionSubProjection(sub_region, p)],
+                    Some(OutlivesBound::RegionSubProjection(sub_region, p)),
                 Component::EscapingProjection(_) =>
                 // If the projection has escaping regions, don't
                 // try to infer any implied bounds even for its
@@ -176,9 +176,9 @@ fn implied_bounds_from_components(
                 // idea is that the WAY that the caller proves
                 // that may change in the future and we want to
                 // give ourselves room to get smarter here.
-                    vec![],
+                    None,
                 Component::UnresolvedInferenceVariable(..) =>
-                    vec![],
+                    None,
             }
         })
         .collect()
index 1978f86545e7bfc5d4372273401a45675b1e2891..7ddc56974d816157abbf594c8c15c24f7d52765e 100644 (file)
@@ -1112,12 +1112,12 @@ fn find_bound_for_assoc_item(&self,
     {
         let tcx = self.tcx();
 
-        let bounds: Vec<_> = self.get_type_parameter_bounds(span, ty_param_def_id)
-            .predicates.into_iter().filter_map(|(p, _)| p.to_opt_poly_trait_ref()).collect();
+        let bounds = self.get_type_parameter_bounds(span, ty_param_def_id)
+            .predicates.into_iter().filter_map(|(p, _)| p.to_opt_poly_trait_ref());
 
         // Check that there is exactly one way to find an associated type with the
         // correct name.
-        let suitable_bounds = traits::transitive_bounds(tcx, &bounds)
+        let suitable_bounds = traits::transitive_bounds(tcx, bounds)
             .filter(|b| self.trait_defines_associated_type_named(b.def_id(), assoc_name));
 
         let param_node_id = tcx.hir.as_local_node_id(ty_param_def_id).unwrap();
index c506f23078f25fe32a3735103a85a84c4411f577..5a8a9632350f2621959bd8d811a3a36b98574c24 100644 (file)
@@ -31,6 +31,7 @@
 use syntax::ast;
 use syntax::util::lev_distance::{lev_distance, find_best_match_for_name};
 use syntax_pos::{Span, symbol::Symbol};
+use std::iter;
 use std::mem;
 use std::ops::Deref;
 use std::rc::Rc;
@@ -627,7 +628,7 @@ fn assemble_inherent_candidates_from_object(&mut self,
         // itself. Hence, a `&self` method will wind up with an
         // argument type like `&Trait`.
         let trait_ref = principal.with_self_ty(self.tcx, self_ty);
-        self.elaborate_bounds(&[trait_ref], |this, new_trait_ref, item| {
+        self.elaborate_bounds(iter::once(trait_ref), |this, new_trait_ref, item| {
             let new_trait_ref = this.erase_late_bound_regions(&new_trait_ref);
 
             let (xform_self_ty, xform_ret_ty) =
@@ -645,7 +646,7 @@ fn assemble_inherent_candidates_from_param(&mut self,
                                                param_ty: ty::ParamTy) {
         // FIXME -- Do we want to commit to this behavior for param bounds?
 
-        let bounds: Vec<_> = self.param_env
+        let bounds = self.param_env
             .caller_bounds
             .iter()
             .filter_map(|predicate| {
@@ -667,10 +668,9 @@ fn assemble_inherent_candidates_from_param(&mut self,
                     ty::Predicate::TypeOutlives(..) |
                     ty::Predicate::ConstEvaluatable(..) => None,
                 }
-            })
-            .collect();
+            });
 
-        self.elaborate_bounds(&bounds, |this, poly_trait_ref, item| {
+        self.elaborate_bounds(bounds, |this, poly_trait_ref, item| {
             let trait_ref = this.erase_late_bound_regions(&poly_trait_ref);
 
             let (xform_self_ty, xform_ret_ty) =
@@ -693,15 +693,16 @@ fn assemble_inherent_candidates_from_param(&mut self,
 
     // Do a search through a list of bounds, using a callback to actually
     // create the candidates.
-    fn elaborate_bounds<F>(&mut self, bounds: &[ty::PolyTraitRef<'tcx>], mut mk_cand: F)
+    fn elaborate_bounds<F>(&mut self,
+                           bounds: impl Iterator<Item = ty::PolyTraitRef<'tcx>>,
+                           mut mk_cand: F)
         where F: for<'b> FnMut(&mut ProbeContext<'b, 'gcx, 'tcx>,
                                ty::PolyTraitRef<'tcx>,
                                ty::AssociatedItem)
     {
-        debug!("elaborate_bounds(bounds={:?})", bounds);
-
         let tcx = self.tcx;
         for bound_trait_ref in traits::transitive_bounds(tcx, bounds) {
+            debug!("elaborate_bounds(bound_trait_ref={:?})", bound_trait_ref);
             for item in self.impl_or_trait_item(bound_trait_ref.def_id()) {
                 if !self.has_applicable_self(&item) {
                     self.record_static_candidate(TraitSource(bound_trait_ref.def_id()));
@@ -831,7 +832,7 @@ fn pick(mut self) -> PickResult<'tcx> {
         }
 
         let static_candidates = mem::replace(&mut self.static_candidates, vec![]);
-        let private_candidate = mem::replace(&mut self.private_candidate, None);
+        let private_candidate = self.private_candidate.take();
         let unsatisfied_predicates = mem::replace(&mut self.unsatisfied_predicates, vec![]);
 
         // things failed, so lets look at all traits, for diagnostic purposes now:
index 7e25694d5598fc9b00a0c7b13a5af14a701fe583..4851938653b53d33eeebd38b78dd083c3a76234d 100644 (file)
@@ -3510,10 +3510,9 @@ fn check_expr_struct_fields(&self,
             _ => span_bug!(span, "non-ADT passed to check_expr_struct_fields")
         };
 
-        let mut remaining_fields = FxHashMap::default();
-        for (i, field) in variant.fields.iter().enumerate() {
-            remaining_fields.insert(field.ident.modern(), (i, field));
-        }
+        let mut remaining_fields = variant.fields.iter().enumerate().map(|(i, field)|
+            (field.ident.modern(), (i, field))
+        ).collect::<FxHashMap<_, _>>();
 
         let mut seen_fields = FxHashMap::default();
 
@@ -5051,10 +5050,8 @@ pub fn instantiate_value_path(&self,
         // provided (if any) into their appropriate spaces. We'll also report
         // errors if type parameters are provided in an inappropriate place.
 
-        let mut generic_segs = FxHashSet::default();
-        for PathSeg(_, index) in &path_segs {
-            generic_segs.insert(index);
-        }
+        let generic_segs = path_segs.iter().map(|PathSeg(_, index)| index)
+            .collect::<FxHashSet<_>>();
         AstConv::prohibit_generics(self, segments.iter().enumerate().filter_map(|(index, seg)| {
             if !generic_segs.contains(&index) {
                 Some(seg)
index b0cf29e9f63a4a2322467778dba3767ca543a29a..a32682967c7409de4d28874a3dd1d9aabff8796e 100644 (file)
 pub struct JsonEmitter {
     dst: Box<dyn Write + Send>,
     registry: Option<Registry>,
-    cm: Lrc<dyn SourceMapper + sync::Send + sync::Sync>,
+    sm: Lrc<dyn SourceMapper + sync::Send + sync::Sync>,
     pretty: bool,
     ui_testing: bool,
 }
 
 impl JsonEmitter {
     pub fn stderr(registry: Option<Registry>,
-                  code_map: Lrc<SourceMap>,
+                  source_map: Lrc<SourceMap>,
                   pretty: bool) -> JsonEmitter {
         JsonEmitter {
             dst: Box::new(io::stderr()),
             registry,
-            cm: code_map,
+            sm: source_map,
             pretty,
             ui_testing: false,
         }
@@ -62,12 +62,12 @@ pub fn basic(pretty: bool) -> JsonEmitter {
 
     pub fn new(dst: Box<dyn Write + Send>,
                registry: Option<Registry>,
-               code_map: Lrc<SourceMap>,
+               source_map: Lrc<SourceMap>,
                pretty: bool) -> JsonEmitter {
         JsonEmitter {
             dst,
             registry,
-            cm: code_map,
+            sm: source_map,
             pretty,
             ui_testing: false,
         }
@@ -199,7 +199,7 @@ fn flush(&mut self) -> io::Result<()> {
         }
         let buf = BufWriter::default();
         let output = buf.clone();
-        EmitterWriter::new(Box::new(buf), Some(je.cm.clone()), false, false)
+        EmitterWriter::new(Box::new(buf), Some(je.sm.clone()), false, false)
             .ui_testing(je.ui_testing).emit(db);
         let output = Arc::try_unwrap(output.0).unwrap().into_inner().unwrap();
         let output = String::from_utf8(output).unwrap();
@@ -269,8 +269,8 @@ fn from_span_full(span: Span,
                       mut backtrace: vec::IntoIter<MacroBacktrace>,
                       je: &JsonEmitter)
                       -> DiagnosticSpan {
-        let start = je.cm.lookup_char_pos(span.lo());
-        let end = je.cm.lookup_char_pos(span.hi());
+        let start = je.sm.lookup_char_pos(span.lo());
+        let end = je.sm.lookup_char_pos(span.hi());
         let backtrace_step = backtrace.next().map(|bt| {
             let call_site =
                 Self::from_span_full(bt.call_site,
@@ -356,7 +356,7 @@ fn line_from_source_file(fm: &syntax_pos::SourceFile,
     /// of `span` gets a DiagnosticSpanLine, with the highlight indicating the
     /// `span` within the line.
     fn from_span(span: Span, je: &JsonEmitter) -> Vec<DiagnosticSpanLine> {
-        je.cm.span_to_lines(span)
+        je.sm.span_to_lines(span)
              .map(|lines| {
                  let fm = &*lines.file;
                  lines.lines
index a814c88ee78216babc4db391df90667d0efabcf7..465ce73e01de20d6dc0097eab8c6db41f8bfc342 100644 (file)
@@ -256,11 +256,11 @@ pub fn retokenize(sess: &'a ParseSess, mut span: Span) -> Self {
         let end = sess.source_map().lookup_byte_offset(span.hi());
 
         // Make the range zero-length if the span is invalid.
-        if span.lo() > span.hi() || begin.fm.start_pos != end.fm.start_pos {
+        if span.lo() > span.hi() || begin.sf.start_pos != end.sf.start_pos {
             span = span.shrink_to_lo();
         }
 
-        let mut sr = StringReader::new_raw_internal(sess, begin.fm, None);
+        let mut sr = StringReader::new_raw_internal(sess, begin.sf, None);
 
         // Seek the lexer to the right byte range.
         sr.next_pos = span.lo();
@@ -640,9 +640,9 @@ fn scan_comment(&mut self) -> Option<TokenAndSpan> {
 
                 // I guess this is the only way to figure out if
                 // we're at the beginning of the file...
-                let cmap = SourceMap::new(FilePathMapping::empty());
-                cmap.files.borrow_mut().file_maps.push(self.source_file.clone());
-                let loc = cmap.lookup_char_pos_adj(self.pos);
+                let smap = SourceMap::new(FilePathMapping::empty());
+                smap.files.borrow_mut().source_files.push(self.source_file.clone());
+                let loc = smap.lookup_char_pos_adj(self.pos);
                 debug!("Skipping a shebang");
                 if loc.line == 1 && loc.col == CharPos(0) {
                     // FIXME: Add shebang "token", return it
@@ -1855,9 +1855,9 @@ mod tests {
     use rustc_data_structures::fx::FxHashSet;
     use rustc_data_structures::sync::Lock;
     use with_globals;
-    fn mk_sess(cm: Lrc<SourceMap>) -> ParseSess {
+    fn mk_sess(sm: Lrc<SourceMap>) -> ParseSess {
         let emitter = errors::emitter::EmitterWriter::new(Box::new(io::sink()),
-                                                          Some(cm.clone()),
+                                                          Some(sm.clone()),
                                                           false,
                                                           false);
         ParseSess {
@@ -1865,7 +1865,7 @@ fn mk_sess(cm: Lrc<SourceMap>) -> ParseSess {
             unstable_features: UnstableFeatures::from_environment(),
             config: CrateConfig::default(),
             included_mod_stack: Lock::new(Vec::new()),
-            code_map: cm,
+            source_map: sm,
             missing_fragment_specifiers: Lock::new(FxHashSet::default()),
             raw_identifier_spans: Lock::new(Vec::new()),
             registered_diagnostics: Lock::new(ErrorMap::new()),
@@ -1875,20 +1875,20 @@ fn mk_sess(cm: Lrc<SourceMap>) -> ParseSess {
     }
 
     // open a string reader for the given string
-    fn setup<'a>(cm: &SourceMap,
+    fn setup<'a>(sm: &SourceMap,
                  sess: &'a ParseSess,
                  teststr: String)
                  -> StringReader<'a> {
-        let fm = cm.new_source_file(PathBuf::from("zebra.rs").into(), teststr);
-        StringReader::new(sess, fm, None)
+        let sf = sm.new_source_file(PathBuf::from("zebra.rs").into(), teststr);
+        StringReader::new(sess, sf, None)
     }
 
     #[test]
     fn t1() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            let mut string_reader = setup(&cm,
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            let mut string_reader = setup(&sm,
                                         &sh,
                                         "/* my source file */ fn main() { println!(\"zebra\"); }\n"
                                             .to_string());
@@ -1934,9 +1934,9 @@ fn mk_ident(id: &str) -> token::Token {
     #[test]
     fn doublecolonparsing() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            check_tokenization(setup(&cm, &sh, "a b".to_string()),
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            check_tokenization(setup(&sm, &sh, "a b".to_string()),
                             vec![mk_ident("a"), token::Whitespace, mk_ident("b")]);
         })
     }
@@ -1944,9 +1944,9 @@ fn doublecolonparsing() {
     #[test]
     fn dcparsing_2() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            check_tokenization(setup(&cm, &sh, "a::b".to_string()),
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            check_tokenization(setup(&sm, &sh, "a::b".to_string()),
                             vec![mk_ident("a"), token::ModSep, mk_ident("b")]);
         })
     }
@@ -1954,9 +1954,9 @@ fn dcparsing_2() {
     #[test]
     fn dcparsing_3() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            check_tokenization(setup(&cm, &sh, "a ::b".to_string()),
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            check_tokenization(setup(&sm, &sh, "a ::b".to_string()),
                             vec![mk_ident("a"), token::Whitespace, token::ModSep, mk_ident("b")]);
         })
     }
@@ -1964,9 +1964,9 @@ fn dcparsing_3() {
     #[test]
     fn dcparsing_4() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            check_tokenization(setup(&cm, &sh, "a:: b".to_string()),
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            check_tokenization(setup(&sm, &sh, "a:: b".to_string()),
                             vec![mk_ident("a"), token::ModSep, token::Whitespace, mk_ident("b")]);
         })
     }
@@ -1974,9 +1974,9 @@ fn dcparsing_4() {
     #[test]
     fn character_a() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            assert_eq!(setup(&cm, &sh, "'a'".to_string()).next_token().tok,
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            assert_eq!(setup(&sm, &sh, "'a'".to_string()).next_token().tok,
                     token::Literal(token::Char(Symbol::intern("a")), None));
         })
     }
@@ -1984,9 +1984,9 @@ fn character_a() {
     #[test]
     fn character_space() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            assert_eq!(setup(&cm, &sh, "' '".to_string()).next_token().tok,
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            assert_eq!(setup(&sm, &sh, "' '".to_string()).next_token().tok,
                     token::Literal(token::Char(Symbol::intern(" ")), None));
         })
     }
@@ -1994,9 +1994,9 @@ fn character_space() {
     #[test]
     fn character_escaped() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            assert_eq!(setup(&cm, &sh, "'\\n'".to_string()).next_token().tok,
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            assert_eq!(setup(&sm, &sh, "'\\n'".to_string()).next_token().tok,
                     token::Literal(token::Char(Symbol::intern("\\n")), None));
         })
     }
@@ -2004,9 +2004,9 @@ fn character_escaped() {
     #[test]
     fn lifetime_name() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            assert_eq!(setup(&cm, &sh, "'abc".to_string()).next_token().tok,
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            assert_eq!(setup(&sm, &sh, "'abc".to_string()).next_token().tok,
                     token::Lifetime(Ident::from_str("'abc")));
         })
     }
@@ -2014,9 +2014,9 @@ fn lifetime_name() {
     #[test]
     fn raw_string() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            assert_eq!(setup(&cm, &sh, "r###\"\"#a\\b\x00c\"\"###".to_string())
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            assert_eq!(setup(&sm, &sh, "r###\"\"#a\\b\x00c\"\"###".to_string())
                         .next_token()
                         .tok,
                     token::Literal(token::StrRaw(Symbol::intern("\"#a\\b\x00c\""), 3), None));
@@ -2026,15 +2026,15 @@ fn raw_string() {
     #[test]
     fn literal_suffixes() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
             macro_rules! test {
                 ($input: expr, $tok_type: ident, $tok_contents: expr) => {{
-                    assert_eq!(setup(&cm, &sh, format!("{}suffix", $input)).next_token().tok,
+                    assert_eq!(setup(&sm, &sh, format!("{}suffix", $input)).next_token().tok,
                             token::Literal(token::$tok_type(Symbol::intern($tok_contents)),
                                             Some(Symbol::intern("suffix"))));
                     // with a whitespace separator:
-                    assert_eq!(setup(&cm, &sh, format!("{} suffix", $input)).next_token().tok,
+                    assert_eq!(setup(&sm, &sh, format!("{} suffix", $input)).next_token().tok,
                             token::Literal(token::$tok_type(Symbol::intern($tok_contents)),
                                             None));
                 }}
@@ -2050,13 +2050,13 @@ macro_rules! test {
             test!("1.0", Float, "1.0");
             test!("1.0e10", Float, "1.0e10");
 
-            assert_eq!(setup(&cm, &sh, "2us".to_string()).next_token().tok,
+            assert_eq!(setup(&sm, &sh, "2us".to_string()).next_token().tok,
                     token::Literal(token::Integer(Symbol::intern("2")),
                                     Some(Symbol::intern("us"))));
-            assert_eq!(setup(&cm, &sh, "r###\"raw\"###suffix".to_string()).next_token().tok,
+            assert_eq!(setup(&sm, &sh, "r###\"raw\"###suffix".to_string()).next_token().tok,
                     token::Literal(token::StrRaw(Symbol::intern("raw"), 3),
                                     Some(Symbol::intern("suffix"))));
-            assert_eq!(setup(&cm, &sh, "br###\"raw\"###suffix".to_string()).next_token().tok,
+            assert_eq!(setup(&sm, &sh, "br###\"raw\"###suffix".to_string()).next_token().tok,
                     token::Literal(token::ByteStrRaw(Symbol::intern("raw"), 3),
                                     Some(Symbol::intern("suffix"))));
         })
@@ -2072,9 +2072,9 @@ fn line_doc_comments() {
     #[test]
     fn nested_block_comments() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            let mut lexer = setup(&cm, &sh, "/* /* */ */'a'".to_string());
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            let mut lexer = setup(&sm, &sh, "/* /* */ */'a'".to_string());
             match lexer.next_token().tok {
                 token::Comment => {}
                 _ => panic!("expected a comment!"),
@@ -2087,9 +2087,9 @@ fn nested_block_comments() {
     #[test]
     fn crlf_comments() {
         with_globals(|| {
-            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-            let sh = mk_sess(cm.clone());
-            let mut lexer = setup(&cm, &sh, "// test\r\n/// test\r\n".to_string());
+            let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+            let sh = mk_sess(sm.clone());
+            let mut lexer = setup(&sm, &sh, "// test\r\n/// test\r\n".to_string());
             let comment = lexer.next_token();
             assert_eq!(comment.tok, token::Comment);
             assert_eq!((comment.sp.lo(), comment.sp.hi()), (BytePos(0), BytePos(7)));
index 77a2ae6acf00b680e4028bd5d98012f20b225980..ce32520b8e74603e3f58a25cbe4fb34e4ba1b5f7 100644 (file)
@@ -57,7 +57,7 @@ pub struct ParseSess {
     pub non_modrs_mods: Lock<Vec<(ast::Ident, Span)>>,
     /// Used to determine and report recursive mod inclusions
     included_mod_stack: Lock<Vec<PathBuf>>,
-    code_map: Lrc<SourceMap>,
+    source_map: Lrc<SourceMap>,
     pub buffered_lints: Lock<Vec<BufferedEarlyLint>>,
 }
 
@@ -71,7 +71,7 @@ pub fn new(file_path_mapping: FilePathMapping) -> Self {
         ParseSess::with_span_handler(handler, cm)
     }
 
-    pub fn with_span_handler(handler: Handler, code_map: Lrc<SourceMap>) -> ParseSess {
+    pub fn with_span_handler(handler: Handler, source_map: Lrc<SourceMap>) -> ParseSess {
         ParseSess {
             span_diagnostic: handler,
             unstable_features: UnstableFeatures::from_environment(),
@@ -80,14 +80,14 @@ pub fn with_span_handler(handler: Handler, code_map: Lrc<SourceMap>) -> ParseSes
             raw_identifier_spans: Lock::new(Vec::new()),
             registered_diagnostics: Lock::new(ErrorMap::new()),
             included_mod_stack: Lock::new(vec![]),
-            code_map,
+            source_map,
             non_modrs_mods: Lock::new(vec![]),
             buffered_lints: Lock::new(vec![]),
         }
     }
 
     pub fn source_map(&self) -> &SourceMap {
-        &self.code_map
+        &self.source_map
     }
 
     pub fn buffer_lint<S: Into<MultiSpan>>(&self,
index 17586a442daa9b4de42755fa4dc0b3d414dfa9dd..e8cacc3b5aff31e4d4560491c3574ae68cffdc9e 100644 (file)
@@ -106,17 +106,17 @@ fn read_file(&self, path: &Path) -> io::Result<String> {
 // subsequent compilation sessions (which is something we need to do during
 // incremental compilation).
 #[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug)]
-pub struct StableFilemapId(u128);
+pub struct StableSourceFileId(u128);
 
-impl StableFilemapId {
-    pub fn new(source_file: &SourceFile) -> StableFilemapId {
+impl StableSourceFileId {
+    pub fn new(source_file: &SourceFile) -> StableSourceFileId {
         let mut hasher = StableHasher::new();
 
         source_file.name.hash(&mut hasher);
         source_file.name_was_remapped.hash(&mut hasher);
         source_file.unmapped_path.hash(&mut hasher);
 
-        StableFilemapId(hasher.finish())
+        StableSourceFileId(hasher.finish())
     }
 }
 
@@ -126,8 +126,8 @@ pub fn new(source_file: &SourceFile) -> StableFilemapId {
 
 #[derive(Default)]
 pub(super) struct SourceMapFiles {
-    pub(super) file_maps: Vec<Lrc<SourceFile>>,
-    stable_id_to_source_file: FxHashMap<StableFilemapId, Lrc<SourceFile>>
+    pub(super) source_files: Vec<Lrc<SourceFile>>,
+    stable_id_to_source_file: FxHashMap<StableSourceFileId, Lrc<SourceFile>>
 }
 
 pub struct SourceMap {
@@ -190,15 +190,16 @@ pub fn load_file(&self, path: &Path) -> io::Result<Lrc<SourceFile>> {
     }
 
     pub fn files(&self) -> MappedLockGuard<Vec<Lrc<SourceFile>>> {
-        LockGuard::map(self.files.borrow(), |files| &mut files.file_maps)
+        LockGuard::map(self.files.borrow(), |files| &mut files.source_files)
     }
 
-    pub fn source_file_by_stable_id(&self, stable_id: StableFilemapId) -> Option<Lrc<SourceFile>> {
-        self.files.borrow().stable_id_to_source_file.get(&stable_id).map(|fm| fm.clone())
+    pub fn source_file_by_stable_id(&self, stable_id: StableSourceFileId) ->
+    Option<Lrc<SourceFile>> {
+        self.files.borrow().stable_id_to_source_file.get(&stable_id).map(|sf| sf.clone())
     }
 
     fn next_start_pos(&self) -> usize {
-        match self.files.borrow().file_maps.last() {
+        match self.files.borrow().source_files.last() {
             None => 0,
             // Add one so there is some space between files. This lets us distinguish
             // positions in the source_map, even in the presence of zero-length files.
@@ -235,8 +236,8 @@ pub fn new_source_file(&self, filename: FileName, src: String) -> Lrc<SourceFile
 
         let mut files = self.files.borrow_mut();
 
-        files.file_maps.push(source_file.clone());
-        files.stable_id_to_source_file.insert(StableFilemapId::new(&source_file),
+        files.source_files.push(source_file.clone());
+        files.stable_id_to_source_file.insert(StableSourceFileId::new(&source_file),
                                               source_file.clone());
 
         source_file
@@ -293,8 +294,8 @@ pub fn new_imported_source_file(
 
         let mut files = self.files.borrow_mut();
 
-        files.file_maps.push(source_file.clone());
-        files.stable_id_to_source_file.insert(StableFilemapId::new(&source_file),
+        files.source_files.push(source_file.clone());
+        files.stable_id_to_source_file.insert(StableSourceFileId::new(&source_file),
                                               source_file.clone());
 
         source_file
@@ -324,7 +325,7 @@ pub fn doctest_offset_line(&self, mut orig: usize) -> usize {
     pub fn lookup_char_pos(&self, pos: BytePos) -> Loc {
         let chpos = self.bytepos_to_file_charpos(pos);
         match self.lookup_line(pos) {
-            Ok(SourceFileAndLine { fm: f, line: a }) => {
+            Ok(SourceFileAndLine { sf: f, line: a }) => {
                 let line = a + 1; // Line numbers start at 1
                 let linebpos = f.lines[a];
                 let linechpos = self.bytepos_to_file_charpos(linebpos);
@@ -387,10 +388,10 @@ pub fn lookup_char_pos(&self, pos: BytePos) -> Loc {
     pub fn lookup_line(&self, pos: BytePos) -> Result<SourceFileAndLine, Lrc<SourceFile>> {
         let idx = self.lookup_source_file_idx(pos);
 
-        let f = (*self.files.borrow().file_maps)[idx].clone();
+        let f = (*self.files.borrow().source_files)[idx].clone();
 
         match f.lookup_line(pos) {
-            Some(line) => Ok(SourceFileAndLine { fm: f, line: line }),
+            Some(line) => Ok(SourceFileAndLine { sf: f, line: line }),
             None => Err(f)
         }
     }
@@ -441,7 +442,7 @@ pub fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span> {
     }
 
     pub fn span_to_string(&self, sp: Span) -> String {
-        if self.files.borrow().file_maps.is_empty() && sp.is_dummy() {
+        if self.files.borrow().source_files.is_empty() && sp.is_dummy() {
             return "no-location".to_string();
         }
 
@@ -531,38 +532,38 @@ fn span_to_source<F>(&self, sp: Span, extract_source: F) -> Result<String, SpanS
         let local_begin = self.lookup_byte_offset(sp.lo());
         let local_end = self.lookup_byte_offset(sp.hi());
 
-        if local_begin.fm.start_pos != local_end.fm.start_pos {
+        if local_begin.sf.start_pos != local_end.sf.start_pos {
             return Err(SpanSnippetError::DistinctSources(DistinctSources {
-                begin: (local_begin.fm.name.clone(),
-                        local_begin.fm.start_pos),
-                end: (local_end.fm.name.clone(),
-                      local_end.fm.start_pos)
+                begin: (local_begin.sf.name.clone(),
+                        local_begin.sf.start_pos),
+                end: (local_end.sf.name.clone(),
+                      local_end.sf.start_pos)
             }));
         } else {
-            self.ensure_source_file_source_present(local_begin.fm.clone());
+            self.ensure_source_file_source_present(local_begin.sf.clone());
 
             let start_index = local_begin.pos.to_usize();
             let end_index = local_end.pos.to_usize();
-            let source_len = (local_begin.fm.end_pos -
-                              local_begin.fm.start_pos).to_usize();
+            let source_len = (local_begin.sf.end_pos -
+                              local_begin.sf.start_pos).to_usize();
 
             if start_index > end_index || end_index > source_len {
-                return Err(SpanSnippetError::MalformedForCodemap(
-                    MalformedCodemapPositions {
-                        name: local_begin.fm.name.clone(),
+                return Err(SpanSnippetError::MalformedForSourcemap(
+                    MalformedSourceMapPositions {
+                        name: local_begin.sf.name.clone(),
                         source_len,
                         begin_pos: local_begin.pos,
                         end_pos: local_end.pos,
                     }));
             }
 
-            if let Some(ref src) = local_begin.fm.src {
+            if let Some(ref src) = local_begin.sf.src {
                 return Ok(extract_source(src, start_index, end_index));
-            } else if let Some(src) = local_begin.fm.external_src.borrow().get_source() {
+            } else if let Some(src) = local_begin.sf.external_src.borrow().get_source() {
                 return Ok(extract_source(src, start_index, end_index));
             } else {
                 return Err(SpanSnippetError::SourceNotAvailable {
-                    filename: local_begin.fm.name.clone()
+                    filename: local_begin.sf.name.clone()
                 });
             }
         }
@@ -757,7 +758,7 @@ fn find_width_of_character_at_span(&self, sp: Span, forwards: bool) -> u32 {
             return 1;
         }
 
-        let source_len = (local_begin.fm.end_pos - local_begin.fm.start_pos).to_usize();
+        let source_len = (local_begin.sf.end_pos - local_begin.sf.start_pos).to_usize();
         debug!("find_width_of_character_at_span: source_len=`{:?}`", source_len);
         // Ensure indexes are also not malformed.
         if start_index > end_index || end_index > source_len {
@@ -765,11 +766,11 @@ fn find_width_of_character_at_span(&self, sp: Span, forwards: bool) -> u32 {
             return 1;
         }
 
-        let src = local_begin.fm.external_src.borrow();
+        let src = local_begin.sf.external_src.borrow();
 
         // We need to extend the snippet to the end of the src rather than to end_index so when
         // searching forwards for boundaries we've got somewhere to search.
-        let snippet = if let Some(ref src) = local_begin.fm.src {
+        let snippet = if let Some(ref src) = local_begin.sf.src {
             let len = src.len();
             (&src[start_index..len])
         } else if let Some(src) = src.get_source() {
@@ -806,9 +807,9 @@ fn find_width_of_character_at_span(&self, sp: Span, forwards: bool) -> u32 {
     }
 
     pub fn get_source_file(&self, filename: &FileName) -> Option<Lrc<SourceFile>> {
-        for fm in self.files.borrow().file_maps.iter() {
-            if *filename == fm.name {
-                return Some(fm.clone());
+        for sf in self.files.borrow().source_files.iter() {
+            if *filename == sf.name {
+                return Some(sf.clone());
             }
         }
         None
@@ -817,15 +818,15 @@ pub fn get_source_file(&self, filename: &FileName) -> Option<Lrc<SourceFile>> {
     /// For a global BytePos compute the local offset within the containing SourceFile
     pub fn lookup_byte_offset(&self, bpos: BytePos) -> SourceFileAndBytePos {
         let idx = self.lookup_source_file_idx(bpos);
-        let fm = (*self.files.borrow().file_maps)[idx].clone();
-        let offset = bpos - fm.start_pos;
-        SourceFileAndBytePos {fm: fm, pos: offset}
+        let sf = (*self.files.borrow().source_files)[idx].clone();
+        let offset = bpos - sf.start_pos;
+        SourceFileAndBytePos {sf: sf, pos: offset}
     }
 
     /// Converts an absolute BytePos to a CharPos relative to the source_file.
     pub fn bytepos_to_file_charpos(&self, bpos: BytePos) -> CharPos {
         let idx = self.lookup_source_file_idx(bpos);
-        let map = &(*self.files.borrow().file_maps)[idx];
+        let map = &(*self.files.borrow().source_files)[idx];
 
         // The number of extra bytes due to multibyte chars in the SourceFile
         let mut total_extra_bytes = 0;
@@ -851,7 +852,7 @@ pub fn bytepos_to_file_charpos(&self, bpos: BytePos) -> CharPos {
     // Return the index of the source_file (in self.files) which contains pos.
     pub fn lookup_source_file_idx(&self, pos: BytePos) -> usize {
         let files = self.files.borrow();
-        let files = &files.file_maps;
+        let files = &files.source_files;
         let count = files.len();
 
         // Binary search for the source_file.
@@ -974,9 +975,9 @@ fn call_span_if_macro(&self, sp: Span) -> Span {
         }
         sp
     }
-    fn ensure_source_file_source_present(&self, file_map: Lrc<SourceFile>) -> bool {
-        file_map.add_external_src(
-            || match file_map.name {
+    fn ensure_source_file_source_present(&self, source_file: Lrc<SourceFile>) -> bool {
+        source_file.add_external_src(
+            || match source_file.name {
                 FileName::Real(ref name) => self.file_loader.read_file(name).ok(),
                 _ => None,
             }
@@ -1031,97 +1032,97 @@ mod tests {
     use super::*;
     use rustc_data_structures::sync::Lrc;
 
-    fn init_code_map() -> SourceMap {
-        let cm = SourceMap::new(FilePathMapping::empty());
-        cm.new_source_file(PathBuf::from("blork.rs").into(),
+    fn init_source_map() -> SourceMap {
+        let sm = SourceMap::new(FilePathMapping::empty());
+        sm.new_source_file(PathBuf::from("blork.rs").into(),
                        "first line.\nsecond line".to_string());
-        cm.new_source_file(PathBuf::from("empty.rs").into(),
+        sm.new_source_file(PathBuf::from("empty.rs").into(),
                        String::new());
-        cm.new_source_file(PathBuf::from("blork2.rs").into(),
+        sm.new_source_file(PathBuf::from("blork2.rs").into(),
                        "first line.\nsecond line".to_string());
-        cm
+        sm
     }
 
     #[test]
     fn t3() {
         // Test lookup_byte_offset
-        let cm = init_code_map();
+        let sm = init_source_map();
 
-        let fmabp1 = cm.lookup_byte_offset(BytePos(23));
-        assert_eq!(fmabp1.fm.name, PathBuf::from("blork.rs").into());
-        assert_eq!(fmabp1.pos, BytePos(23));
+        let srcfbp1 = sm.lookup_byte_offset(BytePos(23));
+        assert_eq!(srcfbp1.sf.name, PathBuf::from("blork.rs").into());
+        assert_eq!(srcfbp1.pos, BytePos(23));
 
-        let fmabp1 = cm.lookup_byte_offset(BytePos(24));
-        assert_eq!(fmabp1.fm.name, PathBuf::from("empty.rs").into());
-        assert_eq!(fmabp1.pos, BytePos(0));
+        let srcfbp1 = sm.lookup_byte_offset(BytePos(24));
+        assert_eq!(srcfbp1.sf.name, PathBuf::from("empty.rs").into());
+        assert_eq!(srcfbp1.pos, BytePos(0));
 
-        let fmabp2 = cm.lookup_byte_offset(BytePos(25));
-        assert_eq!(fmabp2.fm.name, PathBuf::from("blork2.rs").into());
-        assert_eq!(fmabp2.pos, BytePos(0));
+        let srcfbp2 = sm.lookup_byte_offset(BytePos(25));
+        assert_eq!(srcfbp2.sf.name, PathBuf::from("blork2.rs").into());
+        assert_eq!(srcfbp2.pos, BytePos(0));
     }
 
     #[test]
     fn t4() {
         // Test bytepos_to_file_charpos
-        let cm = init_code_map();
+        let sm = init_source_map();
 
-        let cp1 = cm.bytepos_to_file_charpos(BytePos(22));
+        let cp1 = sm.bytepos_to_file_charpos(BytePos(22));
         assert_eq!(cp1, CharPos(22));
 
-        let cp2 = cm.bytepos_to_file_charpos(BytePos(25));
+        let cp2 = sm.bytepos_to_file_charpos(BytePos(25));
         assert_eq!(cp2, CharPos(0));
     }
 
     #[test]
     fn t5() {
         // Test zero-length source_files.
-        let cm = init_code_map();
+        let sm = init_source_map();
 
-        let loc1 = cm.lookup_char_pos(BytePos(22));
+        let loc1 = sm.lookup_char_pos(BytePos(22));
         assert_eq!(loc1.file.name, PathBuf::from("blork.rs").into());
         assert_eq!(loc1.line, 2);
         assert_eq!(loc1.col, CharPos(10));
 
-        let loc2 = cm.lookup_char_pos(BytePos(25));
+        let loc2 = sm.lookup_char_pos(BytePos(25));
         assert_eq!(loc2.file.name, PathBuf::from("blork2.rs").into());
         assert_eq!(loc2.line, 1);
         assert_eq!(loc2.col, CharPos(0));
     }
 
-    fn init_code_map_mbc() -> SourceMap {
-        let cm = SourceMap::new(FilePathMapping::empty());
+    fn init_source_map_mbc() -> SourceMap {
+        let sm = SourceMap::new(FilePathMapping::empty());
         // â‚¬ is a three byte utf8 char.
-        cm.new_source_file(PathBuf::from("blork.rs").into(),
+        sm.new_source_file(PathBuf::from("blork.rs").into(),
                        "fir€st â‚¬â‚¬â‚¬â‚¬ line.\nsecond line".to_string());
-        cm.new_source_file(PathBuf::from("blork2.rs").into(),
+        sm.new_source_file(PathBuf::from("blork2.rs").into(),
                        "first line€€.\n€ second line".to_string());
-        cm
+        sm
     }
 
     #[test]
     fn t6() {
         // Test bytepos_to_file_charpos in the presence of multi-byte chars
-        let cm = init_code_map_mbc();
+        let sm = init_source_map_mbc();
 
-        let cp1 = cm.bytepos_to_file_charpos(BytePos(3));
+        let cp1 = sm.bytepos_to_file_charpos(BytePos(3));
         assert_eq!(cp1, CharPos(3));
 
-        let cp2 = cm.bytepos_to_file_charpos(BytePos(6));
+        let cp2 = sm.bytepos_to_file_charpos(BytePos(6));
         assert_eq!(cp2, CharPos(4));
 
-        let cp3 = cm.bytepos_to_file_charpos(BytePos(56));
+        let cp3 = sm.bytepos_to_file_charpos(BytePos(56));
         assert_eq!(cp3, CharPos(12));
 
-        let cp4 = cm.bytepos_to_file_charpos(BytePos(61));
+        let cp4 = sm.bytepos_to_file_charpos(BytePos(61));
         assert_eq!(cp4, CharPos(15));
     }
 
     #[test]
     fn t7() {
         // Test span_to_lines for a span ending at the end of source_file
-        let cm = init_code_map();
+        let sm = init_source_map();
         let span = Span::new(BytePos(12), BytePos(23), NO_EXPANSION);
-        let file_lines = cm.span_to_lines(span).unwrap();
+        let file_lines = sm.span_to_lines(span).unwrap();
 
         assert_eq!(file_lines.file.name, PathBuf::from("blork.rs").into());
         assert_eq!(file_lines.lines.len(), 1);
@@ -1143,17 +1144,17 @@ fn span_from_selection(input: &str, selection: &str) -> Span {
     /// lines in the middle of a file.
     #[test]
     fn span_to_snippet_and_lines_spanning_multiple_lines() {
-        let cm = SourceMap::new(FilePathMapping::empty());
+        let sm = SourceMap::new(FilePathMapping::empty());
         let inputtext = "aaaaa\nbbbbBB\nCCC\nDDDDDddddd\neee\n";
         let selection = "     \n    ~~\n~~~\n~~~~~     \n   \n";
-        cm.new_source_file(Path::new("blork.rs").to_owned().into(), inputtext.to_string());
+        sm.new_source_file(Path::new("blork.rs").to_owned().into(), inputtext.to_string());
         let span = span_from_selection(inputtext, selection);
 
         // check that we are extracting the text we thought we were extracting
-        assert_eq!(&cm.span_to_snippet(span).unwrap(), "BB\nCCC\nDDDDD");
+        assert_eq!(&sm.span_to_snippet(span).unwrap(), "BB\nCCC\nDDDDD");
 
         // check that span_to_lines gives us the complete result with the lines/cols we expected
-        let lines = cm.span_to_lines(span).unwrap();
+        let lines = sm.span_to_lines(span).unwrap();
         let expected = vec![
             LineInfo { line_index: 1, start_col: CharPos(4), end_col: CharPos(6) },
             LineInfo { line_index: 2, start_col: CharPos(0), end_col: CharPos(3) },
@@ -1165,9 +1166,9 @@ fn span_to_snippet_and_lines_spanning_multiple_lines() {
     #[test]
     fn t8() {
         // Test span_to_snippet for a span ending at the end of source_file
-        let cm = init_code_map();
+        let sm = init_source_map();
         let span = Span::new(BytePos(12), BytePos(23), NO_EXPANSION);
-        let snippet = cm.span_to_snippet(span);
+        let snippet = sm.span_to_snippet(span);
 
         assert_eq!(snippet, Ok("second line".to_string()));
     }
@@ -1175,9 +1176,9 @@ fn t8() {
     #[test]
     fn t9() {
         // Test span_to_str for a span ending at the end of source_file
-        let cm = init_code_map();
+        let sm = init_source_map();
         let span = Span::new(BytePos(12), BytePos(23), NO_EXPANSION);
-        let sstr =  cm.span_to_string(span);
+        let sstr =  sm.span_to_string(span);
 
         assert_eq!(sstr, "blork.rs:2:1: 2:12");
     }
@@ -1185,15 +1186,15 @@ fn t9() {
     /// Test failing to merge two spans on different lines
     #[test]
     fn span_merging_fail() {
-        let cm = SourceMap::new(FilePathMapping::empty());
+        let sm = SourceMap::new(FilePathMapping::empty());
         let inputtext  = "bbbb BB\ncc CCC\n";
         let selection1 = "     ~~\n      \n";
         let selection2 = "       \n   ~~~\n";
-        cm.new_source_file(Path::new("blork.rs").to_owned().into(), inputtext.to_owned());
+        sm.new_source_file(Path::new("blork.rs").to_owned().into(), inputtext.to_owned());
         let span1 = span_from_selection(inputtext, selection1);
         let span2 = span_from_selection(inputtext, selection2);
 
-        assert!(cm.merge_spans(span1, span2).is_none());
+        assert!(sm.merge_spans(span1, span2).is_none());
     }
 
     /// Returns the span corresponding to the `n`th occurrence of
index d49965fd93642dd957aa92a56dba3ab5370acce6..799489ba42cc31b528c0ed6336594b4f2ca08277 100644 (file)
@@ -50,8 +50,8 @@ fn test_harness(file_text: &str, span_labels: Vec<SpanLabel>, expected_output: &
     with_globals(|| {
         let output = Arc::new(Mutex::new(Vec::new()));
 
-        let code_map = Lrc::new(SourceMap::new(FilePathMapping::empty()));
-        code_map.new_source_file(Path::new("test.rs").to_owned().into(), file_text.to_owned());
+        let source_map = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+        source_map.new_source_file(Path::new("test.rs").to_owned().into(), file_text.to_owned());
 
         let primary_span = make_span(&file_text, &span_labels[0].start, &span_labels[0].end);
         let mut msp = MultiSpan::from_span(primary_span);
@@ -59,11 +59,11 @@ fn test_harness(file_text: &str, span_labels: Vec<SpanLabel>, expected_output: &
             let span = make_span(&file_text, &span_label.start, &span_label.end);
             msp.push_span_label(span, span_label.label.to_string());
             println!("span: {:?} label: {:?}", span, span_label.label);
-            println!("text: {:?}", code_map.span_to_snippet(span));
+            println!("text: {:?}", source_map.span_to_snippet(span));
         }
 
         let emitter = EmitterWriter::new(Box::new(Shared { data: output.clone() }),
-                                        Some(code_map.clone()),
+                                        Some(source_map.clone()),
                                         false,
                                         false);
         let handler = Handler::with_emitter(true, false, Box::new(emitter));
index e468aaac7a30686d46d640d0581e07d03a10083a..7bc9a1af62c19b1e45710ce549c51480c1c4690f 100644 (file)
@@ -36,9 +36,9 @@ pub fn analyze_source_file(
     // it encounters. If that point is already outside the source_file, remove
     // it again.
     if let Some(&last_line_start) = lines.last() {
-        let file_map_end = source_file_start_pos + BytePos::from_usize(src.len());
-        assert!(file_map_end >= last_line_start);
-        if last_line_start == file_map_end {
+        let source_file_end = source_file_start_pos + BytePos::from_usize(src.len());
+        assert!(source_file_end >= last_line_start);
+        if last_line_start == source_file_end {
             lines.pop();
         }
     }
index 639155636edfa9ecf7f1e7375d9f3aaeaff79f34..a780a38ff96f53fb1b8ea73fa1036c7e17771154 100644 (file)
@@ -1266,9 +1266,9 @@ pub struct LocWithOpt {
 
 // used to be structural records. Better names, anyone?
 #[derive(Debug)]
-pub struct SourceFileAndLine { pub fm: Lrc<SourceFile>, pub line: usize }
+pub struct SourceFileAndLine { pub sf: Lrc<SourceFile>, pub line: usize }
 #[derive(Debug)]
-pub struct SourceFileAndBytePos { pub fm: Lrc<SourceFile>, pub pos: BytePos }
+pub struct SourceFileAndBytePos { pub sf: Lrc<SourceFile>, pub pos: BytePos }
 
 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
 pub struct LineInfo {
@@ -1303,7 +1303,7 @@ pub struct MacroBacktrace {
 }
 
 // _____________________________________________________________________________
-// SpanLinesError, SpanSnippetError, DistinctSources, MalformedCodemapPositions
+// SpanLinesError, SpanSnippetError, DistinctSources, MalformedSourceMapPositions
 //
 
 pub type FileLinesResult = Result<FileLines, SpanLinesError>;
@@ -1318,7 +1318,7 @@ pub enum SpanLinesError {
 pub enum SpanSnippetError {
     IllFormedSpan(Span),
     DistinctSources(DistinctSources),
-    MalformedForCodemap(MalformedCodemapPositions),
+    MalformedForSourcemap(MalformedSourceMapPositions),
     SourceNotAvailable { filename: FileName }
 }
 
@@ -1329,7 +1329,7 @@ pub struct DistinctSources {
 }
 
 #[derive(Clone, PartialEq, Eq, Debug)]
-pub struct MalformedCodemapPositions {
+pub struct MalformedSourceMapPositions {
     pub name: FileName,
     pub source_len: usize,
     pub begin_pos: BytePos,
index b37533d2da76337c6eb1bdccd2c47341aef82870..dd26cf78fdabeea6f1110b9e601132ee32f54d0b 100644 (file)
@@ -23,8 +23,8 @@ pub fn exported_generic<T>(x: T, y: u32) -> (T, u32) {
     // The AST node for the (1 + y) expression generated by the macro will then
     // take it's `lo` span bound from the `1` literal in the macro-defining file
     // and it's `hi` bound from `y` in this file, which should be lower than the
-    // `lo` and even lower than the lower bound of the FileMap it is supposedly
-    // contained in because the FileMap for this file was allocated earlier than
-    // the FileMap of the macro-defining file.
+    // `lo` and even lower than the lower bound of the SourceFile it is supposedly
+    // contained in because the SourceFile for this file was allocated earlier than
+    // the SourceFile of the macro-defining file.
     return (x, add1!(y));
 }
diff --git a/src/test/run-pass/issue-55376.rs b/src/test/run-pass/issue-55376.rs
new file mode 100644 (file)
index 0000000..9c7256f
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Tests that paths in `pub(...)` don't fail HIR verification.
+
+#![allow(unused_imports)]
+#![allow(dead_code)]
+
+pub(self) use self::my_mod::Foo;
+
+mod my_mod {
+    pub(super) use self::Foo as Bar;
+    pub(in super::my_mod) use self::Foo as Baz;
+
+    pub struct Foo;
+}
+
+fn main() {}
index 3366f0639caa5cadfe22e00ad1f276c29affa313..b9de60f43f703f72c82096ffa92e995bea3c211d 100644 (file)
@@ -13,18 +13,6 @@ note: move occurs because `v` has type `std::vec::Vec<isize>`, which does not im
 LL |         match *s { sty(v) => v } //~ ERROR cannot move out
    |                        ^
 
-error[E0507]: cannot move out of `s.0` which is behind a `&` reference
-  --> $DIR/access-mode-in-closures.rs:19:24
-   |
-LL |     let _foo = unpack(|s| {
-   |                        - help: consider changing this to be a mutable reference: `&mut sty`
-LL |         // Test that `s` is moved here.
-LL |         match *s { sty(v) => v } //~ ERROR cannot move out
-   |                        ^
-   |                        |
-   |                        cannot move out of `s.0` which is behind a `&` reference
-   |                        `s` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index 94676f0e5ad77e0f76ac6a702d6dbbbdd1565312..545a60f6770d9471d24ffd0230fc4c8c0de8c17a 100644 (file)
@@ -32,18 +32,6 @@ error[E0507]: cannot move out of borrowed content
 LL |     *n;  //~ ERROR: cannot move out of borrowed content
    |     ^^ cannot move out of borrowed content
 
-error[E0507]: cannot move out of `*n` which is behind a `&` reference
-  --> $DIR/binop-move-semantics.rs:42:5
-   |
-LL |     let n = &y;
-   |             -- help: consider changing this to be a mutable reference: `&mut y`
-...
-LL |     *n;  //~ ERROR: cannot move out of borrowed content
-   |     ^^
-   |     |
-   |     cannot move out of `*n` which is behind a `&` reference
-   |     `n` is a `&` reference, so the data it refers to cannot be moved
-
 error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable
   --> $DIR/binop-move-semantics.rs:64:5
    |
@@ -74,7 +62,7 @@ LL | |     &mut f;  //~ ERROR: cannot borrow `f` as mutable because it is also b
    |       |    immutable borrow later used here
    |       mutable borrow occurs here
 
-error: aborting due to 7 previous errors
+error: aborting due to 6 previous errors
 
 Some errors occurred: E0382, E0502, E0507.
 For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-a.ast.nll.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-a.ast.nll.stderr
deleted file mode 100644 (file)
index b171a48..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0507]: cannot move out of borrowed content
-  --> $DIR/borrowck-fn-in-const-a.rs:19:16
-   |
-LL |         return *x //[ast]~ ERROR cannot move out of borrowed content [E0507]
-   |                ^^ cannot move out of borrowed content
-
-error[E0507]: cannot move out of `*x` which is behind a `&` reference
-  --> $DIR/borrowck-fn-in-const-a.rs:19:16
-   |
-LL |     fn broken(x: &String) -> String {
-   |                  ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
-LL |         return *x //[ast]~ ERROR cannot move out of borrowed content [E0507]
-   |                ^^
-   |                |
-   |                cannot move out of `*x` which is behind a `&` reference
-   |                `x` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
index 0ab3d3ea5cdfea15c158258e48501d7fcb9860c7..25eb69ad9377dfe21b260a35ad50463847956d75 100644 (file)
@@ -1,13 +1,3 @@
-error[E0507]: cannot move out of `*__next` which is behind a `&` reference
-  --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:10
-   |
-LL |     for &a in x.iter() {    //~ ERROR cannot move out
-   |         -^
-   |         ||
-   |         |cannot move out of `*__next` which is behind a `&` reference
-   |         |`__next` is a `&` reference, so the data it refers to cannot be moved
-   |         help: consider changing this to be a mutable reference: `&mut a`
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:15
    |
@@ -23,16 +13,6 @@ note: move occurs because `a` has type `&mut i32`, which does not implement the
 LL |     for &a in x.iter() {    //~ ERROR cannot move out
    |          ^
 
-error[E0507]: cannot move out of `*__next` which is behind a `&` reference
-  --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:28:10
-   |
-LL |     for &a in &f.a {  //~ ERROR cannot move out
-   |         -^
-   |         ||
-   |         |cannot move out of `*__next` which is behind a `&` reference
-   |         |`__next` is a `&` reference, so the data it refers to cannot be moved
-   |         help: consider changing this to be a mutable reference: `&mut a`
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:28:15
    |
@@ -48,16 +28,6 @@ note: move occurs because `a` has type `std::boxed::Box<isize>`, which does not
 LL |     for &a in &f.a {  //~ ERROR cannot move out
    |          ^
 
-error[E0507]: cannot move out of `*__next` which is behind a `&` reference
-  --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:32:10
-   |
-LL |     for &a in x.iter() {    //~ ERROR cannot move out
-   |         -^
-   |         ||
-   |         |cannot move out of `*__next` which is behind a `&` reference
-   |         |`__next` is a `&` reference, so the data it refers to cannot be moved
-   |         help: consider changing this to be a mutable reference: `&mut a`
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:32:15
    |
@@ -73,6 +43,6 @@ note: move occurs because `a` has type `std::boxed::Box<i32>`, which does not im
 LL |     for &a in x.iter() {    //~ ERROR cannot move out
    |          ^
 
-error: aborting due to 6 previous errors
+error: aborting due to 3 previous errors
 
 For more information about this error, try `rustc --explain E0507`.
index ba42dc2436377c3792f917f890c39e9ea9c8f43c..45fa1764f7027230af918979f7648d00e8a418cb 100644 (file)
@@ -6,21 +6,6 @@ LL |     let x = Box::new(0);
 LL |     Box::new(|| x) //~ ERROR cannot move out of captured outer variable
    |                 ^ cannot move out of captured variable in an `Fn` closure
 
-error[E0507]: cannot move out of `x`, as it is a captured variable in a `Fn` closure
-  --> $DIR/borrowck-in-static.rs:15:17
-   |
-LL |     Box::new(|| x) //~ ERROR cannot move out of captured outer variable
-   |                 ^
-   |                 |
-   |                 cannot move out of `x`, as it is a captured variable in a `Fn` closure
-   |                 cannot move
-   |
-help: consider changing this to accept closures that implement `FnMut`
-  --> $DIR/borrowck-in-static.rs:15:14
-   |
-LL |     Box::new(|| x) //~ ERROR cannot move out of captured outer variable
-   |              ^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index 0445a75d61a9daccd504a45e061d9b685cd022e2..cdbfab8bd054a1903c2d53ce953bc577d7f9faeb 100644 (file)
@@ -7,17 +7,6 @@ LL |         let _b = *y; //~ ERROR cannot move out
    |                  cannot move out of borrowed content
    |                  help: consider removing the `*`: `y`
 
-error[E0507]: cannot move out of `*y` which is behind a `&` reference
-  --> $DIR/borrowck-issue-2657-2.rs:17:18
-   |
-LL |       Some(ref y) => {
-   |            ----- help: consider changing this to be a mutable reference: `ref mut y`
-LL |         let _b = *y; //~ ERROR cannot move out
-   |                  ^^
-   |                  |
-   |                  cannot move out of `*y` which is behind a `&` reference
-   |                  `y` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index f5a9db364065fab0b5da3b2f8589ec7f3e92f155..e7dbc6f6e3ba04ab0ebed1a372805711cd37ed82 100644 (file)
@@ -8,17 +8,3 @@ LL |                 (|| { let bar = foo; bar.take() })();
            It represents potential unsoundness in your code.
            This warning will become a hard error in the future.
 
-warning[E0507]: cannot move out of `foo`, as it is immutable for the pattern guard
-  --> $DIR/borrowck-migrate-to-nll.rs:35:17
-   |
-LL |                 (|| { let bar = foo; bar.take() })();
-   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |                 |
-   |                 cannot move out of `foo`, as it is immutable for the pattern guard
-   |                 cannot move
-   |
-   = note: variables bound in patterns are immutable until the end of the pattern guard
-   = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
-           It represents potential unsoundness in your code.
-           This warning will become a hard error in the future.
-
index f5a9db364065fab0b5da3b2f8589ec7f3e92f155..e7dbc6f6e3ba04ab0ebed1a372805711cd37ed82 100644 (file)
@@ -8,17 +8,3 @@ LL |                 (|| { let bar = foo; bar.take() })();
            It represents potential unsoundness in your code.
            This warning will become a hard error in the future.
 
-warning[E0507]: cannot move out of `foo`, as it is immutable for the pattern guard
-  --> $DIR/borrowck-migrate-to-nll.rs:35:17
-   |
-LL |                 (|| { let bar = foo; bar.take() })();
-   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |                 |
-   |                 cannot move out of `foo`, as it is immutable for the pattern guard
-   |                 cannot move
-   |
-   = note: variables bound in patterns are immutable until the end of the pattern guard
-   = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
-           It represents potential unsoundness in your code.
-           This warning will become a hard error in the future.
-
index 99f69515a473210c326fbecd5b78c74fb2bd89db..2df520a936c9d4a9975563d5eb6221917fda2853 100644 (file)
@@ -24,42 +24,6 @@ LL |                   num2) => (),
 LL |         Foo::Foo2(num) => (),
    |                   ^^^
 
-error[E0507]: cannot move out of `f.0` which is behind a `&` reference
-  --> $DIR/borrowck-move-error-with-note.rs:23:19
-   |
-LL |     let f = &Foo::Foo1(box 1, box 2);
-   |             ------------------------ help: consider changing this to be a mutable reference: `&mut Foo::Foo1(box 1, box 2)`
-...
-LL |         Foo::Foo1(num1,
-   |                   ^^^^
-   |                   |
-   |                   cannot move out of `f.0` which is behind a `&` reference
-   |                   `f` is a `&` reference, so the data it refers to cannot be moved
-
-error[E0507]: cannot move out of `f.1` which is behind a `&` reference
-  --> $DIR/borrowck-move-error-with-note.rs:24:19
-   |
-LL |     let f = &Foo::Foo1(box 1, box 2);
-   |             ------------------------ help: consider changing this to be a mutable reference: `&mut Foo::Foo1(box 1, box 2)`
-...
-LL |                   num2) => (),
-   |                   ^^^^
-   |                   |
-   |                   cannot move out of `f.1` which is behind a `&` reference
-   |                   `f` is a `&` reference, so the data it refers to cannot be moved
-
-error[E0507]: cannot move out of `f.0` which is behind a `&` reference
-  --> $DIR/borrowck-move-error-with-note.rs:25:19
-   |
-LL |     let f = &Foo::Foo1(box 1, box 2);
-   |             ------------------------ help: consider changing this to be a mutable reference: `&mut Foo::Foo1(box 1, box 2)`
-...
-LL |         Foo::Foo2(num) => (),
-   |                   ^^^
-   |                   |
-   |                   cannot move out of `f.0` which is behind a `&` reference
-   |                   `f` is a `&` reference, so the data it refers to cannot be moved
-
 error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
   --> $DIR/borrowck-move-error-with-note.rs:39:11
    |
@@ -97,19 +61,7 @@ note: move occurs because `n` has type `std::boxed::Box<isize>`, which does not
 LL |         n => {
    |         ^
 
-error[E0507]: cannot move out of `a.a` which is behind a `&` reference
-  --> $DIR/borrowck-move-error-with-note.rs:59:9
-   |
-LL |     let a = &A { a: box 1 };
-   |             --------------- help: consider changing this to be a mutable reference: `&mut A { a: box 1 }`
-...
-LL |         n => {
-   |         ^
-   |         |
-   |         cannot move out of `a.a` which is behind a `&` reference
-   |         `a` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 7 previous errors
+error: aborting due to 3 previous errors
 
 Some errors occurred: E0507, E0509.
 For more information about an error, try `rustc --explain E0507`.
index 83c5b82957deaf85738174d3342fb31a68430c59..c3a2180b9f082e062f9afab0ede465a7511ac8f3 100644 (file)
@@ -7,17 +7,6 @@ LL |     let y = *x; //~ ERROR cannot move out of dereference of raw pointer
    |             cannot move out of dereference of raw pointer
    |             help: consider removing the `*`: `x`
 
-error[E0507]: cannot move out of `*x` which is behind a `*const` pointer
-  --> $DIR/borrowck-move-from-unsafe-ptr.rs:13:13
-   |
-LL | unsafe fn foo(x: *const Box<isize>) -> Box<isize> {
-   |                  ----------------- help: consider changing this to be a mutable pointer: `*mut std::boxed::Box<isize>`
-LL |     let y = *x; //~ ERROR cannot move out of dereference of raw pointer
-   |             ^^
-   |             |
-   |             cannot move out of `*x` which is behind a `*const` pointer
-   |             `x` is a `*const` pointer, so the data it refers to cannot be moved
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index f22aca9994986846585b8b30d3244e6b04df796d..49c2ec0dcf4e7c996e77b3f918f482664288f74f 100644 (file)
@@ -14,15 +14,6 @@ note: move occurs because `_x` has type `std::string::String`, which does not im
 LL | fn arg_item(&_x: &String) {}
    |              ^^
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/borrowck-move-in-irrefut-pat.rs:16:14
-   |
-LL | fn arg_item(&_x: &String) {}
-   |              ^^
-   |              |
-   |              cannot move out of data in a `&` reference
-   |              cannot move
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/borrowck-move-in-irrefut-pat.rs:21:11
    |
@@ -39,24 +30,6 @@ note: move occurs because `_x` has type `std::string::String`, which does not im
 LL |     with(|&_x| ())
    |            ^^
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/borrowck-move-in-irrefut-pat.rs:21:12
-   |
-LL |     with(|&_x| ())
-   |            ^^
-   |            |
-   |            cannot move out of data in a `&` reference
-   |            cannot move
-
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/borrowck-move-in-irrefut-pat.rs:27:10
-   |
-LL |     let &_x = &"hi".to_string();
-   |          ^^
-   |          |
-   |          cannot move out of data in a `&` reference
-   |          cannot move
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/borrowck-move-in-irrefut-pat.rs:27:15
    |
@@ -72,6 +45,6 @@ note: move occurs because `_x` has type `std::string::String`, which does not im
 LL |     let &_x = &"hi".to_string();
    |          ^^
 
-error: aborting due to 6 previous errors
+error: aborting due to 3 previous errors
 
 For more information about this error, try `rustc --explain E0507`.
index ba74cd2514e1a244d84191c517ab4f681b80f959..d58beabb3038af551493e03d3d7a35312c100b9f 100644 (file)
@@ -4,15 +4,6 @@ error[E0507]: cannot move out of an `Rc`
 LL |     let _x = Rc::new(vec![1, 2]).into_iter();
    |              ^^^^^^^^^^^^^^^^^^^ cannot move out of an `Rc`
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:17:14
-   |
-LL |     let _x = Rc::new(vec![1, 2]).into_iter();
-   |              ^^^^^^^^^^^^^^^^^^^
-   |              |
-   |              cannot move out of data in a `&` reference
-   |              cannot move
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index 205044bb368851166a9d571ad260566b62d9908a..c9c8cf104ce2e769fa4aa36749ce6b14f9c1894f 100644 (file)
@@ -7,15 +7,6 @@ LL |     let _x = *Rc::new("hi".to_string());
    |              cannot move out of an `Rc`
    |              help: consider removing the `*`: `Rc::new("hi".to_string())`
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/borrowck-move-out-of-overloaded-deref.rs:14:14
-   |
-LL |     let _x = *Rc::new("hi".to_string());
-   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |              |
-   |              cannot move out of data in a `&` reference
-   |              cannot move
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.nll.stderr
deleted file mode 100644 (file)
index 675458d..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0507]: cannot move out of static item
-  --> $DIR/borrowck-move-out-of-static-item.rs:28:10
-   |
-LL |     test(BAR); //[ast]~ ERROR cannot move out of static item [E0507]
-   |          ^^^ cannot move out of static item
-
-error[E0507]: cannot move out of immutable static item `BAR`
-  --> $DIR/borrowck-move-out-of-static-item.rs:28:10
-   |
-LL |     test(BAR); //[ast]~ ERROR cannot move out of static item [E0507]
-   |          ^^^
-   |          |
-   |          cannot move out of immutable static item `BAR`
-   |          cannot move
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
index dea42c53992b19bdabae96a6dd490d9f88c06a41..f3430ba4e06c9038310a8f087594447e8b89dbce 100644 (file)
@@ -26,31 +26,6 @@ LL |                 //~| to prevent move
 LL |                   Foo { string: b }] => {
    |
 
-error[E0507]: cannot move out of `tail[..].string` which is behind a `&` reference
-  --> $DIR/borrowck-move-out-of-vec-tail.rs:30:33
-   |
-LL |         [_, ref tail..] => {
-   |             -------- help: consider changing this to be a mutable reference: `ref mut tail`
-LL |             match tail {
-LL |                 &[Foo { string: a },
-   |                                 ^
-   |                                 |
-   |                                 cannot move out of `tail[..].string` which is behind a `&` reference
-   |                                 `tail` is a `&` reference, so the data it refers to cannot be moved
-
-error[E0507]: cannot move out of `tail[..].string` which is behind a `&` reference
-  --> $DIR/borrowck-move-out-of-vec-tail.rs:34:33
-   |
-LL |         [_, ref tail..] => {
-   |             -------- help: consider changing this to be a mutable reference: `ref mut tail`
-...
-LL |                   Foo { string: b }] => {
-   |                                 ^
-   |                                 |
-   |                                 cannot move out of `tail[..].string` which is behind a `&` reference
-   |                                 `tail` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 3 previous errors
+error: aborting due to previous error
 
-Some errors occurred: E0507, E0508.
-For more information about an error, try `rustc --explain E0507`.
+For more information about this error, try `rustc --explain E0508`.
index 05fd6d71520c76c52a2b7b4c9839faa8fe8cd310..92e10c258c269efbd9cca6855d1dcd0e351bf573 100644 (file)
@@ -7,15 +7,6 @@ LL |     let bad = v[0];
    |               cannot move out of borrowed content
    |               help: consider borrowing here: `&v[0]`
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/borrowck-overloaded-index-move-from-vec.rs:30:15
-   |
-LL |     let bad = v[0];
-   |               ^^^^
-   |               |
-   |               cannot move out of data in a `&` reference
-   |               cannot move
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index ee7e3e71962e8b38784b6e22332c2a1f5161370b..d4340938eebc14880e7b4409021344c26f733c86 100644 (file)
@@ -13,15 +13,6 @@ note: move occurs because `s` has type `std::string::String`, which does not imp
 LL |     let opt = a.iter().enumerate().find(|(_, &s)| {
    |                                               ^
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/issue-51415.rs:16:47
-   |
-LL |     let opt = a.iter().enumerate().find(|(_, &s)| {
-   |                                               ^
-   |                                               |
-   |                                               cannot move out of data in a `&` reference
-   |                                               cannot move
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.nll.stderr b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.nll.stderr
deleted file mode 100644 (file)
index d25fc75..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-error[E0507]: cannot move out of borrowed content
-  --> $DIR/move-in-static-initializer-issue-38520.rs:25:23
-   |
-LL | static Y: usize = get(*&X); //[ast]~ ERROR E0507
-   |                       ^^^ cannot move out of borrowed content
-
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/move-in-static-initializer-issue-38520.rs:25:23
-   |
-LL | static Y: usize = get(*&X); //[ast]~ ERROR E0507
-   |                       ^^^
-   |                       |
-   |                       cannot move out of data in a `&` reference
-   |                       cannot move
-
-error[E0507]: cannot move out of borrowed content
-  --> $DIR/move-in-static-initializer-issue-38520.rs:27:22
-   |
-LL | const Z: usize = get(*&X); //[ast]~ ERROR E0507
-   |                      ^^^ cannot move out of borrowed content
-
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/move-in-static-initializer-issue-38520.rs:27:22
-   |
-LL | const Z: usize = get(*&X); //[ast]~ ERROR E0507
-   |                      ^^^
-   |                      |
-   |                      cannot move out of data in a `&` reference
-   |                      cannot move
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
index 0844ac32b8b60a37edf562e5e167c22b23e3a31f..0eb5fc8c324356ad358fa2438ac9bb1c992834a0 100644 (file)
@@ -7,25 +7,6 @@ LL |     call(|| {
 LL |         y.into_iter();
    |         ^ cannot move out of captured variable in an `Fn` closure
 
-error[E0507]: cannot move out of `y`, as it is a captured variable in a `Fn` closure
-  --> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:21:9
-   |
-LL |         y.into_iter();
-   |         ^
-   |         |
-   |         cannot move out of `y`, as it is a captured variable in a `Fn` closure
-   |         cannot move
-   |
-help: consider changing this to accept closures that implement `FnMut`
-  --> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:20:10
-   |
-LL |       call(|| {
-   |  __________^
-LL | |         y.into_iter();
-LL | |         //~^ ERROR cannot move out of captured outer variable in an `Fn` closure
-LL | |     });
-   | |_____^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index 40987958115895deb46cf043e85040f6516de69d..491b5b5bd74abef53a40f7b6d0e963f9c0683bd5 100644 (file)
@@ -16,15 +16,6 @@ note: move occurs because `identifier` has type `std::string::String`, which doe
 LL |         &E::Bar(identifier) => f(identifier.clone())  //~ ERROR cannot move
    |                 ^^^^^^^^^^
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/by-move-pattern-binding.rs:26:17
-   |
-LL |         &E::Bar(identifier) => f(identifier.clone())  //~ ERROR cannot move
-   |                 ^^^^^^^^^^
-   |                 |
-   |                 cannot move out of data in a `&` reference
-   |                 cannot move
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index 576322ff5c1953d2087d5d88f19bdb19b9c20574..5522e22fb1fa28089a33a6c8851a39b7b52cf70a 100644 (file)
@@ -58,22 +58,13 @@ LL |     let y = { static x: Box<isize> = box 3; x };
    |                                             cannot move out of static item
    |                                             help: consider borrowing here: `&x`
 
-error[E0507]: cannot move out of immutable static item `x`
-  --> $DIR/check-static-values-constraints.rs:120:45
-   |
-LL |     let y = { static x: Box<isize> = box 3; x };
-   |                                             ^
-   |                                             |
-   |                                             cannot move out of immutable static item `x`
-   |                                             cannot move
-
 error[E0010]: allocations are not allowed in statics
   --> $DIR/check-static-values-constraints.rs:120:38
    |
 LL |     let y = { static x: Box<isize> = box 3; x };
    |                                      ^^^^^ allocation not allowed in statics
 
-error: aborting due to 11 previous errors
+error: aborting due to 10 previous errors
 
 Some errors occurred: E0010, E0015, E0493, E0507.
 For more information about an error, try `rustc --explain E0010`.
diff --git a/src/test/ui/consts/const-eval/issue-49296.rs b/src/test/ui/consts/const-eval/issue-49296.rs
new file mode 100644 (file)
index 0000000..a7c3c53
--- /dev/null
@@ -0,0 +1,23 @@
+// issue-49296: Unsafe shenigans in constants can result in missing errors
+
+#![feature(const_fn)]
+#![feature(const_fn_union)]
+
+const unsafe fn transmute<T: Copy, U: Copy>(t: T) -> U {
+    union Transmute<T: Copy, U: Copy> {
+        from: T,
+        to: U,
+    }
+
+    Transmute { from: t }.to
+}
+
+const fn wat(x: u64) -> &'static u64 {
+    unsafe { transmute(&x) }
+}
+const X: u64 = *wat(42);
+//~^ ERROR any use of this value will cause an error
+
+fn main() {
+    println!("{}", X);
+}
diff --git a/src/test/ui/consts/const-eval/issue-49296.stderr b/src/test/ui/consts/const-eval/issue-49296.stderr
new file mode 100644 (file)
index 0000000..37462db
--- /dev/null
@@ -0,0 +1,12 @@
+error: any use of this value will cause an error
+  --> $DIR/issue-49296.rs:18:1
+   |
+LL | const X: u64 = *wat(42);
+   | ^^^^^^^^^^^^^^^--------^
+   |                |
+   |                dangling pointer was dereferenced
+   |
+   = note: #[deny(const_err)] on by default
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/consts/const-validation-fail-55455.rs b/src/test/ui/consts/const-validation-fail-55455.rs
new file mode 100644 (file)
index 0000000..def4062
--- /dev/null
@@ -0,0 +1,9 @@
+// https://github.com/rust-lang/rust/issues/55454
+// compile-pass
+
+struct This<T>(T);
+
+const C: This<Option<&i32>> = This(Some(&1));
+
+fn main() {
+}
diff --git a/src/test/ui/consts/promoted-validation-55454.rs b/src/test/ui/consts/promoted-validation-55454.rs
new file mode 100644 (file)
index 0000000..5e193b1
--- /dev/null
@@ -0,0 +1,9 @@
+// https://github.com/rust-lang/rust/issues/55454
+// compile-pass
+
+#[derive(PartialEq)]
+struct This<T>(T);
+
+fn main() {
+    This(Some(&1)) == This(Some(&1));
+}
index d14760b707db2875b2a50e6b0391265912bfa661..0aa85d3ed7a3d36f248e6d25c10b99f68c55adbd 100644 (file)
@@ -16,31 +16,13 @@ error[E0507]: cannot move out of borrowed content
 LL |     S[0];
    |     ^^^^ cannot move out of borrowed content
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/dst-index.rs:41:5
-   |
-LL |     S[0];
-   |     ^^^^
-   |     |
-   |     cannot move out of data in a `&` reference
-   |     cannot move
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/dst-index.rs:44:5
    |
 LL |     T[0];
    |     ^^^^ cannot move out of borrowed content
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/dst-index.rs:44:5
-   |
-LL |     T[0];
-   |     ^^^^
-   |     |
-   |     cannot move out of data in a `&` reference
-   |     cannot move
-
-error: aborting due to 6 previous errors
+error: aborting due to 4 previous errors
 
 Some errors occurred: E0161, E0507.
 For more information about an error, try `rustc --explain E0161`.
index 537ece48e012c63eb9983500b0a6ac3f83b73dcc..b120da773a24a3448d80882dfaf46fa498d4be5d 100644 (file)
@@ -16,33 +16,13 @@ error[E0507]: cannot move out of borrowed content
 LL |     let _x: Box<str> = box *"hello world";
    |                            ^^^^^^^^^^^^^^ cannot move out of borrowed content
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/dst-rvalue.rs:16:28
-   |
-LL |     let _x: Box<str> = box *"hello world";
-   |                            ^^^^^^^^^^^^^^
-   |                            |
-   |                            cannot move out of data in a `&` reference
-   |                            cannot move
-
 error[E0508]: cannot move out of type `[isize]`, a non-copy slice
   --> $DIR/dst-rvalue.rs:21:32
    |
 LL |     let _x: Box<[isize]> = box *array;
    |                                ^^^^^^ cannot move out of here
 
-error[E0507]: cannot move out of `*array` which is behind a `&` reference
-  --> $DIR/dst-rvalue.rs:21:32
-   |
-LL |     let array: &[isize] = &[1, 2, 3];
-   |                           ---------- help: consider changing this to be a mutable reference: `&mut [1, 2, 3]`
-LL |     let _x: Box<[isize]> = box *array;
-   |                                ^^^^^^
-   |                                |
-   |                                cannot move out of `*array` which is behind a `&` reference
-   |                                `array` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 6 previous errors
+error: aborting due to 4 previous errors
 
 Some errors occurred: E0161, E0507, E0508.
 For more information about an error, try `rustc --explain E0161`.
diff --git a/src/test/ui/error-codes/E0507.nll.stderr b/src/test/ui/error-codes/E0507.nll.stderr
deleted file mode 100644 (file)
index 43795e5..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0507]: cannot move out of borrowed content
-  --> $DIR/E0507.rs:22:5
-   |
-LL |     x.borrow().nothing_is_true(); //~ ERROR E0507
-   |     ^^^^^^^^^^ cannot move out of borrowed content
-
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/E0507.rs:22:5
-   |
-LL |     x.borrow().nothing_is_true(); //~ ERROR E0507
-   |     ^^^^^^^^^^
-   |     |
-   |     cannot move out of data in a `&` reference
-   |     cannot move
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
index bb844c4a69f22096775807aff91292c82f34764f..72d21d47d86fa765985da974e0b8b2664837d7fa 100644 (file)
@@ -40,43 +40,6 @@ LL |         (&[], &[hd, ..]) | (&[hd, ..], &[])
 LL |         (&[hd1, ..], &[hd2, ..])
    |            ^^^
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/issue-12567.rs:16:17
-   |
-LL |         (&[], &[hd, ..]) | (&[hd, ..], &[])
-   |                 ^^
-   |                 |
-   |                 cannot move out of data in a `&` reference
-   |                 cannot move
-
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/issue-12567.rs:16:31
-   |
-LL |         (&[], &[hd, ..]) | (&[hd, ..], &[])
-   |                               ^^
-   |                               |
-   |                               cannot move out of data in a `&` reference
-   |                               cannot move
-
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/issue-12567.rs:20:12
-   |
-LL |         (&[hd1, ..], &[hd2, ..])
-   |            ^^^
-   |            |
-   |            cannot move out of data in a `&` reference
-   |            cannot move
-
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/issue-12567.rs:20:24
-   |
-LL |         (&[hd1, ..], &[hd2, ..])
-   |                        ^^^
-   |                        |
-   |                        cannot move out of data in a `&` reference
-   |                        cannot move
-
-error: aborting due to 6 previous errors
+error: aborting due to 2 previous errors
 
-Some errors occurred: E0507, E0508.
-For more information about an error, try `rustc --explain E0507`.
+For more information about this error, try `rustc --explain E0508`.
index 66fba7749f4791544665507456c64fc834beb17a..f8da3c3d5989eceb45282da4c0f45502ba96354c 100644 (file)
@@ -7,15 +7,6 @@ LL |     let _a = FOO; //~ ERROR: cannot move out of static item
    |              cannot move out of static item
    |              help: consider borrowing here: `&FOO`
 
-error[E0507]: cannot move out of immutable static item `FOO`
-  --> $DIR/issue-17718-static-move.rs:16:14
-   |
-LL |     let _a = FOO; //~ ERROR: cannot move out of static item
-   |              ^^^
-   |              |
-   |              cannot move out of immutable static item `FOO`
-   |              cannot move
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index 60e3056b8c4d4a15af495563f838ba8a2a895bcc..362778b26c861911d2624046c87cd15c65d575ea 100644 (file)
@@ -16,15 +16,6 @@ LL |     let b = unsafe { *imm_ref() };
    |                      cannot move out of borrowed content
    |                      help: consider removing the `*`: `imm_ref()`
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/issue-20801.rs:39:22
-   |
-LL |     let b = unsafe { *imm_ref() };
-   |                      ^^^^^^^^^^
-   |                      |
-   |                      cannot move out of data in a `&` reference
-   |                      cannot move
-
 error[E0507]: cannot move out of dereference of raw pointer
   --> $DIR/issue-20801.rs:42:22
    |
@@ -43,15 +34,6 @@ LL |     let d = unsafe { *const_ptr() };
    |                      cannot move out of dereference of raw pointer
    |                      help: consider removing the `*`: `const_ptr()`
 
-error[E0507]: cannot move out of data in a `*const` pointer
-  --> $DIR/issue-20801.rs:45:22
-   |
-LL |     let d = unsafe { *const_ptr() };
-   |                      ^^^^^^^^^^^^
-   |                      |
-   |                      cannot move out of data in a `*const` pointer
-   |                      cannot move
-
-error: aborting due to 6 previous errors
+error: aborting due to 4 previous errors
 
 For more information about this error, try `rustc --explain E0507`.
index ae726d26d072b80203d31f10cb28fc6eb1cd7b5e..fa2df26498a061dc0fa0ac12d94550dcb349c01f 100644 (file)
@@ -4,17 +4,6 @@ error[E0507]: cannot move out of borrowed content
 LL |         self.tokens //~ ERROR cannot move out of borrowed content
    |         ^^^^^^^^^^^ cannot move out of borrowed content
 
-error[E0507]: cannot move out of `self.tokens` which is behind a `&` reference
-  --> $DIR/issue-2590.rs:22:9
-   |
-LL |     fn parse(&self) -> Vec<isize> {
-   |              ----- help: consider changing this to be a mutable reference: `&mut self`
-LL |         self.tokens //~ ERROR cannot move out of borrowed content
-   |         ^^^^^^^^^^^
-   |         |
-   |         cannot move out of `self.tokens` which is behind a `&` reference
-   |         `self` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index 78cf3661bb76338d365291dd99fe67944a4e8833..fdf8157dcf833918233aacc1107973455570d2df 100644 (file)
@@ -16,16 +16,7 @@ error[E0508]: cannot move out of type `[u8]`, a non-copy slice
 LL |     &X(*Y)
    |        ^^ cannot move out of here
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/issue-30355.rs:15:8
-   |
-LL |     &X(*Y)
-   |        ^^
-   |        |
-   |        cannot move out of data in a `&` reference
-   |        cannot move
-
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
 
-Some errors occurred: E0161, E0507, E0508.
+Some errors occurred: E0161, E0508.
 For more information about an error, try `rustc --explain E0161`.
index 22fcffb9527a4b651c54fea1bb424bfdb2770301..9020d3778c3730820347651be4554a9b7d9c1f0b 100644 (file)
@@ -7,15 +7,6 @@ LL |     let e = f.v[0]; //~ ERROR cannot move out of indexed content
    |             cannot move out of borrowed content
    |             help: consider borrowing here: `&f.v[0]`
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/issue-40402-1.rs:19:13
-   |
-LL |     let e = f.v[0]; //~ ERROR cannot move out of indexed content
-   |             ^^^^^^
-   |             |
-   |             cannot move out of data in a `&` reference
-   |             cannot move
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index cdb547ad10064f8b2734400d3d32c1f58d4705f2..a80e9a5fe091f70343247033078fb2881a09d61d 100644 (file)
@@ -1,21 +1,3 @@
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/issue-40402-2.rs:15:10
-   |
-LL |     let (a, b) = x[0]; //~ ERROR cannot move out of indexed content
-   |          ^
-   |          |
-   |          cannot move out of data in a `&` reference
-   |          cannot move
-
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/issue-40402-2.rs:15:13
-   |
-LL |     let (a, b) = x[0]; //~ ERROR cannot move out of indexed content
-   |             ^
-   |             |
-   |             cannot move out of data in a `&` reference
-   |             cannot move
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/issue-40402-2.rs:15:18
    |
@@ -33,6 +15,6 @@ note: move occurs because these variables have types that don't implement the `C
 LL |     let (a, b) = x[0]; //~ ERROR cannot move out of indexed content
    |          ^  ^
 
-error: aborting due to 3 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index beb853fc91ae504c96115018b02595406c2ee959..d31eddfa5b65deb908818dac6eee2ab8c0accbd9 100644 (file)
@@ -6,15 +6,6 @@ LL | fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
 LL |     id(Box::new(|| *v))
    |                    ^^ cannot move out of captured variable in an `FnMut` closure
 
-error[E0507]: cannot move out of `*v` which is behind a `&` reference
-  --> $DIR/issue-4335.rs:16:20
-   |
-LL |     id(Box::new(|| *v))
-   |                    ^^
-   |                    |
-   |                    cannot move out of `*v` which is behind a `&` reference
-   |                    cannot move
-
 error[E0373]: closure may outlive the current function, but it borrows `v`, which is owned by the current function
   --> $DIR/issue-4335.rs:16:17
    |
@@ -33,7 +24,7 @@ help: to force the closure to take ownership of `v` (and any other referenced va
 LL |     id(Box::new(move || *v))
    |                 ^^^^^^^
 
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
 Some errors occurred: E0373, E0507.
 For more information about an error, try `rustc --explain E0373`.
index 187e7f31dfd710331942a3711a2fc8a740801c40..9eda59614f45828074ccfdd1a2b30e6b2801b0b2 100644 (file)
@@ -23,4 +23,13 @@ fn main() {
     // We want to suggest the properly-balanced expression `1 / (2 + 3)`, not
     // the malformed `1 / (2 + 3`
     let _a = (1 / (2 + 3));
+    f();
+}
+
+fn f() -> bool {
+    loop {
+        if (break { return true }) {
+        }
+    }
+    false
 }
index 1ded703fd5a2f0bc49f3dbaf832a07fbf91492a1..1f22ab148185296bbf3ca71abe0a75ca06630a3d 100644 (file)
@@ -16,18 +16,6 @@ note: move occurs because `x` has type `std::boxed::Box<isize>`, which does not
 LL |                 box E::Bar(x) => println!("{}", x.to_string()),
    |                            ^
 
-error[E0507]: cannot move out of `hellothere.x.0` which is behind a `&` reference
-  --> $DIR/moves-based-on-type-block-bad.rs:37:28
-   |
-LL |         f(&s, |hellothere| {
-   |                ---------- help: consider changing this to be a mutable reference: `&mut S`
-...
-LL |                 box E::Bar(x) => println!("{}", x.to_string()),
-   |                            ^
-   |                            |
-   |                            cannot move out of `hellothere.x.0` which is behind a `&` reference
-   |                            `hellothere` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index a34a9efab6bce413f317a557d9da135e6b17c453..13a6fc15ce3185b7ebbbd5093d018c515fad9293 100644 (file)
@@ -6,21 +6,6 @@ LL |     let i = box 3;
 LL |     let _f = to_fn(|| test(i)); //~ ERROR cannot move out
    |                            ^ cannot move out of captured variable in an `Fn` closure
 
-error[E0507]: cannot move out of `i`, as it is a captured variable in a `Fn` closure
-  --> $DIR/moves-based-on-type-move-out-of-closure-env-issue-1965.rs:21:28
-   |
-LL |     let _f = to_fn(|| test(i)); //~ ERROR cannot move out
-   |                            ^
-   |                            |
-   |                            cannot move out of `i`, as it is a captured variable in a `Fn` closure
-   |                            cannot move
-   |
-help: consider changing this to accept closures that implement `FnMut`
-  --> $DIR/moves-based-on-type-move-out-of-closure-env-issue-1965.rs:21:20
-   |
-LL |     let _f = to_fn(|| test(i)); //~ ERROR cannot move out
-   |                    ^^^^^^^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0507`.
index 2d54ae0b81ec820c054aca57ec17a481432a9cea..6a4c8f2e8d81570161b7d251523acb9c6483235f 100644 (file)
@@ -7,17 +7,6 @@ LL |     let x = { *r }; //~ ERROR
    |               cannot move out of borrowed content
    |               help: consider removing the `*`: `r`
 
-error[E0507]: cannot move out of `*r` which is behind a `&` reference
-  --> $DIR/cannot-move-block-spans.rs:15:15
-   |
-LL | pub fn deref(r: &String) {
-   |                 ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
-LL |     let x = { *r }; //~ ERROR
-   |               ^^
-   |               |
-   |               cannot move out of `*r` which is behind a `&` reference
-   |               `r` is a `&` reference, so the data it refers to cannot be moved
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/cannot-move-block-spans.rs:16:22
    |
@@ -27,18 +16,6 @@ LL |     let y = unsafe { *r }; //~ ERROR
    |                      cannot move out of borrowed content
    |                      help: consider removing the `*`: `r`
 
-error[E0507]: cannot move out of `*r` which is behind a `&` reference
-  --> $DIR/cannot-move-block-spans.rs:16:22
-   |
-LL | pub fn deref(r: &String) {
-   |                 ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
-LL |     let x = { *r }; //~ ERROR
-LL |     let y = unsafe { *r }; //~ ERROR
-   |                      ^^
-   |                      |
-   |                      cannot move out of `*r` which is behind a `&` reference
-   |                      `r` is a `&` reference, so the data it refers to cannot be moved
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/cannot-move-block-spans.rs:17:26
    |
@@ -48,18 +25,6 @@ LL |     let z = loop { break *r; }; //~ ERROR
    |                          cannot move out of borrowed content
    |                          help: consider removing the `*`: `r`
 
-error[E0507]: cannot move out of `*r` which is behind a `&` reference
-  --> $DIR/cannot-move-block-spans.rs:17:26
-   |
-LL | pub fn deref(r: &String) {
-   |                 ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
-...
-LL |     let z = loop { break *r; }; //~ ERROR
-   |                          ^^
-   |                          |
-   |                          cannot move out of `*r` which is behind a `&` reference
-   |                          `r` is a `&` reference, so the data it refers to cannot be moved
-
 error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array
   --> $DIR/cannot-move-block-spans.rs:21:15
    |
@@ -96,17 +61,6 @@ LL |     let x = { let mut u = 0; u += 1; *r }; //~ ERROR
    |                                      cannot move out of borrowed content
    |                                      help: consider removing the `*`: `r`
 
-error[E0507]: cannot move out of `*r` which is behind a `&` reference
-  --> $DIR/cannot-move-block-spans.rs:27:38
-   |
-LL | pub fn additional_statement_cases(r: &String) {
-   |                                      ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
-LL |     let x = { let mut u = 0; u += 1; *r }; //~ ERROR
-   |                                      ^^
-   |                                      |
-   |                                      cannot move out of `*r` which is behind a `&` reference
-   |                                      `r` is a `&` reference, so the data it refers to cannot be moved
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/cannot-move-block-spans.rs:28:45
    |
@@ -116,18 +70,6 @@ LL |     let y = unsafe { let mut u = 0; u += 1; *r }; //~ ERROR
    |                                             cannot move out of borrowed content
    |                                             help: consider removing the `*`: `r`
 
-error[E0507]: cannot move out of `*r` which is behind a `&` reference
-  --> $DIR/cannot-move-block-spans.rs:28:45
-   |
-LL | pub fn additional_statement_cases(r: &String) {
-   |                                      ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
-LL |     let x = { let mut u = 0; u += 1; *r }; //~ ERROR
-LL |     let y = unsafe { let mut u = 0; u += 1; *r }; //~ ERROR
-   |                                             ^^
-   |                                             |
-   |                                             cannot move out of `*r` which is behind a `&` reference
-   |                                             `r` is a `&` reference, so the data it refers to cannot be moved
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/cannot-move-block-spans.rs:29:49
    |
@@ -137,19 +79,7 @@ LL |     let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; //~ ERROR
    |                                                 cannot move out of borrowed content
    |                                                 help: consider removing the `*`: `r`
 
-error[E0507]: cannot move out of `*r` which is behind a `&` reference
-  --> $DIR/cannot-move-block-spans.rs:29:49
-   |
-LL | pub fn additional_statement_cases(r: &String) {
-   |                                      ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
-...
-LL |     let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; //~ ERROR
-   |                                                 ^^
-   |                                                 |
-   |                                                 cannot move out of `*r` which is behind a `&` reference
-   |                                                 `r` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 15 previous errors
+error: aborting due to 9 previous errors
 
 Some errors occurred: E0507, E0508.
 For more information about an error, try `rustc --explain E0507`.
index 4fe01d472f50edac8829c1d09a3e89ca5b654258..afb85c69990f9851fb3702ae4b689c8b52d78856 100644 (file)
@@ -8,20 +8,6 @@ LL |             (|| { let bar = foo; bar.take() })();
            It represents potential unsoundness in your code.
            This warning will become a hard error in the future.
 
-warning[E0507]: cannot move out of `foo`, as it is immutable for the pattern guard
-  --> $DIR/match-guards-always-borrow.rs:23:13
-   |
-LL |             (|| { let bar = foo; bar.take() })();
-   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |             |
-   |             cannot move out of `foo`, as it is immutable for the pattern guard
-   |             cannot move
-   |
-   = note: variables bound in patterns are immutable until the end of the pattern guard
-   = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
-           It represents potential unsoundness in your code.
-           This warning will become a hard error in the future.
-
 error: compilation successful
   --> $DIR/match-guards-always-borrow.rs:57:1
    |
diff --git a/src/test/ui/static/static-items-cant-move.nll.stderr b/src/test/ui/static/static-items-cant-move.nll.stderr
deleted file mode 100644 (file)
index 35a400b..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0507]: cannot move out of static item
-  --> $DIR/static-items-cant-move.rs:28:10
-   |
-LL |     test(BAR); //~ ERROR cannot move out of static item
-   |          ^^^ cannot move out of static item
-
-error[E0507]: cannot move out of immutable static item `BAR`
-  --> $DIR/static-items-cant-move.rs:28:10
-   |
-LL |     test(BAR); //~ ERROR cannot move out of static item
-   |          ^^^
-   |          |
-   |          cannot move out of immutable static item `BAR`
-   |          cannot move
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
index d2576a4baf369ab657e287a0e4b3f71f37beeb33..e6b612fed85885c1a24cae4ce2bfc59e0b3b87f3 100644 (file)
@@ -7,15 +7,6 @@ LL |     let x = *&x; //~ ERROR: cannot move out of borrowed content
    |             cannot move out of borrowed content
    |             help: consider removing the `*`: `&x`
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/std-uncopyable-atomics.rs:19:13
-   |
-LL |     let x = *&x; //~ ERROR: cannot move out of borrowed content
-   |             ^^^
-   |             |
-   |             cannot move out of data in a `&` reference
-   |             cannot move
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/std-uncopyable-atomics.rs:21:13
    |
@@ -25,15 +16,6 @@ LL |     let x = *&x; //~ ERROR: cannot move out of borrowed content
    |             cannot move out of borrowed content
    |             help: consider removing the `*`: `&x`
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/std-uncopyable-atomics.rs:21:13
-   |
-LL |     let x = *&x; //~ ERROR: cannot move out of borrowed content
-   |             ^^^
-   |             |
-   |             cannot move out of data in a `&` reference
-   |             cannot move
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/std-uncopyable-atomics.rs:23:13
    |
@@ -43,15 +25,6 @@ LL |     let x = *&x; //~ ERROR: cannot move out of borrowed content
    |             cannot move out of borrowed content
    |             help: consider removing the `*`: `&x`
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/std-uncopyable-atomics.rs:23:13
-   |
-LL |     let x = *&x; //~ ERROR: cannot move out of borrowed content
-   |             ^^^
-   |             |
-   |             cannot move out of data in a `&` reference
-   |             cannot move
-
 error[E0507]: cannot move out of borrowed content
   --> $DIR/std-uncopyable-atomics.rs:25:13
    |
@@ -61,15 +34,6 @@ LL |     let x = *&x; //~ ERROR: cannot move out of borrowed content
    |             cannot move out of borrowed content
    |             help: consider removing the `*`: `&x`
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/std-uncopyable-atomics.rs:25:13
-   |
-LL |     let x = *&x; //~ ERROR: cannot move out of borrowed content
-   |             ^^^
-   |             |
-   |             cannot move out of data in a `&` reference
-   |             cannot move
-
-error: aborting due to 8 previous errors
+error: aborting due to 4 previous errors
 
 For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.nll.stderr b/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.nll.stderr
deleted file mode 100644 (file)
index 9f56bf0..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0507]: cannot move out of borrowed content
-  --> $DIR/trivial-bounds-leak-copy.rs:19:5
-   |
-LL |     *t //~ ERROR
-   |     ^^ cannot move out of borrowed content
-
-error[E0507]: cannot move out of `*t` which is behind a `&` reference
-  --> $DIR/trivial-bounds-leak-copy.rs:19:5
-   |
-LL | fn move_out_string(t: &String) -> String {
-   |                       ------- help: consider changing this to be a mutable reference: `&mut std::string::String`
-LL |     *t //~ ERROR
-   |     ^^
-   |     |
-   |     cannot move out of `*t` which is behind a `&` reference
-   |     `t` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
index 625084efec2ff38002627fb1ac27da748bab7e31..4baa54e34c75532750ffba07c939ae627e9639c8 100644 (file)
@@ -6,21 +6,6 @@ LL |         let x = Box::new(0);
 LL |         let f = to_fn(|| drop(x)); //~ ERROR cannot move
    |                               ^ cannot move out of captured variable in an `Fn` closure
 
-error[E0507]: cannot move out of `x`, as it is a captured variable in a `Fn` closure
-  --> $DIR/unboxed-closure-illegal-move.rs:25:31
-   |
-LL |         let f = to_fn(|| drop(x)); //~ ERROR cannot move
-   |                               ^
-   |                               |
-   |                               cannot move out of `x`, as it is a captured variable in a `Fn` closure
-   |                               cannot move
-   |
-help: consider changing this to accept closures that implement `FnMut`
-  --> $DIR/unboxed-closure-illegal-move.rs:25:23
-   |
-LL |         let f = to_fn(|| drop(x)); //~ ERROR cannot move
-   |                       ^^^^^^^^^^
-
 error[E0507]: cannot move out of captured variable in an `FnMut` closure
   --> $DIR/unboxed-closure-illegal-move.rs:29:35
    |
@@ -37,21 +22,6 @@ LL |         let x = Box::new(0);
 LL |         let f = to_fn(move || drop(x)); //~ ERROR cannot move
    |                                    ^ cannot move out of captured variable in an `Fn` closure
 
-error[E0507]: cannot move out of `x`, as it is a captured variable in a `Fn` closure
-  --> $DIR/unboxed-closure-illegal-move.rs:38:36
-   |
-LL |         let f = to_fn(move || drop(x)); //~ ERROR cannot move
-   |                                    ^
-   |                                    |
-   |                                    cannot move out of `x`, as it is a captured variable in a `Fn` closure
-   |                                    cannot move
-   |
-help: consider changing this to accept closures that implement `FnMut`
-  --> $DIR/unboxed-closure-illegal-move.rs:38:23
-   |
-LL |         let f = to_fn(move || drop(x)); //~ ERROR cannot move
-   |                       ^^^^^^^^^^^^^^^
-
 error[E0507]: cannot move out of captured variable in an `FnMut` closure
   --> $DIR/unboxed-closure-illegal-move.rs:42:40
    |
@@ -60,6 +30,6 @@ LL |         let x = Box::new(0);
 LL |         let f = to_fn_mut(move || drop(x)); //~ ERROR cannot move
    |                                        ^ cannot move out of captured variable in an `FnMut` closure
 
-error: aborting due to 6 previous errors
+error: aborting due to 4 previous errors
 
 For more information about this error, try `rustc --explain E0507`.
index 8112ddbe2f16e8db858080f795c9fa8daca7bcfb..111940aab2c322764150b4a5be8539b966a6a6ad 100644 (file)
@@ -21,19 +21,7 @@ error[E0507]: cannot move out of borrowed content
 LL |     !*n;  //~ ERROR: cannot move out of borrowed content
    |      ^^ cannot move out of borrowed content
 
-error[E0507]: cannot move out of `*n` which is behind a `&` reference
-  --> $DIR/unop-move-semantics.rs:36:6
-   |
-LL |     let n = &y;
-   |             -- help: consider changing this to be a mutable reference: `&mut y`
-...
-LL |     !*n;  //~ ERROR: cannot move out of borrowed content
-   |      ^^
-   |      |
-   |      cannot move out of `*n` which is behind a `&` reference
-   |      `n` is a `&` reference, so the data it refers to cannot be moved
-
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
 
 Some errors occurred: E0382, E0507.
 For more information about an error, try `rustc --explain E0382`.
index 675457b0db6bb2ff72251c490388a544408219be..a94414ef5603b7a10464c3d687c133dc4111b9bd 100644 (file)
@@ -4,16 +4,6 @@ error[E0508]: cannot move out of type `[u8]`, a non-copy slice
 LL |     udrop::<[u8]>(foo()[..]);
    |                   ^^^^^^^^^ cannot move out of here
 
-error[E0507]: cannot move out of data in a `&` reference
-  --> $DIR/unsized-exprs2.rs:22:19
-   |
-LL |     udrop::<[u8]>(foo()[..]);
-   |                   ^^^^^^^^^
-   |                   |
-   |                   cannot move out of data in a `&` reference
-   |                   cannot move
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
-Some errors occurred: E0507, E0508.
-For more information about an error, try `rustc --explain E0507`.
+For more information about this error, try `rustc --explain E0508`.