Skip to content

Commit 6715873

Browse files
celinvaltedinski
authored andcommitted
Merge rustc into rmc - 2021 week 34 (rust-lang#437)
Required manual fix due to API changes: - compiler/rustc_codegen_llvm/src/gotoc/mir_to_goto/context/goto_ctx.rs - compiler/rustc_codegen_llvm/src/gotoc/mir_to_goto/monomorphize/collector.rs Updated test expectations due to issue rust-lang#466: - src/test/expected/enum/expected - src/test/expected/niche/expected - src/test/expected/niche2/expected
1 parent db4ab63 commit 6715873

File tree

533 files changed

+8388
-4512
lines changed

Some content is hidden

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

533 files changed

+8388
-4512
lines changed

Diff for: Cargo.lock

+17-15
Original file line numberDiff line numberDiff line change
@@ -775,9 +775,9 @@ dependencies = [
775775

776776
[[package]]
777777
name = "crossbeam-deque"
778-
version = "0.7.3"
778+
version = "0.7.4"
779779
source = "registry+https://github.com/rust-lang/crates.io-index"
780-
checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285"
780+
checksum = "c20ff29ded3204c5106278a81a38f4b482636ed4fa1e6cfbeef193291beb29ed"
781781
dependencies = [
782782
"crossbeam-epoch",
783783
"crossbeam-utils 0.7.2",
@@ -881,9 +881,9 @@ dependencies = [
881881

882882
[[package]]
883883
name = "curl-sys"
884-
version = "0.4.44+curl-7.77.0"
884+
version = "0.4.45+curl-7.78.0"
885885
source = "registry+https://github.com/rust-lang/crates.io-index"
886-
checksum = "4b6d85e9322b193f117c966e79c2d6929ec08c02f339f950044aba12e20bbaf1"
886+
checksum = "de9e5a72b1c744eb5dd20b2be4d7eb84625070bb5c4ab9b347b70464ab1e62eb"
887887
dependencies = [
888888
"cc",
889889
"libc",
@@ -2445,9 +2445,9 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
24452445

24462446
[[package]]
24472447
name = "openssl-src"
2448-
version = "111.15.0+1.1.1k"
2448+
version = "111.16.0+1.1.1l"
24492449
source = "registry+https://github.com/rust-lang/crates.io-index"
2450-
checksum = "b1a5f6ae2ac04393b217ea9f700cd04fa9bf3d93fae2872069f3d15d908af70a"
2450+
checksum = "7ab2173f69416cf3ec12debb5823d244127d23a9b127d5a5189aa97c5fa2859f"
24512451
dependencies = [
24522452
"cc",
24532453
]
@@ -2806,9 +2806,9 @@ dependencies = [
28062806

28072807
[[package]]
28082808
name = "psm"
2809-
version = "0.1.11"
2809+
version = "0.1.16"
28102810
source = "registry+https://github.com/rust-lang/crates.io-index"
2811-
checksum = "96e0536f6528466dbbbbe6b986c34175a8d0ff25b794c4bacda22e068cd2f2c5"
2811+
checksum = "cd136ff4382c4753fc061cb9e4712ab2af263376b95bbd5bd8cd50c020b78e69"
28122812
dependencies = [
28132813
"cc",
28142814
]
@@ -3475,9 +3475,9 @@ dependencies = [
34753475

34763476
[[package]]
34773477
name = "rustc-demangle"
3478-
version = "0.1.18"
3478+
version = "0.1.21"
34793479
source = "registry+https://github.com/rust-lang/crates.io-index"
3480-
checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232"
3480+
checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
34813481
dependencies = [
34823482
"compiler_builtins",
34833483
"rustc-std-workspace-core",
@@ -4224,6 +4224,7 @@ dependencies = [
42244224
name = "rustc_privacy"
42254225
version = "0.0.0"
42264226
dependencies = [
4227+
"rustc_ast",
42274228
"rustc_attr",
42284229
"rustc_data_structures",
42294230
"rustc_errors",
@@ -4482,6 +4483,7 @@ dependencies = [
44824483
"rustc_hir_pretty",
44834484
"rustc_index",
44844485
"rustc_infer",
4486+
"rustc_lint",
44854487
"rustc_macros",
44864488
"rustc_middle",
44874489
"rustc_session",
@@ -4890,12 +4892,12 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
48904892

48914893
[[package]]
48924894
name = "stacker"
4893-
version = "0.1.12"
4895+
version = "0.1.14"
48944896
source = "registry+https://github.com/rust-lang/crates.io-index"
4895-
checksum = "21ccb4c06ec57bc82d0f610f1a2963d7648700e43a6f513e564b9c89f7991786"
4897+
checksum = "90939d5171a4420b3ff5fbc8954d641e7377335454c259dcb80786f3f21dc9b4"
48964898
dependencies = [
48974899
"cc",
4898-
"cfg-if 0.1.10",
4900+
"cfg-if 1.0.0",
48994901
"libc",
49004902
"psm",
49014903
"winapi",
@@ -5045,9 +5047,9 @@ dependencies = [
50455047

50465048
[[package]]
50475049
name = "tar"
5048-
version = "0.4.35"
5050+
version = "0.4.37"
50495051
source = "registry+https://github.com/rust-lang/crates.io-index"
5050-
checksum = "7d779dc6aeff029314570f666ec83f19df7280bb36ef338442cfa8c604021b80"
5052+
checksum = "d6f5515d3add52e0bbdcad7b83c388bb36ba7b754dda3b5f5bc2d38640cdba5c"
50515053
dependencies = [
50525054
"filetime",
50535055
"libc",

Diff for: UPSTREAM-RELEASES.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ Cargo
7070
- [The package definition in `cargo metadata` now includes the `"default_run"`
7171
field from the manifest.][cargo/9550]
7272
- [Added `cargo d` as an alias for `cargo doc`.][cargo/9680]
73-
- [Added `{lib}` as formatting option for `cargo tree` to print the "lib_name" of packages.][cargo/9663]
73+
- [Added `{lib}` as formatting option for `cargo tree` to print the `"lib_name"`
74+
of packages.][cargo/9663]
7475

7576
Rustdoc
7677
-------
@@ -116,9 +117,11 @@ Compatibility Notes
116117
[79965]: https://github.com/rust-lang/rust/pull/79965
117118
[87370]: https://github.com/rust-lang/rust/pull/87370
118119
[87298]: https://github.com/rust-lang/rust/pull/87298
120+
[cargo/9663]: https://github.com/rust-lang/cargo/pull/9663
119121
[cargo/9675]: https://github.com/rust-lang/cargo/pull/9675
120122
[cargo/9550]: https://github.com/rust-lang/cargo/pull/9550
121123
[cargo/9680]: https://github.com/rust-lang/cargo/pull/9680
124+
[cargo/9663]: https://github.com/rust-lang/cargo/pull/9663
122125
[`array::map`]: https://doc.rust-lang.org/stable/std/primitive.array.html#method.map
123126
[`Bound::cloned`]: https://doc.rust-lang.org/stable/std/ops/enum.Bound.html#method.cloned
124127
[`Drain::as_str`]: https://doc.rust-lang.org/stable/std/string/struct.Drain.html#method.as_str
@@ -175,6 +178,7 @@ Compiler
175178
- [Improved debugger output for enums on Windows MSVC platforms.][85292]
176179
- [Added tier 3\* support for `bpfel-unknown-none`
177180
and `bpfeb-unknown-none`.][79608]
181+
- [`-Zmutable-noalias=yes`][82834] is enabled by default when using LLVM 12 or above.
178182

179183
\* Refer to Rust's [platform support page][platform-support-doc] for more
180184
information on Rust's tiered platform support.
@@ -244,6 +248,7 @@ Compatibility Notes
244248
[83366]: https://github.com/rust-lang/rust/pull/83366
245249
[83278]: https://github.com/rust-lang/rust/pull/83278
246250
[85292]: https://github.com/rust-lang/rust/pull/85292
251+
[82834]: https://github.com/rust-lang/rust/pull/82834
247252
[cargo/9520]: https://github.com/rust-lang/cargo/pull/9520
248253
[cargo/9499]: https://github.com/rust-lang/cargo/pull/9499
249254
[cargo/9488]: https://github.com/rust-lang/cargo/pull/9488

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

+76-78
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#![feature(new_uninit)]
1616
#![feature(maybe_uninit_slice)]
1717
#![feature(min_specialization)]
18+
#![feature(decl_macro)]
19+
#![feature(rustc_attrs)]
1820
#![cfg_attr(test, feature(test))]
1921

2022
use rustc_data_structures::sync;
@@ -608,117 +610,113 @@ impl DropArena {
608610
}
609611
}
610612

611-
#[macro_export]
612-
macro_rules! arena_for_type {
613+
pub macro arena_for_type {
613614
([][$ty:ty]) => {
614615
$crate::TypedArena<$ty>
615-
};
616+
},
616617
([few $(, $attrs:ident)*][$ty:ty]) => {
617618
::std::marker::PhantomData<$ty>
618-
};
619+
},
619620
([$ignore:ident $(, $attrs:ident)*]$args:tt) => {
620621
$crate::arena_for_type!([$($attrs),*]$args)
621-
};
622+
},
622623
}
623624

624-
#[macro_export]
625-
macro_rules! which_arena_for_type {
625+
pub macro which_arena_for_type {
626626
([][$arena:expr]) => {
627627
::std::option::Option::Some($arena)
628-
};
628+
},
629629
([few$(, $attrs:ident)*][$arena:expr]) => {
630630
::std::option::Option::None
631-
};
631+
},
632632
([$ignore:ident$(, $attrs:ident)*]$args:tt) => {
633633
$crate::which_arena_for_type!([$($attrs),*]$args)
634-
};
634+
},
635635
}
636636

637-
#[macro_export]
638-
macro_rules! declare_arena {
639-
([], [$($a:tt $name:ident: $ty:ty,)*], $tcx:lifetime) => {
640-
#[derive(Default)]
641-
pub struct Arena<$tcx> {
642-
pub dropless: $crate::DroplessArena,
643-
drop: $crate::DropArena,
644-
$($name: $crate::arena_for_type!($a[$ty]),)*
645-
}
637+
#[rustc_macro_transparency = "semitransparent"]
638+
pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*], $tcx:lifetime) {
639+
#[derive(Default)]
640+
pub struct Arena<$tcx> {
641+
pub dropless: $crate::DroplessArena,
642+
drop: $crate::DropArena,
643+
$($name: $crate::arena_for_type!($a[$ty]),)*
644+
}
646645

647-
pub trait ArenaAllocatable<'tcx, T = Self>: Sized {
648-
fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut Self;
649-
fn allocate_from_iter<'a>(
650-
arena: &'a Arena<'tcx>,
651-
iter: impl ::std::iter::IntoIterator<Item = Self>,
652-
) -> &'a mut [Self];
646+
pub trait ArenaAllocatable<'tcx, T = Self>: Sized {
647+
fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut Self;
648+
fn allocate_from_iter<'a>(
649+
arena: &'a Arena<'tcx>,
650+
iter: impl ::std::iter::IntoIterator<Item = Self>,
651+
) -> &'a mut [Self];
652+
}
653+
654+
impl<'tcx, T: Copy> ArenaAllocatable<'tcx, ()> for T {
655+
#[inline]
656+
fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut Self {
657+
arena.dropless.alloc(self)
658+
}
659+
#[inline]
660+
fn allocate_from_iter<'a>(
661+
arena: &'a Arena<'tcx>,
662+
iter: impl ::std::iter::IntoIterator<Item = Self>,
663+
) -> &'a mut [Self] {
664+
arena.dropless.alloc_from_iter(iter)
653665
}
654666

655-
impl<'tcx, T: Copy> ArenaAllocatable<'tcx, ()> for T {
667+
}
668+
$(
669+
impl<$tcx> ArenaAllocatable<$tcx, $ty> for $ty {
656670
#[inline]
657-
fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut Self {
658-
arena.dropless.alloc(self)
671+
fn allocate_on<'a>(self, arena: &'a Arena<$tcx>) -> &'a mut Self {
672+
if !::std::mem::needs_drop::<Self>() {
673+
return arena.dropless.alloc(self);
674+
}
675+
match $crate::which_arena_for_type!($a[&arena.$name]) {
676+
::std::option::Option::<&$crate::TypedArena<Self>>::Some(ty_arena) => {
677+
ty_arena.alloc(self)
678+
}
679+
::std::option::Option::None => unsafe { arena.drop.alloc(self) },
680+
}
659681
}
682+
660683
#[inline]
661684
fn allocate_from_iter<'a>(
662-
arena: &'a Arena<'tcx>,
685+
arena: &'a Arena<$tcx>,
663686
iter: impl ::std::iter::IntoIterator<Item = Self>,
664687
) -> &'a mut [Self] {
665-
arena.dropless.alloc_from_iter(iter)
666-
}
667-
668-
}
669-
$(
670-
impl<$tcx> ArenaAllocatable<$tcx, $ty> for $ty {
671-
#[inline]
672-
fn allocate_on<'a>(self, arena: &'a Arena<$tcx>) -> &'a mut Self {
673-
if !::std::mem::needs_drop::<Self>() {
674-
return arena.dropless.alloc(self);
675-
}
676-
match $crate::which_arena_for_type!($a[&arena.$name]) {
677-
::std::option::Option::<&$crate::TypedArena<Self>>::Some(ty_arena) => {
678-
ty_arena.alloc(self)
679-
}
680-
::std::option::Option::None => unsafe { arena.drop.alloc(self) },
681-
}
688+
if !::std::mem::needs_drop::<Self>() {
689+
return arena.dropless.alloc_from_iter(iter);
682690
}
683-
684-
#[inline]
685-
fn allocate_from_iter<'a>(
686-
arena: &'a Arena<$tcx>,
687-
iter: impl ::std::iter::IntoIterator<Item = Self>,
688-
) -> &'a mut [Self] {
689-
if !::std::mem::needs_drop::<Self>() {
690-
return arena.dropless.alloc_from_iter(iter);
691-
}
692-
match $crate::which_arena_for_type!($a[&arena.$name]) {
693-
::std::option::Option::<&$crate::TypedArena<Self>>::Some(ty_arena) => {
694-
ty_arena.alloc_from_iter(iter)
695-
}
696-
::std::option::Option::None => unsafe { arena.drop.alloc_from_iter(iter) },
691+
match $crate::which_arena_for_type!($a[&arena.$name]) {
692+
::std::option::Option::<&$crate::TypedArena<Self>>::Some(ty_arena) => {
693+
ty_arena.alloc_from_iter(iter)
697694
}
695+
::std::option::Option::None => unsafe { arena.drop.alloc_from_iter(iter) },
698696
}
699697
}
700-
)*
698+
}
699+
)*
701700

702-
impl<'tcx> Arena<'tcx> {
703-
#[inline]
704-
pub fn alloc<T: ArenaAllocatable<'tcx, U>, U>(&self, value: T) -> &mut T {
705-
value.allocate_on(self)
706-
}
701+
impl<'tcx> Arena<'tcx> {
702+
#[inline]
703+
pub fn alloc<T: ArenaAllocatable<'tcx, U>, U>(&self, value: T) -> &mut T {
704+
value.allocate_on(self)
705+
}
707706

708-
#[inline]
709-
pub fn alloc_slice<T: ::std::marker::Copy>(&self, value: &[T]) -> &mut [T] {
710-
if value.is_empty() {
711-
return &mut [];
712-
}
713-
self.dropless.alloc_slice(value)
707+
#[inline]
708+
pub fn alloc_slice<T: ::std::marker::Copy>(&self, value: &[T]) -> &mut [T] {
709+
if value.is_empty() {
710+
return &mut [];
714711
}
712+
self.dropless.alloc_slice(value)
713+
}
715714

716-
pub fn alloc_from_iter<'a, T: ArenaAllocatable<'tcx, U>, U>(
717-
&'a self,
718-
iter: impl ::std::iter::IntoIterator<Item = T>,
719-
) -> &'a mut [T] {
720-
T::allocate_from_iter(self, iter)
721-
}
715+
pub fn alloc_from_iter<'a, T: ArenaAllocatable<'tcx, U>, U>(
716+
&'a self,
717+
iter: impl ::std::iter::IntoIterator<Item = T>,
718+
) -> &'a mut [T] {
719+
T::allocate_from_iter(self, iter)
722720
}
723721
}
724722
}

Diff for: compiler/rustc_ast/src/ast.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ impl ParenthesizedArgs {
284284

285285
pub use crate::node_id::{NodeId, CRATE_NODE_ID, DUMMY_NODE_ID};
286286

287-
/// A modifier on a bound, e.g., `?Sized` or `?const Trait`.
287+
/// A modifier on a bound, e.g., `?Sized` or `~const Trait`.
288288
///
289289
/// Negative bounds should also be handled here.
290290
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug)]
@@ -295,10 +295,10 @@ pub enum TraitBoundModifier {
295295
/// `?Trait`
296296
Maybe,
297297

298-
/// `?const Trait`
298+
/// `~const Trait`
299299
MaybeConst,
300300

301-
/// `?const ?Trait`
301+
/// `~const ?Trait`
302302
//
303303
// This parses but will be rejected during AST validation.
304304
MaybeConstMaybe,
@@ -332,8 +332,8 @@ pub type GenericBounds = Vec<GenericBound>;
332332
pub enum ParamKindOrd {
333333
Lifetime,
334334
Type,
335-
// `unordered` is only `true` if `sess.has_features().const_generics`
336-
// is active. Specifically, if it's only `min_const_generics`, it will still require
335+
// `unordered` is only `true` if `sess.unordered_const_ty_params()`
336+
// returns true. Specifically, if it's only `min_const_generics`, it will still require
337337
// ordering consts after types.
338338
Const { unordered: bool },
339339
// `Infer` is not actually constructed directly from the AST, but is implicitly constructed
@@ -2028,6 +2028,7 @@ pub enum InlineAsmOperand {
20282028
#[derive(Clone, Encodable, Decodable, Debug)]
20292029
pub struct InlineAsm {
20302030
pub template: Vec<InlineAsmTemplatePiece>,
2031+
pub template_strs: Box<[(Symbol, Option<Symbol>, Span)]>,
20312032
pub operands: Vec<(InlineAsmOperand, Span)>,
20322033
pub clobber_abi: Option<(Symbol, Span)>,
20332034
pub options: InlineAsmOptions,

0 commit comments

Comments
 (0)