about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2016-01-11 15:56:21 -0500
committerNiko Matsakis <niko@alum.mit.edu>2016-01-16 05:22:33 -0500
commit0723d6c6edbca3cc7bd8ef2a988594756c9c0b36 (patch)
tree6b3cc96b9b8bea3b22859a60c9700e0e103aa15b
parent57c31b2849ea499fae4a9f6f049d1ab0512e70fd (diff)
downloadrust-0723d6c6edbca3cc7bd8ef2a988594756c9c0b36.tar.gz
rust-0723d6c6edbca3cc7bd8ef2a988594756c9c0b36.zip
Pacify tidy.
-rw-r--r--src/librustc/middle/traits/error_reporting.rs3
-rw-r--r--src/librustc_data_structures/obligation_forest/node_index.rs10
-rw-r--r--src/librustc_data_structures/obligation_forest/test.rs132
-rw-r--r--src/librustc_typeck/check/mod.rs3
4 files changed, 89 insertions, 59 deletions
diff --git a/src/librustc/middle/traits/error_reporting.rs b/src/librustc/middle/traits/error_reporting.rs
index ef97c4c8a12..d09bbc37fe4 100644
--- a/src/librustc/middle/traits/error_reporting.rs
+++ b/src/librustc/middle/traits/error_reporting.rs
@@ -286,7 +286,8 @@ pub fn try_report_overflow_error_type_of_infinite_size<'a, 'tcx>(
         struct_enum_tys.iter()
                        .enumerate()
                        .filter_map(|(index, ty)| match ty.sty {
-                           ty::TyEnum(adt_def, _) | ty::TyStruct(adt_def, _) if adt_def.did.is_local() =>
+                           ty::TyEnum(adt_def, _) | ty::TyStruct(adt_def, _)
+                               if adt_def.did.is_local() =>
                                Some((index, adt_def.did)),
                            _ =>
                                None,
diff --git a/src/librustc_data_structures/obligation_forest/node_index.rs b/src/librustc_data_structures/obligation_forest/node_index.rs
index ecfecd4e628..465cee0b60c 100644
--- a/src/librustc_data_structures/obligation_forest/node_index.rs
+++ b/src/librustc_data_structures/obligation_forest/node_index.rs
@@ -1,3 +1,13 @@
+// Copyright 2014 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 core::nonzero::NonZero;
 use std::u32;
 
diff --git a/src/librustc_data_structures/obligation_forest/test.rs b/src/librustc_data_structures/obligation_forest/test.rs
index 039b683717f..628d3f94bdb 100644
--- a/src/librustc_data_structures/obligation_forest/test.rs
+++ b/src/librustc_data_structures/obligation_forest/test.rs
@@ -1,3 +1,13 @@
+// Copyright 2014 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 super::{ObligationForest, Outcome, Error};
 
 #[test]
@@ -86,42 +96,46 @@ fn success_in_grandchildren() {
     let mut forest = ObligationForest::new();
     forest.push_root("A");
 
-    let Outcome { successful: ok, errors: err, .. } = forest.process_obligations::<(),_>(|obligation, _| {
-        match *obligation {
-            "A" => Ok(Some(vec!["A.1", "A.2", "A.3"])),
-            _ => unreachable!(),
-        }
-    });
+    let Outcome { successful: ok, errors: err, .. } =
+        forest.process_obligations::<(),_>(|obligation, _| {
+            match *obligation {
+                "A" => Ok(Some(vec!["A.1", "A.2", "A.3"])),
+                _ => unreachable!(),
+            }
+        });
     assert!(ok.is_empty());
     assert!(err.is_empty());
 
-    let Outcome { successful: ok, errors: err, .. } = forest.process_obligations::<(),_>(|obligation, _| {
-        match *obligation {
-            "A.1" => Ok(Some(vec![])),
-            "A.2" => Ok(Some(vec!["A.2.i", "A.2.ii"])),
-            "A.3" => Ok(Some(vec![])),
-            _ => unreachable!(),
-        }
-    });
+    let Outcome { successful: ok, errors: err, .. } =
+        forest.process_obligations::<(),_>(|obligation, _| {
+            match *obligation {
+                "A.1" => Ok(Some(vec![])),
+                "A.2" => Ok(Some(vec!["A.2.i", "A.2.ii"])),
+                "A.3" => Ok(Some(vec![])),
+                _ => unreachable!(),
+            }
+        });
     assert_eq!(ok, vec!["A.3", "A.1"]);
     assert!(err.is_empty());
 
-    let Outcome { successful: ok, errors: err, .. } = forest.process_obligations::<(),_>(|obligation, _| {
-        match *obligation {
-            "A.2.i" => Ok(Some(vec!["A.2.i.a"])),
-            "A.2.ii" => Ok(Some(vec![])),
-            _ => unreachable!(),
-        }
-    });
+    let Outcome { successful: ok, errors: err, .. } =
+        forest.process_obligations::<(),_>(|obligation, _| {
+            match *obligation {
+                "A.2.i" => Ok(Some(vec!["A.2.i.a"])),
+                "A.2.ii" => Ok(Some(vec![])),
+                _ => unreachable!(),
+            }
+        });
     assert_eq!(ok, vec!["A.2.ii"]);
     assert!(err.is_empty());
 
-    let Outcome { successful: ok, errors: err, .. } = forest.process_obligations::<(),_>(|obligation, _| {
-        match *obligation {
-            "A.2.i.a" => Ok(Some(vec![])),
-            _ => unreachable!(),
-        }
-    });
+    let Outcome { successful: ok, errors: err, .. } =
+        forest.process_obligations::<(),_>(|obligation, _| {
+            match *obligation {
+                "A.2.i.a" => Ok(Some(vec![])),
+                _ => unreachable!(),
+            }
+        });
     assert_eq!(ok, vec!["A.2.i.a", "A.2.i", "A.2", "A"]);
     assert!(err.is_empty());
 
@@ -137,12 +151,13 @@ fn to_errors_no_throw() {
     // only yields one of them (and does not panic, in particular).
     let mut forest = ObligationForest::new();
     forest.push_root("A");
-    let Outcome { successful: ok, errors: err, .. } = forest.process_obligations::<(),_>(|obligation, _| {
-        match *obligation {
-            "A" => Ok(Some(vec!["A.1", "A.2", "A.3"])),
-            _ => unreachable!(),
-        }
-    });
+    let Outcome { successful: ok, errors: err, .. } =
+        forest.process_obligations::<(),_>(|obligation, _| {
+            match *obligation {
+                "A" => Ok(Some(vec!["A.1", "A.2", "A.3"])),
+                _ => unreachable!(),
+            }
+        });
     assert_eq!(ok.len(), 0);
     assert_eq!(err.len(), 0);
     let errors = forest.to_errors(());
@@ -155,34 +170,37 @@ fn backtrace() {
     // only yields one of them (and does not panic, in particular).
     let mut forest: ObligationForest<&'static str> = ObligationForest::new();
     forest.push_root("A");
-    let Outcome { successful: ok, errors: err, .. } = forest.process_obligations::<(),_>(|obligation, mut backtrace| {
-        assert!(backtrace.next().is_none());
-        match *obligation {
-            "A" => Ok(Some(vec!["A.1"])),
-            _ => unreachable!(),
-        }
-    });
+    let Outcome { successful: ok, errors: err, .. } =
+        forest.process_obligations::<(),_>(|obligation, mut backtrace| {
+            assert!(backtrace.next().is_none());
+            match *obligation {
+                "A" => Ok(Some(vec!["A.1"])),
+                _ => unreachable!(),
+            }
+        });
     assert!(ok.is_empty());
     assert!(err.is_empty());
-    let Outcome { successful: ok, errors: err, .. } = forest.process_obligations::<(),_>(|obligation, mut backtrace| {
-        assert!(backtrace.next().unwrap() == &"A");
-        assert!(backtrace.next().is_none());
-        match *obligation {
-            "A.1" => Ok(Some(vec!["A.1.i"])),
-            _ => unreachable!(),
-        }
-    });
+    let Outcome { successful: ok, errors: err, .. } =
+        forest.process_obligations::<(),_>(|obligation, mut backtrace| {
+            assert!(backtrace.next().unwrap() == &"A");
+            assert!(backtrace.next().is_none());
+            match *obligation {
+                "A.1" => Ok(Some(vec!["A.1.i"])),
+                _ => unreachable!(),
+            }
+        });
     assert!(ok.is_empty());
     assert!(err.is_empty());
-    let Outcome { successful: ok, errors: err, .. } = forest.process_obligations::<(),_>(|obligation, mut backtrace| {
-        assert!(backtrace.next().unwrap() == &"A.1");
-        assert!(backtrace.next().unwrap() == &"A");
-        assert!(backtrace.next().is_none());
-        match *obligation {
-            "A.1.i" => Ok(None),
-            _ => unreachable!(),
-        }
-    });
+    let Outcome { successful: ok, errors: err, .. } =
+        forest.process_obligations::<(),_>(|obligation, mut backtrace| {
+            assert!(backtrace.next().unwrap() == &"A.1");
+            assert!(backtrace.next().unwrap() == &"A");
+            assert!(backtrace.next().is_none());
+            match *obligation {
+                "A.1.i" => Ok(None),
+                _ => unreachable!(),
+            }
+        });
     assert_eq!(ok.len(), 0);
     assert!(err.is_empty());
 }
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index eafa1e4304d..4ada6c36f8f 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -4142,7 +4142,8 @@ pub fn check_representable(tcx: &ty::ctxt,
     // caught by case 1.
     match rty.is_representable(tcx, sp) {
         Representability::SelfRecursive => {
-            traits::recursive_type_with_infinite_size_error(tcx, tcx.map.local_def_id(item_id)).emit();
+            let item_def_id = tcx.map.local_def_id(item_id);
+            traits::recursive_type_with_infinite_size_error(tcx, item_def_id).emit();
             return false
         }
         Representability::Representable | Representability::ContainsRecursive => (),