Skip to content

Commit

Permalink
Auto merge of #64864 - Centril:rollup-pxz6tw3, r=Centril
Browse files Browse the repository at this point in the history
Rollup of 14 pull requests

Successful merges:

 - #64703 (Docs: slice elements are equidistant)
 - #64745 (Include message on tests that should panic but do not)
 - #64781 (Remove stray references to the old global tcx)
 - #64794 (Remove unused DepTrackingMap)
 - #64802 (Account for tail expressions when pointing at return type)
 - #64809 (hir: Disallow `target_feature` on constants)
 - #64815 (Fix div_duration() marked as stable by mistake)
 - #64818 (update rtpSpawn's parameters type(It's prototype has been updated in libc))
 - #64830 (Thou shallt not `.abort_if_errors()`)
 - #64836 (Stabilize map_get_key_value feature)
 - #64845 (pin.rs: fix links to primitives in documentation)
 - #64847 (Upgrade env_logger to 0.7)
 - #64851 (Add mailmap entry for Dustin Bensing by request)
 - #64859 (check_match: improve diagnostics for `let A = 2;` with `const A: i32 = 3`)

Failed merges:

r? @ghost
  • Loading branch information
bors committed Sep 28, 2019
2 parents c6f87c2 + 017944c commit f3c8eba
Show file tree
Hide file tree
Showing 80 changed files with 569 additions and 600 deletions.
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ David Manescu <david.manescu@gmail.com> <dman2626@uni.sydney.edu.au>
David Ross <daboross@daboross.net>
Derek Chiang <derekchiang93@gmail.com> Derek Chiang (Enchi Jiang) <derekchiang93@gmail.com>
Diggory Hardy <diggory.hardy@gmail.com> Diggory Hardy <github@dhardy.name>
Dustin Bensing <dustin.bensing@googlemail.com>
Dylan Braithwaite <dylanbraithwaite1@gmail.com> <mail@dylanb.me>
Dzmitry Malyshau <kvarkus@gmail.com>
E. Dunham <edunham@mozilla.com> edunham <edunham@mozilla.com>
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ name = "compiletest"
version = "0.0.0"
dependencies = [
"diff",
"env_logger 0.6.2",
"env_logger 0.7.0",
"getopts",
"lazy_static 1.3.0",
"libc",
Expand Down Expand Up @@ -3409,7 +3409,7 @@ dependencies = [
name = "rustc_driver"
version = "0.0.0"
dependencies = [
"env_logger 0.6.2",
"env_logger 0.7.0",
"graphviz",
"lazy_static 1.3.0",
"log",
Expand Down
4 changes: 0 additions & 4 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ Stabilized APIs
- [`<*mut T>::cast`]
- [`Duration::as_secs_f32`]
- [`Duration::as_secs_f64`]
- [`Duration::div_duration_f32`]
- [`Duration::div_duration_f64`]
- [`Duration::div_f32`]
- [`Duration::div_f64`]
- [`Duration::from_secs_f32`]
Expand Down Expand Up @@ -100,8 +98,6 @@ Compatibility Notes
[`<*mut T>::cast`]: https://doc.rust-lang.org/std/primitive.pointer.html#method.cast
[`Duration::as_secs_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_secs_f32
[`Duration::as_secs_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_secs_f64
[`Duration::div_duration_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_duration_f32
[`Duration::div_duration_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_duration_f64
[`Duration::div_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_f32
[`Duration::div_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_f64
[`Duration::from_secs_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.from_secs_f32
Expand Down
3 changes: 1 addition & 2 deletions src/liballoc/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -580,15 +580,14 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// # Examples
///
/// ```
/// #![feature(map_get_key_value)]
/// use std::collections::BTreeMap;
///
/// let mut map = BTreeMap::new();
/// map.insert(1, "a");
/// assert_eq!(map.get_key_value(&1), Some((&1, &"a")));
/// assert_eq!(map.get_key_value(&2), None);
/// ```
#[unstable(feature = "map_get_key_value", issue = "49347")]
#[stable(feature = "map_get_key_value", since = "1.40.0")]
pub fn get_key_value<Q: ?Sized>(&self, k: &Q) -> Option<(&K, &V)>
where K: Borrow<Q>,
Q: Ord
Expand Down
2 changes: 2 additions & 0 deletions src/libcore/pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@
//! [drop-guarantee]: #drop-guarantee
//! [`poll`]: ../../std/future/trait.Future.html#tymethod.poll
//! [`Pin::get_unchecked_mut`]: struct.Pin.html#method.get_unchecked_mut
//! [`bool`]: ../../std/primitive.bool.html
//! [`i32`]: ../../std/primitive.i32.html

#![stable(feature = "pin", since = "1.33.0")]

Expand Down
87 changes: 0 additions & 87 deletions src/librustc/dep_graph/dep_tracking_map.rs

This file was deleted.

2 changes: 1 addition & 1 deletion src/librustc/dep_graph/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ impl DepGraph {
// mark it as green by recursively marking all of its
// dependencies green.
self.try_mark_previous_green(
tcx.global_tcx(),
tcx,
data,
prev_index,
&dep_node
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/dep_graph/mod.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
pub mod debug;
mod dep_node;
mod dep_tracking_map;
mod graph;
mod prev;
mod query;
mod safe;
mod serialized;
pub mod cgu_reuse_tracker;

pub use self::dep_tracking_map::{DepTrackingMap, DepTrackingMapConfig};
pub use self::dep_node::{DepNode, DepKind, DepConstructor, WorkProductId, RecoverKey, label_strs};
pub use self::graph::{DepGraph, WorkProduct, DepNodeIndex, DepNodeColor, TaskDeps, hash_result};
pub use self::graph::WorkProductFileKind;
Expand Down
72 changes: 52 additions & 20 deletions src/librustc/hir/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,70 +93,102 @@ struct CheckAttrVisitor<'tcx> {
impl CheckAttrVisitor<'tcx> {
/// Checks any attribute.
fn check_attributes(&self, item: &hir::Item, target: Target) {
if target == Target::Fn || target == Target::Const {
self.tcx.codegen_fn_attrs(self.tcx.hir().local_def_id(item.hir_id));
} else if let Some(a) = item.attrs.iter().find(|a| a.check_name(sym::target_feature)) {
self.tcx.sess.struct_span_err(a.span, "attribute should be applied to a function")
.span_label(item.span, "not a function")
.emit();
}

let mut is_valid = true;
for attr in &item.attrs {
if attr.check_name(sym::inline) {
is_valid &= if attr.check_name(sym::inline) {
self.check_inline(attr, &item.span, target)
} else if attr.check_name(sym::non_exhaustive) {
self.check_non_exhaustive(attr, item, target)
} else if attr.check_name(sym::marker) {
self.check_marker(attr, item, target)
}
} else if attr.check_name(sym::target_feature) {
self.check_target_feature(attr, item, target)
} else {
true
};
}

if !is_valid {
return;
}

if target == Target::Fn {
self.tcx.codegen_fn_attrs(self.tcx.hir().local_def_id(item.hir_id));
}

self.check_repr(item, target);
self.check_used(item, target);
}

/// Checks if an `#[inline]` is applied to a function or a closure.
fn check_inline(&self, attr: &hir::Attribute, span: &Span, target: Target) {
/// Checks if an `#[inline]` is applied to a function or a closure. Returns `true` if valid.
fn check_inline(&self, attr: &hir::Attribute, span: &Span, target: Target) -> bool {
if target != Target::Fn && target != Target::Closure {
struct_span_err!(self.tcx.sess,
attr.span,
E0518,
"attribute should be applied to function or closure")
.span_label(*span, "not a function or closure")
.emit();
false
} else {
true
}
}

/// Checks if the `#[non_exhaustive]` attribute on an `item` is valid.
fn check_non_exhaustive(&self, attr: &hir::Attribute, item: &hir::Item, target: Target) {
/// Checks if the `#[non_exhaustive]` attribute on an `item` is valid. Returns `true` if valid.
fn check_non_exhaustive(
&self,
attr: &hir::Attribute,
item: &hir::Item,
target: Target,
) -> bool {
match target {
Target::Struct | Target::Enum => { /* Valid */ },
Target::Struct | Target::Enum => true,
_ => {
struct_span_err!(self.tcx.sess,
attr.span,
E0701,
"attribute can only be applied to a struct or enum")
.span_label(item.span, "not a struct or enum")
.emit();
return;
false
}
}
}

/// Checks if the `#[marker]` attribute on an `item` is valid.
fn check_marker(&self, attr: &hir::Attribute, item: &hir::Item, target: Target) {
/// Checks if the `#[marker]` attribute on an `item` is valid. Returns `true` if valid.
fn check_marker(&self, attr: &hir::Attribute, item: &hir::Item, target: Target) -> bool {
match target {
Target::Trait => { /* Valid */ },
Target::Trait => true,
_ => {
self.tcx.sess
.struct_span_err(attr.span, "attribute can only be applied to a trait")
.span_label(item.span, "not a trait")
.emit();
return;
false
}
}
}

/// Checks if the `#[target_feature]` attribute on `item` is valid. Returns `true` if valid.
fn check_target_feature(
&self,
attr: &hir::Attribute,
item: &hir::Item,
target: Target,
) -> bool {
match target {
Target::Fn => true,
_ => {
self.tcx.sess
.struct_span_err(attr.span, "attribute should be applied to a function")
.span_label(item.span, "not a function")
.emit();
false
},
}
}

/// Checks if the `#[repr]` attributes on `item` are valid.
fn check_repr(&self, item: &hir::Item, target: Target) {
// Extract the names of all repr hints, e.g., [foo, bar, align] for:
Expand Down
3 changes: 1 addition & 2 deletions src/librustc/hir/lowering/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,6 @@ impl LoweringContext<'_> {
E0628,
"generators cannot have explicit parameters"
);
self.sess.abort_if_errors();
}
Some(match movability {
Movability::Movable => hir::GeneratorMovability::Movable,
Expand Down Expand Up @@ -998,7 +997,7 @@ impl LoweringContext<'_> {
E0727,
"`async` generators are not yet supported",
);
self.sess.abort_if_errors();
return hir::ExprKind::Err;
},
None => self.generator_kind = Some(hir::GeneratorKind::Gen),
}
Expand Down
Loading

0 comments on commit f3c8eba

Please sign in to comment.