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 10 pull requests #69724

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
515446c
Make error message clearer about creating new module
kornelski Feb 27, 2020
96b3261
Apply rustfmt :(
kornelski Mar 1, 2020
7b6f5ed
`delay_span_bug` when codegen cannot select obligation
estebank Mar 1, 2020
98c7ed6
DefKind::Method -> DefKind::AssocFn
mark-i-m Mar 3, 2020
3aeb9f0
rename TraitItemKind::Method -> Fn
mark-i-m Mar 3, 2020
c745b4a
Add explanation for E0380
GuillaumeGomez Mar 4, 2020
6db7e34
use integer assoc consts instead of methods
RalfJung Mar 4, 2020
f0c3cf2
cover some more nearby cases
RalfJung Mar 4, 2020
8ea676e
Update books
ehuss Mar 2, 2020
0e1cd59
Toolstate: remove redundant beta-week check.
ehuss Mar 4, 2020
a6d8c9c
more toolstate comments
RalfJung Mar 4, 2020
a41f1f1
Further clarifications and comments on toolstate operation.
ehuss Mar 4, 2020
729d49d
Update macros.rs: fix documentation typo.
fables-tales Mar 4, 2020
07168f9
Don't use .ok() before unwrapping via .expect() on a Result.
matthiaskrgr Mar 4, 2020
569676b
Use .map() to modify data inside Options instead of using .and_then(|…
matthiaskrgr Mar 4, 2020
38f5db7
Use .as_deref() instead of .as_ref().map(Deref::deref) (clippy::optio…
matthiaskrgr Mar 4, 2020
d8d2004
Don't use "if let" bindings to only check a value and not actually bi…
matthiaskrgr Mar 4, 2020
27becb2
ast: `Mac`/`Macro` -> `MacCall`
petrochenkov Feb 29, 2020
80ed505
Use single-char patter on {ends,starts}_with and remove clone on copy…
matthiaskrgr Mar 4, 2020
91d521e
Rollup merge of #69520 - kornelski:e69492, r=cramertj
JohnTitor Mar 5, 2020
33f4285
Rollup merge of #69589 - petrochenkov:maccall, r=Centril
JohnTitor Mar 5, 2020
e067bf4
Rollup merge of #69614 - estebank:ice-age, r=davidtwco
JohnTitor Mar 5, 2020
c2e496d
Rollup merge of #69641 - ehuss:update-books, r=ehuss
JohnTitor Mar 5, 2020
210d693
Rollup merge of #69674 - mark-i-m:assoc-fn, r=Centril
JohnTitor Mar 5, 2020
c9f7758
Rollup merge of #69697 - GuillaumeGomez:explanation-e0380, r=Dylan-DPC
JohnTitor Mar 5, 2020
2ef7c86
Rollup merge of #69698 - RalfJung:int_assoc, r=davidtwco
JohnTitor Mar 5, 2020
18d3c36
Rollup merge of #69705 - ehuss:toolstate-remove-redundant-beta, r=Mar…
JohnTitor Mar 5, 2020
e15d393
Rollup merge of #69711 - penelopezone:patch-1, r=steveklabnik
JohnTitor Mar 5, 2020
5089e11
Rollup merge of #69713 - matthiaskrgr:more_cleanup, r=cramertj
JohnTitor Mar 5, 2020
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
55 changes: 22 additions & 33 deletions src/bootstrap/toolstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,21 @@ impl Step for ToolStateCheck {
tool, old_state, state
);
} else {
// This warning only appears in the logs, which most
// people won't read. It's mostly here for testing and
// debugging.
eprintln!(
"warning: Tool `{}` is not test-pass (is `{}`), \
this should be fixed before beta is branched.",
tool, state
);
}
}
// `publish_toolstate.py` is responsible for updating
// `latest.json` and creating comments/issues warning people
// if there is a regression. That all happens in a separate CI
// job on the master branch once the PR has passed all tests
// on the `auto` branch.
}
}

Expand All @@ -230,7 +238,7 @@ impl Step for ToolStateCheck {
}

if builder.config.channel == "nightly" && env::var_os("TOOLSTATE_PUBLISH").is_some() {
commit_toolstate_change(&toolstates, in_beta_week);
commit_toolstate_change(&toolstates);
}
}

Expand Down Expand Up @@ -325,11 +333,11 @@ fn prepare_toolstate_config(token: &str) {
Err(_) => false,
};
if !success {
panic!("git config key={} value={} successful (status: {:?})", key, value, status);
panic!("git config key={} value={} failed (status: {:?})", key, value, status);
}
}

// If changing anything here, then please check that src/ci/publish_toolstate.sh is up to date
// If changing anything here, then please check that `src/ci/publish_toolstate.sh` is up to date
// as well.
git_config("user.email", "[email protected]");
git_config("user.name", "Rust Toolstate Update");
Expand Down Expand Up @@ -373,14 +381,14 @@ fn read_old_toolstate() -> Vec<RepoState> {
///
/// * See <https://help.github.com/articles/about-commit-email-addresses/>
/// if a private email by GitHub is wanted.
fn commit_toolstate_change(current_toolstate: &ToolstateData, in_beta_week: bool) {
let old_toolstate = read_old_toolstate();

fn commit_toolstate_change(current_toolstate: &ToolstateData) {
let message = format!("({} CI update)", OS.expect("linux/windows only"));
let mut success = false;
for _ in 1..=5 {
// Update the toolstate results (the new commit-to-toolstate mapping) in the toolstate repo.
change_toolstate(&current_toolstate, &old_toolstate, in_beta_week);
// Upload the test results (the new commit-to-toolstate mapping) to the toolstate repo.
// This does *not* change the "current toolstate"; that only happens post-landing
// via `src/ci/docker/publish_toolstate.sh`.
publish_test_results(&current_toolstate);

// `git commit` failing means nothing to commit.
let status = t!(Command::new("git")
Expand Down Expand Up @@ -429,31 +437,12 @@ fn commit_toolstate_change(current_toolstate: &ToolstateData, in_beta_week: bool
}
}

fn change_toolstate(
current_toolstate: &ToolstateData,
old_toolstate: &[RepoState],
in_beta_week: bool,
) {
let mut regressed = false;
for repo_state in old_toolstate {
let tool = &repo_state.tool;
let state = repo_state.state();
let new_state = current_toolstate[tool.as_str()];

if new_state != state {
eprintln!("The state of `{}` has changed from `{}` to `{}`", tool, state, new_state);
if new_state < state {
if !NIGHTLY_TOOLS.iter().any(|(name, _path)| name == tool) {
regressed = true;
}
}
}
}

if regressed && in_beta_week {
std::process::exit(1);
}

/// Updates the "history" files with the latest results.
///
/// These results will later be promoted to `latest.json` by the
/// `publish_toolstate.py` script if the PR passes all tests and is merged to
/// master.
fn publish_test_results(current_toolstate: &ToolstateData) {
let commit = t!(std::process::Command::new("git").arg("rev-parse").arg("HEAD").output());
let commit = t!(String::from_utf8(commit.stdout));

Expand Down
4 changes: 3 additions & 1 deletion src/ci/publish_toolstate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ GIT_COMMIT_MSG="$(git log --format=%s -n1 HEAD)"
cd rust-toolstate
FAILURE=1
for RETRY_COUNT in 1 2 3 4 5; do
# The purpose is to publish the new "current" toolstate in the toolstate repo.
# The purpose of this is to publish the new "current" toolstate in the toolstate repo.
# This happens post-landing, on master.
# (Publishing the per-commit test results happens pre-landing in src/bootstrap/toolstate.rs).
"$(ciCheckoutPath)/src/tools/publish_toolstate.py" "$GIT_COMMIT" \
"$GIT_COMMIT_MSG" \
"$MESSAGE_FILE" \
Expand Down
2 changes: 1 addition & 1 deletion src/doc/embedded-book
2 changes: 1 addition & 1 deletion src/librustc/dep_graph/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ impl DepGraph {
edge_list_indices.push((start, end));
}

debug_assert!(edge_list_data.len() <= ::std::u32::MAX as usize);
debug_assert!(edge_list_data.len() <= u32::MAX as usize);
debug_assert_eq!(edge_list_data.len(), total_edge_count);

SerializedDepGraph { nodes, fingerprints, edge_list_indices, edge_list_data }
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/hir/map/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl MaybeFnLike for hir::ImplItem<'_> {
impl MaybeFnLike for hir::TraitItem<'_> {
fn is_fn_like(&self) -> bool {
match self.kind {
hir::TraitItemKind::Method(_, hir::TraitMethod::Provided(_)) => true,
hir::TraitItemKind::Fn(_, hir::TraitMethod::Provided(_)) => true,
_ => false,
}
}
Expand Down Expand Up @@ -239,7 +239,7 @@ impl<'a> FnLikeNode<'a> {
_ => bug!("item FnLikeNode that is not fn-like"),
},
Node::TraitItem(ti) => match ti.kind {
hir::TraitItemKind::Method(ref sig, hir::TraitMethod::Provided(body)) => {
hir::TraitItemKind::Fn(ref sig, hir::TraitMethod::Provided(body)) => {
method(ti.hir_id, ti.ident, sig, None, body, ti.span, &ti.attrs)
}
_ => bug!("trait method FnLikeNode that is not fn-like"),
Expand Down
16 changes: 8 additions & 8 deletions src/librustc/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl<'hir> Entry<'hir> {
},

Node::TraitItem(ref item) => match item.kind {
TraitItemKind::Method(ref sig, _) => Some(&sig.decl),
TraitItemKind::Fn(ref sig, _) => Some(&sig.decl),
_ => None,
},

Expand All @@ -77,7 +77,7 @@ impl<'hir> Entry<'hir> {
},

Node::TraitItem(item) => match &item.kind {
TraitItemKind::Method(sig, _) => Some(sig),
TraitItemKind::Fn(sig, _) => Some(sig),
_ => None,
},

Expand All @@ -101,7 +101,7 @@ impl<'hir> Entry<'hir> {

Node::TraitItem(item) => match item.kind {
TraitItemKind::Const(_, Some(body))
| TraitItemKind::Method(_, TraitMethod::Provided(body)) => Some(body),
| TraitItemKind::Fn(_, TraitMethod::Provided(body)) => Some(body),
_ => None,
},

Expand Down Expand Up @@ -326,12 +326,12 @@ impl<'hir> Map<'hir> {
},
Node::TraitItem(item) => match item.kind {
TraitItemKind::Const(..) => DefKind::AssocConst,
TraitItemKind::Method(..) => DefKind::Method,
TraitItemKind::Fn(..) => DefKind::AssocFn,
TraitItemKind::Type(..) => DefKind::AssocTy,
},
Node::ImplItem(item) => match item.kind {
ImplItemKind::Const(..) => DefKind::AssocConst,
ImplItemKind::Method(..) => DefKind::Method,
ImplItemKind::Method(..) => DefKind::AssocFn,
ImplItemKind::TyAlias(..) => DefKind::AssocTy,
ImplItemKind::OpaqueTy(..) => DefKind::AssocOpaqueTy,
},
Expand Down Expand Up @@ -472,7 +472,7 @@ impl<'hir> Map<'hir> {
| Node::AnonConst(_) => BodyOwnerKind::Const,
Node::Ctor(..)
| Node::Item(&Item { kind: ItemKind::Fn(..), .. })
| Node::TraitItem(&TraitItem { kind: TraitItemKind::Method(..), .. })
| Node::TraitItem(&TraitItem { kind: TraitItemKind::Fn(..), .. })
| Node::ImplItem(&ImplItem { kind: ImplItemKind::Method(..), .. }) => BodyOwnerKind::Fn,
Node::Item(&Item { kind: ItemKind::Static(_, m, _), .. }) => BodyOwnerKind::Static(m),
Node::Expr(&Expr { kind: ExprKind::Closure(..), .. }) => BodyOwnerKind::Closure,
Expand Down Expand Up @@ -800,7 +800,7 @@ impl<'hir> Map<'hir> {
_ => false,
},
Node::TraitItem(ti) => match ti.kind {
TraitItemKind::Method(..) => true,
TraitItemKind::Fn(..) => true,
_ => false,
},
Node::ImplItem(ii) => match ii.kind {
Expand Down Expand Up @@ -1311,7 +1311,7 @@ fn hir_id_to_string(map: &Map<'_>, id: HirId, include_id: bool) -> String {
Some(Node::TraitItem(ti)) => {
let kind = match ti.kind {
TraitItemKind::Const(..) => "assoc constant",
TraitItemKind::Method(..) => "trait method",
TraitItemKind::Fn(..) => "trait method",
TraitItemKind::Type(..) => "assoc type",
};

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ pub enum EvalResult {
fn skip_stability_check_due_to_privacy(tcx: TyCtxt<'_>, mut def_id: DefId) -> bool {
// Check if `def_id` is a trait method.
match tcx.def_kind(def_id) {
Some(DefKind::Method) | Some(DefKind::AssocTy) | Some(DefKind::AssocConst) => {
Some(DefKind::AssocFn) | Some(DefKind::AssocTy) | Some(DefKind::AssocConst) => {
if let ty::TraitContainer(trait_def_id) = tcx.associated_item(def_id).container {
// Trait methods do not declare visibility (even
// for visibility info in cstore). Use containing
Expand Down
14 changes: 7 additions & 7 deletions src/librustc/mir/interpret/allocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -818,9 +818,9 @@ impl UndefMask {
// First set all bits except the first `bita`,
// then unset the last `64 - bitb` bits.
let range = if bitb == 0 {
u64::max_value() << bita
u64::MAX << bita
} else {
(u64::max_value() << bita) & (u64::max_value() >> (64 - bitb))
(u64::MAX << bita) & (u64::MAX >> (64 - bitb))
};
if new_state {
self.blocks[blocka] |= range;
Expand All @@ -832,21 +832,21 @@ impl UndefMask {
// across block boundaries
if new_state {
// Set `bita..64` to `1`.
self.blocks[blocka] |= u64::max_value() << bita;
self.blocks[blocka] |= u64::MAX << bita;
// Set `0..bitb` to `1`.
if bitb != 0 {
self.blocks[blockb] |= u64::max_value() >> (64 - bitb);
self.blocks[blockb] |= u64::MAX >> (64 - bitb);
}
// Fill in all the other blocks (much faster than one bit at a time).
for block in (blocka + 1)..blockb {
self.blocks[block] = u64::max_value();
self.blocks[block] = u64::MAX;
}
} else {
// Set `bita..64` to `0`.
self.blocks[blocka] &= !(u64::max_value() << bita);
self.blocks[blocka] &= !(u64::MAX << bita);
// Set `0..bitb` to `0`.
if bitb != 0 {
self.blocks[blockb] &= !(u64::max_value() >> (64 - bitb));
self.blocks[blockb] &= !(u64::MAX >> (64 - bitb));
}
// Fill in all the other blocks (much faster than one bit at a time).
for block in (blocka + 1)..blockb {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/mir/interpret/pointer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ pub trait PointerArithmetic: layout::HasDataLayout {
fn overflowing_signed_offset(&self, val: u64, i: i128) -> (u64, bool) {
// FIXME: is it possible to over/underflow here?
if i < 0 {
// Trickery to ensure that `i64::min_value()` works fine: compute `n = -i`.
// Trickery to ensure that `i64::MIN` works fine: compute `n = -i`.
// This formula only works for true negative values; it overflows for zero!
let n = u64::max_value() - (i as u64) + 1;
let n = u64::MAX - (i as u64) + 1;
let res = val.overflowing_sub(n);
self.truncate_to_ptr(res)
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ rustc_queries! {
Codegen {
query codegen_fulfill_obligation(
key: (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)
) -> Vtable<'tcx, ()> {
) -> Option<Vtable<'tcx, ()>> {
no_force
cache_on_disk_if { true }
desc { |tcx|
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/traits/structural_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,9 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> {
super::ReferenceOutlivesReferent(ty) => {
tcx.lift(&ty).map(super::ReferenceOutlivesReferent)
}
super::ObjectTypeBound(ty, r) => tcx
.lift(&ty)
.and_then(|ty| tcx.lift(&r).and_then(|r| Some(super::ObjectTypeBound(ty, r)))),
super::ObjectTypeBound(ty, r) => {
tcx.lift(&ty).and_then(|ty| tcx.lift(&r).map(|r| super::ObjectTypeBound(ty, r)))
}
super::ObjectCastObligation(ty) => tcx.lift(&ty).map(super::ObjectCastObligation),
super::Coercion { source, target } => {
Some(super::Coercion { source: tcx.lift(&source)?, target: tcx.lift(&target)? })
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ impl<'tcx> TypeckTables<'tcx> {
}

match self.type_dependent_defs().get(expr.hir_id) {
Some(Ok((DefKind::Method, _))) => true,
Some(Ok((DefKind::AssocFn, _))) => true,
_ => false,
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/librustc/ty/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use rustc_span::DUMMY_SP;

use std::cmp;
use std::fmt;
use std::i128;
use std::iter;
use std::mem;
use std::ops::Bound;
Expand Down Expand Up @@ -1001,7 +1000,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
}
}

let (mut min, mut max) = (i128::max_value(), i128::min_value());
let (mut min, mut max) = (i128::MAX, i128::MIN);
let discr_type = def.repr.discr_type();
let bits = Integer::from_attr(self, discr_type).size().bits();
for (i, discr) in def.discriminants(tcx) {
Expand All @@ -1021,7 +1020,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
}
}
// We might have no inhabited variants, so pretend there's at least one.
if (min, max) == (i128::max_value(), i128::min_value()) {
if (min, max) == (i128::MAX, i128::MIN) {
min = 0;
max = 0;
}
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ impl AssocItem {
pub fn def_kind(&self) -> DefKind {
match self.kind {
AssocKind::Const => DefKind::AssocConst,
AssocKind::Method => DefKind::Method,
AssocKind::Method => DefKind::AssocFn,
AssocKind::Type => DefKind::AssocTy,
AssocKind::OpaqueTy => DefKind::AssocOpaqueTy,
}
Expand Down Expand Up @@ -2872,7 +2872,7 @@ impl<'tcx> TyCtxt<'tcx> {
}
} else {
match self.def_kind(def_id).expect("no def for `DefId`") {
DefKind::AssocConst | DefKind::Method | DefKind::AssocTy => true,
DefKind::AssocConst | DefKind::AssocFn | DefKind::AssocTy => true,
_ => false,
}
};
Expand Down Expand Up @@ -3051,7 +3051,7 @@ impl<'tcx> TyCtxt<'tcx> {
/// `DefId` of the impl that the method belongs to; otherwise, returns `None`.
pub fn impl_of_method(self, def_id: DefId) -> Option<DefId> {
let item = if def_id.krate != LOCAL_CRATE {
if let Some(DefKind::Method) = self.def_kind(def_id) {
if let Some(DefKind::AssocFn) = self.def_kind(def_id) {
Some(self.associated_item(def_id))
} else {
None
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ pub trait PrettyPrinter<'tcx>:
}
(ConstValue::Scalar(Scalar::Raw { data, .. }), ty::Uint(ui)) => {
let bit_size = Integer::from_attr(&self.tcx(), UnsignedInt(*ui)).size();
let max = truncate(u128::max_value(), bit_size);
let max = truncate(u128::MAX, bit_size);

let ui_str = ui.name_str();
if data == max {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/query/on_disk_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ struct AbsoluteBytePos(u32);

impl AbsoluteBytePos {
fn new(pos: usize) -> AbsoluteBytePos {
debug_assert!(pos <= ::std::u32::MAX as usize);
debug_assert!(pos <= u32::MAX as usize);
AbsoluteBytePos(pos as u32)
}

Expand Down
Loading