Skip to content

Commit 81a4c1d

Browse files
committed
Auto merge of #2891 - RalfJung:rustup, r=RalfJung
Rustup
2 parents 44de0ee + 97d3e4e commit 81a4c1d

File tree

203 files changed

+4783
-1588
lines changed

Some content is hidden

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

203 files changed

+4783
-1588
lines changed

Cargo.lock

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ dependencies = [
741741
"tracing-subscriber",
742742
"unified-diff",
743743
"walkdir",
744-
"windows 0.46.0",
744+
"windows",
745745
]
746746

747747
[[package]]
@@ -1647,7 +1647,7 @@ dependencies = [
16471647
"iana-time-zone-haiku",
16481648
"js-sys",
16491649
"wasm-bindgen",
1650-
"windows 0.48.0",
1650+
"windows",
16511651
]
16521652

16531653
[[package]]
@@ -3259,7 +3259,7 @@ dependencies = [
32593259
"tempfile",
32603260
"thorin-dwp",
32613261
"tracing",
3262-
"windows 0.46.0",
3262+
"windows",
32633263
]
32643264

32653265
[[package]]
@@ -3315,7 +3315,7 @@ dependencies = [
33153315
"tempfile",
33163316
"thin-vec",
33173317
"tracing",
3318-
"windows 0.46.0",
3318+
"windows",
33193319
]
33203320

33213321
[[package]]
@@ -3376,7 +3376,7 @@ dependencies = [
33763376
"rustc_ty_utils",
33773377
"serde_json",
33783378
"tracing",
3379-
"windows 0.46.0",
3379+
"windows",
33803380
]
33813381

33823382
[[package]]
@@ -3426,7 +3426,7 @@ dependencies = [
34263426
"termize",
34273427
"tracing",
34283428
"unicode-width",
3429-
"windows 0.46.0",
3429+
"windows",
34303430
]
34313431

34323432
[[package]]
@@ -4096,7 +4096,7 @@ dependencies = [
40964096
"smallvec",
40974097
"termize",
40984098
"tracing",
4099-
"windows 0.46.0",
4099+
"windows",
41004100
]
41014101

41024102
[[package]]
@@ -5498,15 +5498,6 @@ version = "0.4.0"
54985498
source = "registry+https://github.com/rust-lang/crates.io-index"
54995499
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
55005500

5501-
[[package]]
5502-
name = "windows"
5503-
version = "0.46.0"
5504-
source = "registry+https://github.com/rust-lang/crates.io-index"
5505-
checksum = "cdacb41e6a96a052c6cb63a144f24900236121c6f63f4f8219fef5977ecb0c25"
5506-
dependencies = [
5507-
"windows-targets 0.42.2",
5508-
]
5509-
55105501
[[package]]
55115502
name = "windows"
55125503
version = "0.48.0"

compiler/rustc_borrowck/src/def_use.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub fn categorize(context: PlaceContext) -> Option<DefUse> {
5555
// `PlaceMention` and `AscribeUserType` both evaluate the place, which must not
5656
// contain dangling references.
5757
PlaceContext::NonMutatingUse(NonMutatingUseContext::PlaceMention) |
58-
PlaceContext::NonUse(NonUseContext::AscribeUserTy) |
58+
PlaceContext::NonUse(NonUseContext::AscribeUserTy(_)) |
5959

6060
PlaceContext::MutatingUse(MutatingUseContext::AddressOf) |
6161
PlaceContext::NonMutatingUse(NonMutatingUseContext::AddressOf) |

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
777777
Inspect | Copy | Move | PlaceMention | SharedBorrow | ShallowBorrow | UniqueBorrow
778778
| AddressOf | Projection,
779779
) => ty::Covariant,
780-
PlaceContext::NonUse(AscribeUserTy) => ty::Covariant,
780+
PlaceContext::NonUse(AscribeUserTy(variance)) => variance,
781781
}
782782
}
783783

compiler/rustc_builtin_macros/src/concat_idents.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub fn expand_concat_idents<'cx>(
1919
}
2020

2121
let mut res_str = String::new();
22-
for (i, e) in tts.into_trees().enumerate() {
22+
for (i, e) in tts.trees().enumerate() {
2323
if i & 1 == 1 {
2424
match e {
2525
TokenTree::Token(Token { kind: token::Comma, .. }, _) => {}

compiler/rustc_builtin_macros/src/trace_macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub fn expand_trace_macros(
88
sp: Span,
99
tt: TokenStream,
1010
) -> Box<dyn base::MacResult + 'static> {
11-
let mut cursor = tt.into_trees();
11+
let mut cursor = tt.trees();
1212
let mut err = false;
1313
let value = match &cursor.next() {
1414
Some(TokenTree::Token(token, _)) if token.is_keyword(kw::True) => true,

compiler/rustc_codegen_llvm/src/callee.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ pub fn get_fn<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, instance: Instance<'tcx>) ->
9494
// LLVM will prefix the name with `__imp_`. Ideally, we'd like the
9595
// existing logic below to set the Storage Class, but it has an
9696
// exemption for MinGW for backwards compatability.
97-
let llfn = cx.declare_fn(&common::i686_decorated_name(&dllimport, common::is_mingw_gnu_toolchain(&tcx.sess.target), true), fn_abi);
97+
let llfn = cx.declare_fn(&common::i686_decorated_name(&dllimport, common::is_mingw_gnu_toolchain(&tcx.sess.target), true), fn_abi, Some(instance));
9898
unsafe { llvm::LLVMSetDLLStorageClass(llfn, llvm::DLLStorageClass::DllImport); }
9999
llfn
100100
} else {
101-
cx.declare_fn(sym, fn_abi)
101+
cx.declare_fn(sym, fn_abi, Some(instance))
102102
};
103103
debug!("get_fn: not casting pointer!");
104104

compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ fn declare_unused_fn<'tcx>(cx: &CodegenCx<'_, 'tcx>, def_id: DefId) -> Instance<
207207
)),
208208
ty::List::empty(),
209209
),
210+
None,
210211
);
211212

212213
llvm::set_linkage(llfn, llvm::Linkage::PrivateLinkage);

compiler/rustc_codegen_llvm/src/declare.rs

Lines changed: 47 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ use crate::llvm::AttributePlace::Function;
1919
use crate::type_::Type;
2020
use crate::value::Value;
2121
use rustc_codegen_ssa::traits::TypeMembershipMethods;
22-
use rustc_middle::ty::Ty;
23-
use rustc_symbol_mangling::typeid::{kcfi_typeid_for_fnabi, typeid_for_fnabi, TypeIdOptions};
22+
use rustc_middle::ty::{Instance, Ty};
23+
use rustc_symbol_mangling::typeid::{
24+
kcfi_typeid_for_fnabi, kcfi_typeid_for_instance, typeid_for_fnabi, typeid_for_instance,
25+
TypeIdOptions,
26+
};
2427
use smallvec::SmallVec;
2528

2629
/// Declare a function.
@@ -116,7 +119,12 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
116119
///
117120
/// If there’s a value with the same name already declared, the function will
118121
/// update the declaration and return existing Value instead.
119-
pub fn declare_fn(&self, name: &str, fn_abi: &FnAbi<'tcx, Ty<'tcx>>) -> &'ll Value {
122+
pub fn declare_fn(
123+
&self,
124+
name: &str,
125+
fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
126+
instance: Option<Instance<'tcx>>,
127+
) -> &'ll Value {
120128
debug!("declare_rust_fn(name={:?}, fn_abi={:?})", name, fn_abi);
121129

122130
// Function addresses in Rust are never significant, allowing functions to
@@ -132,18 +140,35 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
132140
fn_abi.apply_attrs_llfn(self, llfn);
133141

134142
if self.tcx.sess.is_sanitizer_cfi_enabled() {
135-
let typeid = typeid_for_fnabi(self.tcx, fn_abi, TypeIdOptions::empty());
136-
self.set_type_metadata(llfn, typeid);
137-
let typeid = typeid_for_fnabi(self.tcx, fn_abi, TypeIdOptions::GENERALIZE_POINTERS);
138-
self.add_type_metadata(llfn, typeid);
139-
let typeid = typeid_for_fnabi(self.tcx, fn_abi, TypeIdOptions::NORMALIZE_INTEGERS);
140-
self.add_type_metadata(llfn, typeid);
141-
let typeid = typeid_for_fnabi(
142-
self.tcx,
143-
fn_abi,
144-
TypeIdOptions::GENERALIZE_POINTERS | TypeIdOptions::NORMALIZE_INTEGERS,
145-
);
146-
self.add_type_metadata(llfn, typeid);
143+
if let Some(instance) = instance {
144+
let typeid = typeid_for_instance(self.tcx, &instance, TypeIdOptions::empty());
145+
self.set_type_metadata(llfn, typeid);
146+
let typeid =
147+
typeid_for_instance(self.tcx, &instance, TypeIdOptions::GENERALIZE_POINTERS);
148+
self.add_type_metadata(llfn, typeid);
149+
let typeid =
150+
typeid_for_instance(self.tcx, &instance, TypeIdOptions::NORMALIZE_INTEGERS);
151+
self.add_type_metadata(llfn, typeid);
152+
let typeid = typeid_for_instance(
153+
self.tcx,
154+
&instance,
155+
TypeIdOptions::GENERALIZE_POINTERS | TypeIdOptions::NORMALIZE_INTEGERS,
156+
);
157+
self.add_type_metadata(llfn, typeid);
158+
} else {
159+
let typeid = typeid_for_fnabi(self.tcx, fn_abi, TypeIdOptions::empty());
160+
self.set_type_metadata(llfn, typeid);
161+
let typeid = typeid_for_fnabi(self.tcx, fn_abi, TypeIdOptions::GENERALIZE_POINTERS);
162+
self.add_type_metadata(llfn, typeid);
163+
let typeid = typeid_for_fnabi(self.tcx, fn_abi, TypeIdOptions::NORMALIZE_INTEGERS);
164+
self.add_type_metadata(llfn, typeid);
165+
let typeid = typeid_for_fnabi(
166+
self.tcx,
167+
fn_abi,
168+
TypeIdOptions::GENERALIZE_POINTERS | TypeIdOptions::NORMALIZE_INTEGERS,
169+
);
170+
self.add_type_metadata(llfn, typeid);
171+
}
147172
}
148173

149174
if self.tcx.sess.is_sanitizer_kcfi_enabled() {
@@ -156,8 +181,13 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
156181
options.insert(TypeIdOptions::NORMALIZE_INTEGERS);
157182
}
158183

159-
let kcfi_typeid = kcfi_typeid_for_fnabi(self.tcx, fn_abi, options);
160-
self.set_kcfi_type_metadata(llfn, kcfi_typeid);
184+
if let Some(instance) = instance {
185+
let kcfi_typeid = kcfi_typeid_for_instance(self.tcx, &instance, options);
186+
self.set_kcfi_type_metadata(llfn, kcfi_typeid);
187+
} else {
188+
let kcfi_typeid = kcfi_typeid_for_fnabi(self.tcx, fn_abi, options);
189+
self.set_kcfi_type_metadata(llfn, kcfi_typeid);
190+
}
161191
}
162192

163193
llfn

compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ fn gen_fn<'ll, 'tcx>(
772772
) -> (&'ll Type, &'ll Value) {
773773
let fn_abi = cx.fn_abi_of_fn_ptr(rust_fn_sig, ty::List::empty());
774774
let llty = fn_abi.llvm_type(cx);
775-
let llfn = cx.declare_fn(name, fn_abi);
775+
let llfn = cx.declare_fn(name, fn_abi, None);
776776
cx.set_frame_pointer_type(llfn);
777777
cx.apply_target_cpu_attr(llfn);
778778
// FIXME(eddyb) find a nicer way to do this.

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,9 @@ pub type InlineAsmDiagHandlerTy = unsafe extern "C" fn(&SMDiagnostic, *const c_v
680680
pub mod coverageinfo {
681681
use super::coverage_map;
682682

683-
/// Aligns with [llvm::coverage::CounterMappingRegion::RegionKind](https://github.com/rust-lang/llvm-project/blob/rustc/13.0-2021-09-30/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h#L209-L230)
683+
/// Corresponds to enum `llvm::coverage::CounterMappingRegion::RegionKind`.
684+
///
685+
/// Must match the layout of `LLVMRustCounterMappingRegionKind`.
684686
#[derive(Copy, Clone, Debug)]
685687
#[repr(C)]
686688
pub enum RegionKind {
@@ -714,7 +716,9 @@ pub mod coverageinfo {
714716
/// array", encoded separately), and source location (start and end positions of the represented
715717
/// code region).
716718
///
717-
/// Matches LLVMRustCounterMappingRegion.
719+
/// Corresponds to struct `llvm::coverage::CounterMappingRegion`.
720+
///
721+
/// Must match the layout of `LLVMRustCounterMappingRegion`.
718722
#[derive(Copy, Clone, Debug)]
719723
#[repr(C)]
720724
pub struct CounterMappingRegion {

0 commit comments

Comments
 (0)