Skip to content

Commit 61d1607

Browse files
committed
Auto merge of #62866 - pietroalbini:beta-rollup, r=Centril
[beta] Rollup backports Cherry picked: * rustc_target: avoid negative register counts in the SysV x86_64 ABI. #62380 * Fix ICEs when `Self` is used in type aliases #62417 * Raise the default recursion limit to 128 #62450 * Handle errors during error recovery gracefully #62604 * Correctly break out of recovery loop #62607 * Cancel unemitted diagnostics during error recovery #62666 * ci: pin awscli dependencies #62856 * Ensure that checkout is with \n line endings #62564 Rolled up: * [beta] Backport #62615 #62793 * [beta] Fix #62660 #62792 r? @ghost
2 parents 2ba6de7 + 1d5b47d commit 61d1607

Some content is hidden

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

41 files changed

+695
-71
lines changed

.azure-pipelines/steps/install-windows-build-deps.yml

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ steps:
99
displayName: "Ensure build happens on C:/ instead of D:/"
1010
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
1111

12+
- bash: git config --replace-all --global core.autocrlf false
13+
displayName: "Disable git automatic line ending conversion (on C:/)"
14+
1215
# Download and install MSYS2, needed primarily for the test suite (run-make) but
1316
# also used by the MinGW toolchain for assembling things.
1417
#

.azure-pipelines/steps/run.yml

+33-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ steps:
1212
# Azure's Windows image. Having the conversion enabled caused regressions both
1313
# in our test suite (it broke miri tests) and in the ecosystem, since we
1414
# started shipping install scripts with CRLF endings instead of the old LF.
15+
#
16+
# Note that we do this a couple times during the build as the PATH and current
17+
# user/directory change, e.g. when mingw is enabled.
1518
- bash: git config --global core.autocrlf false
1619
displayName: "Disable git automatic line ending conversion"
1720

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

76+
# Disable automatic line ending conversion (again). On Windows, when we're
77+
# installing dependencies, something switches the git configuration directory or
78+
# re-enables autocrlf. We've not tracked down the exact cause -- and there may
79+
# be multiple -- but this should ensure submodules are checked out with the
80+
# appropriate line endings.
81+
- bash: git config --replace-all --global core.autocrlf false
82+
displayName: "Disable git automatic line ending conversion"
83+
7384
# Check out all our submodules, but more quickly than using git by using one of
7485
# our custom scripts
7586
- bash: |
@@ -84,17 +95,37 @@ steps:
8495
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
8596
displayName: Check out submodules (Windows)
8697

98+
# See also the disable for autocrlf above, this just checks that it worked
99+
#
100+
# We check both in rust-lang/rust and in a submodule to make sure both are
101+
# accurate. Submodules are checked out significantly later than the main
102+
# repository in this script, so settings can (and do!) change between then.
103+
#
104+
# Linux (and maybe macOS) builders don't currently have dos2unix so just only
105+
# run this step on Windows.
106+
- bash: |
107+
set -x
108+
# print out the git configuration so we can better investigate failures in
109+
# the following
110+
git config --list --show-origin
111+
dos2unix -ih Cargo.lock src/tools/rust-installer/install-template.sh
112+
endings=$(dos2unix -ic Cargo.lock src/tools/rust-installer/install-template.sh)
113+
# if endings has non-zero length, error out
114+
if [ -n "$endings" ]; then exit 1 ; fi
115+
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
116+
displayName: Verify line endings are LF
117+
87118
# Ensure the `aws` CLI is installed so we can deploy later on, cache docker
88119
# images, etc.
89120
- bash: |
90121
set -e
91122
source src/ci/shared.sh
92123
sudo apt-get install -y python3-setuptools
93-
retry pip3 install awscli --upgrade --user
124+
retry pip3 install -r src/ci/awscli-requirements.txt --upgrade --user
94125
echo "##vso[task.prependpath]$HOME/.local/bin"
95126
displayName: Install awscli (Linux)
96127
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
97-
- script: pip install awscli
128+
- script: pip install -r src/ci/awscli-requirements.txt
98129
displayName: Install awscli (non-Linux)
99130
condition: and(succeeded(), ne(variables['Agent.OS'], 'Linux'))
100131

src/bootstrap/lib.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,11 @@ pub struct Compiler {
197197

198198
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
199199
pub enum DocTests {
200-
// Default, run normal tests and doc tests.
200+
/// Run normal tests and doc tests (default).
201201
Yes,
202-
// Do not run any doc tests.
202+
/// Do not run any doc tests.
203203
No,
204-
// Only run doc tests.
204+
/// Only run doc tests.
205205
Only,
206206
}
207207

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

227-
// Derived properties from the above two configurations
227+
// Properties derived from the above configuration
228228
src: PathBuf,
229229
out: PathBuf,
230230
rust_info: channel::GitInfo,
@@ -240,12 +240,12 @@ pub struct Build {
240240
doc_tests: DocTests,
241241
verbosity: usize,
242242

243-
// Targets for which to build.
243+
// Targets for which to build
244244
build: Interned<String>,
245245
hosts: Vec<Interned<String>>,
246246
targets: Vec<Interned<String>>,
247247

248-
// Stage 0 (downloaded) compiler and cargo or their local rust equivalents.
248+
// Stage 0 (downloaded) compiler and cargo or their local rust equivalents
249249
initial_rustc: PathBuf,
250250
initial_cargo: PathBuf,
251251

@@ -255,7 +255,7 @@ pub struct Build {
255255
cxx: HashMap<Interned<String>, cc::Tool>,
256256
ar: HashMap<Interned<String>, PathBuf>,
257257
ranlib: HashMap<Interned<String>, PathBuf>,
258-
// Misc
258+
// Miscellaneous
259259
crates: HashMap<Interned<String>, Crate>,
260260
is_sudo: bool,
261261
ci_env: CiEnv,

src/ci/awscli-requirements.txt

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
awscli==1.16.201
2+
botocore==1.12.191
3+
colorama==0.3.9
4+
docutils==0.14
5+
jmespath==0.9.4
6+
pyasn1==0.4.5
7+
python-dateutil==2.8.0
8+
PyYAML==5.1
9+
rsa==3.4.2
10+
s3transfer==0.2.1
11+
six==1.12.0
12+
urllib3==1.25.3
13+
futures==3.3.0; python_version < '3.0'

src/librustc/middle/recursion_limit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use syntax::symbol::{Symbol, sym};
1212
use rustc_data_structures::sync::Once;
1313

1414
pub fn update_limits(sess: &Session, krate: &ast::Crate) {
15-
update_limit(krate, &sess.recursion_limit, sym::recursion_limit, 64);
15+
update_limit(krate, &sess.recursion_limit, sym::recursion_limit, 128);
1616
update_limit(krate, &sess.type_length_limit, sym::type_length_limit, 1048576);
1717
}
1818

src/librustc/session/mod.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::lint;
99
use crate::lint::builtin::BuiltinLintDiagnostics;
1010
use crate::middle::allocator::AllocatorKind;
1111
use crate::middle::dependency_format;
12-
use crate::session::config::{OutputType, SwitchWithOptPath};
12+
use crate::session::config::{OutputType, PrintRequest, SwitchWithOptPath};
1313
use crate::session::search_paths::{PathKind, SearchPath};
1414
use crate::util::nodemap::{FxHashMap, FxHashSet};
1515
use crate::util::common::{duration_to_secs_str, ErrorReported};
@@ -1306,9 +1306,12 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
13061306
// an error to combine the two for now. It always runs into an assertions
13071307
// if LLVM is built with assertions, but without assertions it sometimes
13081308
// does not crash and will probably generate a corrupted binary.
1309+
// We should only display this error if we're actually going to run PGO.
1310+
// If we're just supposed to print out some data, don't show the error (#61002).
13091311
if sess.opts.cg.profile_generate.enabled() &&
13101312
sess.target.target.options.is_like_msvc &&
1311-
sess.panic_strategy() == PanicStrategy::Unwind {
1313+
sess.panic_strategy() == PanicStrategy::Unwind &&
1314+
sess.opts.prints.iter().all(|&p| p == PrintRequest::NativeStaticLibs) {
13121315
sess.err("Profile-guided optimization does not yet work in conjunction \
13131316
with `-Cpanic=unwind` on Windows when targeting MSVC. \
13141317
See https://github.com/rust-lang/rust/issues/61002 for details.");

src/librustc_resolve/lib.rs

+1-11
Original file line numberDiff line numberDiff line change
@@ -2519,17 +2519,7 @@ impl<'a> Resolver<'a> {
25192519
debug!("(resolving item) resolving {} ({:?})", name, item.node);
25202520

25212521
match item.node {
2522-
ItemKind::Ty(_, ref generics) => {
2523-
self.with_current_self_item(item, |this| {
2524-
this.with_generic_param_rib(HasGenericParams(generics, ItemRibKind), |this| {
2525-
let item_def_id = this.definitions.local_def_id(item.id);
2526-
this.with_self_rib(Res::SelfTy(Some(item_def_id), None), |this| {
2527-
visit::walk_item(this, item)
2528-
})
2529-
})
2530-
});
2531-
}
2532-
2522+
ItemKind::Ty(_, ref generics) |
25332523
ItemKind::Existential(_, ref generics) |
25342524
ItemKind::Fn(_, _, ref generics, _) => {
25352525
self.with_generic_param_rib(

src/librustc_target/abi/call/x86_64.rs

+24-9
Original file line numberDiff line numberDiff line change
@@ -167,29 +167,44 @@ fn cast_target(cls: &[Option<Class>], size: Size) -> CastTarget {
167167
target
168168
}
169169

170+
const MAX_INT_REGS: usize = 6; // RDI, RSI, RDX, RCX, R8, R9
171+
const MAX_SSE_REGS: usize = 8; // XMM0-7
172+
170173
pub fn compute_abi_info<'a, Ty, C>(cx: &C, fty: &mut FnType<'a, Ty>)
171174
where Ty: TyLayoutMethods<'a, C> + Copy,
172175
C: LayoutOf<Ty = Ty, TyLayout = TyLayout<'a, Ty>> + HasDataLayout
173176
{
174-
let mut int_regs = 6; // RDI, RSI, RDX, RCX, R8, R9
175-
let mut sse_regs = 8; // XMM0-7
177+
let mut int_regs = MAX_INT_REGS;
178+
let mut sse_regs = MAX_SSE_REGS;
176179

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

180-
let mut needed_int = 0;
181-
let mut needed_sse = 0;
182183
if is_arg {
183184
if let Ok(cls) = cls_or_mem {
185+
let mut needed_int = 0;
186+
let mut needed_sse = 0;
184187
for &c in &cls {
185188
match c {
186189
Some(Class::Int) => needed_int += 1,
187190
Some(Class::Sse) => needed_sse += 1,
188191
_ => {}
189192
}
190193
}
191-
if arg.layout.is_aggregate() && (int_regs < needed_int || sse_regs < needed_sse) {
192-
cls_or_mem = Err(Memory);
194+
match (int_regs.checked_sub(needed_int), sse_regs.checked_sub(needed_sse)) {
195+
(Some(left_int), Some(left_sse)) => {
196+
int_regs = left_int;
197+
sse_regs = left_sse;
198+
}
199+
_ => {
200+
// Not enough registers for this argument, so it will be
201+
// passed on the stack, but we only mark aggregates
202+
// explicitly as indirect `byval` arguments, as LLVM will
203+
// automatically put immediates on the stack itself.
204+
if arg.layout.is_aggregate() {
205+
cls_or_mem = Err(Memory);
206+
}
207+
}
193208
}
194209
}
195210
}
@@ -201,14 +216,14 @@ pub fn compute_abi_info<'a, Ty, C>(cx: &C, fty: &mut FnType<'a, Ty>)
201216
} else {
202217
// `sret` parameter thus one less integer register available
203218
arg.make_indirect();
219+
// NOTE(eddyb) return is handled first, so no registers
220+
// should've been used yet.
221+
assert_eq!(int_regs, MAX_INT_REGS);
204222
int_regs -= 1;
205223
}
206224
}
207225
Ok(ref cls) => {
208226
// split into sized chunks passed individually
209-
int_regs -= needed_int;
210-
sse_regs -= needed_sse;
211-
212227
if arg.layout.is_aggregate() {
213228
let size = arg.layout.size;
214229
arg.cast_to(cast_target(cls, size))

src/librustc_typeck/check/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4458,7 +4458,7 @@ pub fn check_bounds_are_used<'tcx>(tcx: TyCtxt<'tcx>, generics: &ty::Generics, t
44584458
return;
44594459
}
44604460

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

44644464
for leaf_ty in ty.walk() {
@@ -4467,7 +4467,7 @@ pub fn check_bounds_are_used<'tcx>(tcx: TyCtxt<'tcx>, generics: &ty::Generics, t
44674467
types_used[index as usize - own_counts.lifetimes] = true;
44684468
} else if let ty::Error = leaf_ty.sty {
44694469
// If there is already another error, do not emit
4470-
// an error for not using a type Parameter.
4470+
// an error for not using a type parameter.
44714471
assert!(tcx.sess.has_errors());
44724472
return;
44734473
}

src/libsyntax/parse/parser.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -1498,7 +1498,7 @@ impl<'a> Parser<'a> {
14981498
F: Fn(&token::Token) -> bool
14991499
{
15001500
let attrs = self.parse_arg_attributes()?;
1501-
if let Ok(Some(mut arg)) = self.parse_self_arg() {
1501+
if let Some(mut arg) = self.parse_self_arg()? {
15021502
arg.attrs = attrs.into();
15031503
return self.recover_bad_self_arg(arg, is_trait_item);
15041504
}
@@ -4675,6 +4675,9 @@ impl<'a> Parser<'a> {
46754675
fn parse_block_tail(&mut self, lo: Span, s: BlockCheckMode) -> PResult<'a, P<Block>> {
46764676
let mut stmts = vec![];
46774677
while !self.eat(&token::CloseDelim(token::Brace)) {
4678+
if self.token == token::Eof {
4679+
break;
4680+
}
46784681
let stmt = match self.parse_full_stmt(false) {
46794682
Err(mut err) => {
46804683
err.emit();
@@ -4689,8 +4692,6 @@ impl<'a> Parser<'a> {
46894692
};
46904693
if let Some(stmt) = stmt {
46914694
stmts.push(stmt);
4692-
} else if self.token == token::Eof {
4693-
break;
46944695
} else {
46954696
// Found only `;` or `}`.
46964697
continue;
@@ -7454,7 +7455,9 @@ impl<'a> Parser<'a> {
74547455
} else if self.look_ahead(1, |t| *t == token::OpenDelim(token::Paren)) {
74557456
let ident = self.parse_ident().unwrap();
74567457
self.bump(); // `(`
7457-
let kw_name = if let Ok(Some(_)) = self.parse_self_arg_with_attrs() {
7458+
let kw_name = if let Ok(Some(_)) = self.parse_self_arg_with_attrs()
7459+
.map_err(|mut e| e.cancel())
7460+
{
74587461
"method"
74597462
} else {
74607463
"function"
@@ -7505,7 +7508,9 @@ impl<'a> Parser<'a> {
75057508
self.eat_to_tokens(&[&token::Gt]);
75067509
self.bump(); // `>`
75077510
let (kw, kw_name, ambiguous) = if self.eat(&token::OpenDelim(token::Paren)) {
7508-
if let Ok(Some(_)) = self.parse_self_arg_with_attrs() {
7511+
if let Ok(Some(_)) = self.parse_self_arg_with_attrs()
7512+
.map_err(|mut e| e.cancel())
7513+
{
75097514
("fn", "method", false)
75107515
} else {
75117516
("fn", "function", false)

src/test/auxiliary/rust_test_helpers.c

+23
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,29 @@ uint64_t get_c_many_params(void *a, void *b, void *c, void *d, struct quad f) {
215215
return f.c;
216216
}
217217

218+
struct quad_floats {
219+
float a;
220+
float b;
221+
float c;
222+
float d;
223+
};
224+
225+
float get_c_exhaust_sysv64_ints(
226+
void *a,
227+
void *b,
228+
void *c,
229+
void *d,
230+
void *e,
231+
void *f,
232+
// `f` used the last integer register, so `g` goes on the stack.
233+
// It also used to bring the "count of available integer registers" down to
234+
// `-1` which broke the next SSE-only aggregate argument (`h`) - see #62350.
235+
void *g,
236+
struct quad_floats h
237+
) {
238+
return h.c;
239+
}
240+
218241
// Calculates the average of `(x + y) / n` where x: i64, y: f64. There must be exactly n pairs
219242
// passed as variadic arguments. There are two versions of this function: the
220243
// variadic one, and the one that takes a `va_list`.

0 commit comments

Comments
 (0)