Skip to content

Commit 9178b42

Browse files
authored
Merge pull request rust-lang#2658 from rust-lang/rustc-pull
Rustc pull update
2 parents 7e318fb + 763749c commit 9178b42

File tree

659 files changed

+24908
-15519
lines changed

Some content is hidden

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

659 files changed

+24908
-15519
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2486,7 +2486,6 @@ dependencies = [
24862486
"serde_json",
24872487
"smallvec",
24882488
"tempfile",
2489-
"tikv-jemalloc-sys",
24902489
"ui_test",
24912490
]
24922491

compiler/rustc_ast/src/ast.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -857,15 +857,15 @@ impl BindingMode {
857857
}
858858
}
859859

860-
#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
860+
#[derive(Clone, Copy, Encodable, Decodable, Debug, Walkable)]
861861
pub enum RangeEnd {
862862
/// `..=` or `...`
863863
Included(RangeSyntax),
864864
/// `..`
865865
Excluded,
866866
}
867867

868-
#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
868+
#[derive(Clone, Copy, Encodable, Decodable, Debug, Walkable)]
869869
pub enum RangeSyntax {
870870
/// `...`
871871
DotDotDot,
@@ -1915,7 +1915,7 @@ pub enum ForLoopKind {
19151915
}
19161916

19171917
/// Used to differentiate between `async {}` blocks and `gen {}` blocks.
1918-
#[derive(Clone, Encodable, Decodable, Debug, PartialEq, Eq, Walkable)]
1918+
#[derive(Clone, Copy, Encodable, Decodable, Debug, PartialEq, Eq, Walkable)]
19191919
pub enum GenBlockKind {
19201920
Async,
19211921
Gen,

compiler/rustc_ast_passes/messages.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ ast_passes_const_and_coroutine = functions cannot be both `const` and `{$corouti
8989
.coroutine = `{$coroutine_kind}` because of this
9090
.label = {""}
9191
92+
ast_passes_const_auto_trait = auto traits cannot be const
93+
.help = remove the `const` keyword
94+
9295
ast_passes_const_bound_trait_object = const trait bounds are not allowed in trait object types
9396
9497
ast_passes_const_without_body =

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,12 @@ impl<'a> AstValidator<'a> {
820820
self.dcx().emit_err(errors::ModuleNonAscii { span: ident.span, name: ident.name });
821821
}
822822

823+
fn deny_const_auto_traits(&self, constness: Const) {
824+
if let Const::Yes(span) = constness {
825+
self.dcx().emit_err(errors::ConstAutoTrait { span });
826+
}
827+
}
828+
823829
fn deny_generic_params(&self, generics: &Generics, ident_span: Span) {
824830
if !generics.params.is_empty() {
825831
self.dcx()
@@ -1257,6 +1263,8 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
12571263
}) => {
12581264
self.visit_attrs_vis_ident(&item.attrs, &item.vis, ident);
12591265
if *is_auto == IsAuto::Yes {
1266+
// For why we reject `const auto trait`, see rust-lang/rust#149285.
1267+
self.deny_const_auto_traits(*constness);
12601268
// Auto traits cannot have generics, super traits nor contain items.
12611269
self.deny_generic_params(generics, ident.span);
12621270
self.deny_super_traits(bounds, ident.span);

compiler/rustc_ast_passes/src/errors.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,14 @@ pub(crate) struct AutoTraitItems {
429429
pub ident: Span,
430430
}
431431

432+
#[derive(Diagnostic)]
433+
#[diag(ast_passes_const_auto_trait)]
434+
#[help]
435+
pub(crate) struct ConstAutoTrait {
436+
#[primary_span]
437+
pub span: Span,
438+
}
439+
432440
#[derive(Diagnostic)]
433441
#[diag(ast_passes_generic_before_constraints)]
434442
pub(crate) struct ArgsBeforeConstraint {

compiler/rustc_builtin_macros/messages.ftl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ builtin_macros_alloc_must_statics = allocators must be statics
33
44
builtin_macros_asm_attribute_not_supported =
55
this attribute is not supported on assembly
6-
builtin_macros_asm_cfg =
7-
the `#[cfg(/* ... */)]` and `#[cfg_attr(/* ... */)]` attributes on assembly are unstable
86
97
builtin_macros_asm_clobber_abi = clobber_abi
108
builtin_macros_asm_clobber_no_reg = asm with `clobber_abi` must specify explicit registers for outputs

compiler/rustc_builtin_macros/src/asm.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ use rustc_expand::base::*;
66
use rustc_index::bit_set::GrowableBitSet;
77
use rustc_parse::parser::asm::*;
88
use rustc_session::lint;
9-
use rustc_session::parse::feature_err;
109
use rustc_span::{ErrorGuaranteed, InnerSpan, Span, Symbol, sym};
1110
use rustc_target::asm::InlineAsmArch;
1211
use smallvec::smallvec;
1312
use {rustc_ast as ast, rustc_parse_format as parse};
1413

14+
use crate::errors;
1515
use crate::util::{ExprToSpannedString, expr_to_spanned_string};
16-
use crate::{errors, fluent_generated as fluent};
1716

1817
/// Validated assembly arguments, ready for macro expansion.
1918
struct ValidatedAsmArgs {
@@ -64,22 +63,13 @@ fn validate_asm_args<'a>(
6463

6564
for arg in args {
6665
for attr in arg.attributes.0.iter() {
67-
match attr.name() {
68-
Some(sym::cfg | sym::cfg_attr) => {
69-
if !ecx.ecfg.features.asm_cfg() {
70-
let span = attr.span();
71-
feature_err(ecx.sess, sym::asm_cfg, span, fluent::builtin_macros_asm_cfg)
72-
.emit();
73-
}
74-
}
75-
_ => {
76-
ecx.dcx().emit_err(errors::AsmAttributeNotSupported { span: attr.span() });
77-
}
66+
if !matches!(attr.name(), Some(sym::cfg | sym::cfg_attr)) {
67+
ecx.dcx().emit_err(errors::AsmAttributeNotSupported { span: attr.span() });
7868
}
7969
}
8070

8171
// Skip arguments that are configured out.
82-
if ecx.ecfg.features.asm_cfg() && strip_unconfigured.configure(arg.attributes).is_none() {
72+
if strip_unconfigured.configure(arg.attributes).is_none() {
8373
continue;
8474
}
8575

compiler/rustc_codegen_gcc/src/gcc_util.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ pub(crate) fn global_gcc_features(sess: &Session) -> Vec<String> {
3333
// should be taken in cases like these.
3434
let mut features = vec![];
3535

36-
// Features implied by an implicit or explicit `--target`.
37-
features.extend(sess.target.features.split(',').filter(|v| !v.is_empty()).map(String::from));
38-
39-
// -Ctarget-features
40-
target_features::flag_to_backend_features(sess, |feature, enable| {
36+
let mut extend_backend_features = |feature: &str, enable: bool| {
4137
// We run through `to_gcc_features` when
4238
// passing requests down to GCC. This means that all in-language
4339
// features also work on the command line instead of having two
@@ -48,7 +44,13 @@ pub(crate) fn global_gcc_features(sess: &Session) -> Vec<String> {
4844
.flat_map(|feat| to_gcc_features(sess, feat).into_iter())
4945
.map(|feature| if !enable { format!("-{}", feature) } else { feature.to_string() }),
5046
);
51-
});
47+
};
48+
49+
// Features implied by an implicit or explicit `--target`.
50+
target_features::target_spec_to_backend_features(sess, &mut extend_backend_features);
51+
52+
// -Ctarget-features
53+
target_features::flag_to_backend_features(sess, extend_backend_features);
5254

5355
gcc_features_by_flags(sess, &mut features);
5456

@@ -66,6 +68,7 @@ pub fn to_gcc_features<'a>(sess: &Session, s: &'a str) -> SmallVec<[&'a str; 2]>
6668
(&Arch::X86 | &Arch::X86_64, "rdrand") => smallvec!["rdrnd"],
6769
(&Arch::X86 | &Arch::X86_64, "bmi1") => smallvec!["bmi"],
6870
(&Arch::X86 | &Arch::X86_64, "cmpxchg16b") => smallvec!["cx16"],
71+
(&Arch::X86 | &Arch::X86_64, "lahfsahf") => smallvec!["sahf"],
6972
(&Arch::X86 | &Arch::X86_64, "avx512vaes") => smallvec!["vaes"],
7073
(&Arch::X86 | &Arch::X86_64, "avx512gfni") => smallvec!["gfni"],
7174
(&Arch::X86 | &Arch::X86_64, "avx512vpclmulqdq") => smallvec!["vpclmulqdq"],

compiler/rustc_codegen_llvm/messages.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ codegen_llvm_lto_bitcode_from_rlib = failed to get bitcode from object file for
1818
codegen_llvm_mismatch_data_layout =
1919
data-layout for target `{$rustc_target}`, `{$rustc_layout}`, differs from LLVM target's `{$llvm_target}` default layout, `{$llvm_layout}`
2020
21+
codegen_llvm_offload_without_enable = using the offload feature requires -Z offload=Enable
22+
codegen_llvm_offload_without_fat_lto = using the offload feature requires -C lto=fat
23+
2124
codegen_llvm_parse_bitcode = failed to parse bitcode for LTO module
2225
codegen_llvm_parse_bitcode_with_llvm_err = failed to parse bitcode for LTO module: {$llvm_err}
2326

compiler/rustc_codegen_llvm/src/attributes.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ pub(crate) fn apply_to_callsite(callsite: &Value, idx: AttributePlace, attrs: &[
3030
}
3131
}
3232

33+
pub(crate) fn has_string_attr(llfn: &Value, name: &str) -> bool {
34+
llvm::HasStringAttribute(llfn, name)
35+
}
36+
37+
pub(crate) fn remove_string_attr_from_llfn(llfn: &Value, name: &str) {
38+
llvm::RemoveStringAttrFromFn(llfn, name);
39+
}
40+
3341
/// Get LLVM attribute for the provided inline heuristic.
3442
pub(crate) fn inline_attr<'ll, 'tcx>(
3543
cx: &SimpleCx<'ll>,
@@ -408,6 +416,10 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
408416
to_add.push(llvm::CreateAttrString(cx.llcx, "no-builtins"));
409417
}
410418

419+
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::OFFLOAD_KERNEL) {
420+
to_add.push(llvm::CreateAttrString(cx.llcx, "offload-kernel"))
421+
}
422+
411423
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::COLD) {
412424
to_add.push(AttributeKind::Cold.create_attr(cx.llcx));
413425
}

0 commit comments

Comments
 (0)