Skip to content

Commit 500c006

Browse files
committed
Auto merge of rust-lang#118821 - GuillaumeGomez:rollup-g34cld3, r=GuillaumeGomez
Rollup of 5 pull requests Successful merges: - rust-lang#118417 (Add unstable `-Zdefault-hidden-visibility` cmdline flag for `rustc`.) - rust-lang#118661 (Restore `const PartialEq`) - rust-lang#118802 (Remove edition umbrella features.) - rust-lang#118807 (Remove an allocation in min_stack) - rust-lang#118812 (rustdoc-search: do not treat associated type names as types) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 8b1ba11 + df7d23c commit 500c006

File tree

102 files changed

+808
-869
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+808
-869
lines changed

Diff for: compiler/rustc_codegen_gcc/src/allocator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ fn create_wrapper_function(
9090
.collect();
9191
let func = context.new_function(None, FunctionType::Exported, output.unwrap_or(void), &args, from_name, false);
9292

93-
if tcx.sess.target.options.default_hidden_visibility {
93+
if tcx.sess.default_hidden_visibility() {
9494
#[cfg(feature="master")]
9595
func.add_attribute(FnAttribute::Visibility(gccjit::Visibility::Hidden));
9696
}

Diff for: compiler/rustc_codegen_llvm/src/allocator.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub(crate) unsafe fn codegen(
7676
// __rust_alloc_error_handler_should_panic
7777
let name = OomStrategy::SYMBOL;
7878
let ll_g = llvm::LLVMRustGetOrInsertGlobal(llmod, name.as_ptr().cast(), name.len(), i8);
79-
if tcx.sess.target.default_hidden_visibility {
79+
if tcx.sess.default_hidden_visibility() {
8080
llvm::LLVMRustSetVisibility(ll_g, llvm::Visibility::Hidden);
8181
}
8282
let val = tcx.sess.opts.unstable_opts.oom.should_panic();
@@ -85,7 +85,7 @@ pub(crate) unsafe fn codegen(
8585

8686
let name = NO_ALLOC_SHIM_IS_UNSTABLE;
8787
let ll_g = llvm::LLVMRustGetOrInsertGlobal(llmod, name.as_ptr().cast(), name.len(), i8);
88-
if tcx.sess.target.default_hidden_visibility {
88+
if tcx.sess.default_hidden_visibility() {
8989
llvm::LLVMRustSetVisibility(ll_g, llvm::Visibility::Hidden);
9090
}
9191
let llval = llvm::LLVMConstInt(i8, 0, False);
@@ -130,7 +130,7 @@ fn create_wrapper_function(
130130
None
131131
};
132132

133-
if tcx.sess.target.default_hidden_visibility {
133+
if tcx.sess.default_hidden_visibility() {
134134
llvm::LLVMRustSetVisibility(llfn, llvm::Visibility::Hidden);
135135
}
136136
if tcx.sess.must_emit_unwind_tables() {

Diff for: compiler/rustc_codegen_llvm/src/declare.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
8484
fn_type: &'ll Type,
8585
) -> &'ll Value {
8686
// Declare C ABI functions with the visibility used by C by default.
87-
let visibility = if self.tcx.sess.target.default_hidden_visibility {
87+
let visibility = if self.tcx.sess.default_hidden_visibility() {
8888
llvm::Visibility::Hidden
8989
} else {
9090
llvm::Visibility::Default
@@ -107,7 +107,7 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
107107
unnamed: llvm::UnnamedAddr,
108108
fn_type: &'ll Type,
109109
) -> &'ll Value {
110-
let visibility = if self.tcx.sess.target.default_hidden_visibility {
110+
let visibility = if self.tcx.sess.default_hidden_visibility() {
111111
llvm::Visibility::Hidden
112112
} else {
113113
llvm::Visibility::Default

Diff for: compiler/rustc_const_eval/src/util/type_name.rs

-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
120120
&mut self,
121121
print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>,
122122
args: &[GenericArg<'tcx>],
123-
_params: &[ty::GenericParamDef],
124123
) -> Result<(), PrintError> {
125124
print_prefix(self)?;
126125
let args =

Diff for: compiler/rustc_error_codes/src/error_codes/E0705.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
#### Note: this error code is no longer emitted by the compiler.
2+
13
A `#![feature]` attribute was declared for a feature that is stable in the
24
current edition, but not in all editions.
35

46
Erroneous code example:
57

6-
```rust2018,compile_fail,E0705
8+
```compile_fail
79
#![feature(rust_2018_preview)]
810
#![feature(test_2018_feature)] // error: the feature
911
// `test_2018_feature` is

Diff for: compiler/rustc_expand/messages.ftl

-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ expand_explain_doc_comment_outer =
3535
expand_expr_repeat_no_syntax_vars =
3636
attempted to repeat an expression containing no syntax variables matched as repeating at this depth
3737
38-
expand_feature_included_in_edition =
39-
the feature `{$feature}` is included in the Rust {$edition} edition
40-
4138
expand_feature_not_allowed =
4239
the feature `{$name}` is not in the list of allowed features
4340

Diff for: compiler/rustc_expand/src/config.rs

+2-72
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! Conditional compilation stripping.
22
33
use crate::errors::{
4-
FeatureIncludedInEdition, FeatureNotAllowed, FeatureRemoved, FeatureRemovedReason, InvalidCfg,
5-
MalformedFeatureAttribute, MalformedFeatureAttributeHelp, RemoveExprNotSupported,
4+
FeatureNotAllowed, FeatureRemoved, FeatureRemovedReason, InvalidCfg, MalformedFeatureAttribute,
5+
MalformedFeatureAttributeHelp, RemoveExprNotSupported,
66
};
77
use rustc_ast::ptr::P;
88
use rustc_ast::token::{Delimiter, Token, TokenKind};
@@ -12,13 +12,11 @@ use rustc_ast::NodeId;
1212
use rustc_ast::{self as ast, AttrStyle, Attribute, HasAttrs, HasTokens, MetaItem};
1313
use rustc_attr as attr;
1414
use rustc_data_structures::flat_map_in_place::FlatMapInPlace;
15-
use rustc_data_structures::fx::FxHashSet;
1615
use rustc_feature::Features;
1716
use rustc_feature::{ACCEPTED_FEATURES, REMOVED_FEATURES, UNSTABLE_FEATURES};
1817
use rustc_parse::validate_attr;
1918
use rustc_session::parse::feature_err;
2019
use rustc_session::Session;
21-
use rustc_span::edition::ALL_EDITIONS;
2220
use rustc_span::symbol::{sym, Symbol};
2321
use rustc_span::Span;
2422
use thin_vec::ThinVec;
@@ -47,42 +45,6 @@ pub fn features(sess: &Session, krate_attrs: &[Attribute], crate_name: Symbol) -
4745

4846
let mut features = Features::default();
4947

50-
// The edition from `--edition`.
51-
let crate_edition = sess.edition();
52-
53-
// The maximum of (a) the edition from `--edition` and (b) any edition
54-
// umbrella feature-gates declared in the code.
55-
// - E.g. if `crate_edition` is 2015 but `rust_2018_preview` is present,
56-
// `feature_edition` is 2018
57-
let mut features_edition = crate_edition;
58-
for attr in krate_attrs {
59-
for mi in feature_list(attr) {
60-
if mi.is_word() {
61-
let name = mi.name_or_empty();
62-
let edition = ALL_EDITIONS.iter().find(|e| name == e.feature_name()).copied();
63-
if let Some(edition) = edition
64-
&& edition > features_edition
65-
{
66-
features_edition = edition;
67-
}
68-
}
69-
}
70-
}
71-
72-
// Enable edition-dependent features based on `features_edition`.
73-
// - E.g. enable `test_2018_feature` if `features_edition` is 2018 or higher
74-
let mut edition_enabled_features = FxHashSet::default();
75-
for f in UNSTABLE_FEATURES {
76-
if let Some(edition) = f.feature.edition
77-
&& edition <= features_edition
78-
{
79-
// FIXME(Manishearth) there is currently no way to set lib features by
80-
// edition.
81-
edition_enabled_features.insert(f.feature.name);
82-
(f.set_enabled)(&mut features);
83-
}
84-
}
85-
8648
// Process all features declared in the code.
8749
for attr in krate_attrs {
8850
for mi in feature_list(attr) {
@@ -107,38 +69,6 @@ pub fn features(sess: &Session, krate_attrs: &[Attribute], crate_name: Symbol) -
10769
}
10870
};
10971

110-
// If the declared feature is an edition umbrella feature-gate,
111-
// warn if it was redundant w.r.t. `crate_edition`.
112-
// - E.g. warn if `rust_2018_preview` is declared when
113-
// `crate_edition` is 2018
114-
// - E.g. don't warn if `rust_2018_preview` is declared when
115-
// `crate_edition` is 2015.
116-
if let Some(&edition) = ALL_EDITIONS.iter().find(|e| name == e.feature_name()) {
117-
if edition <= crate_edition {
118-
sess.emit_warning(FeatureIncludedInEdition {
119-
span: mi.span(),
120-
feature: name,
121-
edition,
122-
});
123-
}
124-
features.set_declared_lang_feature(name, mi.span(), None);
125-
continue;
126-
}
127-
128-
// If the declared feature is edition-dependent and was already
129-
// enabled due to `feature_edition`, give a warning.
130-
// - E.g. warn if `test_2018_feature` is declared when
131-
// `feature_edition` is 2018 or higher.
132-
if edition_enabled_features.contains(&name) {
133-
sess.emit_warning(FeatureIncludedInEdition {
134-
span: mi.span(),
135-
feature: name,
136-
edition: features_edition,
137-
});
138-
features.set_declared_lang_feature(name, mi.span(), None);
139-
continue;
140-
}
141-
14272
// If the declared feature has been removed, issue an error.
14373
if let Some(f) = REMOVED_FEATURES.iter().find(|f| name == f.feature.name) {
14474
sess.emit_err(FeatureRemoved {

Diff for: compiler/rustc_expand/src/errors.rs

-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use rustc_ast::ast;
22
use rustc_macros::Diagnostic;
33
use rustc_session::Limit;
4-
use rustc_span::edition::Edition;
54
use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent};
65
use rustc_span::{Span, Symbol};
76
use std::borrow::Cow;
@@ -168,15 +167,6 @@ pub(crate) struct TakesNoArguments<'a> {
168167
pub name: &'a str,
169168
}
170169

171-
#[derive(Diagnostic)]
172-
#[diag(expand_feature_included_in_edition, code = "E0705")]
173-
pub(crate) struct FeatureIncludedInEdition {
174-
#[primary_span]
175-
pub span: Span,
176-
pub feature: Symbol,
177-
pub edition: Edition,
178-
}
179-
180170
#[derive(Diagnostic)]
181171
#[diag(expand_feature_removed, code = "E0557")]
182172
pub(crate) struct FeatureRemoved<'a> {

0 commit comments

Comments
 (0)