Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 5 pull requests #63607

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c22ba27
Stop emulating cross-crate hygiene with gensyms
matthewjasper Aug 11, 2019
f3a589a
Make built-in derives opaque macros
matthewjasper Aug 9, 2019
dd9a5b8
Make fmt-internal functions private
matthewjasper Aug 11, 2019
ade2c8f
Remove gensyms from built-in derives
matthewjasper Aug 11, 2019
1b0b505
Move type parameter shadowing errors to resolve
matthewjasper Aug 11, 2019
6f00e1e
Remove SyntaxContext from {ast, hir}::{GlobalAsm, InlineAsm}
matthewjasper Aug 12, 2019
01587b1
Remove unused `SyntaxContext` serialization impls
matthewjasper Aug 13, 2019
0b713ae
typeck: extract ban_private_field_access
Centril Aug 13, 2019
5e019de
typeck: extract ban_take_value_of_method
Centril Aug 13, 2019
9805846
typeck: extract maybe_suggest_array_indexing
Centril Aug 13, 2019
039c789
typeck: extract suggest_first_deref_field
Centril Aug 13, 2019
01e96dc
typeck: extract suggest_fields_on_recordish
Centril Aug 13, 2019
0741441
typeck: restructure check_field a bit
Centril Aug 13, 2019
88398a4
typeck: on wrong <expr>.await suggest -> 2018
Centril Aug 13, 2019
9287eb6
typeck: add tests for suggesting -> 2018 on wrong <expr>.await
Centril Aug 13, 2019
4272864
Feature gate 'yield ?' pre-expansion.
Centril Aug 14, 2019
4fe201c
Simplify pre-expansion gating in general.
Centril Aug 14, 2019
f54503c
libcore: more cleanups using associated_type_bounds
Centril Aug 15, 2019
5941acd
Use libunwind from llvm-project submodule for musl targets
malbarbo Jul 30, 2019
f9d3c4e
Rollup merge of #63173 - malbarbo:musl-libunwind, r=alexcrichton
Centril Aug 15, 2019
4382b5d
Rollup merge of #63462 - matthewjasper:hygienic-builtin-derives, r=pe…
Centril Aug 15, 2019
8bb9663
Rollup merge of #63539 - Centril:2015.await, r=oli-obk
Centril Aug 15, 2019
916a8c3
Rollup merge of #63545 - Centril:gate-yield-preexp, r=oli-obk
Centril Aug 15, 2019
8f2decb
Rollup merge of #63584 - Centril:cleanup-core-with-more-atb, r=alexreg
Centril Aug 15, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,6 @@ pub fn check(build: &mut Build) {
panic!("couldn't find libc.a in musl dir: {}",
root.join("lib").display());
}
if fs::metadata(root.join("lib/libunwind.a")).is_err() {
panic!("couldn't find libunwind.a in musl dir: {}",
root.join("lib").display());
}
}
None => {
panic!("when targeting MUSL either the rust.musl-root \
Expand Down
26 changes: 0 additions & 26 deletions src/ci/docker/scripts/musl-toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,29 +54,3 @@ if [ "$REPLACE_CC" = "1" ]; then
ln -s $TARGET-g++ /usr/local/bin/$exec
done
fi

export CC=$TARGET-gcc
export CXX=$TARGET-g++

LLVM=70

# may have been downloaded in a previous run
if [ ! -d libunwind-release_$LLVM ]; then
curl -L https://github.com/llvm-mirror/llvm/archive/release_$LLVM.tar.gz | tar xzf -
curl -L https://github.com/llvm-mirror/libunwind/archive/release_$LLVM.tar.gz | tar xzf -
fi

# fixme(mati865): Replace it with https://github.com/rust-lang/rust/pull/59089
mkdir libunwind-build
cd libunwind-build
cmake ../libunwind-release_$LLVM \
-DLLVM_PATH=/build/llvm-release_$LLVM \
-DLIBUNWIND_ENABLE_SHARED=0 \
-DCMAKE_C_COMPILER=$CC \
-DCMAKE_CXX_COMPILER=$CXX \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS"

hide_output make -j$(nproc)
cp lib/libunwind.a $OUTPUT/$TARGET/lib
cd - && rm -rf libunwind-build
26 changes: 2 additions & 24 deletions src/ci/docker/scripts/musl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ exit 1
TAG=$1
shift

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

MUSL=musl-1.1.22
Expand All @@ -38,27 +40,3 @@ else
fi
hide_output make install
hide_output make clean

cd ..

LLVM=70

# may have been downloaded in a previous run
if [ ! -d libunwind-release_$LLVM ]; then
curl -L https://github.com/llvm-mirror/llvm/archive/release_$LLVM.tar.gz | tar xzf -
curl -L https://github.com/llvm-mirror/libunwind/archive/release_$LLVM.tar.gz | tar xzf -
fi

mkdir libunwind-build
cd libunwind-build
cmake ../libunwind-release_$LLVM \
-DLLVM_PATH=/build/llvm-release_$LLVM \
-DLIBUNWIND_ENABLE_SHARED=0 \
-DCMAKE_C_COMPILER=$CC \
-DCMAKE_CXX_COMPILER=$CXX \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS"

hide_output make -j$(nproc)
cp lib/libunwind.a /musl-$TAG/lib
cd ../ && rm -rf libunwind-build
1 change: 0 additions & 1 deletion src/libcore/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ pub trait Clone : Sized {

/// Derive macro generating an impl of the trait `Clone`.
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow_internal_unstable(core_intrinsics, derive_clone_copy)]
pub macro Clone($item:item) { /* compiler built-in */ }
Expand Down
4 changes: 0 additions & 4 deletions src/libcore/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ pub trait PartialEq<Rhs: ?Sized = Self> {

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

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

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

/// Derive macro generating an impl of the trait `PartialOrd`.
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow_internal_unstable(core_intrinsics)]
pub macro PartialOrd($item:item) { /* compiler built-in */ }
Expand Down
1 change: 0 additions & 1 deletion src/libcore/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ pub trait Default: Sized {

/// Derive macro generating an impl of the trait `Default`.
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow_internal_unstable(core_intrinsics)]
pub macro Default($item:item) { /* compiler built-in */ }
Expand Down
13 changes: 8 additions & 5 deletions src/libcore/fmt/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub struct DebugStruct<'a, 'b: 'a> {
has_fields: bool,
}

pub fn debug_struct_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>,
pub(super) fn debug_struct_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>,
name: &str)
-> DebugStruct<'a, 'b> {
let result = fmt.write_str(name);
Expand Down Expand Up @@ -251,7 +251,10 @@ pub struct DebugTuple<'a, 'b: 'a> {
empty_name: bool,
}

pub fn debug_tuple_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>, name: &str) -> DebugTuple<'a, 'b> {
pub(super) fn debug_tuple_new<'a, 'b>(
fmt: &'a mut fmt::Formatter<'b>,
name: &str,
) -> DebugTuple<'a, 'b> {
let result = fmt.write_str(name);
DebugTuple {
fmt,
Expand Down Expand Up @@ -418,7 +421,7 @@ pub struct DebugSet<'a, 'b: 'a> {
inner: DebugInner<'a, 'b>,
}

pub fn debug_set_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugSet<'a, 'b> {
pub(super) fn debug_set_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugSet<'a, 'b> {
let result = fmt.write_str("{");
DebugSet {
inner: DebugInner {
Expand Down Expand Up @@ -555,7 +558,7 @@ pub struct DebugList<'a, 'b: 'a> {
inner: DebugInner<'a, 'b>,
}

pub fn debug_list_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugList<'a, 'b> {
pub(super) fn debug_list_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugList<'a, 'b> {
let result = fmt.write_str("[");
DebugList {
inner: DebugInner {
Expand Down Expand Up @@ -697,7 +700,7 @@ pub struct DebugMap<'a, 'b: 'a> {
state: PadAdapterState,
}

pub fn debug_map_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugMap<'a, 'b> {
pub(super) fn debug_map_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugMap<'a, 'b> {
let result = fmt.write_str("{");
DebugMap {
fmt,
Expand Down
1 change: 0 additions & 1 deletion src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,6 @@ pub trait Debug {
pub(crate) mod macros {
/// Derive macro generating an impl of the trait `Debug`.
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow_internal_unstable(core_intrinsics)]
pub macro Debug($item:item) { /* compiler built-in */ }
Expand Down
1 change: 0 additions & 1 deletion src/libcore/hash/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ pub trait Hash {
pub(crate) mod macros {
/// Derive macro generating an impl of the trait `Hash`.
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow_internal_unstable(core_intrinsics)]
pub macro Hash($item:item) { /* compiler built-in */ }
Expand Down
8 changes: 2 additions & 6 deletions src/libcore/iter/adapters/flatten.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ impl<I: Iterator, U: IntoIterator, F> Iterator for FlatMap<I, U, F>
impl<I: DoubleEndedIterator, U, F> DoubleEndedIterator for FlatMap<I, U, F>
where
F: FnMut(I::Item) -> U,
U: IntoIterator,
U::IntoIter: DoubleEndedIterator,
U: IntoIterator<IntoIter: DoubleEndedIterator>,
{
#[inline]
fn next_back(&mut self) -> Option<U::Item> { self.inner.next_back() }
Expand Down Expand Up @@ -107,10 +106,7 @@ impl<I, U, F> FusedIterator for FlatMap<I, U, F>
/// [`Iterator`]: trait.Iterator.html
#[must_use = "iterators are lazy and do nothing unless consumed"]
#[stable(feature = "iterator_flatten", since = "1.29.0")]
pub struct Flatten<I: Iterator>
where
I::Item: IntoIterator,
{
pub struct Flatten<I: Iterator<Item: IntoIterator>> {
inner: FlattenCompat<I, <I::Item as IntoIterator>::IntoIter>,
}

Expand Down
2 changes: 0 additions & 2 deletions src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1270,14 +1270,12 @@ pub(crate) mod builtin {

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

/// Unstable implementation detail of the `rustc` compiler, do not use.
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[stable(feature = "rust1", since = "1.0.0")]
#[allow_internal_unstable(core_intrinsics)]
pub macro RustcEncodable($item:item) { /* compiler built-in */ }
Expand Down
1 change: 0 additions & 1 deletion src/libcore/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ pub trait Copy : Clone {

/// Derive macro generating an impl of the trait `Copy`.
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow_internal_unstable(core_intrinsics, derive_clone_copy)]
pub macro Copy($item:item) { /* compiler built-in */ }
Expand Down
1 change: 0 additions & 1 deletion src/librustc/hir/lowering/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,6 @@ impl LoweringContext<'_> {
volatile: asm.volatile,
alignstack: asm.alignstack,
dialect: asm.dialect,
ctxt: asm.ctxt,
};

let outputs = asm.outputs
Expand Down
5 changes: 1 addition & 4 deletions src/librustc/hir/lowering/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -750,10 +750,7 @@ impl LoweringContext<'_> {
}

fn lower_global_asm(&mut self, ga: &GlobalAsm) -> P<hir::GlobalAsm> {
P(hir::GlobalAsm {
asm: ga.asm,
ctxt: ga.ctxt,
})
P(hir::GlobalAsm { asm: ga.asm })
}

fn lower_variant(&mut self, v: &Variant) -> hir::Variant {
Expand Down
5 changes: 0 additions & 5 deletions src/librustc/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use rustc_target::spec::abi::Abi;
use syntax::ast::{self, CrateSugar, Ident, Name, NodeId, AsmDialect};
use syntax::ast::{Attribute, Label, LitKind, StrStyle, FloatTy, IntTy, UintTy};
use syntax::attr::{InlineAttr, OptimizeAttr};
use syntax::ext::hygiene::SyntaxContext;
use syntax::symbol::{Symbol, kw};
use syntax::tokenstream::TokenStream;
use syntax::util::parser::ExprPrecedence;
Expand Down Expand Up @@ -2004,8 +2003,6 @@ pub struct InlineAsm {
pub volatile: bool,
pub alignstack: bool,
pub dialect: AsmDialect,
#[stable_hasher(ignore)] // This is used for error reporting
pub ctxt: SyntaxContext,
}

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

#[derive(RustcEncodable, RustcDecodable, Debug, HashStable)]
Expand Down
7 changes: 4 additions & 3 deletions src/librustc_codegen_llvm/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use crate::value::Value;

use rustc::hir;
use rustc_codegen_ssa::traits::*;

use rustc_codegen_ssa::mir::place::PlaceRef;
use rustc_codegen_ssa::mir::operand::OperandValue;
use syntax_pos::Span;

use std::ffi::{CStr, CString};
use libc::{c_uint, c_char};
Expand All @@ -19,7 +19,8 @@ impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
&mut self,
ia: &hir::InlineAsm,
outputs: Vec<PlaceRef<'tcx, &'ll Value>>,
mut inputs: Vec<&'ll Value>
mut inputs: Vec<&'ll Value>,
span: Span,
) -> bool {
let mut ext_constraints = vec![];
let mut output_types = vec![];
Expand Down Expand Up @@ -102,7 +103,7 @@ impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
let kind = llvm::LLVMGetMDKindIDInContext(self.llcx,
key.as_ptr() as *const c_char, key.len() as c_uint);

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

llvm::LLVMSetMetadata(r, kind,
llvm::LLVMMDNodeInContext(self.llcx, &val, 1));
Expand Down
7 changes: 6 additions & 1 deletion src/librustc_codegen_ssa/mir/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
});

if input_vals.len() == asm.inputs.len() {
let res = bx.codegen_inline_asm(&asm.asm, outputs, input_vals);
let res = bx.codegen_inline_asm(
&asm.asm,
outputs,
input_vals,
statement.source_info.span,
);
if !res {
span_err!(bx.sess(), statement.source_info.span, E0668,
"malformed inline assembly");
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_codegen_ssa/traits/asm.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use super::BackendTypes;
use crate::mir::place::PlaceRef;
use rustc::hir::{GlobalAsm, InlineAsm};
use syntax_pos::Span;

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

Expand Down
8 changes: 8 additions & 0 deletions src/librustc_metadata/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,14 @@ impl<'a, 'tcx> SpecializedDecoder<Span> for DecodeContext<'a, 'tcx> {
}
}

impl SpecializedDecoder<Ident> for DecodeContext<'_, '_> {
fn specialized_decode(&mut self) -> Result<Ident, Self::Error> {
// FIXME(jseyfried): intercrate hygiene

Ok(Ident::with_empty_ctxt(Symbol::decode(self)?))
}
}

impl<'a, 'tcx> SpecializedDecoder<Fingerprint> for DecodeContext<'a, 'tcx> {
fn specialized_decode(&mut self) -> Result<Fingerprint, Self::Error> {
Fingerprint::decode_opaque(&mut self.opaque)
Expand Down
9 changes: 8 additions & 1 deletion src/librustc_metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use std::u32;
use syntax::ast;
use syntax::attr;
use syntax::source_map::Spanned;
use syntax::symbol::{kw, sym};
use syntax::symbol::{kw, sym, Ident};
use syntax_pos::{self, FileName, SourceFile, Span};
use log::{debug, trace};

Expand Down Expand Up @@ -173,6 +173,13 @@ impl<'tcx> SpecializedEncoder<Span> for EncodeContext<'tcx> {
}
}

impl SpecializedEncoder<Ident> for EncodeContext<'tcx> {
fn specialized_encode(&mut self, ident: &Ident) -> Result<(), Self::Error> {
// FIXME(jseyfried): intercrate hygiene
ident.name.encode(self)
}
}

impl<'tcx> SpecializedEncoder<LocalDefId> for EncodeContext<'tcx> {
#[inline]
fn specialized_encode(&mut self, def_id: &LocalDefId) -> Result<(), Self::Error> {
Expand Down
14 changes: 8 additions & 6 deletions src/librustc_resolve/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,14 @@ impl<'a> Resolver<'a> {
err
}
ResolutionError::NameAlreadyUsedInParameterList(name, first_use_span) => {
let mut err = struct_span_err!(self.session,
span,
E0403,
"the name `{}` is already used for a generic \
parameter in this list of generic parameters",
name);
let mut err = struct_span_err!(
self.session,
span,
E0403,
"the name `{}` is already used for a generic \
parameter in this item's generic parameters",
name,
);
err.span_label(span, "already used");
err.span_label(first_use_span, format!("first use of `{}`", name));
err
Expand Down
Loading