Skip to content

Commit c6510d9

Browse files
authored
Merge pull request #2349 from rust-lang/rustc-pull
Rustc pull update
2 parents 021ebcc + d12c1f5 commit c6510d9

File tree

305 files changed

+3929
-2492
lines changed

Some content is hidden

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

305 files changed

+3929
-2492
lines changed

bootstrap.example.toml

+8
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919
# Note that this has no default value (x.py uses the defaults in `bootstrap.example.toml`).
2020
#profile = <none>
2121

22+
# Inherits configuration values from different configuration files (a.k.a. config extensions).
23+
# Supports absolute paths, and uses the current directory (where the bootstrap was invoked)
24+
# as the base if the given path is not absolute.
25+
#
26+
# The overriding logic follows a right-to-left order. For example, in `include = ["a.toml", "b.toml"]`,
27+
# extension `b.toml` overrides `a.toml`. Also, parent extensions always overrides the inner ones.
28+
#include = []
29+
2230
# Keeps track of major changes made to this configuration.
2331
#
2432
# This value also represents ID of the PR that caused major changes. Meaning,

compiler/rustc_attr_data_structures/src/attributes.rs

-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ pub enum AttributeKind {
191191
},
192192
MacroTransparency(Transparency),
193193
Repr(ThinVec<(ReprAttr, Span)>),
194-
RustcMacroEdition2021,
195194
Stability {
196195
stability: Stability,
197196
/// Span of the `#[stable(...)]` or `#[unstable(...)]` attribute

compiler/rustc_attr_parsing/src/attributes/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ pub(crate) mod cfg;
2828
pub(crate) mod confusables;
2929
pub(crate) mod deprecation;
3030
pub(crate) mod repr;
31-
pub(crate) mod rustc;
3231
pub(crate) mod stability;
3332
pub(crate) mod transparency;
3433
pub(crate) mod util;

compiler/rustc_attr_parsing/src/attributes/rustc.rs

-19
This file was deleted.

compiler/rustc_attr_parsing/src/context.rs

-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use crate::attributes::allow_unstable::{AllowConstFnUnstableParser, AllowInterna
1515
use crate::attributes::confusables::ConfusablesParser;
1616
use crate::attributes::deprecation::DeprecationParser;
1717
use crate::attributes::repr::ReprParser;
18-
use crate::attributes::rustc::RustcMacroEdition2021Parser;
1918
use crate::attributes::stability::{
2019
BodyStabilityParser, ConstStabilityIndirectParser, ConstStabilityParser, StabilityParser,
2120
};
@@ -77,7 +76,6 @@ attribute_groups!(
7776
// tidy-alphabetical-start
7877
Single<ConstStabilityIndirectParser>,
7978
Single<DeprecationParser>,
80-
Single<RustcMacroEdition2021Parser>,
8179
Single<TransparencyParser>,
8280
// tidy-alphabetical-end
8381
];

compiler/rustc_builtin_macros/messages.ftl

+2-2
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ builtin_macros_multiple_defaults = multiple declared defaults
247247
.suggestion = make `{$ident}` default
248248
249249
builtin_macros_naked_functions_testing_attribute =
250-
cannot use `#[naked]` with testing attributes
250+
cannot use `#[unsafe(naked)]` with testing attributes
251251
.label = function marked with testing attribute here
252-
.naked_attribute = `#[naked]` is incompatible with testing attributes
252+
.naked_attribute = `#[unsafe(naked)]` is incompatible with testing attributes
253253
254254
builtin_macros_no_default_variant = `#[derive(Default)]` on enum with no `#[default]`
255255
.label = this enum needs a unit variant marked with `#[default]`

compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,9 @@ global_asm! {
387387
}
388388

389389
#[cfg(all(not(jit), target_arch = "x86_64"))]
390-
#[naked]
390+
#[unsafe(naked)]
391391
extern "C" fn naked_test() {
392-
unsafe {
393-
naked_asm!("ret");
394-
}
392+
naked_asm!("ret")
395393
}
396394

397395
#[repr(C)]

compiler/rustc_codegen_gcc/src/intrinsic/simd.rs

+11-14
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,14 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
447447
m_len == v_len,
448448
InvalidMonomorphization::MismatchedLengths { span, name, m_len, v_len }
449449
);
450+
// TODO: also support unsigned integers.
450451
match *m_elem_ty.kind() {
451452
ty::Int(_) => {}
452-
_ => return_error!(InvalidMonomorphization::MaskType { span, name, ty: m_elem_ty }),
453+
_ => return_error!(InvalidMonomorphization::MaskWrongElementType {
454+
span,
455+
name,
456+
ty: m_elem_ty
457+
}),
453458
}
454459
return Ok(bx.vector_select(args[0].immediate(), args[1].immediate(), args[2].immediate()));
455460
}
@@ -991,19 +996,15 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
991996
assert_eq!(pointer_count - 1, ptr_count(element_ty0));
992997
assert_eq!(underlying_ty, non_ptr(element_ty0));
993998

994-
// The element type of the third argument must be a signed integer type of any width:
999+
// The element type of the third argument must be an integer type of any width:
1000+
// TODO: also support unsigned integers.
9951001
let (_, element_ty2) = arg_tys[2].simd_size_and_type(bx.tcx());
9961002
match *element_ty2.kind() {
9971003
ty::Int(_) => (),
9981004
_ => {
9991005
require!(
10001006
false,
1001-
InvalidMonomorphization::ThirdArgElementType {
1002-
span,
1003-
name,
1004-
expected_element: element_ty2,
1005-
third_arg: arg_tys[2]
1006-
}
1007+
InvalidMonomorphization::MaskWrongElementType { span, name, ty: element_ty2 }
10071008
);
10081009
}
10091010
}
@@ -1109,17 +1110,13 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
11091110
assert_eq!(underlying_ty, non_ptr(element_ty0));
11101111

11111112
// The element type of the third argument must be a signed integer type of any width:
1113+
// TODO: also support unsigned integers.
11121114
match *element_ty2.kind() {
11131115
ty::Int(_) => (),
11141116
_ => {
11151117
require!(
11161118
false,
1117-
InvalidMonomorphization::ThirdArgElementType {
1118-
span,
1119-
name,
1120-
expected_element: element_ty2,
1121-
third_arg: arg_tys[2]
1122-
}
1119+
InvalidMonomorphization::MaskWrongElementType { span, name, ty: element_ty2 }
11231120
);
11241121
}
11251122
}

compiler/rustc_codegen_llvm/src/intrinsic.rs

+12-44
Original file line numberDiff line numberDiff line change
@@ -1184,18 +1184,6 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
11841184
}};
11851185
}
11861186

1187-
/// Returns the bitwidth of the `$ty` argument if it is an `Int` type.
1188-
macro_rules! require_int_ty {
1189-
($ty: expr, $diag: expr) => {
1190-
match $ty {
1191-
ty::Int(i) => i.bit_width().unwrap_or_else(|| bx.data_layout().pointer_size.bits()),
1192-
_ => {
1193-
return_error!($diag);
1194-
}
1195-
}
1196-
};
1197-
}
1198-
11991187
/// Returns the bitwidth of the `$ty` argument if it is an `Int` or `Uint` type.
12001188
macro_rules! require_int_or_uint_ty {
12011189
($ty: expr, $diag: expr) => {
@@ -1485,9 +1473,9 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
14851473
m_len == v_len,
14861474
InvalidMonomorphization::MismatchedLengths { span, name, m_len, v_len }
14871475
);
1488-
let in_elem_bitwidth = require_int_ty!(
1476+
let in_elem_bitwidth = require_int_or_uint_ty!(
14891477
m_elem_ty.kind(),
1490-
InvalidMonomorphization::MaskType { span, name, ty: m_elem_ty }
1478+
InvalidMonomorphization::MaskWrongElementType { span, name, ty: m_elem_ty }
14911479
);
14921480
let m_i1s = vector_mask_to_bitmask(bx, args[0].immediate(), in_elem_bitwidth, m_len);
14931481
return Ok(bx.select(m_i1s, args[1].immediate(), args[2].immediate()));
@@ -1508,7 +1496,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
15081496
// Integer vector <i{in_bitwidth} x in_len>:
15091497
let in_elem_bitwidth = require_int_or_uint_ty!(
15101498
in_elem.kind(),
1511-
InvalidMonomorphization::VectorArgument { span, name, in_ty, in_elem }
1499+
InvalidMonomorphization::MaskWrongElementType { span, name, ty: in_elem }
15121500
);
15131501

15141502
let i1xn = vector_mask_to_bitmask(bx, args[0].immediate(), in_elem_bitwidth, in_len);
@@ -1732,14 +1720,9 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
17321720
}
17331721
);
17341722

1735-
let mask_elem_bitwidth = require_int_ty!(
1723+
let mask_elem_bitwidth = require_int_or_uint_ty!(
17361724
element_ty2.kind(),
1737-
InvalidMonomorphization::ThirdArgElementType {
1738-
span,
1739-
name,
1740-
expected_element: element_ty2,
1741-
third_arg: arg_tys[2]
1742-
}
1725+
InvalidMonomorphization::MaskWrongElementType { span, name, ty: element_ty2 }
17431726
);
17441727

17451728
// Alignment of T, must be a constant integer value:
@@ -1834,14 +1817,9 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
18341817
}
18351818
);
18361819

1837-
let m_elem_bitwidth = require_int_ty!(
1820+
let m_elem_bitwidth = require_int_or_uint_ty!(
18381821
mask_elem.kind(),
1839-
InvalidMonomorphization::ThirdArgElementType {
1840-
span,
1841-
name,
1842-
expected_element: values_elem,
1843-
third_arg: mask_ty,
1844-
}
1822+
InvalidMonomorphization::MaskWrongElementType { span, name, ty: mask_elem }
18451823
);
18461824

18471825
let mask = vector_mask_to_bitmask(bx, args[0].immediate(), m_elem_bitwidth, mask_len);
@@ -1924,14 +1902,9 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
19241902
}
19251903
);
19261904

1927-
let m_elem_bitwidth = require_int_ty!(
1905+
let m_elem_bitwidth = require_int_or_uint_ty!(
19281906
mask_elem.kind(),
1929-
InvalidMonomorphization::ThirdArgElementType {
1930-
span,
1931-
name,
1932-
expected_element: values_elem,
1933-
third_arg: mask_ty,
1934-
}
1907+
InvalidMonomorphization::MaskWrongElementType { span, name, ty: mask_elem }
19351908
);
19361909

19371910
let mask = vector_mask_to_bitmask(bx, args[0].immediate(), m_elem_bitwidth, mask_len);
@@ -2019,15 +1992,10 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
20191992
}
20201993
);
20211994

2022-
// The element type of the third argument must be a signed integer type of any width:
2023-
let mask_elem_bitwidth = require_int_ty!(
1995+
// The element type of the third argument must be an integer type of any width:
1996+
let mask_elem_bitwidth = require_int_or_uint_ty!(
20241997
element_ty2.kind(),
2025-
InvalidMonomorphization::ThirdArgElementType {
2026-
span,
2027-
name,
2028-
expected_element: element_ty2,
2029-
third_arg: arg_tys[2]
2030-
}
1998+
InvalidMonomorphization::MaskWrongElementType { span, name, ty: element_ty2 }
20311999
);
20322000

20332001
// Alignment of T, must be a constant integer value:

compiler/rustc_codegen_ssa/messages.ftl

+1-6
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ codegen_ssa_invalid_monomorphization_inserted_type = invalid monomorphization of
125125
126126
codegen_ssa_invalid_monomorphization_invalid_bitmask = invalid monomorphization of `{$name}` intrinsic: invalid bitmask `{$mask_ty}`, expected `u{$expected_int_bits}` or `[u8; {$expected_bytes}]`
127127
128-
codegen_ssa_invalid_monomorphization_mask_type = invalid monomorphization of `{$name}` intrinsic: found mask element type is `{$ty}`, expected a signed integer type
129-
.note = the mask may be widened, which only has the correct behavior for signed integers
128+
codegen_ssa_invalid_monomorphization_mask_wrong_element_type = invalid monomorphization of `{$name}` intrinsic: expected mask element type to be an integer, found `{$ty}`
130129
131130
codegen_ssa_invalid_monomorphization_mismatched_lengths = invalid monomorphization of `{$name}` intrinsic: mismatched lengths: mask length `{$m_len}` != other vector length `{$v_len}`
132131
@@ -158,8 +157,6 @@ codegen_ssa_invalid_monomorphization_simd_shuffle = invalid monomorphization of
158157
159158
codegen_ssa_invalid_monomorphization_simd_third = invalid monomorphization of `{$name}` intrinsic: expected SIMD third type, found non-SIMD `{$ty}`
160159
161-
codegen_ssa_invalid_monomorphization_third_arg_element_type = invalid monomorphization of `{$name}` intrinsic: expected element type `{$expected_element}` of third argument `{$third_arg}` to be a signed integer type
162-
163160
codegen_ssa_invalid_monomorphization_third_argument_length = invalid monomorphization of `{$name}` intrinsic: expected third argument with length {$in_len} (same as input type `{$in_ty}`), found `{$arg_ty}` with length {$out_len}
164161
165162
codegen_ssa_invalid_monomorphization_unrecognized_intrinsic = invalid monomorphization of `{$name}` intrinsic: unrecognized intrinsic `{$name}`
@@ -172,8 +169,6 @@ codegen_ssa_invalid_monomorphization_unsupported_symbol = invalid monomorphizati
172169
173170
codegen_ssa_invalid_monomorphization_unsupported_symbol_of_size = invalid monomorphization of `{$name}` intrinsic: unsupported {$symbol} from `{$in_ty}` with element `{$in_elem}` of size `{$size}` to `{$ret_ty}`
174171
175-
codegen_ssa_invalid_monomorphization_vector_argument = invalid monomorphization of `{$name}` intrinsic: vector argument `{$in_ty}`'s element type `{$in_elem}`, expected integer element type
176-
177172
codegen_ssa_invalid_no_sanitize = invalid argument for `no_sanitize`
178173
.note = expected one of: `address`, `cfi`, `hwaddress`, `kcfi`, `memory`, `memtag`, `shadow-call-stack`, or `thread`
179174

compiler/rustc_codegen_ssa/src/errors.rs

+2-21
Original file line numberDiff line numberDiff line change
@@ -1037,24 +1037,14 @@ pub enum InvalidMonomorphization<'tcx> {
10371037
v_len: u64,
10381038
},
10391039

1040-
#[diag(codegen_ssa_invalid_monomorphization_mask_type, code = E0511)]
1041-
#[note]
1042-
MaskType {
1040+
#[diag(codegen_ssa_invalid_monomorphization_mask_wrong_element_type, code = E0511)]
1041+
MaskWrongElementType {
10431042
#[primary_span]
10441043
span: Span,
10451044
name: Symbol,
10461045
ty: Ty<'tcx>,
10471046
},
10481047

1049-
#[diag(codegen_ssa_invalid_monomorphization_vector_argument, code = E0511)]
1050-
VectorArgument {
1051-
#[primary_span]
1052-
span: Span,
1053-
name: Symbol,
1054-
in_ty: Ty<'tcx>,
1055-
in_elem: Ty<'tcx>,
1056-
},
1057-
10581048
#[diag(codegen_ssa_invalid_monomorphization_cannot_return, code = E0511)]
10591049
CannotReturn {
10601050
#[primary_span]
@@ -1077,15 +1067,6 @@ pub enum InvalidMonomorphization<'tcx> {
10771067
mutability: ExpectedPointerMutability,
10781068
},
10791069

1080-
#[diag(codegen_ssa_invalid_monomorphization_third_arg_element_type, code = E0511)]
1081-
ThirdArgElementType {
1082-
#[primary_span]
1083-
span: Span,
1084-
name: Symbol,
1085-
expected_element: Ty<'tcx>,
1086-
third_arg: Ty<'tcx>,
1087-
},
1088-
10891070
#[diag(codegen_ssa_invalid_monomorphization_unsupported_symbol_of_size, code = E0511)]
10901071
UnsupportedSymbolOfSize {
10911072
#[primary_span]

compiler/rustc_error_codes/src/error_codes/E0736.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Erroneous code example:
1111

1212
```compile_fail,E0736
1313
#[inline]
14-
#[naked]
14+
#[unsafe(naked)]
1515
fn foo() {}
1616
```
1717

compiler/rustc_error_codes/src/error_codes/E0787.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Erroneous code example:
55
```compile_fail,E0787
66
#![feature(naked_functions)]
77
8-
#[naked]
8+
#[unsafe(naked)]
99
pub extern "C" fn f() -> u32 {
1010
42
1111
}

compiler/rustc_feature/src/builtin_attrs.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
517517

518518
// Linking:
519519
gated!(
520-
naked, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No,
520+
unsafe naked, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No,
521521
naked_functions, experimental!(naked)
522522
),
523523

@@ -676,14 +676,6 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
676676
"`rustc_never_type_options` is used to experiment with never type fallback and work on \
677677
never type stabilization, and will never be stable"
678678
),
679-
rustc_attr!(
680-
rustc_macro_edition_2021,
681-
Normal,
682-
template!(Word),
683-
ErrorFollowing,
684-
EncodeCrossCrate::No,
685-
"makes spans in this macro edition 2021"
686-
),
687679

688680
// ==========================================================================
689681
// Internal attributes: Runtime related:

compiler/rustc_interface/src/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,8 @@ fn test_unstable_options_tracking_hash() {
818818
tracked!(min_function_alignment, Some(Align::EIGHT));
819819
tracked!(mir_emit_retag, true);
820820
tracked!(mir_enable_passes, vec![("DestProp".to_string(), false)]);
821-
tracked!(mir_keep_place_mention, true);
822821
tracked!(mir_opt_level, Some(4));
822+
tracked!(mir_preserve_ub, true);
823823
tracked!(move_size_limit, Some(4096));
824824
tracked!(mutable_noalias, false);
825825
tracked!(next_solver, NextSolverConfig { coherence: true, globally: true });

0 commit comments

Comments
 (0)