Skip to content

Commit d95d4f0

Browse files
committed
Auto merge of #81678 - jackh726:rollup-3nerni4, r=jackh726
Rollup of 14 pull requests Successful merges: - #80593 (Upgrade Chalk) - #81260 (Add .editorconfig) - #81455 (Add AArch64 big-endian and ILP32 targets) - #81517 (Remove remnants of the santizer runtime crates from bootstrap) - #81530 (sys: use `process::abort()` instead of `arch::wasm32::unreachable()`) - #81544 (Add better diagnostic for unbounded Abst. Const) - #81588 (Add doc aliases for "delete") - #81603 (rustbuild: Don't build compiler twice for error-index-generator.) - #81634 (Add long explanation e0521) - #81636 (Directly use `Option<&[T]>` instead of converting from `Option<&Vec<T>>` later on) - #81647 (Fix bug with assert!() calling the wrong edition of panic!().) - #81655 (Improve wording of suggestion about accessing field) - #81665 (Fix out of date `Scalar` documentation) - #81671 (Add more associated type tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 3682750 + 81c64b3 commit d95d4f0

File tree

79 files changed

+645
-202
lines changed

Some content is hidden

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

79 files changed

+645
-202
lines changed

.editorconfig

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
end_of_line = lf
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
indent_style = space
13+
indent_size = 4
14+
15+
[*.md]
16+
# double whitespace at end of line
17+
# denotes a line break in Markdown
18+
trim_trailing_whitespace = false
19+
20+
[*.yml]
21+
indent_size = 2

Cargo.lock

+12-10
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
496496

497497
[[package]]
498498
name = "chalk-derive"
499-
version = "0.36.0"
499+
version = "0.55.0"
500500
source = "registry+https://github.com/rust-lang/crates.io-index"
501-
checksum = "9f88ce4deae1dace71e49b7611cfae2d5489de3530d6daba5758043c47ac3a10"
501+
checksum = "3983193cacd81f0f924acb666b7fe5e1a0d81db9f113fa69203eda7ea8ce8b6c"
502502
dependencies = [
503503
"proc-macro2",
504504
"quote",
@@ -508,9 +508,9 @@ dependencies = [
508508

509509
[[package]]
510510
name = "chalk-engine"
511-
version = "0.36.0"
511+
version = "0.55.0"
512512
source = "registry+https://github.com/rust-lang/crates.io-index"
513-
checksum = "0e34c9b1b10616782143d7f49490f91ae94afaf2202de3ab0b2835e78b4f0ccc"
513+
checksum = "05a171ce5abbf0fbd06f221ab80ab182c7ef78603d23b858bc44e7ce8a86a396"
514514
dependencies = [
515515
"chalk-derive",
516516
"chalk-ir",
@@ -521,19 +521,20 @@ dependencies = [
521521

522522
[[package]]
523523
name = "chalk-ir"
524-
version = "0.36.0"
524+
version = "0.55.0"
525525
source = "registry+https://github.com/rust-lang/crates.io-index"
526-
checksum = "63362c629c2014ab639b04029070763fb8224df136d1363d30e9ece4c8877da3"
526+
checksum = "a522f53af971e7678f472d687e053120157b3ae26e2ebd5ecbc0f5ab124f2cb6"
527527
dependencies = [
528+
"bitflags",
528529
"chalk-derive",
529530
"lazy_static",
530531
]
531532

532533
[[package]]
533534
name = "chalk-solve"
534-
version = "0.36.0"
535+
version = "0.55.0"
535536
source = "registry+https://github.com/rust-lang/crates.io-index"
536-
checksum = "cac338a67af52a7f50bb2f8232e730a3518ce432dbe303246acfe525ddd838c7"
537+
checksum = "cdf79fb77a567e456a170f7ec84ea6584163d4ba3f13660cd182013d34ca667c"
537538
dependencies = [
538539
"chalk-derive",
539540
"chalk-ir",
@@ -1783,9 +1784,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
17831784

17841785
[[package]]
17851786
name = "libc"
1786-
version = "0.2.79"
1787+
version = "0.2.85"
17871788
source = "registry+https://github.com/rust-lang/crates.io-index"
1788-
checksum = "2448f6066e80e3bfc792e9c98bf705b4b0fc6e8ef5b43e5889aff0eaa9c58743"
1789+
checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3"
17891790
dependencies = [
17901791
"rustc-std-workspace-core",
17911792
]
@@ -4313,6 +4314,7 @@ dependencies = [
43134314
"chalk-ir",
43144315
"chalk-solve",
43154316
"rustc_ast",
4317+
"rustc_attr",
43164318
"rustc_data_structures",
43174319
"rustc_hir",
43184320
"rustc_index",

compiler/rustc_builtin_macros/src/assert.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ pub fn expand_assert<'cx>(
2929

3030
let panic_call = if let Some(tokens) = custom_message {
3131
let path = if span.rust_2021() {
32-
// On edition 2021, we always call `$crate::panic!()`.
32+
// On edition 2021, we always call `$crate::panic::panic_2021!()`.
3333
Path {
3434
span: sp,
3535
segments: cx
36-
.std_path(&[sym::panic])
36+
.std_path(&[sym::panic, sym::panic_2021])
3737
.into_iter()
3838
.map(|ident| PathSegment::from_ident(ident))
3939
.collect(),

compiler/rustc_codegen_llvm/src/va_arg.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ fn emit_aapcs_va_arg(
105105
let mut end = bx.build_sibling_block("va_arg.end");
106106
let zero = bx.const_i32(0);
107107
let offset_align = Align::from_bytes(4).unwrap();
108-
assert_eq!(bx.tcx().sess.target.endian, Endian::Little);
109108

110109
let gr_type = target_ty.is_any_ptr() || target_ty.is_integral();
111110
let (reg_off, reg_top_index, slot_size) = if gr_type {
@@ -144,9 +143,14 @@ fn emit_aapcs_va_arg(
144143
let top = in_reg.load(top, bx.tcx().data_layout.pointer_align.abi);
145144

146145
// reg_value = *(@top + reg_off_v);
147-
let top = in_reg.gep(top, &[reg_off_v]);
148-
let top = in_reg.bitcast(top, bx.cx.type_ptr_to(layout.llvm_type(bx)));
149-
let reg_value = in_reg.load(top, layout.align.abi);
146+
let mut reg_addr = in_reg.gep(top, &[reg_off_v]);
147+
if bx.tcx().sess.target.endian == Endian::Big && layout.size.bytes() != slot_size {
148+
// On big-endian systems the value is right-aligned in its slot.
149+
let offset = bx.const_i32((slot_size - layout.size.bytes()) as i32);
150+
reg_addr = in_reg.gep(reg_addr, &[offset]);
151+
}
152+
let reg_addr = in_reg.bitcast(reg_addr, bx.cx.type_ptr_to(layout.llvm_type(bx)));
153+
let reg_value = in_reg.load(reg_addr, layout.align.abi);
150154
in_reg.br(&end.llbb());
151155

152156
// On Stack block

compiler/rustc_error_codes/src/error_codes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ E0516: include_str!("./error_codes/E0516.md"),
267267
E0517: include_str!("./error_codes/E0517.md"),
268268
E0518: include_str!("./error_codes/E0518.md"),
269269
E0520: include_str!("./error_codes/E0520.md"),
270+
E0521: include_str!("./error_codes/E0521.md"),
270271
E0522: include_str!("./error_codes/E0522.md"),
271272
E0524: include_str!("./error_codes/E0524.md"),
272273
E0525: include_str!("./error_codes/E0525.md"),
@@ -597,7 +598,6 @@ E0780: include_str!("./error_codes/E0780.md"),
597598
E0514, // metadata version mismatch
598599
E0519, // local crate and dependency have same (crate-name, disambiguator)
599600
// two dependencies have same (crate-name, disambiguator) but different SVH
600-
E0521, // borrowed data escapes outside of closure
601601
E0523,
602602
// E0526, // shuffle indices are not constant
603603
// E0540, // multiple rustc_deprecated attributes
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Borrowed data escapes outside of closure.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,E0521
6+
let mut list: Vec<&str> = Vec::new();
7+
8+
let _add = |el: &str| {
9+
list.push(el); // error: `el` escapes the closure body here
10+
};
11+
```
12+
13+
A type anotation of a closure parameter implies a new lifetime declaration.
14+
Consider to drop it, the compiler is reliably able to infer them.
15+
16+
```
17+
let mut list: Vec<&str> = Vec::new();
18+
19+
let _add = |el| {
20+
list.push(el);
21+
};
22+
```
23+
24+
See the [Closure type inference and annotation][closure-infere-annotation] and
25+
[Lifetime elision][lifetime-elision] sections of the Book for more details.
26+
27+
[closure-infere-annotation]: https://doc.rust-lang.org/book/ch13-01-closures.html#closure-type-inference-and-annotation
28+
[lifetime-elision]: https://doc.rust-lang.org/reference/lifetime-elision.html

compiler/rustc_infer/src/infer/canonical/canonicalizer.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,8 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
353353
// `TyVar(vid)` is unresolved, track its universe index in the canonicalized
354354
// result.
355355
Err(mut ui) => {
356-
if !self.infcx.unwrap().tcx.sess.opts.debugging_opts.chalk {
357-
// FIXME: perf problem described in #55921.
358-
ui = ty::UniverseIndex::ROOT;
359-
}
356+
// FIXME: perf problem described in #55921.
357+
ui = ty::UniverseIndex::ROOT;
360358
self.canonicalize_ty_var(
361359
CanonicalVarInfo {
362360
kind: CanonicalVarKind::Ty(CanonicalTyVarKind::General(ui)),
@@ -440,10 +438,8 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
440438
// `ConstVar(vid)` is unresolved, track its universe index in the
441439
// canonicalized result
442440
Err(mut ui) => {
443-
if !self.infcx.unwrap().tcx.sess.opts.debugging_opts.chalk {
444-
// FIXME: perf problem described in #55921.
445-
ui = ty::UniverseIndex::ROOT;
446-
}
441+
// FIXME: perf problem described in #55921.
442+
ui = ty::UniverseIndex::ROOT;
447443
return self.canonicalize_const_var(
448444
CanonicalVarInfo { kind: CanonicalVarKind::Const(ui) },
449445
ct,

compiler/rustc_infer/src/infer/error_reporting/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1855,7 +1855,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
18551855
diag.span_suggestion(
18561856
span,
18571857
&format!(
1858-
"you might have meant to use field `{}` of type `{}`",
1858+
"you might have meant to use field `{}` whose type is `{}`",
18591859
name, ty
18601860
),
18611861
suggestion,

compiler/rustc_middle/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ rustc_index = { path = "../rustc_index" }
2626
rustc_serialize = { path = "../rustc_serialize" }
2727
rustc_ast = { path = "../rustc_ast" }
2828
rustc_span = { path = "../rustc_span" }
29-
chalk-ir = "0.36.0"
29+
chalk-ir = "0.55.0"
3030
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
3131
measureme = "9.0.0"
3232
rustc_session = { path = "../rustc_session" }

compiler/rustc_middle/src/mir/interpret/value.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl<'tcx> ConstValue<'tcx> {
9696
}
9797

9898
/// A `Scalar` represents an immediate, primitive value existing outside of a
99-
/// `memory::Allocation`. It is in many ways like a small chunk of a `Allocation`, up to 8 bytes in
99+
/// `memory::Allocation`. It is in many ways like a small chunk of a `Allocation`, up to 16 bytes in
100100
/// size. Like a range of bytes in an `Allocation`, a `Scalar` can either represent the raw bytes
101101
/// of a simple value or a pointer into another `Allocation`
102102
#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, TyEncodable, TyDecodable, Hash)]

compiler/rustc_middle/src/traits/chalk.rs

+36-4
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
7272
type InternedQuantifiedWhereClauses = Vec<chalk_ir::QuantifiedWhereClause<Self>>;
7373
type InternedVariableKinds = Vec<chalk_ir::VariableKind<Self>>;
7474
type InternedCanonicalVarKinds = Vec<chalk_ir::CanonicalVarKind<Self>>;
75+
type InternedVariances = Vec<chalk_ir::Variance>;
7576
type InternedConstraints = Vec<chalk_ir::InEnvironment<chalk_ir::Constraint<Self>>>;
7677
type DefId = DefId;
7778
type InternedAdtId = &'tcx AdtDef;
@@ -86,17 +87,34 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
8687
write!(fmt, "{:?}", pci.consequence)?;
8788

8889
let conditions = pci.conditions.interned();
90+
let constraints = pci.constraints.interned();
8991

9092
let conds = conditions.len();
91-
if conds == 0 {
93+
let consts = constraints.len();
94+
if conds == 0 && consts == 0 {
9295
return Ok(());
9396
}
9497

9598
write!(fmt, " :- ")?;
96-
for cond in &conditions[..conds - 1] {
97-
write!(fmt, "{:?}, ", cond)?;
99+
100+
if conds != 0 {
101+
for cond in &conditions[..conds - 1] {
102+
write!(fmt, "{:?}, ", cond)?;
103+
}
104+
write!(fmt, "{:?}", conditions[conds - 1])?;
105+
}
106+
107+
if conds != 0 && consts != 0 {
108+
write!(fmt, " ; ")?;
98109
}
99-
write!(fmt, "{:?}", conditions[conds - 1])?;
110+
111+
if consts != 0 {
112+
for constraint in &constraints[..consts - 1] {
113+
write!(fmt, "{:?}, ", constraint)?;
114+
}
115+
write!(fmt, "{:?}", constraints[consts - 1])?;
116+
}
117+
100118
Ok(())
101119
};
102120
Some(write())
@@ -351,6 +369,20 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
351369
) -> &'a [chalk_ir::InEnvironment<chalk_ir::Constraint<Self>>] {
352370
constraints
353371
}
372+
373+
fn intern_variances<E>(
374+
&self,
375+
data: impl IntoIterator<Item = Result<chalk_ir::Variance, E>>,
376+
) -> Result<Self::InternedVariances, E> {
377+
data.into_iter().collect::<Result<Vec<_>, _>>()
378+
}
379+
380+
fn variances_data<'a>(
381+
&self,
382+
variances: &'a Self::InternedVariances,
383+
) -> &'a [chalk_ir::Variance] {
384+
variances
385+
}
354386
}
355387

356388
impl<'tcx> chalk_ir::interner::HasInterner for RustInterner<'tcx> {

compiler/rustc_resolve/src/late/lifetimes.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2415,7 +2415,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
24152415
_ => break,
24162416
}
24172417
}
2418-
break Some(e);
2418+
break Some(&e[..]);
24192419
}
24202420
Elide::Forbid => break None,
24212421
};
@@ -2445,7 +2445,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
24452445
lifetime_refs.len(),
24462446
&lifetime_names,
24472447
lifetime_spans,
2448-
error.map(|p| &p[..]).unwrap_or(&[]),
2448+
error.unwrap_or(&[]),
24492449
);
24502450
err.emit();
24512451
}

compiler/rustc_target/src/abi/call/aarch64.rs

+2-22
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,7 @@ where
4040
let size = ret.layout.size;
4141
let bits = size.bits();
4242
if bits <= 128 {
43-
let unit = if bits <= 8 {
44-
Reg::i8()
45-
} else if bits <= 16 {
46-
Reg::i16()
47-
} else if bits <= 32 {
48-
Reg::i32()
49-
} else {
50-
Reg::i64()
51-
};
52-
53-
ret.cast_to(Uniform { unit, total: size });
43+
ret.cast_to(Uniform { unit: Reg::i64(), total: size });
5444
return;
5545
}
5646
ret.make_indirect();
@@ -72,17 +62,7 @@ where
7262
let size = arg.layout.size;
7363
let bits = size.bits();
7464
if bits <= 128 {
75-
let unit = if bits <= 8 {
76-
Reg::i8()
77-
} else if bits <= 16 {
78-
Reg::i16()
79-
} else if bits <= 32 {
80-
Reg::i32()
81-
} else {
82-
Reg::i64()
83-
};
84-
85-
arg.cast_to(Uniform { unit, total: size });
65+
arg.cast_to(Uniform { unit: Reg::i64(), total: size });
8666
return;
8767
}
8868
arg.make_indirect();

compiler/rustc_target/src/abi/call/arm.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,7 @@ where
4545
let size = ret.layout.size;
4646
let bits = size.bits();
4747
if bits <= 32 {
48-
let unit = if bits <= 8 {
49-
Reg::i8()
50-
} else if bits <= 16 {
51-
Reg::i16()
52-
} else {
53-
Reg::i32()
54-
};
55-
ret.cast_to(Uniform { unit, total: size });
48+
ret.cast_to(Uniform { unit: Reg::i32(), total: size });
5649
return;
5750
}
5851
ret.make_indirect();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
use crate::abi::Endian;
2+
use crate::spec::{Target, TargetOptions};
3+
4+
pub fn target() -> Target {
5+
let mut base = super::linux_gnu_base::opts();
6+
base.max_atomic_width = Some(128);
7+
8+
Target {
9+
llvm_target: "aarch64_be-unknown-linux-gnu".to_string(),
10+
pointer_width: 64,
11+
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
12+
arch: "aarch64".to_string(),
13+
options: TargetOptions {
14+
unsupported_abis: super::arm_base::unsupported_abis(),
15+
mcount: "\u{1}_mcount".to_string(),
16+
endian: Endian::Big,
17+
..base
18+
},
19+
}
20+
}

0 commit comments

Comments
 (0)