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

remove obsolete ld64 option #85956

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
027d73d
Restrict Fake Read precision
roxelo May 25, 2021
382338f
Remove feature gate
roxelo May 27, 2021
dbff14b
Clarify meaning of MachineApplicable suggestions.
m-ou-se May 31, 2021
a0228d9
Intra doc link-ify a reference to a function
est31 Jun 1, 2021
9283956
skip check_static on rvalue::threadlocalref
csmoe Jun 1, 2021
1213d92
Update unsound label for triagebot
steffahn Jun 1, 2021
ba680aa
Add test for forward declared const param defaults
BoxyUwU Jun 1, 2021
ba0ac88
Avoid a clone of output_filenames.
cjgillot May 11, 2021
e2b22b5
Use pattern matching instead of checking lengths explicitly
LingMan Jun 1, 2021
521d9ab
convert Rvalue::threadlocalref assertion to delay bug
csmoe Jun 1, 2021
7852935
Update cargo
ehuss Jun 2, 2021
012c323
Implement `Ty::is_enum` using `matches!`
tmiasko Jun 2, 2021
c898681
Add `Ty::is_union` predicate and use it
tmiasko Jun 2, 2021
11478bd
Validate type of locals used as indices
tmiasko Jun 2, 2021
aab8545
Turn off frame pointer elimination on all Apple platforms.
jrmuizel Jun 2, 2021
f7c283c
Stabilize `vecdeque_binary_search`
SOF3 Mar 22, 2021
f51f277
Bumped `vecdeque_binary_search` stabilization version to 1.53.0
SOF3 Mar 22, 2021
f086f1e
Bump vecdeque_binary_search stabilization to 1.54.
m-ou-se Jun 2, 2021
f717992
Stabilize VecDeque::partition_point.
m-ou-se Jun 2, 2021
9a06f65
Rollup merge of #83362 - SOF3:stab/vecdeque-binary-search, r=m-ou-se
JohnTitor Jun 3, 2021
9b1e105
Rollup merge of #85706 - jrmuizel:fpe, r=nagisa
JohnTitor Jun 3, 2021
34f1275
Rollup merge of #85724 - sexxi-goose:rox-fix-issue-85435, r=nikomatsakis
JohnTitor Jun 3, 2021
ff0b7cd
Rollup merge of #85852 - m-ou-se:machineapplicable-docs, r=nikomatsakis
JohnTitor Jun 3, 2021
bd18686
Rollup merge of #85877 - est31:intra_doc_links, r=jyn514
JohnTitor Jun 3, 2021
0d4bbc5
Rollup merge of #85880 - csmoe:ice-85768, r=oli-obk
JohnTitor Jun 3, 2021
7ee817e
Rollup merge of #85896 - BoxyUwU:remove-fixme-fwd-declared-const-defa…
JohnTitor Jun 3, 2021
052a3fe
Rollup merge of #85897 - steffahn:update_unsound_label_for_triagebot,…
JohnTitor Jun 3, 2021
ad7b56e
Rollup merge of #85900 - LingMan:pat_mat, r=petrochenkov
JohnTitor Jun 3, 2021
a5466fc
Rollup merge of #85911 - cjgillot:one-output, r=Aaron1011
JohnTitor Jun 3, 2021
80c871c
Rollup merge of #85926 - ehuss:update-cargo, r=ehuss
JohnTitor Jun 3, 2021
2fddcfd
Rollup merge of #85934 - tmiasko:is-union, r=jackh726
JohnTitor Jun 3, 2021
0cdbb7d
Rollup merge of #85935 - tmiasko:validate-indexing, r=jonas-schievink
JohnTitor Jun 3, 2021
a93699f
Auto merge of #85952 - JohnTitor:rollup-r00gu9q, r=JohnTitor
bors Jun 3, 2021
e214cac
remove obsolete ld64 option
tschuett Jun 3, 2021
f5977cd
Update Miri
Jun 3, 2021
835150e
Auto merge of #85958 - hyd-dev:miri, r=RalfJung
bors Jun 3, 2021
a78d593
remove obsolete ld64 option
tschuett Jun 3, 2021
518a45a
Merge branch 'obsoletem64' of github.com:tschuett/rust into obsoletem64
tschuett Jun 4, 2021
4fec017
rustfmt
tschuett Jun 4, 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
25 changes: 22 additions & 3 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ dependencies = [
"humantime 2.0.1",
"ignore",
"im-rc",
"itertools 0.10.0",
"jobserver",
"lazy_static",
"lazycell",
Expand All @@ -293,7 +294,7 @@ dependencies = [
"rand 0.8.3",
"rustc-workspace-hack",
"rustfix",
"semver 0.10.0",
"semver 1.0.1",
"serde",
"serde_ignored",
"serde_json",
Expand Down Expand Up @@ -1715,6 +1716,15 @@ dependencies = [
"either",
]

[[package]]
name = "itertools"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319"
dependencies = [
"either",
]

[[package]]
name = "itoa"
version = "0.4.6"
Expand Down Expand Up @@ -4674,6 +4684,15 @@ dependencies = [
"serde",
]

[[package]]
name = "semver"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d023dabf011d5dcb5ac64e3685d97d3b0ef412911077a2851455c6098524a723"
dependencies = [
"serde",
]

[[package]]
name = "semver-parser"
version = "0.7.0"
Expand Down Expand Up @@ -5033,9 +5052,9 @@ dependencies = [

[[package]]
name = "tar"
version = "0.4.33"
version = "0.4.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0bcfbd6a598361fda270d82469fff3d65089dc33e175c9a131f7b4cd395f228"
checksum = "7d779dc6aeff029314570f666ec83f19df7280bb36ef338442cfa8c604021b80"
dependencies = [
"filetime",
"libc",
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ pub fn create_global_ctxt<'tcx>(
query_result_on_disk_cache,
queries.as_dyn(),
&crate_name,
&outputs,
outputs,
)
})
});
Expand Down
26 changes: 7 additions & 19 deletions compiler/rustc_lint/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ use rustc_data_structures::fx::FxHashSet;
use rustc_errors::Applicability;
use rustc_hir as hir;
use rustc_hir::{is_range_literal, ExprKind, Node};
use rustc_index::vec::Idx;
use rustc_middle::ty::layout::{IntegerExt, SizeSkeleton};
use rustc_middle::ty::subst::SubstsRef;
use rustc_middle::ty::{self, AdtKind, Ty, TyCtxt, TypeFoldable};
use rustc_span::source_map;
use rustc_span::symbol::sym;
use rustc_span::{Span, DUMMY_SP};
use rustc_target::abi::Abi;
use rustc_target::abi::{Integer, LayoutOf, TagEncoding, VariantIdx, Variants};
use rustc_target::abi::{Integer, LayoutOf, TagEncoding, Variants};
use rustc_target::spec::abi::Abi as SpecAbi;

use std::cmp;
Expand Down Expand Up @@ -783,25 +782,14 @@ crate fn repr_nullable_ptr<'tcx>(
) -> Option<Ty<'tcx>> {
debug!("is_repr_nullable_ptr(cx, ty = {:?})", ty);
if let ty::Adt(ty_def, substs) = ty.kind() {
if ty_def.variants.len() != 2 {
return None;
}

let get_variant_fields = |index| &ty_def.variants[VariantIdx::new(index)].fields;
let variant_fields = [get_variant_fields(0), get_variant_fields(1)];
let fields = if variant_fields[0].is_empty() {
&variant_fields[1]
} else if variant_fields[1].is_empty() {
&variant_fields[0]
} else {
return None;
let field_ty = match &ty_def.variants.raw[..] {
[var_one, var_two] => match (&var_one.fields[..], &var_two.fields[..]) {
([], [field]) | ([field], []) => field.ty(cx.tcx, substs),
_ => return None,
},
_ => return None,
};

if fields.len() != 1 {
return None;
}

let field_ty = fields[0].ty(cx.tcx, substs);
if !ty_is_known_nonnull(cx, field_ty, ckind) {
return None;
}
Expand Down
6 changes: 5 additions & 1 deletion compiler/rustc_lint_defs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ macro_rules! pluralize {
/// before applying the suggestion.
#[derive(Copy, Clone, Debug, PartialEq, Hash, Encodable, Decodable)]
pub enum Applicability {
/// The suggestion is definitely what the user intended. This suggestion should be
/// The suggestion is definitely what the user intended, or maintains the exact meaning of the code.
/// This suggestion should be automatically applied.
///
/// In case of multiple `MachineApplicable` suggestions (whether as part of
/// the same `multipart_suggestion` or not), all of them should be
/// automatically applied.
MachineApplicable,

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ impl<'tcx> TyCtxt<'tcx> {
on_disk_cache: Option<query::OnDiskCache<'tcx>>,
queries: &'tcx dyn query::QueryEngine<'tcx>,
crate_name: &str,
output_filenames: &OutputFilenames,
output_filenames: OutputFilenames,
) -> GlobalCtxt<'tcx> {
let data_layout = TargetDataLayout::parse(&s.target).unwrap_or_else(|err| {
s.fatal(&err);
Expand Down Expand Up @@ -1179,7 +1179,7 @@ impl<'tcx> TyCtxt<'tcx> {
stability_interner: Default::default(),
const_stability_interner: Default::default(),
alloc_map: Lock::new(interpret::AllocMap::new()),
output_filenames: Arc::new(output_filenames.clone()),
output_filenames: Arc::new(output_filenames),
main_def: resolutions.main_def,
}
}
Expand Down
10 changes: 6 additions & 4 deletions compiler/rustc_middle/src/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1837,10 +1837,12 @@ impl<'tcx> TyS<'tcx> {

#[inline]
pub fn is_enum(&self) -> bool {
match self.kind() {
Adt(adt_def, _) => adt_def.is_enum(),
_ => false,
}
matches!(self.kind(), Adt(adt_def, _) if adt_def.is_enum())
}

#[inline]
pub fn is_union(&self) -> bool {
matches!(self.kind(), Adt(adt_def, _) if adt_def.is_union())
}

#[inline]
Expand Down
12 changes: 5 additions & 7 deletions compiler/rustc_mir/src/borrow_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1965,13 +1965,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
// no move out from an earlier location) then this is an attempt at initialization
// of the union - we should error in that case.
let tcx = this.infcx.tcx;
if let ty::Adt(def, _) = base.ty(this.body(), tcx).ty.kind() {
if def.is_union() {
if this.move_data.path_map[mpi].iter().any(|moi| {
this.move_data.moves[*moi].source.is_predecessor_of(location, this.body)
}) {
return;
}
if base.ty(this.body(), tcx).ty.is_union() {
if this.move_data.path_map[mpi].iter().any(|moi| {
this.move_data.moves[*moi].source.is_predecessor_of(location, this.body)
}) {
return;
}
}

Expand Down
19 changes: 8 additions & 11 deletions compiler/rustc_mir/src/borrow_check/places_conflict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,17 +331,14 @@ fn place_projection_conflict<'tcx>(
Overlap::EqualOrDisjoint
} else {
let ty = Place::ty_from(pi1_local, pi1_proj_base, body, tcx).ty;
match ty.kind() {
ty::Adt(def, _) if def.is_union() => {
// Different fields of a union, we are basically stuck.
debug!("place_element_conflict: STUCK-UNION");
Overlap::Arbitrary
}
_ => {
// Different fields of a struct (`a.x` vs. `a.y`). Disjoint!
debug!("place_element_conflict: DISJOINT-FIELD");
Overlap::Disjoint
}
if ty.is_union() {
// Different fields of a union, we are basically stuck.
debug!("place_element_conflict: STUCK-UNION");
Overlap::Arbitrary
} else {
// Different fields of a struct (`a.x` vs. `a.y`). Disjoint!
debug!("place_element_conflict: DISJOINT-FIELD");
Overlap::Disjoint
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions compiler/rustc_mir/src/dataflow/move_paths/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,10 +519,8 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
// Check if we are assigning into a field of a union, if so, lookup the place
// of the union so it is marked as initialized again.
if let Some((place_base, ProjectionElem::Field(_, _))) = place.last_projection() {
if let ty::Adt(def, _) = place_base.ty(self.builder.body, self.builder.tcx).ty.kind() {
if def.is_union() {
place = place_base;
}
if place_base.ty(self.builder.body, self.builder.tcx).ty.is_union() {
place = place_base;
}
}

Expand Down
15 changes: 5 additions & 10 deletions compiler/rustc_mir/src/transform/check_consts/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,9 @@ impl Validator<'mir, 'tcx> {
}

fn check_static(&mut self, def_id: DefId, span: Span) {
assert!(
!self.tcx.is_thread_local_static(def_id),
"tls access is checked in `Rvalue::ThreadLocalRef"
);
if self.tcx.is_thread_local_static(def_id) {
self.tcx.sess.delay_span_bug(span, "tls access is checked in `Rvalue::ThreadLocalRef");
}
self.check_op_spanned(ops::StaticAccess, span)
}

Expand Down Expand Up @@ -753,12 +752,8 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
| ProjectionElem::Field(..)
| ProjectionElem::Index(_) => {
let base_ty = Place::ty_from(place_local, proj_base, self.body, self.tcx).ty;
match base_ty.ty_adt_def() {
Some(def) if def.is_union() => {
self.check_op(ops::UnionAccess);
}

_ => {}
if base_ty.is_union() {
self.check_op(ops::UnionAccess);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/transform/check_unsafety.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
}

let base_ty = base.ty(self.body, self.tcx).ty;
if base_ty.ty_adt_def().map_or(false, |adt| adt.is_union()) {
if base_ty.is_union() {
// If we did not hit a `Deref` yet and the overall place use is an assignment, the
// rules are different.
let assign_to_field = !saw_deref
Expand Down
15 changes: 3 additions & 12 deletions compiler/rustc_mir/src/transform/dest_prop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ use rustc_middle::mir::{
traversal, Body, InlineAsmOperand, Local, LocalKind, Location, Operand, Place, PlaceElem,
Rvalue, Statement, StatementKind, Terminator, TerminatorKind,
};
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_middle::ty::TyCtxt;

// Empirical measurements have resulted in some observations:
// - Running on a body with a single block and 500 locals takes barely any time
Expand Down Expand Up @@ -910,17 +910,8 @@ impl<'a, 'tcx> Visitor<'tcx> for FindAssignments<'a, 'tcx> {

// Handle the "subtle case" described above by rejecting any `dest` that is or
// projects through a union.
let is_union = |ty: Ty<'_>| {
if let ty::Adt(def, _) = ty.kind() {
if def.is_union() {
return true;
}
}

false
};
let mut place_ty = PlaceTy::from_ty(self.body.local_decls[dest.local].ty);
if is_union(place_ty.ty) {
if place_ty.ty.is_union() {
return;
}
for elem in dest.projection {
Expand All @@ -930,7 +921,7 @@ impl<'a, 'tcx> Visitor<'tcx> for FindAssignments<'a, 'tcx> {
}

place_ty = place_ty.projection_ty(self.tcx, elem);
if is_union(place_ty.ty) {
if place_ty.ty.is_union() {
return;
}
}
Expand Down
6 changes: 2 additions & 4 deletions compiler/rustc_mir/src/transform/promote_consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,9 @@ impl<'tcx> Validator<'_, 'tcx> {

ProjectionElem::Field(..) => {
let base_ty = place_base.ty(self.body, self.tcx).ty;
if let Some(def) = base_ty.ty_adt_def() {
if base_ty.is_union() {
// No promotion of union field accesses.
if def.is_union() {
return Err(Unpromotable);
}
return Err(Unpromotable);
}
}
}
Expand Down
11 changes: 2 additions & 9 deletions compiler/rustc_mir/src/transform/remove_zsts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,14 @@ fn involves_a_union<'tcx>(
tcx: TyCtxt<'tcx>,
) -> bool {
let mut place_ty = PlaceTy::from_ty(local_decls[place.local].ty);
if is_union(place_ty.ty) {
if place_ty.ty.is_union() {
return true;
}
for elem in place.projection {
place_ty = place_ty.projection_ty(tcx, elem);
if is_union(place_ty.ty) {
if place_ty.ty.is_union() {
return true;
}
}
return false;
}

fn is_union(ty: Ty<'_>) -> bool {
match ty.kind() {
ty::Adt(def, _) if def.is_union() => true,
_ => false,
}
}
22 changes: 20 additions & 2 deletions compiler/rustc_mir/src/transform/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ use rustc_middle::mir::interpret::Scalar;
use rustc_middle::mir::traversal;
use rustc_middle::mir::visit::{PlaceContext, Visitor};
use rustc_middle::mir::{
AggregateKind, BasicBlock, Body, BorrowKind, Local, Location, MirPhase, Operand, PlaceRef,
Rvalue, SourceScope, Statement, StatementKind, Terminator, TerminatorKind,
AggregateKind, BasicBlock, Body, BorrowKind, Local, Location, MirPhase, Operand, PlaceElem,
PlaceRef, ProjectionElem, Rvalue, SourceScope, Statement, StatementKind, Terminator,
TerminatorKind,
};
use rustc_middle::ty::fold::BottomUpFolder;
use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt, TypeFoldable};
Expand Down Expand Up @@ -217,6 +218,23 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
self.super_operand(operand, location);
}

fn visit_projection_elem(
&mut self,
local: Local,
proj_base: &[PlaceElem<'tcx>],
elem: PlaceElem<'tcx>,
context: PlaceContext,
location: Location,
) {
if let ProjectionElem::Index(index) = elem {
let index_ty = self.body.local_decls[index].ty;
if index_ty != self.tcx.types.usize {
self.fail(location, format!("bad index ({:?} != usize)", index_ty))
}
}
self.super_projection_elem(local, proj_base, elem, context, location);
}

fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) {
match &statement.kind {
StatementKind::Assign(box (dest, rvalue)) => {
Expand Down
Loading