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 14 pull requests #81678

Merged
merged 40 commits into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
8afe598
Add big-endian support for AArch64 va_arg
Jan 20, 2021
d53b0a0
Fix ARM and AArch64 calling convention for passing small composite types
Jan 20, 2021
06f14df
Support AArch64 ILP32 in libunwind bindings
Jan 20, 2021
a112c4d
Support AArch64 big-endian and ILP32 in compiletest
Jan 20, 2021
8783d1a
Add big-endian and ILP32 AArch64 targets
Jan 20, 2021
69e6326
Add new aarch64 targets to platform-support.md
Jan 26, 2021
5307230
Bump LLVM submodule
Jan 21, 2021
99eeb13
Remove remnants of the santizer runtime crates from bootstrap
tmiasko Jan 29, 2021
c7f4154
sys: use `process::abort()` instead of `arch::wasm32::unreachable()`
ojeda Jan 29, 2021
15701f7
Add doc aliases for "delete"
KamilaBorowska Jan 31, 2021
071d227
rustbuild: Don't build compiler twice for error-index-generator.
ehuss Jan 31, 2021
4b64bc1
Upgrade Chalk
jackh726 Jan 1, 2021
ee5ea24
Add long error explanation for E0521
jesusprubio Feb 1, 2021
9ef24f9
Update ui tests
jesusprubio Feb 1, 2021
b35d601
Directly use `Option<&[T]>` instead of converting from `Option<&Vec<T…
LingMan Feb 1, 2021
5022ad0
Add UI test for panic/assert in Rust 2021.
m-ou-se Feb 1, 2021
ed1de99
Fix bug with assert!() calling the wrong edition of panic!().
m-ou-se Feb 1, 2021
c3dedd0
Upgrade libc to 0.2.85
Jan 21, 2021
3408c58
Fix AArch64 types in std::os::raw
Amanieu Feb 1, 2021
bad0f28
Improve wording of suggestion about accessing field
hkmatsumoto Feb 2, 2021
07c4eeb
Fix out of date `Scalar` documentation
jacob-hughes Feb 2, 2021
6525671
Add better diagnostic for missing where clause
JulianKnodt Jan 30, 2021
ae3164e
Add .editorconfig
vn971 Jan 22, 2021
a0622d6
Update Chalk
jackh726 Jan 31, 2021
c57889b
Update ui tests (nll)
jesusprubio Feb 2, 2021
f0a3de6
More associated type tests
jackh726 Feb 2, 2021
c1623a2
Rollup merge of #80593 - jackh726:chalk-upgrade, r=nikomatsakis
jackh726 Feb 2, 2021
d91ce83
Rollup merge of #81260 - vn971:restore-editorconfig, r=Mark-Simulacrum
jackh726 Feb 2, 2021
399c0a8
Rollup merge of #81455 - Amanieu:aarch64_ilp32, r=sanxiyn
jackh726 Feb 2, 2021
71792d8
Rollup merge of #81517 - tmiasko:san-crates, r=Mark-Simulacrum
jackh726 Feb 2, 2021
76be6bb
Rollup merge of #81530 - ojeda:sys-use-abort-instead-of-wasm32-unreac…
jackh726 Feb 2, 2021
3aed8b1
Rollup merge of #81544 - JulianKnodt:sat_where, r=lcnr
jackh726 Feb 2, 2021
d3304c8
Rollup merge of #81588 - xfix:delete-doc-alias, r=Mark-Simulacrum
jackh726 Feb 2, 2021
3b9d77c
Rollup merge of #81603 - ehuss:error-index-build, r=Mark-Simulacrum
jackh726 Feb 2, 2021
fd4f4ad
Rollup merge of #81634 - jesusprubio:jesusprubio/add-long-explanation…
jackh726 Feb 2, 2021
86e23cc
Rollup merge of #81636 - LingMan:slice_not_vec, r=petrochenkov
jackh726 Feb 2, 2021
7f2eeb1
Rollup merge of #81647 - m-ou-se:assert-2021-fix, r=petrochenkov
jackh726 Feb 2, 2021
7edb3ad
Rollup merge of #81655 - matsujika:suggest-accessing-field-rewording,…
jackh726 Feb 2, 2021
70d16d5
Rollup merge of #81665 - jacob-hughes:mir_doc_fix, r=estebank
jackh726 Feb 2, 2021
81c64b3
Rollup merge of #81671 - jackh726:atb-tests, r=estebank
jackh726 Feb 2, 2021
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
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4

[*.md]
# double whitespace at end of line
# denotes a line break in Markdown
trim_trailing_whitespace = false

[*.yml]
indent_size = 2
22 changes: 12 additions & 10 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -496,9 +496,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"

[[package]]
name = "chalk-derive"
version = "0.36.0"
version = "0.55.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f88ce4deae1dace71e49b7611cfae2d5489de3530d6daba5758043c47ac3a10"
checksum = "3983193cacd81f0f924acb666b7fe5e1a0d81db9f113fa69203eda7ea8ce8b6c"
dependencies = [
"proc-macro2",
"quote",
Expand All @@ -508,9 +508,9 @@ dependencies = [

[[package]]
name = "chalk-engine"
version = "0.36.0"
version = "0.55.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e34c9b1b10616782143d7f49490f91ae94afaf2202de3ab0b2835e78b4f0ccc"
checksum = "05a171ce5abbf0fbd06f221ab80ab182c7ef78603d23b858bc44e7ce8a86a396"
dependencies = [
"chalk-derive",
"chalk-ir",
Expand All @@ -521,19 +521,20 @@ dependencies = [

[[package]]
name = "chalk-ir"
version = "0.36.0"
version = "0.55.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63362c629c2014ab639b04029070763fb8224df136d1363d30e9ece4c8877da3"
checksum = "a522f53af971e7678f472d687e053120157b3ae26e2ebd5ecbc0f5ab124f2cb6"
dependencies = [
"bitflags",
"chalk-derive",
"lazy_static",
]

[[package]]
name = "chalk-solve"
version = "0.36.0"
version = "0.55.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cac338a67af52a7f50bb2f8232e730a3518ce432dbe303246acfe525ddd838c7"
checksum = "cdf79fb77a567e456a170f7ec84ea6584163d4ba3f13660cd182013d34ca667c"
dependencies = [
"chalk-derive",
"chalk-ir",
Expand Down Expand Up @@ -1783,9 +1784,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"

[[package]]
name = "libc"
version = "0.2.79"
version = "0.2.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2448f6066e80e3bfc792e9c98bf705b4b0fc6e8ef5b43e5889aff0eaa9c58743"
checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3"
dependencies = [
"rustc-std-workspace-core",
]
Expand Down Expand Up @@ -4313,6 +4314,7 @@ dependencies = [
"chalk-ir",
"chalk-solve",
"rustc_ast",
"rustc_attr",
"rustc_data_structures",
"rustc_hir",
"rustc_index",
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_builtin_macros/src/assert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ pub fn expand_assert<'cx>(

let panic_call = if let Some(tokens) = custom_message {
let path = if span.rust_2021() {
// On edition 2021, we always call `$crate::panic!()`.
// On edition 2021, we always call `$crate::panic::panic_2021!()`.
Path {
span: sp,
segments: cx
.std_path(&[sym::panic])
.std_path(&[sym::panic, sym::panic_2021])
.into_iter()
.map(|ident| PathSegment::from_ident(ident))
.collect(),
Expand Down
12 changes: 8 additions & 4 deletions compiler/rustc_codegen_llvm/src/va_arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ fn emit_aapcs_va_arg(
let mut end = bx.build_sibling_block("va_arg.end");
let zero = bx.const_i32(0);
let offset_align = Align::from_bytes(4).unwrap();
assert_eq!(bx.tcx().sess.target.endian, Endian::Little);

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

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

// On Stack block
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_error_codes/src/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ E0516: include_str!("./error_codes/E0516.md"),
E0517: include_str!("./error_codes/E0517.md"),
E0518: include_str!("./error_codes/E0518.md"),
E0520: include_str!("./error_codes/E0520.md"),
E0521: include_str!("./error_codes/E0521.md"),
E0522: include_str!("./error_codes/E0522.md"),
E0524: include_str!("./error_codes/E0524.md"),
E0525: include_str!("./error_codes/E0525.md"),
Expand Down Expand Up @@ -597,7 +598,6 @@ E0780: include_str!("./error_codes/E0780.md"),
E0514, // metadata version mismatch
E0519, // local crate and dependency have same (crate-name, disambiguator)
// two dependencies have same (crate-name, disambiguator) but different SVH
E0521, // borrowed data escapes outside of closure
E0523,
// E0526, // shuffle indices are not constant
// E0540, // multiple rustc_deprecated attributes
Expand Down
28 changes: 28 additions & 0 deletions compiler/rustc_error_codes/src/error_codes/E0521.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Borrowed data escapes outside of closure.

Erroneous code example:

```compile_fail,E0521
let mut list: Vec<&str> = Vec::new();

let _add = |el: &str| {
list.push(el); // error: `el` escapes the closure body here
};
```

A type anotation of a closure parameter implies a new lifetime declaration.
Consider to drop it, the compiler is reliably able to infer them.

```
let mut list: Vec<&str> = Vec::new();

let _add = |el| {
list.push(el);
};
```

See the [Closure type inference and annotation][closure-infere-annotation] and
[Lifetime elision][lifetime-elision] sections of the Book for more details.

[closure-infere-annotation]: https://doc.rust-lang.org/book/ch13-01-closures.html#closure-type-inference-and-annotation
[lifetime-elision]: https://doc.rust-lang.org/reference/lifetime-elision.html
12 changes: 4 additions & 8 deletions compiler/rustc_infer/src/infer/canonical/canonicalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,8 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
// `TyVar(vid)` is unresolved, track its universe index in the canonicalized
// result.
Err(mut ui) => {
if !self.infcx.unwrap().tcx.sess.opts.debugging_opts.chalk {
// FIXME: perf problem described in #55921.
ui = ty::UniverseIndex::ROOT;
}
// FIXME: perf problem described in #55921.
ui = ty::UniverseIndex::ROOT;
self.canonicalize_ty_var(
CanonicalVarInfo {
kind: CanonicalVarKind::Ty(CanonicalTyVarKind::General(ui)),
Expand Down Expand Up @@ -440,10 +438,8 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
// `ConstVar(vid)` is unresolved, track its universe index in the
// canonicalized result
Err(mut ui) => {
if !self.infcx.unwrap().tcx.sess.opts.debugging_opts.chalk {
// FIXME: perf problem described in #55921.
ui = ty::UniverseIndex::ROOT;
}
// FIXME: perf problem described in #55921.
ui = ty::UniverseIndex::ROOT;
return self.canonicalize_const_var(
CanonicalVarInfo { kind: CanonicalVarKind::Const(ui) },
ct,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1855,7 +1855,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
diag.span_suggestion(
span,
&format!(
"you might have meant to use field `{}` of type `{}`",
"you might have meant to use field `{}` whose type is `{}`",
name, ty
),
suggestion,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ rustc_index = { path = "../rustc_index" }
rustc_serialize = { path = "../rustc_serialize" }
rustc_ast = { path = "../rustc_ast" }
rustc_span = { path = "../rustc_span" }
chalk-ir = "0.36.0"
chalk-ir = "0.55.0"
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
measureme = "9.0.0"
rustc_session = { path = "../rustc_session" }
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/mir/interpret/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl<'tcx> ConstValue<'tcx> {
}

/// A `Scalar` represents an immediate, primitive value existing outside of a
/// `memory::Allocation`. It is in many ways like a small chunk of a `Allocation`, up to 8 bytes in
/// `memory::Allocation`. It is in many ways like a small chunk of a `Allocation`, up to 16 bytes in
/// size. Like a range of bytes in an `Allocation`, a `Scalar` can either represent the raw bytes
/// of a simple value or a pointer into another `Allocation`
#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, TyEncodable, TyDecodable, Hash)]
Expand Down
40 changes: 36 additions & 4 deletions compiler/rustc_middle/src/traits/chalk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
type InternedQuantifiedWhereClauses = Vec<chalk_ir::QuantifiedWhereClause<Self>>;
type InternedVariableKinds = Vec<chalk_ir::VariableKind<Self>>;
type InternedCanonicalVarKinds = Vec<chalk_ir::CanonicalVarKind<Self>>;
type InternedVariances = Vec<chalk_ir::Variance>;
type InternedConstraints = Vec<chalk_ir::InEnvironment<chalk_ir::Constraint<Self>>>;
type DefId = DefId;
type InternedAdtId = &'tcx AdtDef;
Expand All @@ -86,17 +87,34 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
write!(fmt, "{:?}", pci.consequence)?;

let conditions = pci.conditions.interned();
let constraints = pci.constraints.interned();

let conds = conditions.len();
if conds == 0 {
let consts = constraints.len();
if conds == 0 && consts == 0 {
return Ok(());
}

write!(fmt, " :- ")?;
for cond in &conditions[..conds - 1] {
write!(fmt, "{:?}, ", cond)?;

if conds != 0 {
for cond in &conditions[..conds - 1] {
write!(fmt, "{:?}, ", cond)?;
}
write!(fmt, "{:?}", conditions[conds - 1])?;
}

if conds != 0 && consts != 0 {
write!(fmt, " ; ")?;
}
write!(fmt, "{:?}", conditions[conds - 1])?;

if consts != 0 {
for constraint in &constraints[..consts - 1] {
write!(fmt, "{:?}, ", constraint)?;
}
write!(fmt, "{:?}", constraints[consts - 1])?;
}

Ok(())
};
Some(write())
Expand Down Expand Up @@ -351,6 +369,20 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
) -> &'a [chalk_ir::InEnvironment<chalk_ir::Constraint<Self>>] {
constraints
}

fn intern_variances<E>(
&self,
data: impl IntoIterator<Item = Result<chalk_ir::Variance, E>>,
) -> Result<Self::InternedVariances, E> {
data.into_iter().collect::<Result<Vec<_>, _>>()
}

fn variances_data<'a>(
&self,
variances: &'a Self::InternedVariances,
) -> &'a [chalk_ir::Variance] {
variances
}
}

impl<'tcx> chalk_ir::interner::HasInterner for RustInterner<'tcx> {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_resolve/src/late/lifetimes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2415,7 +2415,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
_ => break,
}
}
break Some(e);
break Some(&e[..]);
}
Elide::Forbid => break None,
};
Expand Down Expand Up @@ -2445,7 +2445,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
lifetime_refs.len(),
&lifetime_names,
lifetime_spans,
error.map(|p| &p[..]).unwrap_or(&[]),
error.unwrap_or(&[]),
);
err.emit();
}
Expand Down
24 changes: 2 additions & 22 deletions compiler/rustc_target/src/abi/call/aarch64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,7 @@ where
let size = ret.layout.size;
let bits = size.bits();
if bits <= 128 {
let unit = if bits <= 8 {
Reg::i8()
} else if bits <= 16 {
Reg::i16()
} else if bits <= 32 {
Reg::i32()
} else {
Reg::i64()
};

ret.cast_to(Uniform { unit, total: size });
ret.cast_to(Uniform { unit: Reg::i64(), total: size });
return;
}
ret.make_indirect();
Expand All @@ -72,17 +62,7 @@ where
let size = arg.layout.size;
let bits = size.bits();
if bits <= 128 {
let unit = if bits <= 8 {
Reg::i8()
} else if bits <= 16 {
Reg::i16()
} else if bits <= 32 {
Reg::i32()
} else {
Reg::i64()
};

arg.cast_to(Uniform { unit, total: size });
arg.cast_to(Uniform { unit: Reg::i64(), total: size });
return;
}
arg.make_indirect();
Expand Down
9 changes: 1 addition & 8 deletions compiler/rustc_target/src/abi/call/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,7 @@ where
let size = ret.layout.size;
let bits = size.bits();
if bits <= 32 {
let unit = if bits <= 8 {
Reg::i8()
} else if bits <= 16 {
Reg::i16()
} else {
Reg::i32()
};
ret.cast_to(Uniform { unit, total: size });
ret.cast_to(Uniform { unit: Reg::i32(), total: size });
return;
}
ret.make_indirect();
Expand Down
20 changes: 20 additions & 0 deletions compiler/rustc_target/src/spec/aarch64_be_unknown_linux_gnu.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use crate::abi::Endian;
use crate::spec::{Target, TargetOptions};

pub fn target() -> Target {
let mut base = super::linux_gnu_base::opts();
base.max_atomic_width = Some(128);

Target {
llvm_target: "aarch64_be-unknown-linux-gnu".to_string(),
pointer_width: 64,
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
options: TargetOptions {
unsupported_abis: super::arm_base::unsupported_abis(),
mcount: "\u{1}_mcount".to_string(),
endian: Endian::Big,
..base
},
}
}
Loading