Skip to content

Commit 57b72b8

Browse files
authored
Rollup merge of rust-lang#66498 - bjorn3:less_feature_flags, r=Dylan-DPC
Remove unused feature gates I think many of the remaining unstable things can be easily be replaced with stable things. I have kept the `#![feature(nll)]` even though it is only necessary in `libstd`, to make regressions of it harder.
2 parents 07a34df + 5827d78 commit 57b72b8

File tree

21 files changed

+14
-71
lines changed

21 files changed

+14
-71
lines changed

src/bootstrap/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@
103103
//! More documentation can be found in each respective module below, and you can
104104
//! also check out the `src/bootstrap/README.md` file for more information.
105105
106-
#![feature(core_intrinsics)]
107106
#![feature(drain_filter)]
108107

109108
use std::cell::{Cell, RefCell};

src/librustc/lib.rs

-7
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
//! This API is completely unstable and subject to change.
2828
2929
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
30-
#![feature(arbitrary_self_types)]
3130
#![feature(bool_to_option)]
3231
#![feature(box_patterns)]
3332
#![feature(box_syntax)]
@@ -39,21 +38,15 @@
3938
#![feature(marker_trait_attr)]
4039
#![feature(extern_types)]
4140
#![feature(nll)]
42-
#![feature(optin_builtin_traits)]
4341
#![feature(option_expect_none)]
4442
#![feature(range_is_empty)]
4543
#![feature(specialization)]
46-
#![feature(unboxed_closures)]
47-
#![feature(thread_local)]
48-
#![feature(trace_macros)]
4944
#![feature(trusted_len)]
5045
#![feature(vec_remove_item)]
5146
#![feature(stmt_expr_attributes)]
52-
#![feature(integer_atomics)]
5347
#![feature(test)]
5448
#![feature(in_band_lifetimes)]
5549
#![feature(crate_visibility_modifier)]
56-
#![feature(log_syntax)]
5750
#![feature(associated_type_bounds)]
5851
#![feature(rustc_attrs)]
5952
#![feature(hash_raw_entry)]

src/librustc_codegen_llvm/lib.rs

+4-11
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,11 @@
66
77
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
88
#![feature(bool_to_option)]
9-
#![feature(box_patterns)]
10-
#![feature(box_syntax)]
119
#![feature(const_cstr_unchecked)]
1210
#![feature(crate_visibility_modifier)]
1311
#![feature(extern_types)]
1412
#![feature(in_band_lifetimes)]
15-
#![feature(libc)]
1613
#![feature(nll)]
17-
#![feature(optin_builtin_traits)]
18-
#![feature(concat_idents)]
19-
#![feature(link_args)]
20-
#![feature(static_nobundle)]
2114
#![feature(trusted_len)]
2215
#![recursion_limit = "256"]
2316

@@ -196,7 +189,7 @@ unsafe impl Sync for LlvmCodegenBackend {}
196189

197190
impl LlvmCodegenBackend {
198191
pub fn new() -> Box<dyn CodegenBackend> {
199-
box LlvmCodegenBackend(())
192+
Box::new(LlvmCodegenBackend(()))
200193
}
201194
}
202195

@@ -245,7 +238,7 @@ impl CodegenBackend for LlvmCodegenBackend {
245238
}
246239

247240
fn metadata_loader(&self) -> Box<MetadataLoaderDyn> {
248-
box metadata::LlvmMetadataLoader
241+
Box::new(metadata::LlvmMetadataLoader)
249242
}
250243

251244
fn provide(&self, providers: &mut ty::query::Providers<'_>) {
@@ -262,12 +255,12 @@ impl CodegenBackend for LlvmCodegenBackend {
262255
metadata: EncodedMetadata,
263256
need_metadata_module: bool,
264257
) -> Box<dyn Any> {
265-
box rustc_codegen_ssa::base::codegen_crate(
258+
Box::new(rustc_codegen_ssa::base::codegen_crate(
266259
LlvmCodegenBackend(()),
267260
tcx,
268261
metadata,
269262
need_metadata_module,
270-
)
263+
))
271264
}
272265

273266
fn join_codegen(

src/librustc_codegen_llvm/metadata.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ impl MetadataLoader for LlvmMetadataLoader {
2222
// Use ArchiveRO for speed here, it's backed by LLVM and uses mmap
2323
// internally to read the file. We also avoid even using a memcpy by
2424
// just keeping the archive along while the metadata is in use.
25-
let archive = ArchiveRO::open(filename).map(|ar| OwningRef::new(box ar)).map_err(|e| {
26-
debug!("llvm didn't like `{}`: {}", filename.display(), e);
27-
format!("failed to read rlib metadata in '{}': {}", filename.display(), e)
28-
})?;
25+
let archive =
26+
ArchiveRO::open(filename).map(|ar| OwningRef::new(Box::new(ar))).map_err(|e| {
27+
debug!("llvm didn't like `{}`: {}", filename.display(), e);
28+
format!("failed to read rlib metadata in '{}': {}", filename.display(), e)
29+
})?;
2930
let buf: OwningRef<_, [u8]> = archive.try_map(|ar| {
3031
ar.iter()
3132
.filter_map(|s| s.ok())
@@ -44,9 +45,10 @@ impl MetadataLoader for LlvmMetadataLoader {
4445
let buf = path_to_c_string(filename);
4546
let mb = llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(buf.as_ptr())
4647
.ok_or_else(|| format!("error reading library: '{}'", filename.display()))?;
47-
let of = ObjectFile::new(mb).map(|of| OwningRef::new(box of)).ok_or_else(|| {
48-
format!("provided path not an object file: '{}'", filename.display())
49-
})?;
48+
let of =
49+
ObjectFile::new(mb).map(|of| OwningRef::new(Box::new(of))).ok_or_else(|| {
50+
format!("provided path not an object file: '{}'", filename.display())
51+
})?;
5052
let buf = of.try_map(|of| search_meta_section(of, target, filename))?;
5153
Ok(rustc_erase_owner!(buf))
5254
}

src/librustc_codegen_ssa/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
22
#![feature(bool_to_option)]
33
#![feature(box_patterns)]
4-
#![feature(box_syntax)]
5-
#![feature(core_intrinsics)]
6-
#![feature(libc)]
7-
#![feature(stmt_expr_attributes)]
84
#![feature(try_blocks)]
95
#![feature(in_band_lifetimes)]
106
#![feature(nll)]

src/librustc_codegen_utils/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
//! This API is completely unstable and subject to change.
44
55
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
6-
#![feature(arbitrary_self_types)]
7-
#![feature(box_patterns)]
8-
#![feature(box_syntax)]
9-
#![feature(core_intrinsics)]
106
#![feature(never_type)]
117
#![feature(nll)]
128
#![feature(in_band_lifetimes)]

src/librustc_data_structures/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,16 @@
1212
#![feature(generators)]
1313
#![feature(generator_trait)]
1414
#![feature(fn_traits)]
15-
#![feature(unsize)]
1615
#![feature(specialization)]
1716
#![feature(optin_builtin_traits)]
1817
#![feature(nll)]
1918
#![feature(allow_internal_unstable)]
2019
#![feature(hash_raw_entry)]
2120
#![feature(stmt_expr_attributes)]
2221
#![feature(core_intrinsics)]
23-
#![feature(integer_atomics)]
2422
#![feature(test)]
2523
#![feature(associated_type_bounds)]
2624
#![feature(thread_id_value)]
27-
#![cfg_attr(unix, feature(libc))]
2825
#![allow(rustc::default_hash_types)]
2926

3027
#[macro_use]

src/librustc_driver/lib.rs

-5
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,7 @@
55
//! This API is completely unstable and subject to change.
66
77
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
8-
#![feature(box_syntax)]
9-
#![cfg_attr(unix, feature(libc))]
108
#![feature(nll)]
11-
#![feature(set_stdio)]
12-
#![feature(no_debug)]
13-
#![feature(integer_atomics)]
149
#![recursion_limit = "256"]
1510

1611
pub extern crate getopts;

src/librustc_errors/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
55
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
66
#![feature(crate_visibility_modifier)]
7-
#![cfg_attr(unix, feature(libc))]
87
#![feature(nll)]
9-
#![feature(optin_builtin_traits)]
108

119
pub use emitter::ColorConfig;
1210

src/librustc_incremental/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
44
#![feature(in_band_lifetimes)]
55
#![feature(nll)]
6-
#![feature(specialization)]
76
#![recursion_limit = "256"]
87

98
#[macro_use]

src/librustc_interface/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
#![feature(box_syntax)]
33
#![feature(set_stdio)]
44
#![feature(nll)]
5-
#![feature(arbitrary_self_types)]
65
#![feature(generator_trait)]
76
#![feature(generators)]
8-
#![cfg_attr(unix, feature(libc))]
97
#![recursion_limit = "256"]
108

119
#[cfg(unix)]

src/librustc_lint/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
2929
#![cfg_attr(test, feature(test))]
3030
#![feature(bool_to_option)]
31-
#![feature(box_patterns)]
3231
#![feature(box_syntax)]
3332
#![feature(crate_visibility_modifier)]
3433
#![feature(never_type)]

src/librustc_metadata/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
22
#![feature(bool_to_option)]
3-
#![feature(box_patterns)]
43
#![feature(core_intrinsics)]
54
#![feature(crate_visibility_modifier)]
65
#![feature(drain_filter)]
76
#![feature(in_band_lifetimes)]
8-
#![feature(libc)]
97
#![feature(nll)]
108
#![feature(proc_macro_internals)]
11-
#![feature(proc_macro_quote)]
12-
#![feature(rustc_private)]
139
#![feature(specialization)]
1410
#![feature(stmt_expr_attributes)]
1511
#![recursion_limit = "256"]

src/librustc_mir/lib.rs

-6
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,15 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
66

77
#![feature(nll)]
88
#![feature(in_band_lifetimes)]
9-
#![feature(inner_deref)]
109
#![feature(bool_to_option)]
1110
#![feature(box_patterns)]
1211
#![feature(box_syntax)]
1312
#![feature(crate_visibility_modifier)]
14-
#![feature(core_intrinsics)]
15-
#![feature(decl_macro)]
1613
#![feature(drain_filter)]
1714
#![feature(exhaustive_patterns)]
1815
#![feature(iter_order_by)]
1916
#![feature(never_type)]
2017
#![feature(specialization)]
21-
#![feature(try_trait)]
22-
#![feature(unicode_internals)]
23-
#![feature(slice_concat_ext)]
2418
#![feature(trusted_len)]
2519
#![feature(try_blocks)]
2620
#![feature(associated_type_bounds)]

src/librustc_resolve/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
1010
#![feature(bool_to_option)]
1111
#![feature(crate_visibility_modifier)]
12-
#![feature(label_break_value)]
1312
#![feature(nll)]
1413
#![recursion_limit = "256"]
1514

src/librustc_span/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
#![feature(crate_visibility_modifier)]
99
#![feature(nll)]
1010
#![feature(optin_builtin_traits)]
11-
#![feature(rustc_attrs)]
12-
#![feature(specialization)]
13-
#![feature(step_trait)]
1411

1512
use rustc_data_structures::AtomicRef;
1613
use rustc_macros::HashStable_Generic;

src/librustc_target/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
//! LLVM.
99
1010
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
11-
#![feature(box_syntax)]
1211
#![feature(bool_to_option)]
1312
#![feature(nll)]
1413

src/librustc_typeck/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,8 @@ This API is completely unstable and subject to change.
5858
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
5959
#![allow(non_camel_case_types)]
6060
#![feature(bool_to_option)]
61-
#![feature(box_patterns)]
6261
#![feature(box_syntax)]
6362
#![feature(crate_visibility_modifier)]
64-
#![feature(exhaustive_patterns)]
6563
#![feature(in_band_lifetimes)]
6664
#![feature(nll)]
6765
#![feature(try_blocks)]

src/librustdoc/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,15 @@
33
html_playground_url = "https://play.rust-lang.org/"
44
)]
55
#![feature(rustc_private)]
6-
#![feature(arbitrary_self_types)]
76
#![feature(box_patterns)]
87
#![feature(box_syntax)]
98
#![feature(in_band_lifetimes)]
109
#![feature(nll)]
11-
#![feature(set_stdio)]
1210
#![feature(test)]
1311
#![feature(vec_remove_item)]
1412
#![feature(ptr_offset_from)]
1513
#![feature(crate_visibility_modifier)]
16-
#![feature(drain_filter)]
1714
#![feature(never_type)]
18-
#![feature(unicode_internals)]
1915
#![recursion_limit = "256"]
2016

2117
extern crate env_logger;

src/libserialize/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Core encoding and decoding interfaces.
1010
test(attr(allow(unused_variables), deny(warnings)))
1111
)]
1212
#![feature(box_syntax)]
13-
#![feature(core_intrinsics)]
1413
#![feature(specialization)]
1514
#![feature(never_type)]
1615
#![feature(nll)]

src/test/ui/consts/miri_unleashed/mutable_const2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ error: internal compiler error: mutable allocation in constant
1010
LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

13-
thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:357:17
13+
thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:355:17
1414
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
1515

1616
error: internal compiler error: unexpected panic

0 commit comments

Comments
 (0)