Skip to content

Commit 6e3e05b

Browse files
authored
Merge pull request #4445 from RalfJung/rustup
Rustup
2 parents 23b3be5 + 72043e3 commit 6e3e05b

File tree

158 files changed

+4731
-3006
lines changed

Some content is hidden

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

158 files changed

+4731
-3006
lines changed

.github/workflows/dependencies.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ env:
1919
PR_TITLE: Weekly `cargo update`
2020
PR_MESSAGE: |
2121
Automation to keep dependencies in `Cargo.lock` current.
22+
r? dep-bumps
2223
2324
The following is the output from `cargo update`:
2425
COMMIT_MESSAGE: "cargo update \n\n"

Cargo.lock

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ dependencies = [
581581
"serde_json",
582582
"syn 2.0.104",
583583
"tempfile",
584-
"termize",
584+
"termize 0.1.1",
585585
"tokio",
586586
"toml 0.7.8",
587587
"ui_test",
@@ -3761,7 +3761,7 @@ dependencies = [
37613761
"serde",
37623762
"serde_json",
37633763
"termcolor",
3764-
"termize",
3764+
"termize 0.2.0",
37653765
"tracing",
37663766
"windows 0.61.3",
37673767
]
@@ -4133,6 +4133,7 @@ dependencies = [
41334133
"rustc_fs_util",
41344134
"rustc_hir",
41354135
"rustc_hir_pretty",
4136+
"rustc_incremental",
41364137
"rustc_index",
41374138
"rustc_macros",
41384139
"rustc_middle",
@@ -4522,7 +4523,7 @@ dependencies = [
45224523
"rustc_serialize",
45234524
"rustc_span",
45244525
"rustc_target",
4525-
"termize",
4526+
"termize 0.2.0",
45264527
"tracing",
45274528
"windows 0.61.3",
45284529
]
@@ -5294,6 +5295,16 @@ dependencies = [
52945295
"winapi",
52955296
]
52965297

5298+
[[package]]
5299+
name = "termize"
5300+
version = "0.2.0"
5301+
source = "registry+https://github.com/rust-lang/crates.io-index"
5302+
checksum = "6a8da106d1a19c5b9c53c03311936568a0439926a7607815bd3461139cbab1cc"
5303+
dependencies = [
5304+
"libc",
5305+
"windows-sys 0.60.2",
5306+
]
5307+
52975308
[[package]]
52985309
name = "test-float-parse"
52995310
version = "0.1.0"

compiler/rustc_abi/src/layout/ty.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_macros::HashStable_Generic;
66

77
use crate::{
88
AbiAlign, Align, BackendRepr, FieldsShape, Float, HasDataLayout, LayoutData, Niche,
9-
PointeeInfo, Primitive, Scalar, Size, TargetDataLayout, Variants,
9+
PointeeInfo, Primitive, Size, Variants,
1010
};
1111

1212
// Explicitly import `Float` to avoid ambiguity with `Primitive::Float`.
@@ -115,16 +115,6 @@ impl<'a> Layout<'a> {
115115
pub fn unadjusted_abi_align(self) -> Align {
116116
self.0.0.unadjusted_abi_align
117117
}
118-
119-
/// Whether the layout is from a type that implements [`std::marker::PointerLike`].
120-
///
121-
/// Currently, that means that the type is pointer-sized, pointer-aligned,
122-
/// and has a initialized (non-union), scalar ABI.
123-
pub fn is_pointer_like(self, data_layout: &TargetDataLayout) -> bool {
124-
self.size() == data_layout.pointer_size
125-
&& self.align().abi == data_layout.pointer_align.abi
126-
&& matches!(self.backend_repr(), BackendRepr::Scalar(Scalar::Initialized { .. }))
127-
}
128118
}
129119

130120
/// The layout of a type, alongside the type itself.

compiler/rustc_attr_data_structures/src/attributes.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,21 @@ pub enum AttributeKind {
278278
/// Represents `#[naked]`
279279
Naked(Span),
280280

281+
/// Represents `#[no_implicit_prelude]`
282+
NoImplicitPrelude(Span),
283+
281284
/// Represents `#[no_mangle]`
282285
NoMangle(Span),
283286

287+
/// Represents `#[non_exhaustive]`
288+
NonExhaustive(Span),
289+
284290
/// Represents `#[optimize(size|speed)]`
285291
Optimize(OptimizeAttr, Span),
286292

293+
/// Represents `#[rustc_pass_by_value]` (used by the `rustc_pass_by_value` lint).
294+
PassByValue(Span),
295+
287296
/// Represents `#[rustc_pub_transparent]` (used by the `repr_transparent_external_private_fields` lint).
288297
PubTransparent(Span),
289298

compiler/rustc_attr_data_structures/src/encode_cross_crate.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,44 @@ impl AttributeKind {
1212
use EncodeCrossCrate::*;
1313

1414
match self {
15+
// tidy-alphabetical-start
1516
Align { .. } => No,
1617
AllowConstFnUnstable(..) => No,
1718
AllowInternalUnstable(..) => Yes,
1819
AsPtr(..) => Yes,
1920
BodyStability { .. } => No,
21+
Cold(..) => No,
2022
Confusables { .. } => Yes,
23+
ConstContinue(..) => No,
2124
ConstStability { .. } => Yes,
2225
ConstStabilityIndirect => No,
2326
Deprecation { .. } => Yes,
2427
DocComment { .. } => Yes,
2528
ExportName { .. } => Yes,
2629
Inline(..) => No,
27-
LinkSection { .. } => No,
28-
MacroTransparency(..) => Yes,
29-
Repr(..) => No,
30-
Stability { .. } => Yes,
31-
Cold(..) => No,
32-
ConstContinue(..) => No,
3330
LinkName { .. } => Yes,
31+
LinkSection { .. } => No,
3432
LoopMatch(..) => No,
33+
MacroTransparency(..) => Yes,
3534
MayDangle(..) => No,
3635
MustUse { .. } => Yes,
3736
Naked(..) => No,
37+
NoImplicitPrelude(..) => No,
3838
NoMangle(..) => No,
39+
NonExhaustive(..) => Yes,
3940
Optimize(..) => No,
41+
PassByValue(..) => Yes,
4042
PubTransparent(..) => Yes,
43+
Repr(..) => No,
4144
RustcLayoutScalarValidRangeEnd(..) => Yes,
4245
RustcLayoutScalarValidRangeStart(..) => Yes,
4346
RustcObjectLifetimeDefault => No,
4447
SkipDuringMethodDispatch { .. } => No,
48+
Stability { .. } => Yes,
4549
TargetFeature(..) => No,
4650
TrackCaller(..) => Yes,
4751
Used { .. } => No,
52+
// tidy-alphabetical-end
4853
}
4954
}
5055
}

compiler/rustc_attr_parsing/src/attributes/lint_helpers.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,10 @@ impl<S: Stage> NoArgsAttributeParser<S> for PubTransparentParser {
1717
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
1818
const CREATE: fn(Span) -> AttributeKind = AttributeKind::PubTransparent;
1919
}
20+
21+
pub(crate) struct PassByValueParser;
22+
impl<S: Stage> NoArgsAttributeParser<S> for PassByValueParser {
23+
const PATH: &[Symbol] = &[sym::rustc_pass_by_value];
24+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
25+
const CREATE: fn(Span) -> AttributeKind = AttributeKind::PassByValue;
26+
}

compiler/rustc_attr_parsing/src/attributes/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ pub(crate) mod link_attrs;
3535
pub(crate) mod lint_helpers;
3636
pub(crate) mod loop_match;
3737
pub(crate) mod must_use;
38+
pub(crate) mod no_implicit_prelude;
39+
pub(crate) mod non_exhaustive;
3840
pub(crate) mod repr;
3941
pub(crate) mod rustc_internal;
4042
pub(crate) mod semantics;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use rustc_attr_data_structures::AttributeKind;
2+
use rustc_span::{Span, sym};
3+
4+
use crate::attributes::{NoArgsAttributeParser, OnDuplicate};
5+
use crate::context::Stage;
6+
7+
pub(crate) struct NoImplicitPreludeParser;
8+
9+
impl<S: Stage> NoArgsAttributeParser<S> for NoImplicitPreludeParser {
10+
const PATH: &[rustc_span::Symbol] = &[sym::no_implicit_prelude];
11+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
12+
const CREATE: fn(Span) -> AttributeKind = AttributeKind::NoImplicitPrelude;
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use rustc_attr_data_structures::AttributeKind;
2+
use rustc_span::{Span, Symbol, sym};
3+
4+
use crate::attributes::{NoArgsAttributeParser, OnDuplicate};
5+
use crate::context::Stage;
6+
7+
pub(crate) struct NonExhaustiveParser;
8+
9+
impl<S: Stage> NoArgsAttributeParser<S> for NonExhaustiveParser {
10+
const PATH: &[Symbol] = &[sym::non_exhaustive];
11+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
12+
const CREATE: fn(Span) -> AttributeKind = AttributeKind::NonExhaustive;
13+
}

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ use crate::attributes::confusables::ConfusablesParser;
2323
use crate::attributes::deprecation::DeprecationParser;
2424
use crate::attributes::inline::{InlineParser, RustcForceInlineParser};
2525
use crate::attributes::link_attrs::{LinkNameParser, LinkSectionParser};
26-
use crate::attributes::lint_helpers::{AsPtrParser, PubTransparentParser};
26+
use crate::attributes::lint_helpers::{AsPtrParser, PassByValueParser, PubTransparentParser};
2727
use crate::attributes::loop_match::{ConstContinueParser, LoopMatchParser};
2828
use crate::attributes::must_use::MustUseParser;
29+
use crate::attributes::no_implicit_prelude::NoImplicitPreludeParser;
30+
use crate::attributes::non_exhaustive::NonExhaustiveParser;
2931
use crate::attributes::repr::{AlignParser, ReprParser};
3032
use crate::attributes::rustc_internal::{
3133
RustcLayoutScalarValidRangeEnd, RustcLayoutScalarValidRangeStart,
@@ -141,7 +143,10 @@ attribute_parsers!(
141143
Single<WithoutArgs<ConstStabilityIndirectParser>>,
142144
Single<WithoutArgs<LoopMatchParser>>,
143145
Single<WithoutArgs<MayDangleParser>>,
146+
Single<WithoutArgs<NoImplicitPreludeParser>>,
144147
Single<WithoutArgs<NoMangleParser>>,
148+
Single<WithoutArgs<NonExhaustiveParser>>,
149+
Single<WithoutArgs<PassByValueParser>>,
145150
Single<WithoutArgs<PubTransparentParser>>,
146151
Single<WithoutArgs<TrackCallerParser>>,
147152
// tidy-alphabetical-end

compiler/rustc_codegen_cranelift/src/allocator.rs

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,34 @@ fn codegen_inner(
8484
&mangle_internal_symbol(tcx, alloc_error_handler_name(alloc_error_handler_kind)),
8585
);
8686

87-
let data_id = module
88-
.declare_data(
89-
&mangle_internal_symbol(tcx, OomStrategy::SYMBOL),
90-
Linkage::Export,
91-
false,
92-
false,
93-
)
94-
.unwrap();
95-
let mut data = DataDescription::new();
96-
data.set_align(1);
97-
let val = oom_strategy.should_panic();
98-
data.define(Box::new([val]));
99-
module.define_data(data_id, &data).unwrap();
87+
{
88+
let sig = Signature {
89+
call_conv: module.target_config().default_call_conv,
90+
params: vec![],
91+
returns: vec![AbiParam::new(types::I8)],
92+
};
93+
let func_id = module
94+
.declare_function(
95+
&mangle_internal_symbol(tcx, OomStrategy::SYMBOL),
96+
Linkage::Export,
97+
&sig,
98+
)
99+
.unwrap();
100+
let mut ctx = Context::new();
101+
ctx.func.signature = sig;
102+
{
103+
let mut func_ctx = FunctionBuilderContext::new();
104+
let mut bcx = FunctionBuilder::new(&mut ctx.func, &mut func_ctx);
105+
106+
let block = bcx.create_block();
107+
bcx.switch_to_block(block);
108+
let value = bcx.ins().iconst(types::I8, oom_strategy.should_panic() as i64);
109+
bcx.ins().return_(&[value]);
110+
bcx.seal_all_blocks();
111+
bcx.finalize();
112+
}
113+
module.define_function(func_id, &mut ctx).unwrap();
114+
}
100115

101116
{
102117
let sig = Signature {

compiler/rustc_codegen_gcc/src/allocator.rs

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use gccjit::{Context, FunctionType, GlobalKind, ToRValue, Type};
21
#[cfg(feature = "master")]
3-
use gccjit::{FnAttribute, VarAttribute};
2+
use gccjit::FnAttribute;
3+
use gccjit::{Context, FunctionType, RValue, ToRValue, Type};
44
use rustc_ast::expand::allocator::{
55
ALLOCATOR_METHODS, AllocatorKind, AllocatorTy, NO_ALLOC_SHIM_IS_UNSTABLE,
66
alloc_error_handler_name, default_fn_name, global_fn_name,
@@ -71,15 +71,13 @@ pub(crate) unsafe fn codegen(
7171
None,
7272
);
7373

74-
let name = mangle_internal_symbol(tcx, OomStrategy::SYMBOL);
75-
let global = context.new_global(None, GlobalKind::Exported, i8, name);
76-
#[cfg(feature = "master")]
77-
global.add_attribute(VarAttribute::Visibility(symbol_visibility_to_gcc(
78-
tcx.sess.default_visibility(),
79-
)));
80-
let value = tcx.sess.opts.unstable_opts.oom.should_panic();
81-
let value = context.new_rvalue_from_int(i8, value as i32);
82-
global.global_set_initializer_rvalue(value);
74+
create_const_value_function(
75+
tcx,
76+
context,
77+
&mangle_internal_symbol(tcx, OomStrategy::SYMBOL),
78+
i8,
79+
context.new_rvalue_from_int(i8, tcx.sess.opts.unstable_opts.oom.should_panic() as i32),
80+
);
8381

8482
create_wrapper_function(
8583
tcx,
@@ -91,6 +89,30 @@ pub(crate) unsafe fn codegen(
9189
);
9290
}
9391

92+
fn create_const_value_function(
93+
tcx: TyCtxt<'_>,
94+
context: &Context<'_>,
95+
name: &str,
96+
output: Type<'_>,
97+
value: RValue<'_>,
98+
) {
99+
let func = context.new_function(None, FunctionType::Exported, output, &[], name, false);
100+
101+
#[cfg(feature = "master")]
102+
func.add_attribute(FnAttribute::Visibility(symbol_visibility_to_gcc(
103+
tcx.sess.default_visibility(),
104+
)));
105+
106+
func.add_attribute(FnAttribute::AlwaysInline);
107+
108+
if tcx.sess.must_emit_unwind_tables() {
109+
// TODO(antoyo): emit unwind tables.
110+
}
111+
112+
let block = func.new_block("entry");
113+
block.end_with_return(None, value);
114+
}
115+
94116
fn create_wrapper_function(
95117
tcx: TyCtxt<'_>,
96118
context: &Context<'_>,

0 commit comments

Comments
 (0)