Skip to content

Commit 4a6e875

Browse files
committed
Auto merge of #54403 - eddyb:oopsie-daisy-stabilize, r=alexcrichton
Stabilize crate_in_paths, extern_absolute_paths and extern_prelude on all editions. Needed for beta, path-related migrations to Rust 2018 don't work on RC1 without these stabilizations. r? @aturon cc @nikomatsakis @Centril @alexcrichton
2 parents c97b60f + fa2c246 commit 4a6e875

File tree

19 files changed

+61
-181
lines changed

19 files changed

+61
-181
lines changed

src/doc/unstable-book/src/language-features/crate-in-paths.md

-49
This file was deleted.

src/doc/unstable-book/src/language-features/extern-absolute-paths.md

-43
This file was deleted.

src/librustc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
#![cfg_attr(not(stage0), feature(impl_header_lifetime_elision))]
7474
#![feature(in_band_lifetimes)]
7575
#![feature(macro_at_most_once_rep)]
76-
#![feature(crate_in_paths)]
76+
#![cfg_attr(stage0, feature(crate_in_paths))]
7777
#![feature(crate_visibility_modifier)]
7878

7979
#![recursion_limit="512"]

src/librustc_resolve/lib.rs

+1-20
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ use syntax::ast::{FnDecl, ForeignItem, ForeignItemKind, GenericParamKind, Generi
6565
use syntax::ast::{Item, ItemKind, ImplItem, ImplItemKind};
6666
use syntax::ast::{Label, Local, Mutability, Pat, PatKind, Path};
6767
use syntax::ast::{QSelf, TraitItemKind, TraitRef, Ty, TyKind};
68-
use syntax::feature_gate::{feature_err, GateIssue};
6968
use syntax::ptr::P;
7069

7170
use syntax_pos::{Span, DUMMY_SP, MultiSpan};
@@ -1466,9 +1465,6 @@ pub struct Resolver<'a, 'b: 'a> {
14661465
current_type_ascription: Vec<Span>,
14671466

14681467
injected_crate: Option<Module<'a>>,
1469-
1470-
/// Only supposed to be used by rustdoc, otherwise should be false.
1471-
pub ignore_extern_prelude_feature: bool,
14721468
}
14731469

14741470
/// Nothing really interesting here, it just provides memory for the rest of the crate.
@@ -1766,7 +1762,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
17661762
unused_macros: FxHashSet(),
17671763
current_type_ascription: Vec::new(),
17681764
injected_crate: None,
1769-
ignore_extern_prelude_feature: false,
17701765
}
17711766
}
17721767

@@ -1969,13 +1964,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
19691964
if !module.no_implicit_prelude {
19701965
// `record_used` means that we don't try to load crates during speculative resolution
19711966
if record_used && ns == TypeNS && self.extern_prelude.contains(&ident.name) {
1972-
if !self.session.features_untracked().extern_prelude &&
1973-
!self.ignore_extern_prelude_feature {
1974-
feature_err(&self.session.parse_sess, "extern_prelude",
1975-
ident.span, GateIssue::Language,
1976-
"access to extern crates through prelude is experimental").emit();
1977-
}
1978-
19791967
let crate_id = self.crate_loader.process_path_extern(ident.name, ident.span);
19801968
let crate_root = self.get_module(DefId { krate: crate_id, index: CRATE_DEF_INDEX });
19811969
self.populate_module_if_necessary(&crate_root);
@@ -3576,7 +3564,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
35763564
}
35773565
if name == keywords::Extern.name() ||
35783566
name == keywords::CrateRoot.name() &&
3579-
self.session.features_untracked().extern_absolute_paths &&
35803567
self.session.rust_2018() {
35813568
module = Some(ModuleOrUniformRoot::UniformRoot(name));
35823569
continue;
@@ -3715,12 +3702,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
37153702
return
37163703
}
37173704

3718-
// In the 2015 edition there's no use in emitting lints unless the
3719-
// crate's already enabled the feature that we're going to suggest
3720-
if !self.session.features_untracked().crate_in_paths {
3721-
return
3722-
}
3723-
37243705
let (diag_id, diag_span) = match crate_lint {
37253706
CrateLint::No => return,
37263707
CrateLint::SimplePath(id) => (id, path_span),
@@ -4417,7 +4398,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
44174398
)
44184399
);
44194400

4420-
if self.session.features_untracked().extern_prelude {
4401+
if self.session.rust_2018() {
44214402
let extern_prelude_names = self.extern_prelude.clone();
44224403
for &name in extern_prelude_names.iter() {
44234404
let ident = Ident::with_empty_ctxt(name);

src/librustc_resolve/macros.rs

-8
Original file line numberDiff line numberDiff line change
@@ -682,14 +682,6 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
682682
}
683683
WhereToResolve::ExternPrelude => {
684684
if use_prelude && self.extern_prelude.contains(&ident.name) {
685-
if !self.session.features_untracked().extern_prelude &&
686-
!self.ignore_extern_prelude_feature {
687-
feature_err(&self.session.parse_sess, "extern_prelude",
688-
ident.span, GateIssue::Language,
689-
"access to extern crates through prelude is experimental")
690-
.emit();
691-
}
692-
693685
let crate_id =
694686
self.crate_loader.process_path_extern(ident.name, ident.span);
695687
let crate_root =

src/librustc_traits/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
//! New recursive solver modeled on Chalk's recursive solver. Most of
1212
//! the guts are broken up into modules; see the comments in those modules.
1313
14-
#![feature(crate_in_paths)]
14+
#![cfg_attr(stage0, feature(crate_in_paths))]
1515
#![feature(crate_visibility_modifier)]
16-
#![feature(extern_prelude)]
16+
#![cfg_attr(stage0, feature(extern_prelude))]
1717
#![feature(in_band_lifetimes)]
1818
#![cfg_attr(not(stage0), feature(nll))]
1919

src/librustdoc/core.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -455,12 +455,10 @@ pub fn run_core(search_paths: SearchPaths,
455455
|_| Ok(()));
456456
let driver::InnerExpansionResult {
457457
mut hir_forest,
458-
mut resolver,
458+
resolver,
459459
..
460460
} = abort_on_err(result, &sess);
461461

462-
resolver.ignore_extern_prelude_feature = true;
463-
464462
// We need to hold on to the complete resolver, so we clone everything
465463
// for the analysis passes to use. Suboptimal, but necessary in the
466464
// current architecture.

src/libsyntax/feature_gate.rs

+7-14
Original file line numberDiff line numberDiff line change
@@ -394,18 +394,12 @@ declare_features! (
394394
// Allows trait methods with arbitrary self types
395395
(active, arbitrary_self_types, "1.23.0", Some(44874), None),
396396

397-
// `crate` in paths
398-
(active, crate_in_paths, "1.23.0", Some(45477), Some(Edition::Edition2018)),
399-
400397
// In-band lifetime bindings (e.g. `fn foo(x: &'a u8) -> &'a u8`)
401398
(active, in_band_lifetimes, "1.23.0", Some(44524), None),
402399

403400
// Generic associated types (RFC 1598)
404401
(active, generic_associated_types, "1.23.0", Some(44265), None),
405402

406-
// Resolve absolute paths as paths from other crates
407-
(active, extern_absolute_paths, "1.24.0", Some(44660), Some(Edition::Edition2018)),
408-
409403
// `extern` in paths
410404
(active, extern_in_paths, "1.23.0", Some(44660), None),
411405

@@ -455,9 +449,6 @@ declare_features! (
455449
// #[doc(alias = "...")]
456450
(active, doc_alias, "1.27.0", Some(50146), None),
457451

458-
// Access to crate names passed via `--extern` through prelude
459-
(active, extern_prelude, "1.27.0", Some(44660), Some(Edition::Edition2018)),
460-
461452
// Scoped lints
462453
(active, tool_lints, "1.28.0", Some(44690), None),
463454

@@ -683,7 +674,12 @@ declare_features! (
683674
(accepted, panic_handler, "1.30.0", Some(44489), None),
684675
// Used to preserve symbols (see llvm.used)
685676
(accepted, used, "1.30.0", Some(40289), None),
686-
677+
// `crate` in paths
678+
(accepted, crate_in_paths, "1.30.0", Some(45477), None),
679+
// Resolve absolute paths as paths from other crates
680+
(accepted, extern_absolute_paths, "1.30.0", Some(44660), None),
681+
// Access to crate names passed via `--extern` through prelude
682+
(accepted, extern_prelude, "1.30.0", Some(44660), None),
687683
);
688684

689685
// If you change this, please modify src/doc/unstable-book as well. You must
@@ -1892,10 +1888,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
18921888
// cannot be kept in identifiers, so it's kept in paths instead and we take it from
18931889
// there while keeping location info from the ident span.
18941890
let span = segment.ident.span.with_ctxt(path.span.ctxt());
1895-
if segment.ident.name == keywords::Crate.name() {
1896-
gate_feature_post!(&self, crate_in_paths, span,
1897-
"`crate` in paths is experimental");
1898-
} else if segment.ident.name == keywords::Extern.name() {
1891+
if segment.ident.name == keywords::Extern.name() {
18991892
gate_feature_post!(&self, extern_in_paths, span,
19001893
"`extern` in paths is experimental");
19011894
}

src/test/run-make-fulldeps/extern-prelude/Makefile

-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ all:
77
$(RUSTC) basic.rs --extern ep_lib=$(TMPDIR)/libep_lib.rlib
88
$(RUSTC) shadow-mod.rs --extern ep_lib=$(TMPDIR)/libep_lib.rlib
99
$(RUSTC) shadow-prelude.rs --extern Vec=$(TMPDIR)/libep_vec.rlib
10-
$(RUSTC) feature-gate.rs --extern ep_lib=$(TMPDIR)/libep_lib.rlib 2>&1 | $(CGREP) "access to extern crates through prelude is experimental"
1110
$(RUSTC) relative-only.rs --extern ep_lib=$(TMPDIR)/libep_lib.rlib 2>&1 | $(CGREP) "unresolved import"
1211
$(RUSTC) relative-only.rs --extern ep_lib=$(TMPDIR)/libep_lib.rlib 2>&1 | $(CGREP) "failed to resolve"

src/test/run-make-fulldeps/extern-prelude/feature-gate.rs

-13
This file was deleted.

src/test/ui/feature-gates/feature-gate-crate_in_paths.rs

-15
This file was deleted.

src/test/ui/feature-gates/feature-gate-crate_in_paths.stderr

-11
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
warning: the feature `crate_in_paths` has been stable since 1.30.0 and no longer requires an attribute to enable
2+
--> $DIR/dollar-crate-modern.rs:16:24
3+
|
4+
LL | #![feature(decl_macro, crate_in_paths)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: #[warn(stable_features)] on by default
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
warning: the feature `extern_prelude` has been stable since 1.30.0 and no longer requires an attribute to enable
2+
--> $DIR/macro-path-prelude-pass.rs:13:12
3+
|
4+
LL | #![feature(extern_prelude)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: #[warn(stable_features)] on by default
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
warning: the feature `extern_prelude` has been stable since 1.30.0 and no longer requires an attribute to enable
2+
--> $DIR/extern-prelude-core.rs:12:12
3+
|
4+
LL | #![feature(extern_prelude, lang_items, start, alloc)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: #[warn(stable_features)] on by default
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
warning: the feature `extern_prelude` has been stable since 1.30.0 and no longer requires an attribute to enable
2+
--> $DIR/extern-prelude-std.rs:12:12
3+
|
4+
LL | #![feature(extern_prelude)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: #[warn(stable_features)] on by default
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
warning: the feature `crate_in_paths` has been stable since 1.30.0 and no longer requires an attribute to enable
2+
--> $DIR/crate-path-absolute.rs:12:12
3+
|
4+
LL | #![feature(crate_in_paths)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: #[warn(stable_features)] on by default
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
warning: the feature `crate_in_paths` has been stable since 1.30.0 and no longer requires an attribute to enable
2+
--> $DIR/crate-path-visibility-ambiguity.rs:12:12
3+
|
4+
LL | #![feature(crate_in_paths)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: #[warn(stable_features)] on by default
8+

src/tools/cargo

0 commit comments

Comments
 (0)