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

[beta] Rollup backports #62866

Merged
merged 16 commits into from
Jul 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .azure-pipelines/steps/install-windows-build-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ steps:
displayName: "Ensure build happens on C:/ instead of D:/"
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))

- bash: git config --replace-all --global core.autocrlf false
displayName: "Disable git automatic line ending conversion (on C:/)"

# Download and install MSYS2, needed primarily for the test suite (run-make) but
# also used by the MinGW toolchain for assembling things.
#
Expand Down
35 changes: 33 additions & 2 deletions .azure-pipelines/steps/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ steps:
# Azure's Windows image. Having the conversion enabled caused regressions both
# in our test suite (it broke miri tests) and in the ecosystem, since we
# started shipping install scripts with CRLF endings instead of the old LF.
#
# Note that we do this a couple times during the build as the PATH and current
# user/directory change, e.g. when mingw is enabled.
- bash: git config --global core.autocrlf false
displayName: "Disable git automatic line ending conversion"

Expand Down Expand Up @@ -70,6 +73,14 @@ steps:
displayName: Enable IPv6
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))

# Disable automatic line ending conversion (again). On Windows, when we're
# installing dependencies, something switches the git configuration directory or
# re-enables autocrlf. We've not tracked down the exact cause -- and there may
# be multiple -- but this should ensure submodules are checked out with the
# appropriate line endings.
- bash: git config --replace-all --global core.autocrlf false
displayName: "Disable git automatic line ending conversion"

# Check out all our submodules, but more quickly than using git by using one of
# our custom scripts
- bash: |
Expand All @@ -84,17 +95,37 @@ steps:
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
displayName: Check out submodules (Windows)

# See also the disable for autocrlf above, this just checks that it worked
#
# We check both in rust-lang/rust and in a submodule to make sure both are
# accurate. Submodules are checked out significantly later than the main
# repository in this script, so settings can (and do!) change between then.
#
# Linux (and maybe macOS) builders don't currently have dos2unix so just only
# run this step on Windows.
- bash: |
set -x
# print out the git configuration so we can better investigate failures in
# the following
git config --list --show-origin
dos2unix -ih Cargo.lock src/tools/rust-installer/install-template.sh
endings=$(dos2unix -ic Cargo.lock src/tools/rust-installer/install-template.sh)
# if endings has non-zero length, error out
if [ -n "$endings" ]; then exit 1 ; fi
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
displayName: Verify line endings are LF

# Ensure the `aws` CLI is installed so we can deploy later on, cache docker
# images, etc.
- bash: |
set -e
source src/ci/shared.sh
sudo apt-get install -y python3-setuptools
retry pip3 install awscli --upgrade --user
retry pip3 install -r src/ci/awscli-requirements.txt --upgrade --user
echo "##vso[task.prependpath]$HOME/.local/bin"
displayName: Install awscli (Linux)
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
- script: pip install awscli
- script: pip install -r src/ci/awscli-requirements.txt
displayName: Install awscli (non-Linux)
condition: and(succeeded(), ne(variables['Agent.OS'], 'Linux'))

Expand Down
16 changes: 8 additions & 8 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ pub struct Compiler {

#[derive(PartialEq, Eq, Copy, Clone, Debug)]
pub enum DocTests {
// Default, run normal tests and doc tests.
/// Run normal tests and doc tests (default).
Yes,
// Do not run any doc tests.
/// Do not run any doc tests.
No,
// Only run doc tests.
/// Only run doc tests.
Only,
}

Expand All @@ -221,10 +221,10 @@ pub enum GitRepo {
/// methods specifically on this structure itself (to make it easier to
/// organize).
pub struct Build {
// User-specified configuration via config.toml
/// User-specified configuration from `config.toml`.
config: Config,

// Derived properties from the above two configurations
// Properties derived from the above configuration
src: PathBuf,
out: PathBuf,
rust_info: channel::GitInfo,
Expand All @@ -240,12 +240,12 @@ pub struct Build {
doc_tests: DocTests,
verbosity: usize,

// Targets for which to build.
// Targets for which to build
build: Interned<String>,
hosts: Vec<Interned<String>>,
targets: Vec<Interned<String>>,

// Stage 0 (downloaded) compiler and cargo or their local rust equivalents.
// Stage 0 (downloaded) compiler and cargo or their local rust equivalents
initial_rustc: PathBuf,
initial_cargo: PathBuf,

Expand All @@ -255,7 +255,7 @@ pub struct Build {
cxx: HashMap<Interned<String>, cc::Tool>,
ar: HashMap<Interned<String>, PathBuf>,
ranlib: HashMap<Interned<String>, PathBuf>,
// Misc
// Miscellaneous
crates: HashMap<Interned<String>, Crate>,
is_sudo: bool,
ci_env: CiEnv,
Expand Down
13 changes: 13 additions & 0 deletions src/ci/awscli-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
awscli==1.16.201
botocore==1.12.191
colorama==0.3.9
docutils==0.14
jmespath==0.9.4
pyasn1==0.4.5
python-dateutil==2.8.0
PyYAML==5.1
rsa==3.4.2
s3transfer==0.2.1
six==1.12.0
urllib3==1.25.3
futures==3.3.0; python_version < '3.0'
2 changes: 1 addition & 1 deletion src/librustc/middle/recursion_limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use syntax::symbol::{Symbol, sym};
use rustc_data_structures::sync::Once;

pub fn update_limits(sess: &Session, krate: &ast::Crate) {
update_limit(krate, &sess.recursion_limit, sym::recursion_limit, 64);
update_limit(krate, &sess.recursion_limit, sym::recursion_limit, 128);
update_limit(krate, &sess.type_length_limit, sym::type_length_limit, 1048576);
}

Expand Down
7 changes: 5 additions & 2 deletions src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::lint;
use crate::lint::builtin::BuiltinLintDiagnostics;
use crate::middle::allocator::AllocatorKind;
use crate::middle::dependency_format;
use crate::session::config::{OutputType, SwitchWithOptPath};
use crate::session::config::{OutputType, PrintRequest, SwitchWithOptPath};
use crate::session::search_paths::{PathKind, SearchPath};
use crate::util::nodemap::{FxHashMap, FxHashSet};
use crate::util::common::{duration_to_secs_str, ErrorReported};
Expand Down Expand Up @@ -1306,9 +1306,12 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
// an error to combine the two for now. It always runs into an assertions
// if LLVM is built with assertions, but without assertions it sometimes
// does not crash and will probably generate a corrupted binary.
// We should only display this error if we're actually going to run PGO.
// If we're just supposed to print out some data, don't show the error (#61002).
if sess.opts.cg.profile_generate.enabled() &&
sess.target.target.options.is_like_msvc &&
sess.panic_strategy() == PanicStrategy::Unwind {
sess.panic_strategy() == PanicStrategy::Unwind &&
sess.opts.prints.iter().all(|&p| p == PrintRequest::NativeStaticLibs) {
sess.err("Profile-guided optimization does not yet work in conjunction \
with `-Cpanic=unwind` on Windows when targeting MSVC. \
See https://github.com/rust-lang/rust/issues/61002 for details.");
Expand Down
12 changes: 1 addition & 11 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2519,17 +2519,7 @@ impl<'a> Resolver<'a> {
debug!("(resolving item) resolving {} ({:?})", name, item.node);

match item.node {
ItemKind::Ty(_, ref generics) => {
self.with_current_self_item(item, |this| {
this.with_generic_param_rib(HasGenericParams(generics, ItemRibKind), |this| {
let item_def_id = this.definitions.local_def_id(item.id);
this.with_self_rib(Res::SelfTy(Some(item_def_id), None), |this| {
visit::walk_item(this, item)
})
})
});
}

ItemKind::Ty(_, ref generics) |
ItemKind::Existential(_, ref generics) |
ItemKind::Fn(_, _, ref generics, _) => {
self.with_generic_param_rib(
Expand Down
33 changes: 24 additions & 9 deletions src/librustc_target/abi/call/x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,29 +167,44 @@ fn cast_target(cls: &[Option<Class>], size: Size) -> CastTarget {
target
}

const MAX_INT_REGS: usize = 6; // RDI, RSI, RDX, RCX, R8, R9
const MAX_SSE_REGS: usize = 8; // XMM0-7

pub fn compute_abi_info<'a, Ty, C>(cx: &C, fty: &mut FnType<'a, Ty>)
where Ty: TyLayoutMethods<'a, C> + Copy,
C: LayoutOf<Ty = Ty, TyLayout = TyLayout<'a, Ty>> + HasDataLayout
{
let mut int_regs = 6; // RDI, RSI, RDX, RCX, R8, R9
let mut sse_regs = 8; // XMM0-7
let mut int_regs = MAX_INT_REGS;
let mut sse_regs = MAX_SSE_REGS;

let mut x86_64_ty = |arg: &mut ArgType<'a, Ty>, is_arg: bool| {
let mut cls_or_mem = classify_arg(cx, arg);

let mut needed_int = 0;
let mut needed_sse = 0;
if is_arg {
if let Ok(cls) = cls_or_mem {
let mut needed_int = 0;
let mut needed_sse = 0;
for &c in &cls {
match c {
Some(Class::Int) => needed_int += 1,
Some(Class::Sse) => needed_sse += 1,
_ => {}
}
}
if arg.layout.is_aggregate() && (int_regs < needed_int || sse_regs < needed_sse) {
cls_or_mem = Err(Memory);
match (int_regs.checked_sub(needed_int), sse_regs.checked_sub(needed_sse)) {
(Some(left_int), Some(left_sse)) => {
int_regs = left_int;
sse_regs = left_sse;
}
_ => {
// Not enough registers for this argument, so it will be
// passed on the stack, but we only mark aggregates
// explicitly as indirect `byval` arguments, as LLVM will
// automatically put immediates on the stack itself.
if arg.layout.is_aggregate() {
cls_or_mem = Err(Memory);
}
}
}
}
}
Expand All @@ -201,14 +216,14 @@ pub fn compute_abi_info<'a, Ty, C>(cx: &C, fty: &mut FnType<'a, Ty>)
} else {
// `sret` parameter thus one less integer register available
arg.make_indirect();
// NOTE(eddyb) return is handled first, so no registers
// should've been used yet.
assert_eq!(int_regs, MAX_INT_REGS);
int_regs -= 1;
}
}
Ok(ref cls) => {
// split into sized chunks passed individually
int_regs -= needed_int;
sse_regs -= needed_sse;

if arg.layout.is_aggregate() {
let size = arg.layout.size;
arg.cast_to(cast_target(cls, size))
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4458,7 +4458,7 @@ pub fn check_bounds_are_used<'tcx>(tcx: TyCtxt<'tcx>, generics: &ty::Generics, t
return;
}

// Make a vector of booleans initially false, set to true when used.
// Make a vector of booleans initially `false`; set to `true` when used.
let mut types_used = vec![false; own_counts.types];

for leaf_ty in ty.walk() {
Expand All @@ -4467,7 +4467,7 @@ pub fn check_bounds_are_used<'tcx>(tcx: TyCtxt<'tcx>, generics: &ty::Generics, t
types_used[index as usize - own_counts.lifetimes] = true;
} else if let ty::Error = leaf_ty.sty {
// If there is already another error, do not emit
// an error for not using a type Parameter.
// an error for not using a type parameter.
assert!(tcx.sess.has_errors());
return;
}
Expand Down
15 changes: 10 additions & 5 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,7 @@ impl<'a> Parser<'a> {
F: Fn(&token::Token) -> bool
{
let attrs = self.parse_arg_attributes()?;
if let Ok(Some(mut arg)) = self.parse_self_arg() {
if let Some(mut arg) = self.parse_self_arg()? {
arg.attrs = attrs.into();
return self.recover_bad_self_arg(arg, is_trait_item);
}
Expand Down Expand Up @@ -4675,6 +4675,9 @@ impl<'a> Parser<'a> {
fn parse_block_tail(&mut self, lo: Span, s: BlockCheckMode) -> PResult<'a, P<Block>> {
let mut stmts = vec![];
while !self.eat(&token::CloseDelim(token::Brace)) {
if self.token == token::Eof {
break;
}
let stmt = match self.parse_full_stmt(false) {
Err(mut err) => {
err.emit();
Expand All @@ -4689,8 +4692,6 @@ impl<'a> Parser<'a> {
};
if let Some(stmt) = stmt {
stmts.push(stmt);
} else if self.token == token::Eof {
break;
} else {
// Found only `;` or `}`.
continue;
Expand Down Expand Up @@ -7454,7 +7455,9 @@ impl<'a> Parser<'a> {
} else if self.look_ahead(1, |t| *t == token::OpenDelim(token::Paren)) {
let ident = self.parse_ident().unwrap();
self.bump(); // `(`
let kw_name = if let Ok(Some(_)) = self.parse_self_arg_with_attrs() {
let kw_name = if let Ok(Some(_)) = self.parse_self_arg_with_attrs()
.map_err(|mut e| e.cancel())
{
"method"
} else {
"function"
Expand Down Expand Up @@ -7505,7 +7508,9 @@ impl<'a> Parser<'a> {
self.eat_to_tokens(&[&token::Gt]);
self.bump(); // `>`
let (kw, kw_name, ambiguous) = if self.eat(&token::OpenDelim(token::Paren)) {
if let Ok(Some(_)) = self.parse_self_arg_with_attrs() {
if let Ok(Some(_)) = self.parse_self_arg_with_attrs()
.map_err(|mut e| e.cancel())
{
("fn", "method", false)
} else {
("fn", "function", false)
Expand Down
23 changes: 23 additions & 0 deletions src/test/auxiliary/rust_test_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,29 @@ uint64_t get_c_many_params(void *a, void *b, void *c, void *d, struct quad f) {
return f.c;
}

struct quad_floats {
float a;
float b;
float c;
float d;
};

float get_c_exhaust_sysv64_ints(
void *a,
void *b,
void *c,
void *d,
void *e,
void *f,
// `f` used the last integer register, so `g` goes on the stack.
// It also used to bring the "count of available integer registers" down to
// `-1` which broke the next SSE-only aggregate argument (`h`) - see #62350.
void *g,
struct quad_floats h
) {
return h.c;
}

// Calculates the average of `(x + y) / n` where x: i64, y: f64. There must be exactly n pairs
// passed as variadic arguments. There are two versions of this function: the
// variadic one, and the one that takes a `va_list`.
Expand Down
Loading