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 12 pull requests #79994

Merged
merged 35 commits into from
Dec 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ce3d604
std::iter: document iteration over `&T` and `&mut T`
wchargin Nov 23, 2020
6edc90a
[update patch]
wchargin Nov 23, 2020
872b5cd
Link loop/for keyword
pickfire Nov 25, 2020
6b272e0
Fix typo in keyword link
pickfire Nov 25, 2020
2d4cfd0
Add while loop keyword to see also
pickfire Nov 25, 2020
5cab04e
Remove deprecated linked_list_extras methods.
m-ou-se Dec 8, 2020
8909c4d
Fix rustup support in default_build_triple for python3
jyn514 Dec 9, 2020
56d8936
Add post-initialization hook for static memory initialized using the …
JCTyblaidd Dec 11, 2020
6ce2990
Fix rustfmt failure
JCTyblaidd Dec 11, 2020
175226a
Rustfmt
JCTyblaidd Dec 11, 2020
5c8de1c
use strip_prefix over slicing (clippy::manual_strip)
matthiaskrgr Dec 11, 2020
82fe5c1
don't convert types into identical types with .into() (clippy::useles…
matthiaskrgr Dec 11, 2020
db6c509
don't clone types that are copy (clippy::clone_on_copy)
matthiaskrgr Dec 11, 2020
b7795e1
fix clippy::{needless_bool, manual_unwrap_or}
matthiaskrgr Dec 11, 2020
5833f74
use if let Some(x) = .. instead of ...map(|x|) to conditionally run …
matthiaskrgr Dec 11, 2020
cf10a0a
fix clippy::unnecessary_filter_map
matthiaskrgr Dec 11, 2020
6a1f92b
Fix typo in `DebruijnIndex` documentation
LeSeulArtichaut Dec 12, 2020
16f69b5
Don't checkout llvm-project when the LLVM backend isn't built
bjorn3 Dec 12, 2020
d79e19f
Don't require cmake and ninja when the LLVM backend is not used
bjorn3 Dec 12, 2020
2b455aa
rustdoc light theme: Fix CSS for selected buttons
camelid Dec 12, 2020
600efe7
Remove an unused dependency that made `rustdoc` crash
Nadrieril Dec 12, 2020
9df0348
Fix building compiler docs with stage 0
jyn514 Dec 12, 2020
98118bb
Fixes submit event of the search input
GuillaumeGomez Dec 12, 2020
1698773
Rollup merge of #79360 - wchargin:wchargin-doc-iter-by-reference, r=m…
JohnTitor Dec 13, 2020
d559bb6
Rollup merge of #79398 - pickfire:keyword, r=Dylan-DPC
JohnTitor Dec 13, 2020
89051d8
Rollup merge of #79834 - m-ou-se:bye-linked-list-extras, r=Mark-Simul…
JohnTitor Dec 13, 2020
f80c6ae
Rollup merge of #79845 - jyn514:python3, r=Mark-Simulacrum
JohnTitor Dec 13, 2020
1b81f08
Rollup merge of #79940 - matthiaskrgr:cl15ppy, r=Dylan-DPC
JohnTitor Dec 13, 2020
2b43980
Rollup merge of #79942 - JCTyblaidd:static-mem-init, r=RalfJung
JohnTitor Dec 13, 2020
54119d4
Rollup merge of #79954 - jyn514:normalize-oops, r=Mark-Simulacrum
JohnTitor Dec 13, 2020
e4a663c
Rollup merge of #79963 - LeSeulArtichaut:debruijn-typo, r=Dylan-DPC
JohnTitor Dec 13, 2020
d90084c
Rollup merge of #79970 - bjorn3:no_unnecessary_llvm_checkout, r=Mark-…
JohnTitor Dec 13, 2020
5115bbf
Rollup merge of #79973 - camelid:rustdoc-search-tab-color, r=Guillaum…
JohnTitor Dec 13, 2020
424e44a
Rollup merge of #79984 - Nadrieril:remove-unused-dep, r=jyn514
JohnTitor Dec 13, 2020
3213089
Rollup merge of #79985 - GuillaumeGomez:fix-submit-event, r=jyn514
JohnTitor Dec 13, 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
3 changes: 0 additions & 3 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -725,9 +725,6 @@ checksum = "9a21fa21941700a3cd8fcb4091f361a6a712fac632f85d9f487cc892045d55c6"
[[package]]
name = "coverage_test_macros"
version = "0.0.0"
dependencies = [
"proc-macro2",
]

[[package]]
name = "cpuid-bool"
Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,10 +597,7 @@ impl<'a> TraitDef<'a> {

let mut ty_params = params
.iter()
.filter_map(|param| match param.kind {
ast::GenericParamKind::Type { .. } => Some(param),
_ => None,
})
.filter(|param| matches!(param.kind, ast::GenericParamKind::Type{..}))
.peekable();

if ty_params.peek().is_some() {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_llvm/src/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -854,8 +854,8 @@ fn generic_simd_intrinsic(
));
}

if name_str.starts_with("simd_shuffle") {
let n: u64 = name_str["simd_shuffle".len()..].parse().unwrap_or_else(|_| {
if let Some(stripped) = name_str.strip_prefix("simd_shuffle") {
let n: u64 = stripped.parse().unwrap_or_else(|_| {
span_bug!(span, "bad `simd_shuffle` instruction only caught in codegen?")
});

Expand Down
36 changes: 18 additions & 18 deletions compiler/rustc_llvm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ fn main() {
cmd.args(&components);

for lib in output(&mut cmd).split_whitespace() {
let name = if lib.starts_with("-l") {
&lib[2..]
} else if lib.starts_with('-') {
&lib[1..]
let name = if let Some(stripped) = lib.strip_prefix("-l") {
stripped
} else if let Some(stripped) = lib.strip_prefix('-') {
stripped
} else if Path::new(lib).exists() {
// On MSVC llvm-config will print the full name to libraries, but
// we're only interested in the name part
Expand Down Expand Up @@ -241,17 +241,17 @@ fn main() {
cmd.arg(llvm_link_arg).arg("--ldflags");
for lib in output(&mut cmd).split_whitespace() {
if is_crossed {
if lib.starts_with("-LIBPATH:") {
println!("cargo:rustc-link-search=native={}", lib[9..].replace(&host, &target));
} else if lib.starts_with("-L") {
println!("cargo:rustc-link-search=native={}", lib[2..].replace(&host, &target));
if let Some(stripped) = lib.strip_prefix("-LIBPATH:") {
println!("cargo:rustc-link-search=native={}", stripped.replace(&host, &target));
} else if let Some(stripped) = lib.strip_prefix("-L") {
println!("cargo:rustc-link-search=native={}", stripped.replace(&host, &target));
}
} else if lib.starts_with("-LIBPATH:") {
println!("cargo:rustc-link-search=native={}", &lib[9..]);
} else if lib.starts_with("-l") {
println!("cargo:rustc-link-lib={}", &lib[2..]);
} else if lib.starts_with("-L") {
println!("cargo:rustc-link-search=native={}", &lib[2..]);
} else if let Some(stripped) = lib.strip_prefix("-LIBPATH:") {
println!("cargo:rustc-link-search=native={}", stripped);
} else if let Some(stripped) = lib.strip_prefix("-l") {
println!("cargo:rustc-link-lib={}", stripped);
} else if let Some(stripped) = lib.strip_prefix("-L") {
println!("cargo:rustc-link-search=native={}", stripped);
}
}

Expand All @@ -262,10 +262,10 @@ fn main() {
let llvm_linker_flags = tracked_env_var_os("LLVM_LINKER_FLAGS");
if let Some(s) = llvm_linker_flags {
for lib in s.into_string().unwrap().split_whitespace() {
if lib.starts_with("-l") {
println!("cargo:rustc-link-lib={}", &lib[2..]);
} else if lib.starts_with("-L") {
println!("cargo:rustc-link-search=native={}", &lib[2..]);
if let Some(stripped) = lib.strip_prefix("-l") {
println!("cargo:rustc-link-lib={}", stripped);
} else if let Some(stripped) = lib.strip_prefix("-L") {
println!("cargo:rustc-link-search=native={}", stripped);
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions compiler/rustc_mir/src/interpret/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use std::hash::Hash;
use rustc_middle::mir;
use rustc_middle::ty::{self, Ty};
use rustc_span::def_id::DefId;
use rustc_target::abi::Size;

use super::{
AllocId, Allocation, AllocationExtra, CheckInAllocMsg, Frame, ImmTy, InterpCx, InterpResult,
Expand Down Expand Up @@ -299,6 +300,15 @@ pub trait Machine<'mir, 'tcx>: Sized {
Ok(())
}

/// Called after initializing static memory using the interpreter.
fn after_static_mem_initialized(
_ecx: &mut InterpCx<'mir, 'tcx, Self>,
_ptr: Pointer<Self::PointerTag>,
_size: Size,
) -> InterpResult<'tcx> {
Ok(())
}

/// Executes a retagging operation
#[inline]
fn retag(
Expand Down
9 changes: 4 additions & 5 deletions compiler/rustc_mir/src/interpret/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
// If you touch this code, be sure to also make the corresponding changes to
// `get_vtable` in `rust_codegen_llvm/meth.rs`.
// /////////////////////////////////////////////////////////////////////////////////////////
let vtable = self.memory.allocate(
ptr_size * u64::try_from(methods.len()).unwrap().checked_add(3).unwrap(),
ptr_align,
MemoryKind::Vtable,
);
let vtable_size = ptr_size * u64::try_from(methods.len()).unwrap().checked_add(3).unwrap();
let vtable = self.memory.allocate(vtable_size, ptr_align, MemoryKind::Vtable);

let drop = Instance::resolve_drop_in_place(tcx, ty);
let drop = self.memory.create_fn_alloc(FnVal::Instance(drop));
Expand Down Expand Up @@ -93,6 +90,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
}
}

M::after_static_mem_initialized(self, vtable, vtable_size)?;

self.memory.mark_immutable(vtable.alloc_id)?;
assert!(self.vtables.insert((ty, poly_trait_ref), vtable).is_none());

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_mir/src/transform/coverage/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ impl DebugCounters {
),
};
counters
.insert(id.into(), DebugCounter::new(counter_kind.clone(), some_block_label))
.insert(id, DebugCounter::new(counter_kind.clone(), some_block_label))
.expect_none(
"attempt to add the same counter_kind to DebugCounters more than once",
);
Expand Down Expand Up @@ -340,7 +340,7 @@ impl DebugCounters {
if self.some_counters.is_some() && (counter_format.block || !counter_format.id) {
let counters = self.some_counters.as_ref().unwrap();
if let Some(DebugCounter { some_block_label: Some(block_label), .. }) =
counters.get(&id.into())
counters.get(&id)
{
return if counter_format.id {
format!("{}#{}", block_label, id.index())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@ edition = "2018"
[lib]
proc-macro = true
doctest = false

[dependencies]
proc-macro2 = "1"
7 changes: 4 additions & 3 deletions compiler/rustc_mir/src/transform/early_otherwise_branch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,10 @@ impl<'a, 'tcx> Helper<'a, 'tcx> {
let discr = self.find_switch_discriminant_info(bb, switch)?;

// go through each target, finding a discriminant read, and a switch
let results = discr.targets_with_values.iter().map(|(value, target)| {
self.find_discriminant_switch_pairing(&discr, target.clone(), value.clone())
});
let results = discr
.targets_with_values
.iter()
.map(|(value, target)| self.find_discriminant_switch_pairing(&discr, *target, *value));

// if the optimization did not apply for one of the targets, then abort
if results.clone().any(|x| x.is_none()) || results.len() == 0 {
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_mir_build/src/build/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -616,8 +616,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
debug!("stmt_expr Break val block_context.push(SubExpr)");
self.block_context.push(BlockFrame::SubExpr);
unpack!(block = self.into(destination, dest_scope, block, value));
dest_scope
.map(|scope| self.unschedule_drop(scope, destination.as_local().unwrap()));
if let Some(scope) = dest_scope {
self.unschedule_drop(scope, destination.as_local().unwrap())
};
self.block_context.pop();
} else {
self.cfg.push_assign_unit(block, source_info, destination, self.hir.tcx())
Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_session/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1109,10 +1109,7 @@ impl Session {
}

pub fn link_dead_code(&self) -> bool {
match self.opts.cg.link_dead_code {
Some(explicitly_set) => explicitly_set,
None => false,
}
self.opts.cg.link_dead_code.unwrap_or(false)
}

pub fn mark_attr_known(&self, attr: &Attribute) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1448,31 +1448,30 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
});
};

typeck_results
if let Some(cause) = typeck_results
.generator_interior_types
.iter()
.find(|ty::GeneratorInteriorTypeCause { ty, .. }| ty_matches(ty))
.map(|cause| {
// Check to see if any awaited expressions have the target type.
let from_awaited_ty = visitor
.awaits
.into_iter()
.map(|id| hir.expect_expr(id))
.find(|await_expr| {
let ty = typeck_results.expr_ty_adjusted(&await_expr);
debug!(
"maybe_note_obligation_cause_for_async_await: await_expr={:?}",
await_expr
);
ty_matches(ty)
})
.map(|expr| expr.span);
let ty::GeneratorInteriorTypeCause { span, scope_span, yield_span, expr, .. } =
cause;
{
// Check to see if any awaited expressions have the target type.
let from_awaited_ty = visitor
.awaits
.into_iter()
.map(|id| hir.expect_expr(id))
.find(|await_expr| {
let ty = typeck_results.expr_ty_adjusted(&await_expr);
debug!(
"maybe_note_obligation_cause_for_async_await: await_expr={:?}",
await_expr
);
ty_matches(ty)
})
.map(|expr| expr.span);
let ty::GeneratorInteriorTypeCause { span, scope_span, yield_span, expr, .. } = cause;

interior_or_upvar_span = Some(GeneratorInteriorOrUpvar::Interior(*span));
interior_extra_info = Some((*scope_span, *yield_span, *expr, from_awaited_ty));
});
interior_or_upvar_span = Some(GeneratorInteriorOrUpvar::Interior(*span));
interior_extra_info = Some((*scope_span, *yield_span, *expr, from_awaited_ty));
};

debug!(
"maybe_note_obligation_cause_for_async_await: interior_or_upvar={:?} \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
);
nested.push(Obligation::new(
obligation.cause.clone(),
obligation.param_env.clone(),
obligation.param_env,
normalized_super_trait,
));
}
Expand Down Expand Up @@ -485,7 +485,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
);
nested.push(Obligation::new(
obligation.cause.clone(),
obligation.param_env.clone(),
obligation.param_env,
normalized_bound,
));
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_type_ir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ rustc_index::newtype_index! {
/// Bruijn index of 0, meaning "the innermost binder" (in this case, a
/// fn). The region `'a` that appears in the second argument type (`&'a
/// isize`) would then be assigned a De Bruijn index of 1, meaning "the
/// second-innermost binder". (These indices are written on the arrays
/// second-innermost binder". (These indices are written on the arrows
/// in the diagram).
///
/// What is interesting is that De Bruijn index attached to a particular
Expand Down
21 changes: 10 additions & 11 deletions compiler/rustc_typeck/src/check/upvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,17 +294,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

closure_captures.insert(*var_hir_id, upvar_id);

let new_capture_kind = if let Some(capture_kind) =
upvar_capture_map.get(&upvar_id)
{
// upvar_capture_map only stores the UpvarCapture (CaptureKind),
// so we create a fake capture info with no expression.
let fake_capture_info =
ty::CaptureInfo { expr_id: None, capture_kind: capture_kind.clone() };
determine_capture_info(fake_capture_info, capture_info).capture_kind
} else {
capture_info.capture_kind
};
let new_capture_kind =
if let Some(capture_kind) = upvar_capture_map.get(&upvar_id) {
// upvar_capture_map only stores the UpvarCapture (CaptureKind),
// so we create a fake capture info with no expression.
let fake_capture_info =
ty::CaptureInfo { expr_id: None, capture_kind: *capture_kind };
determine_capture_info(fake_capture_info, capture_info).capture_kind
} else {
capture_info.capture_kind
};
upvar_capture_map.insert(upvar_id, new_capture_kind);
}
}
Expand Down
7 changes: 1 addition & 6 deletions compiler/rustc_typeck/src/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2141,13 +2141,8 @@ fn explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicat
// * It must be an associated type for this trait (*not* a
// supertrait).
if let ty::Projection(projection) = ty.kind() {
if projection.substs == trait_identity_substs
projection.substs == trait_identity_substs
&& tcx.associated_item(projection.item_def_id).container.id() == def_id
{
true
} else {
false
}
} else {
false
}
Expand Down
62 changes: 0 additions & 62 deletions library/alloc/src/collections/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1099,68 +1099,6 @@ impl<T> ExactSizeIterator for IterMut<'_, T> {}
#[stable(feature = "fused", since = "1.26.0")]
impl<T> FusedIterator for IterMut<'_, T> {}

impl<T> IterMut<'_, T> {
/// Inserts the given element just after the element most recently returned by `.next()`.
/// The inserted element does not appear in the iteration.
///
/// This method will be removed soon.
#[inline]
#[unstable(
feature = "linked_list_extras",
reason = "this is probably better handled by a cursor type -- we'll see",
issue = "27794"
)]
#[rustc_deprecated(
reason = "Deprecated in favor of CursorMut methods. This method will be removed soon.",
since = "1.47.0"
)]
pub fn insert_next(&mut self, element: T) {
match self.head {
// `push_back` is okay with aliasing `element` references
None => self.list.push_back(element),
Some(head) => unsafe {
let prev = match head.as_ref().prev {
// `push_front` is okay with aliasing nodes
None => return self.list.push_front(element),
Some(prev) => prev,
};

let node = Some(
Box::leak(box Node { next: Some(head), prev: Some(prev), element }).into(),
);

// Not creating references to entire nodes to not invalidate the
// reference to `element` we handed to the user.
(*prev.as_ptr()).next = node;
(*head.as_ptr()).prev = node;

self.list.len += 1;
},
}
}

/// Provides a reference to the next element, without changing the iterator.
///
/// This method will be removed soon.
#[inline]
#[unstable(
feature = "linked_list_extras",
reason = "this is probably better handled by a cursor type -- we'll see",
issue = "27794"
)]
#[rustc_deprecated(
reason = "Deprecated in favor of CursorMut methods. This method will be removed soon.",
since = "1.47.0"
)]
pub fn peek_next(&mut self) -> Option<&mut T> {
if self.len == 0 {
None
} else {
unsafe { self.head.as_mut().map(|node| &mut node.as_mut().element) }
}
}
}

/// A cursor over a `LinkedList`.
///
/// A `Cursor` is like an iterator, except that it can freely seek back-and-forth.
Expand Down
Loading