Rollup merge of #69667 - JohnTitor:no-debug, r=nikomatsakis
Remove the `no_debug` feature Context: https://github.com/rust-lang/rust/issues/29721#issuecomment-367642779 r? @nikomatsakis
This commit is contained in:
commit
614cd8dc47
14 changed files with 14 additions and 125 deletions
|
@ -58,9 +58,6 @@ bitflags! {
|
||||||
/// "weird symbol" for the standard library in that it has slightly
|
/// "weird symbol" for the standard library in that it has slightly
|
||||||
/// different linkage, visibility, and reachability rules.
|
/// different linkage, visibility, and reachability rules.
|
||||||
const RUSTC_STD_INTERNAL_SYMBOL = 1 << 6;
|
const RUSTC_STD_INTERNAL_SYMBOL = 1 << 6;
|
||||||
/// `#[no_debug]`: an indicator that no debugging information should be
|
|
||||||
/// generated for this function by LLVM.
|
|
||||||
const NO_DEBUG = 1 << 7;
|
|
||||||
/// `#[thread_local]`: indicates a static is actually a thread local
|
/// `#[thread_local]`: indicates a static is actually a thread local
|
||||||
/// piece of memory
|
/// piece of memory
|
||||||
const THREAD_LOCAL = 1 << 8;
|
const THREAD_LOCAL = 1 << 8;
|
||||||
|
|
|
@ -2269,10 +2269,6 @@ pub fn create_global_var_metadata(cx: &CodegenCx<'ll, '_>, def_id: DefId, global
|
||||||
let tcx = cx.tcx;
|
let tcx = cx.tcx;
|
||||||
let attrs = tcx.codegen_fn_attrs(def_id);
|
let attrs = tcx.codegen_fn_attrs(def_id);
|
||||||
|
|
||||||
if attrs.flags.contains(CodegenFnAttrFlags::NO_DEBUG) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let no_mangle = attrs.flags.contains(CodegenFnAttrFlags::NO_MANGLE);
|
let no_mangle = attrs.flags.contains(CodegenFnAttrFlags::NO_MANGLE);
|
||||||
// We may want to remove the namespace scope if we're in an extern block (see
|
// We may want to remove the namespace scope if we're in an extern block (see
|
||||||
// https://github.com/rust-lang/rust/pull/46457#issuecomment-351750952).
|
// https://github.com/rust-lang/rust/pull/46457#issuecomment-351750952).
|
||||||
|
|
|
@ -12,7 +12,6 @@ use crate::llvm;
|
||||||
use crate::llvm::debuginfo::{
|
use crate::llvm::debuginfo::{
|
||||||
DIArray, DIBuilder, DIFile, DIFlags, DILexicalBlock, DISPFlags, DIScope, DIType, DIVariable,
|
DIArray, DIBuilder, DIFile, DIFlags, DILexicalBlock, DISPFlags, DIScope, DIType, DIVariable,
|
||||||
};
|
};
|
||||||
use rustc::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
|
||||||
use rustc::ty::subst::{GenericArgKind, SubstsRef};
|
use rustc::ty::subst::{GenericArgKind, SubstsRef};
|
||||||
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LOCAL_CRATE};
|
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LOCAL_CRATE};
|
||||||
|
|
||||||
|
@ -22,7 +21,7 @@ use crate::common::CodegenCx;
|
||||||
use crate::value::Value;
|
use crate::value::Value;
|
||||||
use rustc::mir;
|
use rustc::mir;
|
||||||
use rustc::session::config::{self, DebugInfo};
|
use rustc::session::config::{self, DebugInfo};
|
||||||
use rustc::ty::{self, Instance, InstanceDef, ParamEnv, Ty};
|
use rustc::ty::{self, Instance, ParamEnv, Ty};
|
||||||
use rustc_codegen_ssa::debuginfo::type_names;
|
use rustc_codegen_ssa::debuginfo::type_names;
|
||||||
use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext, VariableKind};
|
use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext, VariableKind};
|
||||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||||
|
@ -241,12 +240,6 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let InstanceDef::Item(def_id) = instance.def {
|
|
||||||
if self.tcx().codegen_fn_attrs(def_id).flags.contains(CodegenFnAttrFlags::NO_DEBUG) {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let span = mir.span;
|
let span = mir.span;
|
||||||
|
|
||||||
// This can be the case for functions inlined from another crate
|
// This can be the case for functions inlined from another crate
|
||||||
|
|
|
@ -289,9 +289,6 @@ declare_features! (
|
||||||
/// Permits specifying whether a function should permit unwinding or abort on unwind.
|
/// Permits specifying whether a function should permit unwinding or abort on unwind.
|
||||||
(active, unwind_attributes, "1.4.0", Some(58760), None),
|
(active, unwind_attributes, "1.4.0", Some(58760), None),
|
||||||
|
|
||||||
/// Allows `#[no_debug]`.
|
|
||||||
(active, no_debug, "1.5.0", Some(29721), None),
|
|
||||||
|
|
||||||
/// Allows attributes on expressions and non-item statements.
|
/// Allows attributes on expressions and non-item statements.
|
||||||
(active, stmt_expr_attributes, "1.6.0", Some(15701), None),
|
(active, stmt_expr_attributes, "1.6.0", Some(15701), None),
|
||||||
|
|
||||||
|
|
|
@ -507,16 +507,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
||||||
cfg_fn!(rustc_attrs),
|
cfg_fn!(rustc_attrs),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
|
||||||
sym::no_debug, Whitelisted, template!(Word),
|
|
||||||
Gated(
|
|
||||||
Stability::Deprecated("https://github.com/rust-lang/rust/issues/29721", None),
|
|
||||||
sym::no_debug,
|
|
||||||
"the `#[no_debug]` attribute was an experimental feature that has been \
|
|
||||||
deprecated due to lack of demand",
|
|
||||||
cfg_fn!(no_debug)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
gated!(
|
gated!(
|
||||||
// Used in resolve:
|
// Used in resolve:
|
||||||
prelude_import, Whitelisted, template!(Word),
|
prelude_import, Whitelisted, template!(Word),
|
||||||
|
|
|
@ -111,6 +111,8 @@ declare_features! (
|
||||||
/// Allows overlapping impls of marker traits.
|
/// Allows overlapping impls of marker traits.
|
||||||
(removed, overlapping_marker_traits, "1.42.0", Some(29864), None,
|
(removed, overlapping_marker_traits, "1.42.0", Some(29864), None,
|
||||||
Some("removed in favor of `#![feature(marker_trait_attr)]`")),
|
Some("removed in favor of `#![feature(marker_trait_attr)]`")),
|
||||||
|
/// Allows `#[no_debug]`.
|
||||||
|
(removed, no_debug, "1.43.0", Some(29721), None, Some("removed due to lack of demand")),
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
// feature-group-end: removed features
|
// feature-group-end: removed features
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
|
@ -2341,8 +2341,6 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs {
|
||||||
codegen_fn_attrs.flags |= CodegenFnAttrFlags::NO_MANGLE;
|
codegen_fn_attrs.flags |= CodegenFnAttrFlags::NO_MANGLE;
|
||||||
} else if attr.check_name(sym::rustc_std_internal_symbol) {
|
} else if attr.check_name(sym::rustc_std_internal_symbol) {
|
||||||
codegen_fn_attrs.flags |= CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL;
|
codegen_fn_attrs.flags |= CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL;
|
||||||
} else if attr.check_name(sym::no_debug) {
|
|
||||||
codegen_fn_attrs.flags |= CodegenFnAttrFlags::NO_DEBUG;
|
|
||||||
} else if attr.check_name(sym::used) {
|
} else if attr.check_name(sym::used) {
|
||||||
codegen_fn_attrs.flags |= CodegenFnAttrFlags::USED;
|
codegen_fn_attrs.flags |= CodegenFnAttrFlags::USED;
|
||||||
} else if attr.check_name(sym::thread_local) {
|
} else if attr.check_name(sym::thread_local) {
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
// ignore-lldb
|
|
||||||
|
|
||||||
// compile-flags:-g
|
|
||||||
|
|
||||||
// gdb-command:run
|
|
||||||
|
|
||||||
// gdb-command:info locals
|
|
||||||
// gdb-check:No locals.
|
|
||||||
// gdb-command:continue
|
|
||||||
|
|
||||||
// gdb-command:info locals
|
|
||||||
// gdb-check:abc = 10
|
|
||||||
// gdb-command:continue
|
|
||||||
|
|
||||||
#![allow(unused_variables)]
|
|
||||||
#![feature(no_debug)]
|
|
||||||
#![feature(omit_gdb_pretty_printer_section)]
|
|
||||||
#![omit_gdb_pretty_printer_section]
|
|
||||||
|
|
||||||
#[inline(never)]
|
|
||||||
fn id<T>(x: T) -> T {x}
|
|
||||||
|
|
||||||
fn function_with_debuginfo() {
|
|
||||||
let abc = 10_usize;
|
|
||||||
id(abc); // #break
|
|
||||||
}
|
|
||||||
|
|
||||||
#[no_debug]
|
|
||||||
fn function_without_debuginfo() {
|
|
||||||
let abc = -57i32;
|
|
||||||
id(abc); // #break
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
function_without_debuginfo();
|
|
||||||
function_with_debuginfo();
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
#![deny(deprecated)]
|
|
||||||
#![feature(no_debug)]
|
|
||||||
|
|
||||||
#[no_debug] //~ ERROR use of deprecated attribute `no_debug`
|
|
||||||
fn main() {}
|
|
|
@ -1,14 +0,0 @@
|
||||||
error: use of deprecated attribute `no_debug`: the `#[no_debug]` attribute was an experimental feature that has been deprecated due to lack of demand. See https://github.com/rust-lang/rust/issues/29721
|
|
||||||
--> $DIR/feature-gate-no-debug-2.rs:4:1
|
|
||||||
|
|
|
||||||
LL | #[no_debug]
|
|
||||||
| ^^^^^^^^^^^ help: remove this attribute
|
|
||||||
|
|
|
||||||
note: the lint level is defined here
|
|
||||||
--> $DIR/feature-gate-no-debug-2.rs:1:9
|
|
||||||
|
|
|
||||||
LL | #![deny(deprecated)]
|
|
||||||
| ^^^^^^^^^^
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
#![allow(deprecated)]
|
|
||||||
|
|
||||||
#[no_debug] //~ ERROR the `#[no_debug]` attribute was
|
|
||||||
fn main() {}
|
|
|
@ -1,12 +0,0 @@
|
||||||
error[E0658]: the `#[no_debug]` attribute was an experimental feature that has been deprecated due to lack of demand
|
|
||||||
--> $DIR/feature-gate-no-debug.rs:3:1
|
|
||||||
|
|
|
||||||
LL | #[no_debug]
|
|
||||||
| ^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: see issue #29721 <https://github.com/rust-lang/rust/issues/29721> for more information
|
|
||||||
= help: add `#![feature(no_debug)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0658`.
|
|
|
@ -1,7 +1,6 @@
|
||||||
// ignore-tidy-tab
|
// ignore-tidy-tab
|
||||||
|
|
||||||
#![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896
|
#![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896
|
||||||
#![feature(no_debug)]
|
|
||||||
|
|
||||||
#[no_mangle] const DISCOVERY: usize = 1;
|
#[no_mangle] const DISCOVERY: usize = 1;
|
||||||
//~^ ERROR const items should never be `#[no_mangle]`
|
//~^ ERROR const items should never be `#[no_mangle]`
|
||||||
|
@ -39,9 +38,6 @@ struct Equinox {
|
||||||
warp_factor: f32,
|
warp_factor: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_debug] // should suggest removal of deprecated attribute
|
|
||||||
//~^ WARN deprecated
|
|
||||||
//~| HELP remove this attribute
|
|
||||||
fn main() {
|
fn main() {
|
||||||
while true {
|
while true {
|
||||||
//~^ WARN denote infinite loops
|
//~^ WARN denote infinite loops
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
warning: denote infinite loops with `loop { ... }`
|
warning: denote infinite loops with `loop { ... }`
|
||||||
--> $DIR/suggestions.rs:46:5
|
--> $DIR/suggestions.rs:42:5
|
||||||
|
|
|
|
||||||
LL | while true {
|
LL | while true {
|
||||||
| ^^^^^^^^^^ help: use `loop`
|
| ^^^^^^^^^^ help: use `loop`
|
||||||
|
@ -7,7 +7,7 @@ LL | while true {
|
||||||
= note: `#[warn(while_true)]` on by default
|
= note: `#[warn(while_true)]` on by default
|
||||||
|
|
||||||
warning: unnecessary parentheses around assigned value
|
warning: unnecessary parentheses around assigned value
|
||||||
--> $DIR/suggestions.rs:49:31
|
--> $DIR/suggestions.rs:45:31
|
||||||
|
|
|
|
||||||
LL | let mut registry_no = (format!("NX-{}", 74205));
|
LL | let mut registry_no = (format!("NX-{}", 74205));
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses
|
||||||
|
@ -18,16 +18,8 @@ note: the lint level is defined here
|
||||||
LL | #![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896
|
LL | #![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
warning: use of deprecated attribute `no_debug`: the `#[no_debug]` attribute was an experimental feature that has been deprecated due to lack of demand. See https://github.com/rust-lang/rust/issues/29721
|
|
||||||
--> $DIR/suggestions.rs:42:1
|
|
||||||
|
|
|
||||||
LL | #[no_debug] // should suggest removal of deprecated attribute
|
|
||||||
| ^^^^^^^^^^^ help: remove this attribute
|
|
||||||
|
|
|
||||||
= note: `#[warn(deprecated)]` on by default
|
|
||||||
|
|
||||||
warning: variable does not need to be mutable
|
warning: variable does not need to be mutable
|
||||||
--> $DIR/suggestions.rs:49:13
|
--> $DIR/suggestions.rs:45:13
|
||||||
|
|
|
|
||||||
LL | let mut registry_no = (format!("NX-{}", 74205));
|
LL | let mut registry_no = (format!("NX-{}", 74205));
|
||||||
| ----^^^^^^^^^^^
|
| ----^^^^^^^^^^^
|
||||||
|
@ -41,7 +33,7 @@ LL | #![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issu
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
warning: variable does not need to be mutable
|
warning: variable does not need to be mutable
|
||||||
--> $DIR/suggestions.rs:55:13
|
--> $DIR/suggestions.rs:51:13
|
||||||
|
|
|
|
||||||
LL | let mut
|
LL | let mut
|
||||||
| _____________^
|
| _____________^
|
||||||
|
@ -53,7 +45,7 @@ LL | || b = 1;
|
||||||
| help: remove this `mut`
|
| help: remove this `mut`
|
||||||
|
|
||||||
error: const items should never be `#[no_mangle]`
|
error: const items should never be `#[no_mangle]`
|
||||||
--> $DIR/suggestions.rs:6:14
|
--> $DIR/suggestions.rs:5:14
|
||||||
|
|
|
|
||||||
LL | #[no_mangle] const DISCOVERY: usize = 1;
|
LL | #[no_mangle] const DISCOVERY: usize = 1;
|
||||||
| -----^^^^^^^^^^^^^^^^^^^^^^
|
| -----^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -63,7 +55,7 @@ LL | #[no_mangle] const DISCOVERY: usize = 1;
|
||||||
= note: `#[deny(no_mangle_const_items)]` on by default
|
= note: `#[deny(no_mangle_const_items)]` on by default
|
||||||
|
|
||||||
warning: functions generic over types or consts must be mangled
|
warning: functions generic over types or consts must be mangled
|
||||||
--> $DIR/suggestions.rs:12:1
|
--> $DIR/suggestions.rs:11:1
|
||||||
|
|
|
|
||||||
LL | #[no_mangle]
|
LL | #[no_mangle]
|
||||||
| ------------ help: remove this attribute
|
| ------------ help: remove this attribute
|
||||||
|
@ -74,7 +66,7 @@ LL | pub fn defiant<T>(_t: T) {}
|
||||||
= note: `#[warn(no_mangle_generic_items)]` on by default
|
= note: `#[warn(no_mangle_generic_items)]` on by default
|
||||||
|
|
||||||
warning: the `warp_factor:` in this pattern is redundant
|
warning: the `warp_factor:` in this pattern is redundant
|
||||||
--> $DIR/suggestions.rs:61:23
|
--> $DIR/suggestions.rs:57:23
|
||||||
|
|
|
|
||||||
LL | Equinox { warp_factor: warp_factor } => {}
|
LL | Equinox { warp_factor: warp_factor } => {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use shorthand field pattern: `warp_factor`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use shorthand field pattern: `warp_factor`
|
||||||
|
@ -82,7 +74,7 @@ LL | Equinox { warp_factor: warp_factor } => {}
|
||||||
= note: `#[warn(non_shorthand_field_patterns)]` on by default
|
= note: `#[warn(non_shorthand_field_patterns)]` on by default
|
||||||
|
|
||||||
error: const items should never be `#[no_mangle]`
|
error: const items should never be `#[no_mangle]`
|
||||||
--> $DIR/suggestions.rs:22:18
|
--> $DIR/suggestions.rs:21:18
|
||||||
|
|
|
|
||||||
LL | #[no_mangle] pub const DAUNTLESS: bool = true;
|
LL | #[no_mangle] pub const DAUNTLESS: bool = true;
|
||||||
| ---------^^^^^^^^^^^^^^^^^^^^^^^^
|
| ---------^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -90,7 +82,7 @@ LL | #[no_mangle] pub const DAUNTLESS: bool = true;
|
||||||
| help: try a static value: `pub static`
|
| help: try a static value: `pub static`
|
||||||
|
|
||||||
warning: functions generic over types or consts must be mangled
|
warning: functions generic over types or consts must be mangled
|
||||||
--> $DIR/suggestions.rs:25:18
|
--> $DIR/suggestions.rs:24:18
|
||||||
|
|
|
|
||||||
LL | #[no_mangle] pub fn val_jean<T>() {}
|
LL | #[no_mangle] pub fn val_jean<T>() {}
|
||||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^
|
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -98,7 +90,7 @@ LL | #[no_mangle] pub fn val_jean<T>() {}
|
||||||
| help: remove this attribute
|
| help: remove this attribute
|
||||||
|
|
||||||
error: const items should never be `#[no_mangle]`
|
error: const items should never be `#[no_mangle]`
|
||||||
--> $DIR/suggestions.rs:30:18
|
--> $DIR/suggestions.rs:29:18
|
||||||
|
|
|
|
||||||
LL | #[no_mangle] pub(crate) const VETAR: bool = true;
|
LL | #[no_mangle] pub(crate) const VETAR: bool = true;
|
||||||
| ----------------^^^^^^^^^^^^^^^^^^^^
|
| ----------------^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -106,7 +98,7 @@ LL | #[no_mangle] pub(crate) const VETAR: bool = true;
|
||||||
| help: try a static value: `pub static`
|
| help: try a static value: `pub static`
|
||||||
|
|
||||||
warning: functions generic over types or consts must be mangled
|
warning: functions generic over types or consts must be mangled
|
||||||
--> $DIR/suggestions.rs:33:18
|
--> $DIR/suggestions.rs:32:18
|
||||||
|
|
|
|
||||||
LL | #[no_mangle] pub(crate) fn crossfield<T>() {}
|
LL | #[no_mangle] pub(crate) fn crossfield<T>() {}
|
||||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue