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 15 pull requests #78767

Merged
merged 44 commits into from
Nov 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
4af560e
Move zero-sized-vec-push test
poliorcetics Sep 14, 2020
85afbd8
Rebase conflicts
poliorcetics Oct 17, 2020
4fd06b9
Move vec-macro-repeat test
poliorcetics Oct 3, 2020
42271a5
Move vec swap test
poliorcetics Oct 3, 2020
1bdee96
Move subslice pattern tests to alloc/tests/slice.rs
poliorcetics Oct 3, 2020
251f6da
(rustdoc) fix test for trait impl display
liketechnik Oct 25, 2020
e4d1096
Change as_str → to_string in proc_macro::Ident::span() docs
est31 Oct 28, 2020
300362e
Close the theme picker when Escape is pressed
notriddle Oct 30, 2020
ac3a434
Allow the theme picker to work with arrow keys
notriddle Oct 30, 2020
6918a17
Add aria roles for theme picker menu
notriddle Oct 30, 2020
90c7c63
Add comment describing the Escape key weirdness
notriddle Oct 30, 2020
17b8ca9
Pull theme picker keyboard code into main.js
notriddle Oct 30, 2020
5801109
Move Copy and Clone into the list of traits implemented for all sizes
est31 Nov 4, 2020
93fa023
Fix outdated comment next to array_impl_default
est31 Nov 4, 2020
bcd2f2d
fix a couple of clippy warnings:
matthiaskrgr Nov 4, 2020
69e5729
Simplify the implementation of `get_mut` (no unsafe)
danielhenrymantilla Nov 4, 2020
232b9ba
Move range in ui test to ops test in library/core
sasurau4 Nov 4, 2020
a70e0c2
Fix issue 78654.
hameerabbasi Nov 4, 2020
bd7229d
make intern_const_alloc_recursive return error fix #78655
vn-ki Nov 4, 2020
5855fb7
Move f64::NAN ui tests into `library`
Oct 27, 2020
97d5a1b
Fix format
Nov 4, 2020
d8afe98
Clean up docs for 'as' keyword
camelid Oct 19, 2020
bdbcaf0
Update cargo
ehuss Nov 5, 2020
3084a55
Don't use `crate` in link text
camelid Nov 5, 2020
bbdb1f0
Clean up some intra-doc links
camelid Nov 5, 2020
677b2ac
Add missing comma
camelid Nov 5, 2020
873ebcb
Fixed typo in comment
eltociear Nov 5, 2020
f9b139f
Add `mod nan` for test
Nov 5, 2020
a15ee4d
update dangling-alloc-id-ice test
vn-ki Nov 5, 2020
55f4b80
Rollup merge of #76718 - poliorcetics:vec-ui-to-unit-test, r=jyn514
m-ou-se Nov 5, 2020
10d2843
Rollup merge of #78093 - camelid:as-cleanup, r=jyn514
m-ou-se Nov 5, 2020
9922933
Rollup merge of #78425 - chansuke:move_nan, r=jyn514
m-ou-se Nov 5, 2020
6d7098f
Rollup merge of #78465 - est31:proc_macro_to_string, r=jyn514
m-ou-se Nov 5, 2020
cbf74bc
Rollup merge of #78584 - notriddle:master, r=GuillaumeGomez
m-ou-se Nov 5, 2020
43e1b58
Rollup merge of #78716 - est31:array_traits, r=Dylan-DPC
m-ou-se Nov 5, 2020
9bbb052
Rollup merge of #78727 - liketechnik:issue-55201, r=GuillaumeGomez
m-ou-se Nov 5, 2020
8640360
Rollup merge of #78733 - matthiaskrgr:cl11ppy, r=jyn514
m-ou-se Nov 5, 2020
29fad21
Rollup merge of #78735 - danielhenrymantilla:simplify-unsafecell-getm…
m-ou-se Nov 5, 2020
86e6afa
Rollup merge of #78738 - sasurau4:test/move-range-test-to-library-cor…
m-ou-se Nov 5, 2020
171d29c
Rollup merge of #78739 - hameerabbasi:issue-78654, r=nikomatsakis
m-ou-se Nov 5, 2020
5ffccc4
Rollup merge of #78742 - vn-ki:fix-issue-78655, r=oli-obk
m-ou-se Nov 5, 2020
679c4c7
Rollup merge of #78756 - ehuss:update-cargo, r=ehuss
m-ou-se Nov 5, 2020
f383e4f
Rollup merge of #78757 - camelid:crate-link-text, r=jyn514
m-ou-se Nov 5, 2020
8416e13
Rollup merge of #78758 - eltociear:patch-1, r=jyn514
m-ou-se Nov 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
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ dependencies = [

[[package]]
name = "anyhow"
version = "1.0.32"
version = "1.0.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b602bfe940d21c130f3895acd65221e8a61270debe89d628b9cb4e3ccb8569b"
checksum = "bf8dcb5b4bbaa28653b647d8c77bd4ed40183b48882e130c1f1ffb73de069fd7"

[[package]]
name = "arc-swap"
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast/src/attr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ pub fn list_contains_name(items: &[NestedMetaItem], name: Symbol) -> bool {
impl MetaItem {
fn token_trees_and_spacings(&self) -> Vec<TreeAndSpacing> {
let mut idents = vec![];
let mut last_pos = BytePos(0 as u32);
let mut last_pos = BytePos(0_u32);
for (i, segment) in self.path.segments.iter().enumerate() {
let is_first = i == 0;
if !is_first {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,6 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
"cannot infer {} {} {} `{}`{}",
kind_str, preposition, descr, type_name, parent_desc
)
.into()
}
}
}
9 changes: 4 additions & 5 deletions compiler/rustc_interface/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,10 @@ pub fn get_codegen_backend(sopts: &config::Options) -> Box<dyn CodegenBackend> {

INIT.call_once(|| {
#[cfg(feature = "llvm")]
const DEFAULT_CODEGEN_BACKEND: &'static str = "llvm";
const DEFAULT_CODEGEN_BACKEND: &str = "llvm";

#[cfg(not(feature = "llvm"))]
const DEFAULT_CODEGEN_BACKEND: &'static str = "cranelift";
const DEFAULT_CODEGEN_BACKEND: &str = "cranelift";

let codegen_name = sopts
.debugging_opts
Expand Down Expand Up @@ -414,11 +414,10 @@ pub fn get_codegen_sysroot(backend_name: &str) -> fn() -> Box<dyn CodegenBackend
let libdir = filesearch::relative_target_lib_path(&sysroot, &target);
sysroot.join(libdir).with_file_name("codegen-backends")
})
.filter(|f| {
.find(|f| {
info!("codegen backend candidate: {}", f.display());
f.exists()
})
.next();
});
let sysroot = sysroot.unwrap_or_else(|| {
let candidates = sysroot_candidates
.iter()
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/middle/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ impl<'tcx> TyCtxt<'tcx> {
def_id: DefId,
id: Option<HirId>,
span: Span,
unmarked: impl FnOnce(Span, DefId) -> (),
unmarked: impl FnOnce(Span, DefId),
) {
let soft_handler = |lint, span, msg: &_| {
self.struct_span_lint_hir(lint, id.unwrap_or(hir::CRATE_HIR_ID), span, |lint| {
Expand Down
12 changes: 9 additions & 3 deletions compiler/rustc_middle/src/mir/interpret/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ impl From<ErrorHandled> for InterpErrorInfo<'_> {
}
}

impl From<ErrorReported> for InterpErrorInfo<'_> {
fn from(err: ErrorReported) -> Self {
InterpError::InvalidProgram(InvalidProgramInfo::AlreadyReported(err)).into()
}
}

impl<'tcx> From<InterpError<'tcx>> for InterpErrorInfo<'tcx> {
fn from(kind: InterpError<'tcx>) -> Self {
let capture_backtrace = tls::with_opt(|tcx| {
Expand Down Expand Up @@ -115,8 +121,8 @@ pub enum InvalidProgramInfo<'tcx> {
/// Cannot compute this constant because it depends on another one
/// which already produced an error.
ReferencedConstant,
/// Abort in case type errors are reached.
TypeckError(ErrorReported),
/// Abort in case errors are already reported.
AlreadyReported(ErrorReported),
/// An error occurred during layout computation.
Layout(layout::LayoutError<'tcx>),
/// An invalid transmute happened.
Expand All @@ -129,7 +135,7 @@ impl fmt::Display for InvalidProgramInfo<'_> {
match self {
TooGeneric => write!(f, "encountered overly generic constant"),
ReferencedConstant => write!(f, "referenced constant has errors"),
TypeckError(ErrorReported) => {
AlreadyReported(ErrorReported) => {
write!(f, "encountered constants with type errors, stopping evaluation")
}
Layout(ref err) => write!(f, "{}", err),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/mir/terminator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl SwitchTargets {
pub fn new(targets: impl Iterator<Item = (u128, BasicBlock)>, otherwise: BasicBlock) -> Self {
let (values, mut targets): (SmallVec<_>, SmallVec<_>) = targets.unzip();
targets.push(otherwise);
Self { values: values.into(), targets }
Self { values, targets }
}

/// Builds a switch targets definition that jumps to `then` if the tested value equals `value`,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1641,7 +1641,7 @@ pub type PlaceholderConst = Placeholder<BoundVar>;
#[derive(Hash, HashStable)]
pub struct WithOptConstParam<T> {
pub did: T,
/// The `DefId` of the corresponding generic paramter in case `did` is
/// The `DefId` of the corresponding generic parameter in case `did` is
/// a const argument.
///
/// Note that even if `did` is a const argument, this may still be `None`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
let move_out = self.move_data.moves[(*move_site).moi];
let moved_place = &self.move_data.move_paths[move_out.path].place;
// `*(_1)` where `_1` is a `Box` is actually a move out.
let is_box_move = moved_place.as_ref().projection == &[ProjectionElem::Deref]
let is_box_move = moved_place.as_ref().projection == [ProjectionElem::Deref]
&& self.body.local_decls[moved_place.local].ty.is_box();

!is_box_move
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/const_eval/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl<'tcx> ConstEvalErr<'tcx> {
err_inval!(Layout(LayoutError::Unknown(_))) | err_inval!(TooGeneric) => {
return ErrorHandled::TooGeneric;
}
err_inval!(TypeckError(error_reported)) => {
err_inval!(AlreadyReported(error_reported)) => {
return ErrorHandled::Reported(error_reported);
}
// We must *always* hard error on these, even if the caller wants just a lint.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/const_eval/eval_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fn eval_body_using_ecx<'mir, 'tcx>(
None => InternKind::Constant,
}
};
intern_const_alloc_recursive(ecx, intern_kind, ret);
intern_const_alloc_recursive(ecx, intern_kind, ret)?;

debug!("eval_body_using_ecx done: {:?}", *ret);
Ok(ret)
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_mir/src/const_eval/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ pub(crate) fn const_caller_location(
let mut ecx = mk_eval_cx(tcx, DUMMY_SP, ty::ParamEnv::reveal_all(), false);

let loc_place = ecx.alloc_caller_location(file, line, col);
intern_const_alloc_recursive(&mut ecx, InternKind::Constant, loc_place);
if intern_const_alloc_recursive(&mut ecx, InternKind::Constant, loc_place).is_err() {
bug!("intern_const_alloc_recursive should not error in this case")
}
ConstValue::Scalar(loc_place.ptr)
}

Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_mir/src/interpret/eval_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
if let Some(def) = def.as_local() {
if self.tcx.has_typeck_results(def.did) {
if let Some(error_reported) = self.tcx.typeck_opt_const_arg(def).tainted_by_errors {
throw_inval!(TypeckError(error_reported))
throw_inval!(AlreadyReported(error_reported))
}
}
}
Expand Down Expand Up @@ -525,8 +525,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
Ok(Some(instance)) => Ok(instance),
Ok(None) => throw_inval!(TooGeneric),

// FIXME(eddyb) this could be a bit more specific than `TypeckError`.
Err(error_reported) => throw_inval!(TypeckError(error_reported)),
// FIXME(eddyb) this could be a bit more specific than `AlreadyReported`.
Err(error_reported) => throw_inval!(AlreadyReported(error_reported)),
}
}

Expand Down
7 changes: 6 additions & 1 deletion compiler/rustc_mir/src/interpret/intern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

use super::validity::RefTracking;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_errors::ErrorReported;
use rustc_hir as hir;
use rustc_middle::mir::interpret::InterpResult;
use rustc_middle::ty::{self, layout::TyAndLayout, Ty};
Expand Down Expand Up @@ -285,11 +286,13 @@ pub enum InternKind {
/// tracks where in the value we are and thus can show much better error messages.
/// Any errors here would anyway be turned into `const_err` lints, whereas validation failures
/// are hard errors.
#[tracing::instrument(skip(ecx))]
pub fn intern_const_alloc_recursive<M: CompileTimeMachine<'mir, 'tcx>>(
ecx: &mut InterpCx<'mir, 'tcx, M>,
intern_kind: InternKind,
ret: MPlaceTy<'tcx>,
) where
) -> Result<(), ErrorReported>
where
'tcx: 'mir,
{
let tcx = ecx.tcx;
Expand Down Expand Up @@ -405,12 +408,14 @@ pub fn intern_const_alloc_recursive<M: CompileTimeMachine<'mir, 'tcx>>(
// Codegen does not like dangling pointers, and generally `tcx` assumes that
// all allocations referenced anywhere actually exist. So, make sure we error here.
ecx.tcx.sess.span_err(ecx.tcx.span, "encountered dangling pointer in final constant");
return Err(ErrorReported);
} else if ecx.tcx.get_global_alloc(alloc_id).is_none() {
// We have hit an `AllocId` that is neither in local or global memory and isn't
// marked as dangling by local memory. That should be impossible.
span_bug!(ecx.tcx.span, "encountered unknown alloc id {:?}", alloc_id);
}
}
Ok(())
}

impl<'mir, 'tcx: 'mir, M: super::intern::CompileTimeMachine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/interpret/operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
// Early-return cases.
let val_val = match val.val {
ty::ConstKind::Param(_) | ty::ConstKind::Bound(..) => throw_inval!(TooGeneric),
ty::ConstKind::Error(_) => throw_inval!(TypeckError(ErrorReported)),
ty::ConstKind::Error(_) => throw_inval!(AlreadyReported(ErrorReported)),
ty::ConstKind::Unevaluated(def, substs, promoted) => {
let instance = self.resolve(def, substs)?;
return Ok(self.eval_to_allocation(GlobalId { instance, promoted })?.into());
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/transform/match_branches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl<'tcx> MirPass<'tcx> for MatchBranchSimplification {
};

// Check that destinations are identical, and if not, then don't optimize this block
if &bbs[first].terminator().kind != &bbs[second].terminator().kind {
if bbs[first].terminator().kind != bbs[second].terminator().kind {
continue;
}

Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_resolve/src/late/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1886,9 +1886,8 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
if snippet.starts_with('&') && !snippet.starts_with("&'") {
introduce_suggestion
.push((param.span, format!("&'a {}", &snippet[1..])));
} else if snippet.starts_with("&'_ ") {
introduce_suggestion
.push((param.span, format!("&'a {}", &snippet[4..])));
} else if let Some(stripped) = snippet.strip_prefix("&'_ ") {
introduce_suggestion.push((param.span, format!("&'a {}", &stripped)));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_span/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1574,7 +1574,7 @@ fn normalize_src(src: &mut String, start_pos: BytePos) -> Vec<NormalizedPos> {

/// Removes UTF-8 BOM, if any.
fn remove_bom(src: &mut String, normalized_pos: &mut Vec<NormalizedPos>) {
if src.starts_with("\u{feff}") {
if src.starts_with('\u{feff}') {
src.drain(..3);
normalized_pos.push(NormalizedPos { pos: BytePos(0), diff: 3 });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1388,11 +1388,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
trait_ref: &ty::PolyTraitRef<'tcx>,
) {
let get_trait_impl = |trait_def_id| {
self.tcx.find_map_relevant_impl(
trait_def_id,
trait_ref.skip_binder().self_ty(),
|impl_def_id| Some(impl_def_id),
)
self.tcx.find_map_relevant_impl(trait_def_id, trait_ref.skip_binder().self_ty(), Some)
};
let required_trait_path = self.tcx.def_path_str(trait_ref.def_id());
let all_traits = self.tcx.all_traits(LOCAL_CRATE);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/traits/fulfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> {
Err(ErrorHandled::TooGeneric) => {
pending_obligation.stalled_on = substs
.iter()
.filter_map(|ty| TyOrConstInferVar::maybe_from_generic_arg(ty))
.filter_map(TyOrConstInferVar::maybe_from_generic_arg)
.collect();
ProcessResult::Unchanged
}
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_typeck/src/check/closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let ret_ty = self.inh.infcx.shallow_resolve(ret_ty);
let ret_vid = match *ret_ty.kind() {
ty::Infer(ty::TyVar(ret_vid)) => ret_vid,
ty::Error(_) => return None,
_ => span_bug!(
self.tcx.def_span(expr_def_id),
"async fn generator return type not an inference variable"
Expand Down
Loading