Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[beta] Stabilize crate_in_paths, extern_absolute_paths and extern_prelude on all editions. #54404

Merged
merged 1 commit into from
Sep 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 0 additions & 49 deletions src/doc/unstable-book/src/language-features/crate-in-paths.md

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
#![cfg_attr(not(stage0), feature(impl_header_lifetime_elision))]
#![feature(in_band_lifetimes)]
#![feature(macro_at_most_once_rep)]
#![feature(crate_in_paths)]
#![cfg_attr(stage0, feature(crate_in_paths))]
#![feature(crate_visibility_modifier)]

#![recursion_limit="512"]
Expand Down
21 changes: 1 addition & 20 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ use syntax::ast::{FnDecl, ForeignItem, ForeignItemKind, GenericParamKind, Generi
use syntax::ast::{Item, ItemKind, ImplItem, ImplItemKind};
use syntax::ast::{Label, Local, Mutability, Pat, PatKind, Path};
use syntax::ast::{QSelf, TraitItemKind, TraitRef, Ty, TyKind};
use syntax::feature_gate::{feature_err, GateIssue};
use syntax::ptr::P;

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

injected_crate: Option<Module<'a>>,

/// Only supposed to be used by rustdoc, otherwise should be false.
pub ignore_extern_prelude_feature: bool,
}

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

Expand Down Expand Up @@ -1969,13 +1964,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
if !module.no_implicit_prelude {
// `record_used` means that we don't try to load crates during speculative resolution
if record_used && ns == TypeNS && self.extern_prelude.contains(&ident.name) {
if !self.session.features_untracked().extern_prelude &&
!self.ignore_extern_prelude_feature {
feature_err(&self.session.parse_sess, "extern_prelude",
ident.span, GateIssue::Language,
"access to extern crates through prelude is experimental").emit();
}

let crate_id = self.crate_loader.process_path_extern(ident.name, ident.span);
let crate_root = self.get_module(DefId { krate: crate_id, index: CRATE_DEF_INDEX });
self.populate_module_if_necessary(&crate_root);
Expand Down Expand Up @@ -3573,7 +3561,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
}
if name == keywords::Extern.name() ||
name == keywords::CrateRoot.name() &&
self.session.features_untracked().extern_absolute_paths &&
self.session.rust_2018() {
module = Some(ModuleOrUniformRoot::UniformRoot(name));
continue;
Expand Down Expand Up @@ -3712,12 +3699,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
return
}

// In the 2015 edition there's no use in emitting lints unless the
// crate's already enabled the feature that we're going to suggest
if !self.session.features_untracked().crate_in_paths {
return
}

let (diag_id, diag_span) = match crate_lint {
CrateLint::No => return,
CrateLint::SimplePath(id) => (id, path_span),
Expand Down Expand Up @@ -4414,7 +4395,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
)
);

if self.session.features_untracked().extern_prelude {
if self.session.rust_2018() {
let extern_prelude_names = self.extern_prelude.clone();
for &name in extern_prelude_names.iter() {
let ident = Ident::with_empty_ctxt(name);
Expand Down
8 changes: 0 additions & 8 deletions src/librustc_resolve/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -682,14 +682,6 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
}
WhereToResolve::ExternPrelude => {
if use_prelude && self.extern_prelude.contains(&ident.name) {
if !self.session.features_untracked().extern_prelude &&
!self.ignore_extern_prelude_feature {
feature_err(&self.session.parse_sess, "extern_prelude",
ident.span, GateIssue::Language,
"access to extern crates through prelude is experimental")
.emit();
}

let crate_id =
self.crate_loader.process_path_extern(ident.name, ident.span);
let crate_root =
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_traits/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
//! New recursive solver modeled on Chalk's recursive solver. Most of
//! the guts are broken up into modules; see the comments in those modules.

#![feature(crate_in_paths)]
#![cfg_attr(stage0, feature(crate_in_paths))]
#![feature(crate_visibility_modifier)]
#![feature(extern_prelude)]
#![cfg_attr(stage0, feature(extern_prelude))]
#![feature(in_band_lifetimes)]
#![cfg_attr(not(stage0), feature(nll))]

Expand Down
4 changes: 1 addition & 3 deletions src/librustdoc/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,10 @@ pub fn run_core(search_paths: SearchPaths,
|_| Ok(()));
let driver::InnerExpansionResult {
mut hir_forest,
mut resolver,
resolver,
..
} = abort_on_err(result, &sess);

resolver.ignore_extern_prelude_feature = true;

// We need to hold on to the complete resolver, so we clone everything
// for the analysis passes to use. Suboptimal, but necessary in the
// current architecture.
Expand Down
21 changes: 7 additions & 14 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,18 +394,12 @@ declare_features! (
// Allows trait methods with arbitrary self types
(active, arbitrary_self_types, "1.23.0", Some(44874), None),

// `crate` in paths
(active, crate_in_paths, "1.23.0", Some(45477), Some(Edition::Edition2018)),

// In-band lifetime bindings (e.g. `fn foo(x: &'a u8) -> &'a u8`)
(active, in_band_lifetimes, "1.23.0", Some(44524), None),

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

// Resolve absolute paths as paths from other crates
(active, extern_absolute_paths, "1.24.0", Some(44660), Some(Edition::Edition2018)),

// `extern` in paths
(active, extern_in_paths, "1.23.0", Some(44660), None),

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

// Access to crate names passed via `--extern` through prelude
(active, extern_prelude, "1.27.0", Some(44660), Some(Edition::Edition2018)),

// Scoped lints
(active, tool_lints, "1.28.0", Some(44690), None),

Expand Down Expand Up @@ -677,7 +668,12 @@ declare_features! (
(accepted, panic_handler, "1.30.0", Some(44489), None),
// Used to preserve symbols (see llvm.used)
(accepted, used, "1.30.0", Some(40289), None),

// `crate` in paths
(accepted, crate_in_paths, "1.30.0", Some(45477), None),
// Resolve absolute paths as paths from other crates
(accepted, extern_absolute_paths, "1.30.0", Some(44660), None),
// Access to crate names passed via `--extern` through prelude
(accepted, extern_prelude, "1.30.0", Some(44660), None),
);

// If you change this, please modify src/doc/unstable-book as well. You must
Expand Down Expand Up @@ -1883,10 +1879,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
// cannot be kept in identifiers, so it's kept in paths instead and we take it from
// there while keeping location info from the ident span.
let span = segment.ident.span.with_ctxt(path.span.ctxt());
if segment.ident.name == keywords::Crate.name() {
gate_feature_post!(&self, crate_in_paths, span,
"`crate` in paths is experimental");
} else if segment.ident.name == keywords::Extern.name() {
if segment.ident.name == keywords::Extern.name() {
gate_feature_post!(&self, extern_in_paths, span,
"`extern` in paths is experimental");
}
Expand Down
1 change: 0 additions & 1 deletion src/test/run-make-fulldeps/extern-prelude/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ all:
$(RUSTC) basic.rs --extern ep_lib=$(TMPDIR)/libep_lib.rlib
$(RUSTC) shadow-mod.rs --extern ep_lib=$(TMPDIR)/libep_lib.rlib
$(RUSTC) shadow-prelude.rs --extern Vec=$(TMPDIR)/libep_vec.rlib
$(RUSTC) feature-gate.rs --extern ep_lib=$(TMPDIR)/libep_lib.rlib 2>&1 | $(CGREP) "access to extern crates through prelude is experimental"
$(RUSTC) relative-only.rs --extern ep_lib=$(TMPDIR)/libep_lib.rlib 2>&1 | $(CGREP) "unresolved import"
$(RUSTC) relative-only.rs --extern ep_lib=$(TMPDIR)/libep_lib.rlib 2>&1 | $(CGREP) "failed to resolve"
13 changes: 0 additions & 13 deletions src/test/run-make-fulldeps/extern-prelude/feature-gate.rs

This file was deleted.

15 changes: 0 additions & 15 deletions src/test/ui/feature-gates/feature-gate-crate_in_paths.rs

This file was deleted.

11 changes: 0 additions & 11 deletions src/test/ui/feature-gates/feature-gate-crate_in_paths.stderr

This file was deleted.

8 changes: 8 additions & 0 deletions src/test/ui/hygiene/dollar-crate-modern.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
warning: the feature `crate_in_paths` has been stable since 1.30.0 and no longer requires an attribute to enable
--> $DIR/dollar-crate-modern.rs:16:24
|
LL | #![feature(decl_macro, crate_in_paths)]
| ^^^^^^^^^^^^^^
|
= note: #[warn(stable_features)] on by default

8 changes: 8 additions & 0 deletions src/test/ui/macros/macro-path-prelude-pass.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
warning: the feature `extern_prelude` has been stable since 1.30.0 and no longer requires an attribute to enable
--> $DIR/macro-path-prelude-pass.rs:13:12
|
LL | #![feature(extern_prelude)]
| ^^^^^^^^^^^^^^
|
= note: #[warn(stable_features)] on by default

8 changes: 8 additions & 0 deletions src/test/ui/run-pass/extern/extern-prelude-core.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
warning: the feature `extern_prelude` has been stable since 1.30.0 and no longer requires an attribute to enable
--> $DIR/extern-prelude-core.rs:12:12
|
LL | #![feature(extern_prelude, lang_items, start, alloc)]
| ^^^^^^^^^^^^^^
|
= note: #[warn(stable_features)] on by default

8 changes: 8 additions & 0 deletions src/test/ui/run-pass/extern/extern-prelude-std.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
warning: the feature `extern_prelude` has been stable since 1.30.0 and no longer requires an attribute to enable
--> $DIR/extern-prelude-std.rs:12:12
|
LL | #![feature(extern_prelude)]
| ^^^^^^^^^^^^^^
|
= note: #[warn(stable_features)] on by default

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
warning: the feature `crate_in_paths` has been stable since 1.30.0 and no longer requires an attribute to enable
--> $DIR/crate-path-absolute.rs:12:12
|
LL | #![feature(crate_in_paths)]
| ^^^^^^^^^^^^^^
|
= note: #[warn(stable_features)] on by default

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
warning: the feature `crate_in_paths` has been stable since 1.30.0 and no longer requires an attribute to enable
--> $DIR/crate-path-visibility-ambiguity.rs:12:12
|
LL | #![feature(crate_in_paths)]
| ^^^^^^^^^^^^^^
|
= note: #[warn(stable_features)] on by default

2 changes: 1 addition & 1 deletion src/tools/cargo
Submodule cargo updated 1 files
+0 −31 tests/testsuite/fix.rs