Skip to content

Commit

Permalink
Feature-gate #[no_debug] and #[omit_gdb_pretty_printer_section]
Browse files Browse the repository at this point in the history
Closes #28091.
  • Loading branch information
apasel422 committed Sep 19, 2015
1 parent 783c3fc commit 6fa0ff2
Show file tree
Hide file tree
Showing 97 changed files with 135 additions and 5 deletions.
15 changes: 13 additions & 2 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Option<u32>, Status

// allow overloading augmented assignment operations like `a += b`
("augmented_assignments", "1.5.0", None, Active),

// allow `#[no_debug]`
("no_debug", "1.5.0", None, Active),

// allow `#[omit_gdb_pretty_printer_section]`
("omit_gdb_pretty_printer_section", "1.5.0", None, Active),
];
// (changing above list without updating src/doc/reference.md makes @cmr sad)

Expand Down Expand Up @@ -320,8 +326,13 @@ pub const KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeGat
("link_section", Whitelisted, Ungated),
("no_builtins", Whitelisted, Ungated),
("no_mangle", Whitelisted, Ungated),
("no_debug", Whitelisted, Ungated),
("omit_gdb_pretty_printer_section", Whitelisted, Ungated),
("no_debug", Whitelisted, Gated("no_debug",
"the `#[no_debug]` attribute \
is an experimental feature")),
("omit_gdb_pretty_printer_section", Whitelisted, Gated("omit_gdb_pretty_printer_section",
"the `#[omit_gdb_pretty_printer_section]` \
attribute is just used for the Rust test \
suite")),
("unsafe_no_drop_flag", Whitelisted, Gated("unsafe_no_drop_flag",
"unsafe_no_drop_flag has unstable semantics \
and may be removed in the future")),
Expand Down
1 change: 1 addition & 0 deletions src/test/auxiliary/cross_crate_spans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#![crate_type = "rlib"]

#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

// no-prefer-dynamic
Expand Down
12 changes: 12 additions & 0 deletions src/test/compile-fail/feature-gate-no-debug.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright 2015 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.

#[no_debug] //~ ERROR the `#[no_debug]` attribute is
fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright 2015 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.

#[omit_gdb_pretty_printer_section] //~ ERROR the `#[omit_gdb_pretty_printer_section]` attribute is
fn main() {}
1 change: 1 addition & 0 deletions src/test/debuginfo/associated-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@

#![allow(unused_variables)]
#![allow(dead_code)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

trait TraitWithAssocType {
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/basic-types-globals-metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

#![allow(unused_variables)]
#![allow(dead_code)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

// N.B. These are `mut` only so they don't constant fold away.
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/basic-types-globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
// gdb-command:continue

#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

// N.B. These are `mut` only so they don't constant fold away.
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/basic-types-metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
// gdb-command:continue

#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

fn main() {
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/basic-types-mut-globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
// gdb-check:$28 = 9.25

#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

static mut B: bool = false;
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/basic-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
// lldb-check:[...]$12 = 3.5

#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

fn main() {
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/borrowed-basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
// lldb-check:[...]$12 = 3.5

#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

fn main() {
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/borrowed-c-style-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
// lldb-check:[...]$2 = TheC

#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

enum ABC { TheA, TheB, TheC }
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/borrowed-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
// lldb-check:[...]$2 = TheOnlyCase(4820353753753434)

#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

// The first element is to ensure proper alignment, irrespective of the machines word size. Since
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/borrowed-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@

#![allow(unused_variables)]
#![feature(box_syntax)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

struct SomeStruct {
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/borrowed-tuple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

#![allow(unused_variables)]
#![feature(box_syntax)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

fn main() {
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/borrowed-unique-basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@

#![allow(unused_variables)]
#![feature(box_syntax)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

fn main() {
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#![allow(unused_variables)]
#![feature(box_syntax)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

fn main() {
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/boxed-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

#![allow(unused_variables)]
#![feature(box_syntax)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

struct StructWithSomePadding {
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/by-value-non-immediate-argument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
// lldb-check:[...]$6 = Case1 { x: 0, y: 8970181431921507452 }
// lldb-command:continue

#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

#[derive(Clone)]
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/by-value-self-argument-in-trait-impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
// lldb-check:[...]$2 = (4444.5, 5555, 6666, 7777.5)
// lldb-command:continue

#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

trait Trait {
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/c-style-enum-in-composite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
// lldb-check:[...]$6 = (StructWithDrop { a: OneHundred, b: Vienna }, 9)

#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

use self::AnEnum::{OneHundred, OneThousand, OneMillion};
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/c-style-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@

#![allow(unused_variables)]
#![allow(dead_code)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

use self::AutoDiscriminant::{One, Two, Three};
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/closure-in-generic-function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
// lldb-command:continue

#![feature(box_syntax)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

fn some_generic_fun<T1, T2>(a: T1, b: T2) -> (T2, T1) {
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/constant-debug-locs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// compile-flags:-g

#![allow(dead_code, unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]
#![feature(const_fn)]
#![feature(static_mutex)]
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/constant-in-match-pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// compile-flags:-g

#![allow(dead_code, unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

// This test makes sure that the compiler doesn't crash when trying to assign
Expand Down
5 changes: 3 additions & 2 deletions src/test/debuginfo/cross-crate-spans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

// min-lldb-version: 310
Expand All @@ -20,7 +21,7 @@ extern crate cross_crate_spans;

// === GDB TESTS ===================================================================================

// gdb-command:break cross_crate_spans.rs:23
// gdb-command:break cross_crate_spans.rs:24
// gdb-command:run

// gdb-command:print result
Expand All @@ -43,7 +44,7 @@ extern crate cross_crate_spans;

// === LLDB TESTS ==================================================================================

// lldb-command:b cross_crate_spans.rs:23
// lldb-command:b cross_crate_spans.rs:24
// lldb-command:run

// lldb-command:print result
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/destructured-fn-argument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@
#![allow(unused_variables)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

use self::Univariant::Unit;
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/destructured-for-loop-variable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
#![allow(unused_variables)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

struct Struct {
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/destructured-local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@
#![allow(unused_variables)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

use self::Univariant::Unit;
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/evec-in-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
// lldb-check:[...]$4 = StructPaddedAtEnd { x: [22, 23], y: [24, 25] }

#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

struct NoPadding1 {
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/extern-c-fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

#![allow(unused_variables)]
#![allow(dead_code)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]


Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/function-arg-initialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@


#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

fn immediate_args(a: isize, b: bool, c: f64) {
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/function-arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
// lldb-command:continue


#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

fn main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@
// lldb-command:continue

#![allow(dead_code, unused_assignments, unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

#[no_stack_check]
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/function-prologue-stepping-regular.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
// lldb-command:continue

#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

fn immediate_args(a: isize, b: bool, c: f64) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@

#![allow(unused_variables)]
#![allow(dead_code)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

// This test case makes sure that we get correct type descriptions for the enum
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/generic-function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
// lldb-check:[...]$8 = ((5, Struct { a: 6, b: 7.5 }), (Struct { a: 6, b: 7.5 }, 5))
// lldb-command:continue

#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

#[derive(Clone)]
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/generic-functions-nested.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
// lldb-command:continue


#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

fn outer<TA: Clone>(a: TA) {
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/generic-method-on-generic-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
// lldb-command:continue

#![feature(box_syntax)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

#[derive(Copy, Clone)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
// gdb-command:continue


#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

struct Struct {
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/generic-struct-style-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
// gdb-check:$4 = {{a = -1}}


#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

use self::Regular::{Case1, Case2, Case3};
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/generic-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
// lldb-check:[...]$3 = AGenericStruct<f64, generic_struct::AGenericStruct<i32, f64>> { key: 6.5, value: AGenericStruct<i32, f64> { key: 7, value: 8.5 } }


#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

struct AGenericStruct<TKey, TValue> {
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/generic-tuple-style-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
// lldb-command:print univariant
// lldb-check:[...]$3 = TheOnlyCase(-1)

#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]

use self::Regular::{Case1, Case2, Case3};
Expand Down
Loading

0 comments on commit 6fa0ff2

Please sign in to comment.