From 352853c18bf1ec00c69725ee97ae1e3c0bb176fe Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sun, 22 Nov 2015 10:22:25 +0530 Subject: [PATCH 1/2] Register diagnostics for rustc_privacy and rustc_trans properly fixes #29665 --- src/librustc_driver/lib.rs | 2 ++ src/librustc_privacy/lib.rs | 2 ++ src/librustc_trans/lib.rs | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 63326c538c9..6cbba235ff7 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -907,6 +907,8 @@ pub fn diagnostics_registry() -> diagnostics::registry::Registry { all_errors.push_all(&rustc_typeck::DIAGNOSTICS); all_errors.push_all(&rustc_borrowck::DIAGNOSTICS); all_errors.push_all(&rustc_resolve::DIAGNOSTICS); + all_errors.push_all(&rustc_privacy::DIAGNOSTICS); + all_errors.push_all(&rustc_trans::DIAGNOSTICS); Registry::new(&*all_errors) } diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 1ca8eeadfe5..fdd5add68f2 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -1505,3 +1505,5 @@ pub fn check_crate(tcx: &ty::ctxt, access_levels } + +__build_diagnostic_array! { librustc_privacy, DIAGNOSTICS } diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index 84ce458ed14..6b465cf28f3 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -89,3 +89,5 @@ pub mod save; pub mod lib { pub use llvm; } + +__build_diagnostic_array! { librustc_trans, DIAGNOSTICS } From bef93557e5f230e2d99d1fa5f0f8b9354c85ac7c Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sun, 22 Nov 2015 10:26:50 +0530 Subject: [PATCH 2/2] Improve transmute diagnostics with a note about destructors fixes #29922 --- src/librustc/diagnostics.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index 7cb2de78e2c..361b8c53108 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -858,6 +858,9 @@ It is also possible to manually transmute: ``` ptr::read(&v as *const _ as *const SomeType) // `v` transmuted to `SomeType` ``` + +Note that this does not move `v` (unlike `transmute`), and may need a +call to `mem::forget(v)` in case you want to avoid destructors being called. "##, E0152: r##"