Skip to content

Commit 69b3959

Browse files
committed
Auto merge of rust-lang#139622 - matthiaskrgr:rollup-8ri1vid, r=matthiaskrgr
Rollup of 13 pull requests Successful merges: - rust-lang#138167 (Small code improvement in rustdoc hidden stripper) - rust-lang#138605 (Clean up librustdoc::html::render to be better encapsulated) - rust-lang#139423 (Suppress missing field error when autoderef bottoms out in infer) - rust-lang#139449 (match ergonomics: replace `peel_off_references` with a recursive call) - rust-lang#139507 (compiletest: Trim whitespace from environment variable names) - rust-lang#139530 (Remove some dead or leftover code related to rustc-intrinsic abi removal) - rust-lang#139560 (fix title of offset_of_enum feature) - rust-lang#139563 (emit a better error message for using the macro incorrectly) - rust-lang#139568 (Don't use empty trait names) - rust-lang#139580 (Temporarily leave the review rotation) - rust-lang#139589 (saethlin is back from vacation) - rust-lang#139592 (rustdoc: Enable Markdown extensions when looking for doctests) - rust-lang#139599 (Tracking issue template: fine-grained information on style update status) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 7d7de5b + b14671e commit 69b3959

File tree

30 files changed

+268
-329
lines changed

30 files changed

+268
-329
lines changed

Diff for: .github/ISSUE_TEMPLATE/tracking_issue.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ for larger features an implementation could be broken up into multiple PRs.
4141
- [ ] Implement the RFC (cc @rust-lang/XXX -- can anyone write up mentoring
4242
instructions?)
4343
- [ ] Adjust documentation ([see instructions on rustc-dev-guide][doc-guide])
44-
- [ ] Formatting for new syntax has been added to the [Style Guide] ([nightly-style-procedure])
44+
- [ ] Style updates for any new syntax ([nightly-style-procedure])
45+
- [ ] Style team decision on new formatting
46+
- [ ] Formatting for new syntax has been added to the [Style Guide]
47+
- [ ] (non-blocking) Formatting has been implemented in `rustfmt`
4548
- [ ] Stabilization PR ([see instructions on rustc-dev-guide][stabilization-guide])
4649

4750
[stabilization-guide]: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#stabilization-pr

Diff for: compiler/rustc_builtin_macros/src/autodiff.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ mod llvm_enzyme {
234234
let meta_item_vec: ThinVec<MetaItemInner> = match meta_item.kind {
235235
ast::MetaItemKind::List(ref vec) => vec.clone(),
236236
_ => {
237-
dcx.emit_err(errors::AutoDiffInvalidApplication { span: item.span() });
237+
dcx.emit_err(errors::AutoDiffMissingConfig { span: item.span() });
238238
return vec![item];
239239
}
240240
};

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
#### Note: this error code is no longer emitted by the compiler.
2+
13
An intrinsic was declared without being a function.
24

35
Erroneous code example:
46

5-
```compile_fail,E0622
7+
```no_run
68
#![feature(intrinsics)]
79
#![allow(internal_features)]
810

Diff for: compiler/rustc_error_codes/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ E0618: 0618,
397397
E0619: 0619,
398398
E0620: 0620,
399399
E0621: 0621,
400-
E0622: 0622,
400+
E0622: 0622, // REMOVED: rustc-intrinsic ABI was removed
401401
E0623: 0623,
402402
E0624: 0624,
403403
E0625: 0625,

Diff for: compiler/rustc_hir_analysis/src/check/check.rs

-11
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,6 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
719719
def_id,
720720
tcx.def_ident_span(def_id).unwrap(),
721721
i.name,
722-
ExternAbi::Rust,
723722
)
724723
}
725724
}
@@ -787,16 +786,6 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
787786
for item in items {
788787
let def_id = item.id.owner_id.def_id;
789788

790-
if tcx.has_attr(def_id, sym::rustc_intrinsic) {
791-
intrinsic::check_intrinsic_type(
792-
tcx,
793-
item.id.owner_id.def_id,
794-
item.span,
795-
item.ident.name,
796-
abi,
797-
);
798-
}
799-
800789
let generics = tcx.generics_of(def_id);
801790
let own_counts = generics.own_counts();
802791
if generics.own_params.len() - own_counts.lifetimes != 0 {

Diff for: compiler/rustc_hir_analysis/src/check/intrinsic.rs

+9-24
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//! Type-checking for the `#[rustc_intrinsic]` intrinsics that the compiler exposes.
22
33
use rustc_abi::ExternAbi;
4-
use rustc_errors::codes::*;
5-
use rustc_errors::{DiagMessage, struct_span_code_err};
6-
use rustc_hir::{self as hir, Safety};
4+
use rustc_errors::DiagMessage;
5+
use rustc_hir::{self as hir};
76
use rustc_middle::bug;
87
use rustc_middle::traits::{ObligationCause, ObligationCauseCode};
98
use rustc_middle::ty::{self, Ty, TyCtxt};
@@ -26,17 +25,10 @@ fn equate_intrinsic_type<'tcx>(
2625
sig: ty::PolyFnSig<'tcx>,
2726
) {
2827
let (generics, span) = match tcx.hir_node_by_def_id(def_id) {
29-
hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn { generics, .. }, .. })
30-
| hir::Node::ForeignItem(hir::ForeignItem {
31-
kind: hir::ForeignItemKind::Fn(_, _, generics),
32-
..
33-
}) => (tcx.generics_of(def_id), generics.span),
34-
_ => {
35-
struct_span_code_err!(tcx.dcx(), span, E0622, "intrinsic must be a function")
36-
.with_span_label(span, "expected a function")
37-
.emit();
38-
return;
28+
hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn { generics, .. }, .. }) => {
29+
(tcx.generics_of(def_id), generics.span)
3930
}
31+
_ => tcx.dcx().span_bug(span, "intrinsic must be a function"),
4032
};
4133
let own_counts = generics.own_counts();
4234

@@ -70,13 +62,7 @@ fn equate_intrinsic_type<'tcx>(
7062
}
7163

7264
/// Returns the unsafety of the given intrinsic.
73-
pub fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -> hir::Safety {
74-
let has_safe_attr = if tcx.has_attr(intrinsic_id, sym::rustc_intrinsic) {
75-
tcx.fn_sig(intrinsic_id).skip_binder().safety()
76-
} else {
77-
// Old-style intrinsics are never safe
78-
Safety::Unsafe
79-
};
65+
fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -> hir::Safety {
8066
let is_in_list = match tcx.item_name(intrinsic_id.into()) {
8167
// When adding a new intrinsic to this list,
8268
// it's usually worth updating that intrinsic's documentation
@@ -148,7 +134,7 @@ pub fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -
148134
_ => hir::Safety::Unsafe,
149135
};
150136

151-
if has_safe_attr != is_in_list {
137+
if tcx.fn_sig(intrinsic_id).skip_binder().safety() != is_in_list {
152138
tcx.dcx().struct_span_err(
153139
tcx.def_span(intrinsic_id),
154140
DiagMessage::from(format!(
@@ -163,12 +149,11 @@ pub fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -
163149

164150
/// Remember to add all intrinsics here, in `compiler/rustc_codegen_llvm/src/intrinsic.rs`,
165151
/// and in `library/core/src/intrinsics.rs`.
166-
pub fn check_intrinsic_type(
152+
pub(crate) fn check_intrinsic_type(
167153
tcx: TyCtxt<'_>,
168154
intrinsic_id: LocalDefId,
169155
span: Span,
170156
intrinsic_name: Symbol,
171-
abi: ExternAbi,
172157
) {
173158
let generics = tcx.generics_of(intrinsic_id);
174159
let param = |n| {
@@ -706,7 +691,7 @@ pub fn check_intrinsic_type(
706691
};
707692
(n_tps, 0, n_cts, inputs, output, safety)
708693
};
709-
let sig = tcx.mk_fn_sig(inputs, output, false, safety, abi);
694+
let sig = tcx.mk_fn_sig(inputs, output, false, safety, ExternAbi::Rust);
710695
let sig = ty::Binder::bind_with_vars(sig, bound_vars);
711696
equate_intrinsic_type(tcx, span, intrinsic_id, n_tps, n_lts, n_cts, sig)
712697
}

Diff for: compiler/rustc_hir_typeck/src/expr.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -2920,8 +2920,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
29202920
}
29212921
// We failed to check the expression, report an error.
29222922

2923-
// Emits an error if we deref an infer variable, like calling `.field` on a base type of &_.
2924-
self.structurally_resolve_type(autoderef.span(), autoderef.final_ty(false));
2923+
// Emits an error if we deref an infer variable, like calling `.field` on a base type
2924+
// of `&_`. We can also use this to suppress unnecessary "missing field" errors that
2925+
// will follow ambiguity errors.
2926+
let final_ty = self.structurally_resolve_type(autoderef.span(), autoderef.final_ty(false));
2927+
if let ty::Error(_) = final_ty.kind() {
2928+
return final_ty;
2929+
}
29252930

29262931
if let Some((adjustments, did)) = private_candidate {
29272932
// (#90483) apply adjustments to avoid ExprUseVisitor from

0 commit comments

Comments
 (0)