Skip to content

Commit c8b62df

Browse files
committed
Auto merge of #63607 - Centril:rollup-yry7nsw, r=Centril
Rollup of 5 pull requests Successful merges: - #63173 (Use libunwind from llvm-project submodule for musl targets) - #63462 (Opaque builtin derive macros) - #63539 (Suggest Rust 2018 on `<expr>.await` with no such field) - #63545 (Feature gate 'yield $expr?' pre-expansion) - #63584 (libcore: more cleanups using `#![feature(associated_type_bounds)]`) Failed merges: r? @ghost
2 parents f7af19c + 8f2decb commit c8b62df

Some content is hidden

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

63 files changed

+677
-470
lines changed

src/bootstrap/sanity.rs

-4
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,6 @@ pub fn check(build: &mut Build) {
202202
panic!("couldn't find libc.a in musl dir: {}",
203203
root.join("lib").display());
204204
}
205-
if fs::metadata(root.join("lib/libunwind.a")).is_err() {
206-
panic!("couldn't find libunwind.a in musl dir: {}",
207-
root.join("lib").display());
208-
}
209205
}
210206
None => {
211207
panic!("when targeting MUSL either the rust.musl-root \

src/ci/docker/scripts/musl-toolchain.sh

-26
Original file line numberDiff line numberDiff line change
@@ -54,29 +54,3 @@ if [ "$REPLACE_CC" = "1" ]; then
5454
ln -s $TARGET-g++ /usr/local/bin/$exec
5555
done
5656
fi
57-
58-
export CC=$TARGET-gcc
59-
export CXX=$TARGET-g++
60-
61-
LLVM=70
62-
63-
# may have been downloaded in a previous run
64-
if [ ! -d libunwind-release_$LLVM ]; then
65-
curl -L https://github.com/llvm-mirror/llvm/archive/release_$LLVM.tar.gz | tar xzf -
66-
curl -L https://github.com/llvm-mirror/libunwind/archive/release_$LLVM.tar.gz | tar xzf -
67-
fi
68-
69-
# fixme(mati865): Replace it with https://github.com/rust-lang/rust/pull/59089
70-
mkdir libunwind-build
71-
cd libunwind-build
72-
cmake ../libunwind-release_$LLVM \
73-
-DLLVM_PATH=/build/llvm-release_$LLVM \
74-
-DLIBUNWIND_ENABLE_SHARED=0 \
75-
-DCMAKE_C_COMPILER=$CC \
76-
-DCMAKE_CXX_COMPILER=$CXX \
77-
-DCMAKE_C_FLAGS="$CFLAGS" \
78-
-DCMAKE_CXX_FLAGS="$CXXFLAGS"
79-
80-
hide_output make -j$(nproc)
81-
cp lib/libunwind.a $OUTPUT/$TARGET/lib
82-
cd - && rm -rf libunwind-build

src/ci/docker/scripts/musl.sh

+2-24
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ exit 1
2020
TAG=$1
2121
shift
2222

23+
# Ancient binutils versions don't understand debug symbols produced by more recent tools.
24+
# Apparently applying `-fPIC` everywhere allows them to link successfully.
2325
export CFLAGS="-fPIC $CFLAGS"
2426

2527
MUSL=musl-1.1.22
@@ -38,27 +40,3 @@ else
3840
fi
3941
hide_output make install
4042
hide_output make clean
41-
42-
cd ..
43-
44-
LLVM=70
45-
46-
# may have been downloaded in a previous run
47-
if [ ! -d libunwind-release_$LLVM ]; then
48-
curl -L https://github.com/llvm-mirror/llvm/archive/release_$LLVM.tar.gz | tar xzf -
49-
curl -L https://github.com/llvm-mirror/libunwind/archive/release_$LLVM.tar.gz | tar xzf -
50-
fi
51-
52-
mkdir libunwind-build
53-
cd libunwind-build
54-
cmake ../libunwind-release_$LLVM \
55-
-DLLVM_PATH=/build/llvm-release_$LLVM \
56-
-DLIBUNWIND_ENABLE_SHARED=0 \
57-
-DCMAKE_C_COMPILER=$CC \
58-
-DCMAKE_CXX_COMPILER=$CXX \
59-
-DCMAKE_C_FLAGS="$CFLAGS" \
60-
-DCMAKE_CXX_FLAGS="$CXXFLAGS"
61-
62-
hide_output make -j$(nproc)
63-
cp lib/libunwind.a /musl-$TAG/lib
64-
cd ../ && rm -rf libunwind-build

src/libcore/clone.rs

-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ pub trait Clone : Sized {
135135

136136
/// Derive macro generating an impl of the trait `Clone`.
137137
#[rustc_builtin_macro]
138-
#[rustc_macro_transparency = "semitransparent"]
139138
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
140139
#[allow_internal_unstable(core_intrinsics, derive_clone_copy)]
141140
pub macro Clone($item:item) { /* compiler built-in */ }

src/libcore/cmp.rs

-4
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ pub trait PartialEq<Rhs: ?Sized = Self> {
202202

203203
/// Derive macro generating an impl of the trait `PartialEq`.
204204
#[rustc_builtin_macro]
205-
#[rustc_macro_transparency = "semitransparent"]
206205
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
207206
#[allow_internal_unstable(core_intrinsics)]
208207
pub macro PartialEq($item:item) { /* compiler built-in */ }
@@ -265,7 +264,6 @@ pub trait Eq: PartialEq<Self> {
265264

266265
/// Derive macro generating an impl of the trait `Eq`.
267266
#[rustc_builtin_macro]
268-
#[rustc_macro_transparency = "semitransparent"]
269267
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
270268
#[allow_internal_unstable(core_intrinsics, derive_eq)]
271269
pub macro Eq($item:item) { /* compiler built-in */ }
@@ -616,7 +614,6 @@ pub trait Ord: Eq + PartialOrd<Self> {
616614

617615
/// Derive macro generating an impl of the trait `Ord`.
618616
#[rustc_builtin_macro]
619-
#[rustc_macro_transparency = "semitransparent"]
620617
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
621618
#[allow_internal_unstable(core_intrinsics)]
622619
pub macro Ord($item:item) { /* compiler built-in */ }
@@ -865,7 +862,6 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
865862

866863
/// Derive macro generating an impl of the trait `PartialOrd`.
867864
#[rustc_builtin_macro]
868-
#[rustc_macro_transparency = "semitransparent"]
869865
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
870866
#[allow_internal_unstable(core_intrinsics)]
871867
pub macro PartialOrd($item:item) { /* compiler built-in */ }

src/libcore/default.rs

-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ pub trait Default: Sized {
117117

118118
/// Derive macro generating an impl of the trait `Default`.
119119
#[rustc_builtin_macro]
120-
#[rustc_macro_transparency = "semitransparent"]
121120
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
122121
#[allow_internal_unstable(core_intrinsics)]
123122
pub macro Default($item:item) { /* compiler built-in */ }

src/libcore/fmt/builders.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ pub struct DebugStruct<'a, 'b: 'a> {
9898
has_fields: bool,
9999
}
100100

101-
pub fn debug_struct_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>,
101+
pub(super) fn debug_struct_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>,
102102
name: &str)
103103
-> DebugStruct<'a, 'b> {
104104
let result = fmt.write_str(name);
@@ -251,7 +251,10 @@ pub struct DebugTuple<'a, 'b: 'a> {
251251
empty_name: bool,
252252
}
253253

254-
pub fn debug_tuple_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>, name: &str) -> DebugTuple<'a, 'b> {
254+
pub(super) fn debug_tuple_new<'a, 'b>(
255+
fmt: &'a mut fmt::Formatter<'b>,
256+
name: &str,
257+
) -> DebugTuple<'a, 'b> {
255258
let result = fmt.write_str(name);
256259
DebugTuple {
257260
fmt,
@@ -418,7 +421,7 @@ pub struct DebugSet<'a, 'b: 'a> {
418421
inner: DebugInner<'a, 'b>,
419422
}
420423

421-
pub fn debug_set_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugSet<'a, 'b> {
424+
pub(super) fn debug_set_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugSet<'a, 'b> {
422425
let result = fmt.write_str("{");
423426
DebugSet {
424427
inner: DebugInner {
@@ -555,7 +558,7 @@ pub struct DebugList<'a, 'b: 'a> {
555558
inner: DebugInner<'a, 'b>,
556559
}
557560

558-
pub fn debug_list_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugList<'a, 'b> {
561+
pub(super) fn debug_list_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugList<'a, 'b> {
559562
let result = fmt.write_str("[");
560563
DebugList {
561564
inner: DebugInner {
@@ -697,7 +700,7 @@ pub struct DebugMap<'a, 'b: 'a> {
697700
state: PadAdapterState,
698701
}
699702

700-
pub fn debug_map_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugMap<'a, 'b> {
703+
pub(super) fn debug_map_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugMap<'a, 'b> {
701704
let result = fmt.write_str("{");
702705
DebugMap {
703706
fmt,

src/libcore/fmt/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,6 @@ pub trait Debug {
549549
pub(crate) mod macros {
550550
/// Derive macro generating an impl of the trait `Debug`.
551551
#[rustc_builtin_macro]
552-
#[rustc_macro_transparency = "semitransparent"]
553552
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
554553
#[allow_internal_unstable(core_intrinsics)]
555554
pub macro Debug($item:item) { /* compiler built-in */ }

src/libcore/hash/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ pub trait Hash {
202202
pub(crate) mod macros {
203203
/// Derive macro generating an impl of the trait `Hash`.
204204
#[rustc_builtin_macro]
205-
#[rustc_macro_transparency = "semitransparent"]
206205
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
207206
#[allow_internal_unstable(core_intrinsics)]
208207
pub macro Hash($item:item) { /* compiler built-in */ }

src/libcore/iter/adapters/flatten.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ impl<I: Iterator, U: IntoIterator, F> Iterator for FlatMap<I, U, F>
7272
impl<I: DoubleEndedIterator, U, F> DoubleEndedIterator for FlatMap<I, U, F>
7373
where
7474
F: FnMut(I::Item) -> U,
75-
U: IntoIterator,
76-
U::IntoIter: DoubleEndedIterator,
75+
U: IntoIterator<IntoIter: DoubleEndedIterator>,
7776
{
7877
#[inline]
7978
fn next_back(&mut self) -> Option<U::Item> { self.inner.next_back() }
@@ -107,10 +106,7 @@ impl<I, U, F> FusedIterator for FlatMap<I, U, F>
107106
/// [`Iterator`]: trait.Iterator.html
108107
#[must_use = "iterators are lazy and do nothing unless consumed"]
109108
#[stable(feature = "iterator_flatten", since = "1.29.0")]
110-
pub struct Flatten<I: Iterator>
111-
where
112-
I::Item: IntoIterator,
113-
{
109+
pub struct Flatten<I: Iterator<Item: IntoIterator>> {
114110
inner: FlattenCompat<I, <I::Item as IntoIterator>::IntoIter>,
115111
}
116112

src/libcore/macros.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1270,14 +1270,12 @@ pub(crate) mod builtin {
12701270

12711271
/// Unstable implementation detail of the `rustc` compiler, do not use.
12721272
#[rustc_builtin_macro]
1273-
#[rustc_macro_transparency = "semitransparent"]
12741273
#[stable(feature = "rust1", since = "1.0.0")]
12751274
#[allow_internal_unstable(core_intrinsics, libstd_sys_internals)]
12761275
pub macro RustcDecodable($item:item) { /* compiler built-in */ }
12771276

12781277
/// Unstable implementation detail of the `rustc` compiler, do not use.
12791278
#[rustc_builtin_macro]
1280-
#[rustc_macro_transparency = "semitransparent"]
12811279
#[stable(feature = "rust1", since = "1.0.0")]
12821280
#[allow_internal_unstable(core_intrinsics)]
12831281
pub macro RustcEncodable($item:item) { /* compiler built-in */ }

src/libcore/marker.rs

-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@ pub trait Copy : Clone {
290290

291291
/// Derive macro generating an impl of the trait `Copy`.
292292
#[rustc_builtin_macro]
293-
#[rustc_macro_transparency = "semitransparent"]
294293
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
295294
#[allow_internal_unstable(core_intrinsics, derive_clone_copy)]
296295
pub macro Copy($item:item) { /* compiler built-in */ }

src/librustc/hir/lowering/expr.rs

-1
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,6 @@ impl LoweringContext<'_> {
984984
volatile: asm.volatile,
985985
alignstack: asm.alignstack,
986986
dialect: asm.dialect,
987-
ctxt: asm.ctxt,
988987
};
989988

990989
let outputs = asm.outputs

src/librustc/hir/lowering/item.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -750,10 +750,7 @@ impl LoweringContext<'_> {
750750
}
751751

752752
fn lower_global_asm(&mut self, ga: &GlobalAsm) -> P<hir::GlobalAsm> {
753-
P(hir::GlobalAsm {
754-
asm: ga.asm,
755-
ctxt: ga.ctxt,
756-
})
753+
P(hir::GlobalAsm { asm: ga.asm })
757754
}
758755

759756
fn lower_variant(&mut self, v: &Variant) -> hir::Variant {

src/librustc/hir/mod.rs

-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use rustc_target::spec::abi::Abi;
2323
use syntax::ast::{self, CrateSugar, Ident, Name, NodeId, AsmDialect};
2424
use syntax::ast::{Attribute, Label, LitKind, StrStyle, FloatTy, IntTy, UintTy};
2525
use syntax::attr::{InlineAttr, OptimizeAttr};
26-
use syntax::ext::hygiene::SyntaxContext;
2726
use syntax::symbol::{Symbol, kw};
2827
use syntax::tokenstream::TokenStream;
2928
use syntax::util::parser::ExprPrecedence;
@@ -2004,8 +2003,6 @@ pub struct InlineAsm {
20042003
pub volatile: bool,
20052004
pub alignstack: bool,
20062005
pub dialect: AsmDialect,
2007-
#[stable_hasher(ignore)] // This is used for error reporting
2008-
pub ctxt: SyntaxContext,
20092006
}
20102007

20112008
/// Represents an argument in a function header.
@@ -2184,8 +2181,6 @@ pub struct ForeignMod {
21842181
#[derive(RustcEncodable, RustcDecodable, Debug, HashStable)]
21852182
pub struct GlobalAsm {
21862183
pub asm: Symbol,
2187-
#[stable_hasher(ignore)] // This is used for error reporting
2188-
pub ctxt: SyntaxContext,
21892184
}
21902185

21912186
#[derive(RustcEncodable, RustcDecodable, Debug, HashStable)]

src/librustc_codegen_llvm/asm.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ use crate::value::Value;
66

77
use rustc::hir;
88
use rustc_codegen_ssa::traits::*;
9-
109
use rustc_codegen_ssa::mir::place::PlaceRef;
1110
use rustc_codegen_ssa::mir::operand::OperandValue;
11+
use syntax_pos::Span;
1212

1313
use std::ffi::{CStr, CString};
1414
use libc::{c_uint, c_char};
@@ -19,7 +19,8 @@ impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
1919
&mut self,
2020
ia: &hir::InlineAsm,
2121
outputs: Vec<PlaceRef<'tcx, &'ll Value>>,
22-
mut inputs: Vec<&'ll Value>
22+
mut inputs: Vec<&'ll Value>,
23+
span: Span,
2324
) -> bool {
2425
let mut ext_constraints = vec![];
2526
let mut output_types = vec![];
@@ -102,7 +103,7 @@ impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
102103
let kind = llvm::LLVMGetMDKindIDInContext(self.llcx,
103104
key.as_ptr() as *const c_char, key.len() as c_uint);
104105

105-
let val: &'ll Value = self.const_i32(ia.ctxt.outer_expn().as_u32() as i32);
106+
let val: &'ll Value = self.const_i32(span.ctxt().outer_expn().as_u32() as i32);
106107

107108
llvm::LLVMSetMetadata(r, kind,
108109
llvm::LLVMMDNodeInContext(self.llcx, &val, 1));

src/librustc_codegen_ssa/mir/statement.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
8989
});
9090

9191
if input_vals.len() == asm.inputs.len() {
92-
let res = bx.codegen_inline_asm(&asm.asm, outputs, input_vals);
92+
let res = bx.codegen_inline_asm(
93+
&asm.asm,
94+
outputs,
95+
input_vals,
96+
statement.source_info.span,
97+
);
9398
if !res {
9499
span_err!(bx.sess(), statement.source_info.span, E0668,
95100
"malformed inline assembly");

src/librustc_codegen_ssa/traits/asm.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use super::BackendTypes;
22
use crate::mir::place::PlaceRef;
33
use rustc::hir::{GlobalAsm, InlineAsm};
4+
use syntax_pos::Span;
45

56
pub trait AsmBuilderMethods<'tcx>: BackendTypes {
67
/// Take an inline assembly expression and splat it out via LLVM
@@ -9,6 +10,7 @@ pub trait AsmBuilderMethods<'tcx>: BackendTypes {
910
ia: &InlineAsm,
1011
outputs: Vec<PlaceRef<'tcx, Self::Value>>,
1112
inputs: Vec<Self::Value>,
13+
span: Span,
1214
) -> bool;
1315
}
1416

src/librustc_metadata/decoder.rs

+8
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,14 @@ impl<'a, 'tcx> SpecializedDecoder<Span> for DecodeContext<'a, 'tcx> {
348348
}
349349
}
350350

351+
impl SpecializedDecoder<Ident> for DecodeContext<'_, '_> {
352+
fn specialized_decode(&mut self) -> Result<Ident, Self::Error> {
353+
// FIXME(jseyfried): intercrate hygiene
354+
355+
Ok(Ident::with_empty_ctxt(Symbol::decode(self)?))
356+
}
357+
}
358+
351359
impl<'a, 'tcx> SpecializedDecoder<Fingerprint> for DecodeContext<'a, 'tcx> {
352360
fn specialized_decode(&mut self) -> Result<Fingerprint, Self::Error> {
353361
Fingerprint::decode_opaque(&mut self.opaque)

src/librustc_metadata/encoder.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use std::u32;
3131
use syntax::ast;
3232
use syntax::attr;
3333
use syntax::source_map::Spanned;
34-
use syntax::symbol::{kw, sym};
34+
use syntax::symbol::{kw, sym, Ident};
3535
use syntax_pos::{self, FileName, SourceFile, Span};
3636
use log::{debug, trace};
3737

@@ -173,6 +173,13 @@ impl<'tcx> SpecializedEncoder<Span> for EncodeContext<'tcx> {
173173
}
174174
}
175175

176+
impl SpecializedEncoder<Ident> for EncodeContext<'tcx> {
177+
fn specialized_encode(&mut self, ident: &Ident) -> Result<(), Self::Error> {
178+
// FIXME(jseyfried): intercrate hygiene
179+
ident.name.encode(self)
180+
}
181+
}
182+
176183
impl<'tcx> SpecializedEncoder<LocalDefId> for EncodeContext<'tcx> {
177184
#[inline]
178185
fn specialized_encode(&mut self, def_id: &LocalDefId) -> Result<(), Self::Error> {

src/librustc_resolve/diagnostics.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,14 @@ impl<'a> Resolver<'a> {
166166
err
167167
}
168168
ResolutionError::NameAlreadyUsedInParameterList(name, first_use_span) => {
169-
let mut err = struct_span_err!(self.session,
170-
span,
171-
E0403,
172-
"the name `{}` is already used for a generic \
173-
parameter in this list of generic parameters",
174-
name);
169+
let mut err = struct_span_err!(
170+
self.session,
171+
span,
172+
E0403,
173+
"the name `{}` is already used for a generic \
174+
parameter in this item's generic parameters",
175+
name,
176+
);
175177
err.span_label(span, "already used");
176178
err.span_label(first_use_span, format!("first use of `{}`", name));
177179
err

0 commit comments

Comments
 (0)