Skip to content

Commit 6d140d5

Browse files
committed
Auto merge of rust-lang#111271 - JohnTitor:rollup-t07qk1c, r=JohnTitor
Rollup of 8 pull requests Successful merges: - rust-lang#109677 (Stabilize raw-dylib, link_ordinal, import_name_type and -Cdlltool) - rust-lang#110780 (rustdoc-search: add slices and arrays to index) - rust-lang#110830 (Add FreeBSD cpuset support to `std::thread::available_concurrency`) - rust-lang#111139 (Fix MXCSR configuration dependent timing) - rust-lang#111239 (Remove unnecessary attribute from a diagnostic) - rust-lang#111246 (forbid escaping bound vars in combine) - rust-lang#111251 (Issue 109502 follow up, remove unnecessary Vec::new() from compile_test()) - rust-lang#111261 (Mark `ErrorGuaranteed` constructor as deprecated so people don't use it) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 963e5c0 + 393e285 commit 6d140d5

File tree

81 files changed

+403
-387
lines changed

Some content is hidden

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

81 files changed

+403
-387
lines changed

compiler/rustc_codegen_llvm/messages.ftl

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ codegen_llvm_error_writing_def_file =
2424
Error writing .DEF file: {$error}
2525
2626
codegen_llvm_error_calling_dlltool =
27-
Error calling dlltool: {$error}
27+
Error calling dlltool '{$dlltool_path}': {$error}
2828
2929
codegen_llvm_dlltool_fail_import_library =
3030
Dlltool could not create import library: {$stdout}

compiler/rustc_codegen_llvm/src/back/archive.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl ArchiveBuilderBuilder for LlvmArchiveBuilderBuilder {
198198
"arm" => ("arm", "--32"),
199199
_ => panic!("unsupported arch {}", sess.target.arch),
200200
};
201-
let result = std::process::Command::new(dlltool)
201+
let result = std::process::Command::new(&dlltool)
202202
.args([
203203
"-d",
204204
def_file_path.to_str().unwrap(),
@@ -218,9 +218,13 @@ impl ArchiveBuilderBuilder for LlvmArchiveBuilderBuilder {
218218

219219
match result {
220220
Err(e) => {
221-
sess.emit_fatal(ErrorCallingDllTool { error: e });
221+
sess.emit_fatal(ErrorCallingDllTool {
222+
dlltool_path: dlltool.to_string_lossy(),
223+
error: e,
224+
});
222225
}
223-
Ok(output) if !output.status.success() => {
226+
// dlltool returns '0' on failure, so check for error output instead.
227+
Ok(output) if !output.stderr.is_empty() => {
224228
sess.emit_fatal(DlltoolFailImportLibrary {
225229
stdout: String::from_utf8_lossy(&output.stdout),
226230
stderr: String::from_utf8_lossy(&output.stderr),
@@ -431,7 +435,7 @@ fn string_to_io_error(s: String) -> io::Error {
431435

432436
fn find_binutils_dlltool(sess: &Session) -> OsString {
433437
assert!(sess.target.options.is_like_windows && !sess.target.options.is_like_msvc);
434-
if let Some(dlltool_path) = &sess.opts.unstable_opts.dlltool {
438+
if let Some(dlltool_path) = &sess.opts.cg.dlltool {
435439
return dlltool_path.clone().into_os_string();
436440
}
437441

compiler/rustc_codegen_llvm/src/errors.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ pub(crate) struct ErrorWritingDEFFile {
6767

6868
#[derive(Diagnostic)]
6969
#[diag(codegen_llvm_error_calling_dlltool)]
70-
pub(crate) struct ErrorCallingDllTool {
70+
pub(crate) struct ErrorCallingDllTool<'a> {
71+
pub dlltool_path: Cow<'a, str>,
7172
pub error: std::io::Error,
7273
}
7374

compiler/rustc_codegen_ssa/src/codegen_attrs.rs

-9
Original file line numberDiff line numberDiff line change
@@ -592,15 +592,6 @@ fn should_inherit_track_caller(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
592592

593593
fn check_link_ordinal(tcx: TyCtxt<'_>, attr: &ast::Attribute) -> Option<u16> {
594594
use rustc_ast::{LitIntType, LitKind, MetaItemLit};
595-
if !tcx.features().raw_dylib && tcx.sess.target.arch == "x86" {
596-
feature_err(
597-
&tcx.sess.parse_sess,
598-
sym::raw_dylib,
599-
attr.span,
600-
"`#[link_ordinal]` is unstable on x86",
601-
)
602-
.emit();
603-
}
604595
let meta_item_list = attr.meta_item_list();
605596
let meta_item_list = meta_item_list.as_deref();
606597
let sole_meta_list = match meta_item_list {

compiler/rustc_driver_impl/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,7 @@ fn extra_compiler_flags() -> Option<(Vec<String>, bool)> {
11781178
pub fn catch_fatal_errors<F: FnOnce() -> R, R>(f: F) -> Result<R, ErrorGuaranteed> {
11791179
catch_unwind(panic::AssertUnwindSafe(f)).map_err(|value| {
11801180
if value.is::<rustc_errors::FatalErrorMarker>() {
1181+
#[allow(deprecated)]
11811182
ErrorGuaranteed::unchecked_claim_error_was_emitted()
11821183
} else {
11831184
panic::resume_unwind(value);

compiler/rustc_errors/src/diagnostic_builder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ impl EmissionGuarantee for ErrorGuaranteed {
192192
became non-error ({:?}), after original `.emit()`",
193193
db.inner.diagnostic.level,
194194
);
195+
#[allow(deprecated)]
195196
ErrorGuaranteed::unchecked_claim_error_was_emitted()
196197
}
197198
}

compiler/rustc_errors/src/lib.rs

+21-14
Original file line numberDiff line numberDiff line change
@@ -1069,26 +1069,29 @@ impl Handler {
10691069
}
10701070

10711071
pub fn has_errors(&self) -> Option<ErrorGuaranteed> {
1072-
self.inner.borrow().has_errors().then(ErrorGuaranteed::unchecked_claim_error_was_emitted)
1072+
self.inner.borrow().has_errors().then(|| {
1073+
#[allow(deprecated)]
1074+
ErrorGuaranteed::unchecked_claim_error_was_emitted()
1075+
})
10731076
}
10741077

10751078
pub fn has_errors_or_lint_errors(&self) -> Option<ErrorGuaranteed> {
1076-
self.inner
1077-
.borrow()
1078-
.has_errors_or_lint_errors()
1079-
.then(ErrorGuaranteed::unchecked_claim_error_was_emitted)
1079+
self.inner.borrow().has_errors_or_lint_errors().then(|| {
1080+
#[allow(deprecated)]
1081+
ErrorGuaranteed::unchecked_claim_error_was_emitted()
1082+
})
10801083
}
10811084
pub fn has_errors_or_delayed_span_bugs(&self) -> Option<ErrorGuaranteed> {
1082-
self.inner
1083-
.borrow()
1084-
.has_errors_or_delayed_span_bugs()
1085-
.then(ErrorGuaranteed::unchecked_claim_error_was_emitted)
1085+
self.inner.borrow().has_errors_or_delayed_span_bugs().then(|| {
1086+
#[allow(deprecated)]
1087+
ErrorGuaranteed::unchecked_claim_error_was_emitted()
1088+
})
10861089
}
10871090
pub fn is_compilation_going_to_fail(&self) -> Option<ErrorGuaranteed> {
1088-
self.inner
1089-
.borrow()
1090-
.is_compilation_going_to_fail()
1091-
.then(ErrorGuaranteed::unchecked_claim_error_was_emitted)
1091+
self.inner.borrow().is_compilation_going_to_fail().then(|| {
1092+
#[allow(deprecated)]
1093+
ErrorGuaranteed::unchecked_claim_error_was_emitted()
1094+
})
10921095
}
10931096

10941097
pub fn print_error_count(&self, registry: &Registry) {
@@ -1333,6 +1336,7 @@ impl HandlerInner {
13331336
.push(DelayedDiagnostic::with_backtrace(diagnostic.clone(), backtrace));
13341337

13351338
if !self.flags.report_delayed_bugs {
1339+
#[allow(deprecated)]
13361340
return Some(ErrorGuaranteed::unchecked_claim_error_was_emitted());
13371341
}
13381342
}
@@ -1411,7 +1415,10 @@ impl HandlerInner {
14111415
self.bump_err_count();
14121416
}
14131417

1414-
guaranteed = Some(ErrorGuaranteed::unchecked_claim_error_was_emitted());
1418+
#[allow(deprecated)]
1419+
{
1420+
guaranteed = Some(ErrorGuaranteed::unchecked_claim_error_was_emitted());
1421+
}
14151422
} else {
14161423
self.bump_warn_count();
14171424
}

compiler/rustc_feature/src/accepted.rs

+2
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ declare_features! (
280280
(accepted, pub_restricted, "1.18.0", Some(32409), None),
281281
/// Allows use of the postfix `?` operator in expressions.
282282
(accepted, question_mark, "1.13.0", Some(31436), None),
283+
/// Allows the use of raw-dylibs (RFC 2627).
284+
(accepted, raw_dylib, "CURRENT_RUSTC_VERSION", Some(58713), None),
283285
/// Allows keywords to be escaped for use as identifiers.
284286
(accepted, raw_identifiers, "1.30.0", Some(48589), None),
285287
/// Allows relaxing the coherence rules such that

compiler/rustc_feature/src/active.rs

-2
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,6 @@ declare_features! (
489489
(active, precise_pointer_size_matching, "1.32.0", Some(56354), None),
490490
/// Allows macro attributes on expressions, statements and non-inline modules.
491491
(active, proc_macro_hygiene, "1.30.0", Some(54727), None),
492-
/// Allows the use of raw-dylibs (RFC 2627).
493-
(active, raw_dylib, "1.65.0", Some(58713), None),
494492
/// Allows `&raw const $place_expr` and `&raw mut $place_expr` expressions.
495493
(active, raw_ref_op, "1.41.0", Some(64490), None),
496494
/// Allows using the `#[register_tool]` attribute.

compiler/rustc_hir_analysis/src/errors.rs

-1
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,6 @@ pub enum ImplNotMarkedDefault {
657657
#[note]
658658
Err {
659659
#[primary_span]
660-
#[label]
661660
span: Span,
662661
cname: Symbol,
663662
ident: Symbol,

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -854,9 +854,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
854854
let result = self
855855
.resolve_fully_qualified_call(span, item_name, ty.normalized, qself.span, hir_id)
856856
.or_else(|error| {
857+
let guar = self
858+
.tcx
859+
.sess
860+
.delay_span_bug(span, "method resolution should've emitted an error");
857861
let result = match error {
858862
method::MethodError::PrivateMatch(kind, def_id, _) => Ok((kind, def_id)),
859-
_ => Err(ErrorGuaranteed::unchecked_claim_error_was_emitted()),
863+
_ => Err(guar),
860864
};
861865

862866
// If we have a path like `MyTrait::missing_method`, then don't register

compiler/rustc_infer/src/infer/combine.rs

+8-14
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ impl<'tcx> InferCtxt<'tcx> {
7373
R: ObligationEmittingRelation<'tcx>,
7474
{
7575
let a_is_expected = relation.a_is_expected();
76+
debug_assert!(!a.has_escaping_bound_vars());
77+
debug_assert!(!b.has_escaping_bound_vars());
7678

7779
match (a.kind(), b.kind()) {
7880
// Relate integral variables to other types
@@ -163,6 +165,8 @@ impl<'tcx> InferCtxt<'tcx> {
163165
R: ObligationEmittingRelation<'tcx>,
164166
{
165167
debug!("{}.consts({:?}, {:?})", relation.tag(), a, b);
168+
debug_assert!(!a.has_escaping_bound_vars());
169+
debug_assert!(!b.has_escaping_bound_vars());
166170
if a == b {
167171
return Ok(a);
168172
}
@@ -238,22 +242,12 @@ impl<'tcx> InferCtxt<'tcx> {
238242
(_, ty::ConstKind::Infer(InferConst::Var(vid))) => {
239243
return self.unify_const_variable(vid, a);
240244
}
241-
(ty::ConstKind::Unevaluated(..), _) if self.tcx.lazy_normalization() => {
242-
// FIXME(#59490): Need to remove the leak check to accommodate
243-
// escaping bound variables here.
244-
if !a.has_escaping_bound_vars() && !b.has_escaping_bound_vars() {
245-
relation.register_const_equate_obligation(a, b);
246-
}
245+
(ty::ConstKind::Unevaluated(..), _) | (_, ty::ConstKind::Unevaluated(..))
246+
if self.tcx.lazy_normalization() =>
247+
{
248+
relation.register_const_equate_obligation(a, b);
247249
return Ok(b);
248250
}
249-
(_, ty::ConstKind::Unevaluated(..)) if self.tcx.lazy_normalization() => {
250-
// FIXME(#59490): Need to remove the leak check to accommodate
251-
// escaping bound variables here.
252-
if !a.has_escaping_bound_vars() && !b.has_escaping_bound_vars() {
253-
relation.register_const_equate_obligation(a, b);
254-
}
255-
return Ok(a);
256-
}
257251
_ => {}
258252
}
259253

compiler/rustc_interface/src/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ fn test_codegen_options_tracking_hash() {
547547
untracked!(ar, String::from("abc"));
548548
untracked!(codegen_units, Some(42));
549549
untracked!(default_linker_libraries, true);
550+
untracked!(dlltool, Some(PathBuf::from("custom_dlltool.exe")));
550551
untracked!(extra_filename, String::from("extra-filename"));
551552
untracked!(incremental, Some(String::from("abc")));
552553
// `link_arg` is omitted because it just forwards to `link_args`.
@@ -651,7 +652,6 @@ fn test_unstable_options_tracking_hash() {
651652
untracked!(assert_incr_state, Some(String::from("loaded")));
652653
untracked!(deduplicate_diagnostics, false);
653654
untracked!(dep_tasks, true);
654-
untracked!(dlltool, Some(PathBuf::from("custom_dlltool.exe")));
655655
untracked!(dont_buffer_diagnostics, true);
656656
untracked!(dump_dep_graph, true);
657657
untracked!(dump_drop_tracking_cfg, Some("cfg.dot".to_string()));

compiler/rustc_metadata/src/native_libs.rs

-18
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,6 @@ impl<'tcx> Collector<'tcx> {
161161
"raw-dylib" => {
162162
if !sess.target.is_like_windows {
163163
sess.emit_err(errors::FrameworkOnlyWindows { span });
164-
} else if !features.raw_dylib && sess.target.arch == "x86" {
165-
feature_err(
166-
&sess.parse_sess,
167-
sym::raw_dylib,
168-
span,
169-
"link kind `raw-dylib` is unstable on x86",
170-
)
171-
.emit();
172164
}
173165
NativeLibKind::RawDylib
174166
}
@@ -251,16 +243,6 @@ impl<'tcx> Collector<'tcx> {
251243
continue;
252244
}
253245
};
254-
if !features.raw_dylib {
255-
let span = item.name_value_literal_span().unwrap();
256-
feature_err(
257-
&sess.parse_sess,
258-
sym::raw_dylib,
259-
span,
260-
"import name type is unstable",
261-
)
262-
.emit();
263-
}
264246
import_name_type = Some((link_import_name_type, item.span()));
265247
}
266248
_ => {

compiler/rustc_session/src/options.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1235,6 +1235,8 @@ options! {
12351235
line-tables-only, limited, or full; default: 0)"),
12361236
default_linker_libraries: bool = (false, parse_bool, [UNTRACKED],
12371237
"allow the linker to link its default libraries (default: no)"),
1238+
dlltool: Option<PathBuf> = (None, parse_opt_pathbuf, [UNTRACKED],
1239+
"import library generation tool (ignored except when targeting windows-gnu)"),
12381240
embed_bitcode: bool = (true, parse_bool, [TRACKED],
12391241
"emit bitcode in rlibs (default: yes)"),
12401242
extra_filename: String = (String::new(), parse_string, [UNTRACKED],
@@ -1391,8 +1393,6 @@ options! {
13911393
(default: no)"),
13921394
diagnostic_width: Option<usize> = (None, parse_opt_number, [UNTRACKED],
13931395
"set the current output width for diagnostic truncation"),
1394-
dlltool: Option<PathBuf> = (None, parse_opt_pathbuf, [UNTRACKED],
1395-
"import library generation tool (windows-gnu only)"),
13961396
dont_buffer_diagnostics: bool = (false, parse_bool, [UNTRACKED],
13971397
"emit diagnostics rather than buffering (breaks NLL error downgrading, sorting) \
13981398
(default: no)"),

compiler/rustc_span/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2199,6 +2199,7 @@ pub struct ErrorGuaranteed(());
21992199
impl ErrorGuaranteed {
22002200
/// To be used only if you really know what you are doing... ideally, we would find a way to
22012201
/// eliminate all calls to this method.
2202+
#[deprecated = "`Session::delay_span_bug` should be preferred over this function"]
22022203
pub fn unchecked_claim_error_was_emitted() -> Self {
22032204
ErrorGuaranteed(())
22042205
}

0 commit comments

Comments
 (0)