Skip to content

Commit 833bacf

Browse files
committed
Merge from rustc
2 parents e7ab062 + 72c917d commit 833bacf

File tree

207 files changed

+3129
-1796
lines changed

Some content is hidden

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

207 files changed

+3129
-1796
lines changed

.mailmap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ Alexander Ronald Altman <alexanderaltman@me.com>
2929
Alexandre Martin <martin.alex32@hotmail.fr>
3030
Alexis Beingessner <a.beingessner@gmail.com>
3131
Alfie John <alfie@alfie.wtf> Alfie John <alfiej@fastmail.fm>
32+
Alona Enraght-Moony <code@alona.page> <nixon.emoony@gmail.com>
33+
Alona Enraght-Moony <code@alona.page> <nixon@caminus.local>
3234
Amos Onn <amosonn@gmail.com>
3335
Ana-Maria Mihalache <mihalacheana.maria@yahoo.com>
3436
Anatoly Ikorsky <aikorsky@gmail.com>
@@ -415,7 +417,6 @@ Nicolas Abram <abramlujan@gmail.com>
415417
Nicole Mazzuca <npmazzuca@gmail.com>
416418
Nif Ward <nif.ward@gmail.com>
417419
Nika Layzell <nika@thelayzells.com> <michael@thelayzells.com>
418-
Nixon Enraght-Moony <nixon.emoony@gmail.com>
419420
NODA Kai <nodakai@gmail.com>
420421
oliver <16816606+o752d@users.noreply.github.com>
421422
Oliver Middleton <olliemail27@gmail.com> <ollie27@users.noreply.github.com>

Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,9 +1128,9 @@ dependencies = [
11281128

11291129
[[package]]
11301130
name = "curl-sys"
1131-
version = "0.4.59+curl-7.86.0"
1131+
version = "0.4.61+curl-8.0.1"
11321132
source = "registry+https://github.com/rust-lang/crates.io-index"
1133-
checksum = "6cfce34829f448b08f55b7db6d0009e23e2e86a34e8c2b366269bf5799b4a407"
1133+
checksum = "14d05c10f541ae6f3bc5b3d923c20001f47db7d5f0b2bc6ad16490133842db79"
11341134
dependencies = [
11351135
"cc",
11361136
"libc",

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use rustc_span::hygiene::DesugaringKind;
2424
use rustc_span::symbol::{kw, sym};
2525
use rustc_span::{BytePos, Span, Symbol};
2626
use rustc_trait_selection::infer::InferCtxtExt;
27+
use rustc_trait_selection::traits::ObligationCtxt;
2728

2829
use crate::borrow_set::TwoPhaseActivation;
2930
use crate::borrowck_errors;
@@ -760,20 +761,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
760761
else { return; };
761762
// Try to find predicates on *generic params* that would allow copying `ty`
762763
let infcx = tcx.infer_ctxt().build();
763-
let copy_did = infcx.tcx.require_lang_item(LangItem::Copy, Some(span));
764-
let cause = ObligationCause::new(
765-
span,
766-
self.mir_def_id(),
767-
rustc_infer::traits::ObligationCauseCode::MiscObligation,
768-
);
769-
let errors = rustc_trait_selection::traits::fully_solve_bound(
770-
&infcx,
771-
cause,
772-
self.param_env,
773-
// Erase any region vids from the type, which may not be resolved
774-
infcx.tcx.erase_regions(ty),
775-
copy_did,
776-
);
764+
let ocx = ObligationCtxt::new(&infcx);
765+
let copy_did = tcx.require_lang_item(LangItem::Copy, Some(span));
766+
let cause = ObligationCause::misc(span, self.mir_def_id());
767+
768+
ocx.register_bound(cause, self.param_env, infcx.tcx.erase_regions(ty), copy_did);
769+
let errors = ocx.select_all_or_error();
777770

778771
// Only emit suggestion if all required predicates are on generic
779772
let predicates: Result<Vec<_>, _> = errors

compiler/rustc_borrowck/src/diagnostics/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,6 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
10781078
self.param_env,
10791079
tcx.mk_imm_ref(tcx.lifetimes.re_erased, tcx.erase_regions(ty)),
10801080
def_id,
1081-
DUMMY_SP,
10821081
)
10831082
}
10841083
_ => false,

compiler/rustc_borrowck/src/region_infer/opaque_types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
284284
// hidden type is well formed even without those bounds.
285285
let predicate = ty::Binder::dummy(ty::PredicateKind::WellFormed(definition_ty.into()));
286286

287-
let id_substs = InternalSubsts::identity_for_item(self.tcx, def_id.to_def_id());
287+
let id_substs = InternalSubsts::identity_for_item(self.tcx, def_id);
288288

289289
// Require that the hidden type actually fulfills all the bounds of the opaque type, even without
290290
// the bounds that the function supplies.

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,14 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
176176

177177
return_if_di_node_created_in_meantime!(cx, unique_type_id);
178178

179-
let (thin_pointer_size, thin_pointer_align) =
180-
cx.size_and_align_of(cx.tcx.mk_imm_ptr(cx.tcx.types.unit));
179+
let data_layout = &cx.tcx.data_layout;
181180
let ptr_type_debuginfo_name = compute_debuginfo_type_name(cx.tcx, ptr_type, true);
182181

183182
match fat_pointer_kind(cx, pointee_type) {
184183
None => {
185184
// This is a thin pointer. Create a regular pointer type and give it the correct name.
186185
debug_assert_eq!(
187-
(thin_pointer_size, thin_pointer_align),
186+
(data_layout.pointer_size, data_layout.pointer_align.abi),
188187
cx.size_and_align_of(ptr_type),
189188
"ptr_type={}, pointee_type={}",
190189
ptr_type,
@@ -195,8 +194,8 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
195194
llvm::LLVMRustDIBuilderCreatePointerType(
196195
DIB(cx),
197196
pointee_type_di_node,
198-
thin_pointer_size.bits(),
199-
thin_pointer_align.bits() as u32,
197+
data_layout.pointer_size.bits(),
198+
data_layout.pointer_align.abi.bits() as u32,
200199
0, // Ignore DWARF address space.
201200
ptr_type_debuginfo_name.as_ptr().cast(),
202201
ptr_type_debuginfo_name.len(),

compiler/rustc_codegen_ssa/src/back/symbol_export.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
1010
use rustc_middle::middle::exported_symbols::{
1111
metadata_symbol_name, ExportedSymbol, SymbolExportInfo, SymbolExportKind, SymbolExportLevel,
1212
};
13+
use rustc_middle::query::LocalCrate;
1314
use rustc_middle::ty::query::{ExternProviders, Providers};
1415
use rustc_middle::ty::subst::{GenericArgKind, SubstsRef};
1516
use rustc_middle::ty::Instance;
@@ -41,9 +42,7 @@ pub fn crates_export_threshold(crate_types: &[CrateType]) -> SymbolExportLevel {
4142
}
4243
}
4344

44-
fn reachable_non_generics_provider(tcx: TyCtxt<'_>, cnum: CrateNum) -> DefIdMap<SymbolExportInfo> {
45-
assert_eq!(cnum, LOCAL_CRATE);
46-
45+
fn reachable_non_generics_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> DefIdMap<SymbolExportInfo> {
4746
if !tcx.sess.opts.output_types.should_codegen() {
4847
return Default::default();
4948
}
@@ -154,10 +153,10 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, cnum: CrateNum) -> DefIdMap<
154153
reachable_non_generics
155154
}
156155

157-
fn is_reachable_non_generic_provider_local(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
156+
fn is_reachable_non_generic_provider_local(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
158157
let export_threshold = threshold(tcx);
159158

160-
if let Some(&info) = tcx.reachable_non_generics(def_id.krate).get(&def_id) {
159+
if let Some(&info) = tcx.reachable_non_generics(LOCAL_CRATE).get(&def_id.to_def_id()) {
161160
info.level.is_below_threshold(export_threshold)
162161
} else {
163162
false
@@ -170,10 +169,8 @@ fn is_reachable_non_generic_provider_extern(tcx: TyCtxt<'_>, def_id: DefId) -> b
170169

171170
fn exported_symbols_provider_local(
172171
tcx: TyCtxt<'_>,
173-
cnum: CrateNum,
172+
_: LocalCrate,
174173
) -> &[(ExportedSymbol<'_>, SymbolExportInfo)] {
175-
assert_eq!(cnum, LOCAL_CRATE);
176-
177174
if !tcx.sess.opts.output_types.should_codegen() {
178175
return &[];
179176
}

compiler/rustc_codegen_ssa/src/codegen_attrs.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fn linkage_by_name(tcx: TyCtxt<'_>, def_id: LocalDefId, name: &str) -> Linkage {
4343
}
4444
}
4545

46-
fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: DefId) -> CodegenFnAttrs {
46+
fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
4747
if cfg!(debug_assertions) {
4848
let def_kind = tcx.def_kind(did);
4949
assert!(
@@ -52,7 +52,6 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: DefId) -> CodegenFnAttrs {
5252
);
5353
}
5454

55-
let did = did.expect_local();
5655
let attrs = tcx.hir().attrs(tcx.hir().local_def_id_to_hir_id(did));
5756
let mut codegen_fn_attrs = CodegenFnAttrs::new();
5857
if tcx.should_inherit_track_caller(did) {

compiler/rustc_const_eval/src/const_eval/fn_queries.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ pub fn is_parent_const_impl_raw(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
3232
/// it is a trait impl/function, return if it has a `const` modifier. If it is an intrinsic,
3333
/// report whether said intrinsic has a `rustc_const_{un,}stable` attribute. Otherwise, return
3434
/// `Constness::NotConst`.
35-
fn constness(tcx: TyCtxt<'_>, def_id: DefId) -> hir::Constness {
36-
let def_id = def_id.expect_local();
35+
fn constness(tcx: TyCtxt<'_>, def_id: LocalDefId) -> hir::Constness {
3736
let node = tcx.hir().get_by_def_id(def_id);
3837

3938
match node {

compiler/rustc_const_eval/src/transform/check_consts/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
246246
self.check_local_or_return_ty(return_ty.skip_binder(), RETURN_PLACE);
247247
}
248248

249-
if !tcx.has_attr(def_id.to_def_id(), sym::rustc_do_not_const_check) {
249+
if !tcx.has_attr(def_id, sym::rustc_do_not_const_check) {
250250
self.visit_body(&body);
251251
}
252252

0 commit comments

Comments
 (0)