From 953f294ea30253bb5578e3c895d17fcc97c20dce Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 20 Jan 2015 10:57:10 -0800 Subject: rustc: Remove deprecated flags This commit removes a number of deprecated flags from the compiler: * opt-level => -C opt-level * debuginfo => -C debuginfo * print-crate-name => --print crate-name * print-file-name => --print file-names * no-trans => -Z no-trans * no-analysis => -Z no-analysis * parse-only => -Z parse-only * dep-info => --emit dep-info This commit also moves the --pretty flag behind `-Z unstable-options` as the pretty printer will likely not be stable for 1.0 cc #19051 --- src/test/debuginfo/issue7712.rs | 2 +- src/test/debuginfo/lexical-scope-in-parameterless-closure.rs | 2 +- src/test/debuginfo/limited-debuginfo.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/test/debuginfo') diff --git a/src/test/debuginfo/issue7712.rs b/src/test/debuginfo/issue7712.rs index 94458a7fb4b..124cdfb436c 100644 --- a/src/test/debuginfo/issue7712.rs +++ b/src/test/debuginfo/issue7712.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags:--debuginfo=1 +// compile-flags:-C debuginfo=1 // min-lldb-version: 310 pub trait TraitWithDefaultMethod : Sized { diff --git a/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs index b2617c57742..0050b9273e8 100644 --- a/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs +++ b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs @@ -11,7 +11,7 @@ // ignore-android: FIXME(#10381) // min-lldb-version: 310 -// compile-flags:--debuginfo=1 +// compile-flags:-C debuginfo=1 // gdb-command:run // lldb-command:run diff --git a/src/test/debuginfo/limited-debuginfo.rs b/src/test/debuginfo/limited-debuginfo.rs index 00de4497ced..76a0fd58395 100644 --- a/src/test/debuginfo/limited-debuginfo.rs +++ b/src/test/debuginfo/limited-debuginfo.rs @@ -12,7 +12,7 @@ // ignore-lldb -// compile-flags:--debuginfo=1 +// compile-flags:-C debuginfo=1 // Make sure functions have proper names // gdb-command:info functions -- cgit 1.4.1-3-g733a5 From 3a44107f9eb70342c0b2cac56c0b6ebc0f94f253 Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Wed, 21 Jan 2015 17:10:02 +0100 Subject: debuginfo: Fix issue with associated types and struct fields --- src/librustc_trans/trans/debuginfo.rs | 8 +- src/test/debuginfo/associated-types.rs | 152 +++++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 src/test/debuginfo/associated-types.rs (limited to 'src/test/debuginfo') diff --git a/src/librustc_trans/trans/debuginfo.rs b/src/librustc_trans/trans/debuginfo.rs index 2f01f0328e2..79de3b5b33b 100644 --- a/src/librustc_trans/trans/debuginfo.rs +++ b/src/librustc_trans/trans/debuginfo.rs @@ -2068,7 +2068,13 @@ fn prepare_struct_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, unique_type_id, containing_scope); - let fields = ty::struct_fields(cx.tcx(), def_id, substs); + let mut fields = ty::struct_fields(cx.tcx(), def_id, substs); + + // The `Ty` values returned by `ty::struct_fields` can still contain + // `ty_projection` variants, so normalize those away. + for field in fields.iter_mut() { + field.mt.ty = monomorphize::normalize_associated_type(cx.tcx(), &field.mt.ty); + } create_and_register_recursive_type_forward_declaration( cx, diff --git a/src/test/debuginfo/associated-types.rs b/src/test/debuginfo/associated-types.rs new file mode 100644 index 00000000000..6a624e39e32 --- /dev/null +++ b/src/test/debuginfo/associated-types.rs @@ -0,0 +1,152 @@ +// Copyright 2013-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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// ignore-android: FIXME(#10381) +// min-lldb-version: 310 + +// compile-flags:-g + +// === GDB TESTS =================================================================================== +// gdb-command:run + +// gdb-command:print arg +// gdb-check:$1 = {b = -1, b1 = 0} +// gdb-command:continue + +// gdb-command:print inferred +// gdb-check:$2 = 1 +// gdb-command:print explicitly +// gdb-check:$3 = 1 +// gdb-command:continue + +// gdb-command:print arg +// gdb-check:$4 = 2 +// gdb-command:continue + +// gdb-command:print arg +// gdb-check:$5 = {4, 5} +// gdb-command:continue + +// gdb-command:print a +// gdb-check:$6 = 6 +// gdb-command:print b +// gdb-check:$7 = 7 +// gdb-command:continue + +// gdb-command:print a +// gdb-check:$8 = 8 +// gdb-command:print b +// gdb-check:$9 = 9 +// gdb-command:continue + +// === LLDB TESTS ================================================================================== +// lldb-command:run + +// lldb-command:print arg +// lldb-check:[...]$0 = Struct { b: -1, b1: 0 } +// lldb-command:continue + +// lldb-command:print inferred +// lldb-check:[...]$1 = 1 +// lldb-command:print explicitly +// lldb-check:[...]$2 = 1 +// lldb-command:continue + +// lldb-command:print arg +// lldb-check:[...]$3 = 2 +// lldb-command:continue + +// lldb-command:print arg +// lldb-check:[...]$4 = (4, 5) +// lldb-command:continue + +// lldb-command:print a +// lldb-check:[...]$5 = 6 +// lldb-command:print b +// lldb-check:[...]$6 = 7 +// lldb-command:continue + +// lldb-command:print a +// lldb-check:[...]$7 = 8 +// lldb-command:print b +// lldb-check:[...]$8 = 9 +// lldb-command:continue + +#![allow(unused_variables)] +#![allow(dead_code)] +#![omit_gdb_pretty_printer_section] + +trait TraitWithAssocType { + type Type; + + fn get_value(&self) -> Self::Type; +} +impl TraitWithAssocType for i32 { + type Type = i64; + + fn get_value(&self) -> i64 { *self as i64 } +} + +struct Struct { + b: T, + b1: T::Type, +} + +enum Enum { + Variant1(T, T::Type), + Variant2(T::Type, T) +} + +fn assoc_struct(arg: Struct) { + zzz(); // #break +} + +fn assoc_local(x: T) { + let inferred = x.get_value(); + let explicitly: T::Type = x.get_value(); + + zzz(); // #break +} + +fn assoc_arg(arg: T::Type) { + zzz(); // #break +} + +fn assoc_return_value(arg: T) -> T::Type { + return arg.get_value(); +} + +fn assoc_tuple(arg: (T, T::Type)) { + zzz(); // #break +} + +fn assoc_enum(arg: Enum) { + + match arg { + Enum::Variant1(a, b) => { + zzz(); // #break + } + Enum::Variant2(a, b) => { + zzz(); // #break + } + } +} + +fn main() { + assoc_struct(Struct { b: -1i32, b1: 0i64 }); + assoc_local(1i32); + assoc_arg::(2i64); + assoc_return_value(3i32); + assoc_tuple((4i32, 5i64)); + assoc_enum(Enum::Variant1(6i32, 7i64)); + assoc_enum(Enum::Variant2(8i64, 9i32)); +} + +fn zzz() { () } \ No newline at end of file -- cgit 1.4.1-3-g733a5 From 90af72378d9f848de78adc5003dff6b90f327b3c Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 21 Jan 2015 14:32:54 -0800 Subject: Make diagnostic ordering deterministic --- src/librustc/diagnostics.rs | 2 -- src/libsyntax/diagnostics/plugin.rs | 14 +++++++------- src/test/debuginfo/vec-slices.rs | 1 + src/test/run-pass/issue-20797.rs | 3 +++ 4 files changed, 11 insertions(+), 9 deletions(-) (limited to 'src/test/debuginfo') diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index 653ade67b72..b48df36a679 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -77,8 +77,6 @@ register_diagnostics! { E0138, E0139, E0152, - E0153, - E0157, E0158, E0161, E0162, diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs index 0e99829fa1c..bd5247bbad6 100644 --- a/src/libsyntax/diagnostics/plugin.rs +++ b/src/libsyntax/diagnostics/plugin.rs @@ -9,7 +9,7 @@ // except according to those terms. use std::cell::RefCell; -use std::collections::HashMap; +use std::collections::BTreeMap; use ast; use ast::{Ident, Name, TokenTree}; use codemap::Span; @@ -19,18 +19,18 @@ use parse::token; use ptr::P; thread_local! { - static REGISTERED_DIAGNOSTICS: RefCell>> = { - RefCell::new(HashMap::new()) + static REGISTERED_DIAGNOSTICS: RefCell>> = { + RefCell::new(BTreeMap::new()) } } thread_local! { - static USED_DIAGNOSTICS: RefCell> = { - RefCell::new(HashMap::new()) + static USED_DIAGNOSTICS: RefCell> = { + RefCell::new(BTreeMap::new()) } } fn with_registered_diagnostics(f: F) -> T where - F: FnOnce(&mut HashMap>) -> T, + F: FnOnce(&mut BTreeMap>) -> T, { REGISTERED_DIAGNOSTICS.with(move |slot| { f(&mut *slot.borrow_mut()) @@ -38,7 +38,7 @@ fn with_registered_diagnostics(f: F) -> T where } fn with_used_diagnostics(f: F) -> T where - F: FnOnce(&mut HashMap) -> T, + F: FnOnce(&mut BTreeMap) -> T, { USED_DIAGNOSTICS.with(move |slot| { f(&mut *slot.borrow_mut()) diff --git a/src/test/debuginfo/vec-slices.rs b/src/test/debuginfo/vec-slices.rs index 949dffaac06..3ceb3946f3c 100644 --- a/src/test/debuginfo/vec-slices.rs +++ b/src/test/debuginfo/vec-slices.rs @@ -9,6 +9,7 @@ // except according to those terms. // ignore-android: FIXME(#10381) +// ignore-windows // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/run-pass/issue-20797.rs b/src/test/run-pass/issue-20797.rs index c4f3c33f269..089b6f31975 100644 --- a/src/test/run-pass/issue-20797.rs +++ b/src/test/run-pass/issue-20797.rs @@ -8,6 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-android +// ignore-windows + // Regression test for #20797. use std::default::Default; -- cgit 1.4.1-3-g733a5