Skip to content

Commit 2d52243

Browse files
committed
Auto merge of #64860 - Centril:rollup-h84usom, r=Centril
Rollup of 14 pull requests Successful merges: - #63492 (Remove redundancy from the implementation of C variadics.) - #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) Failed merges: - #64824 (No StableHasherResult everywhere) r? @ghost
2 parents c6f87c2 + 14a70cc commit 2d52243

File tree

110 files changed

+767
-980
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+767
-980
lines changed

.mailmap

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ David Manescu <[email protected]> <[email protected]>
6969
David Ross <[email protected]>
7070
Derek Chiang <[email protected]> Derek Chiang (Enchi Jiang) <[email protected]>
7171
Diggory Hardy <[email protected]> Diggory Hardy <[email protected]>
72+
Dustin Bensing <[email protected]>
7273
7374
Dzmitry Malyshau <[email protected]>
7475

Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ name = "compiletest"
534534
version = "0.0.0"
535535
dependencies = [
536536
"diff",
537-
"env_logger 0.6.2",
537+
"env_logger 0.7.0",
538538
"getopts",
539539
"lazy_static 1.3.0",
540540
"libc",
@@ -3409,7 +3409,7 @@ dependencies = [
34093409
name = "rustc_driver"
34103410
version = "0.0.0"
34113411
dependencies = [
3412-
"env_logger 0.6.2",
3412+
"env_logger 0.7.0",
34133413
"graphviz",
34143414
"lazy_static 1.3.0",
34153415
"log",

RELEASES.md

-4
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ Stabilized APIs
4747
- [`<*mut T>::cast`]
4848
- [`Duration::as_secs_f32`]
4949
- [`Duration::as_secs_f64`]
50-
- [`Duration::div_duration_f32`]
51-
- [`Duration::div_duration_f64`]
5250
- [`Duration::div_f32`]
5351
- [`Duration::div_f64`]
5452
- [`Duration::from_secs_f32`]
@@ -100,8 +98,6 @@ Compatibility Notes
10098
[`<*mut T>::cast`]: https://doc.rust-lang.org/std/primitive.pointer.html#method.cast
10199
[`Duration::as_secs_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_secs_f32
102100
[`Duration::as_secs_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_secs_f64
103-
[`Duration::div_duration_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_duration_f32
104-
[`Duration::div_duration_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_duration_f64
105101
[`Duration::div_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_f32
106102
[`Duration::div_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_f64
107103
[`Duration::from_secs_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.from_secs_f32

src/liballoc/collections/btree/map.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -580,15 +580,14 @@ impl<K: Ord, V> BTreeMap<K, V> {
580580
/// # Examples
581581
///
582582
/// ```
583-
/// #![feature(map_get_key_value)]
584583
/// use std::collections::BTreeMap;
585584
///
586585
/// let mut map = BTreeMap::new();
587586
/// map.insert(1, "a");
588587
/// assert_eq!(map.get_key_value(&1), Some((&1, &"a")));
589588
/// assert_eq!(map.get_key_value(&2), None);
590589
/// ```
591-
#[unstable(feature = "map_get_key_value", issue = "49347")]
590+
#[stable(feature = "map_get_key_value", since = "1.40.0")]
592591
pub fn get_key_value<Q: ?Sized>(&self, k: &Q) -> Option<(&K, &V)>
593592
where K: Borrow<Q>,
594593
Q: Ord

src/libcore/pin.rs

+2
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@
369369
//! [drop-guarantee]: #drop-guarantee
370370
//! [`poll`]: ../../std/future/trait.Future.html#tymethod.poll
371371
//! [`Pin::get_unchecked_mut`]: struct.Pin.html#method.get_unchecked_mut
372+
//! [`bool`]: ../../std/primitive.bool.html
373+
//! [`i32`]: ../../std/primitive.i32.html
372374
373375
#![stable(feature = "pin", since = "1.33.0")]
374376

src/librustc/dep_graph/dep_tracking_map.rs

-87
This file was deleted.

src/librustc/dep_graph/graph.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ impl DepGraph {
590590
// mark it as green by recursively marking all of its
591591
// dependencies green.
592592
self.try_mark_previous_green(
593-
tcx.global_tcx(),
593+
tcx,
594594
data,
595595
prev_index,
596596
&dep_node

src/librustc/dep_graph/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
pub mod debug;
22
mod dep_node;
3-
mod dep_tracking_map;
43
mod graph;
54
mod prev;
65
mod query;
76
mod safe;
87
mod serialized;
98
pub mod cgu_reuse_tracker;
109

11-
pub use self::dep_tracking_map::{DepTrackingMap, DepTrackingMapConfig};
1210
pub use self::dep_node::{DepNode, DepKind, DepConstructor, WorkProductId, RecoverKey, label_strs};
1311
pub use self::graph::{DepGraph, WorkProduct, DepNodeIndex, DepNodeColor, TaskDeps, hash_result};
1412
pub use self::graph::WorkProductFileKind;

src/librustc/hir/check_attr.rs

+52-20
Original file line numberDiff line numberDiff line change
@@ -93,70 +93,102 @@ struct CheckAttrVisitor<'tcx> {
9393
impl CheckAttrVisitor<'tcx> {
9494
/// Checks any attribute.
9595
fn check_attributes(&self, item: &hir::Item, target: Target) {
96-
if target == Target::Fn || target == Target::Const {
97-
self.tcx.codegen_fn_attrs(self.tcx.hir().local_def_id(item.hir_id));
98-
} else if let Some(a) = item.attrs.iter().find(|a| a.check_name(sym::target_feature)) {
99-
self.tcx.sess.struct_span_err(a.span, "attribute should be applied to a function")
100-
.span_label(item.span, "not a function")
101-
.emit();
102-
}
103-
96+
let mut is_valid = true;
10497
for attr in &item.attrs {
105-
if attr.check_name(sym::inline) {
98+
is_valid &= if attr.check_name(sym::inline) {
10699
self.check_inline(attr, &item.span, target)
107100
} else if attr.check_name(sym::non_exhaustive) {
108101
self.check_non_exhaustive(attr, item, target)
109102
} else if attr.check_name(sym::marker) {
110103
self.check_marker(attr, item, target)
111-
}
104+
} else if attr.check_name(sym::target_feature) {
105+
self.check_target_feature(attr, item, target)
106+
} else {
107+
true
108+
};
109+
}
110+
111+
if !is_valid {
112+
return;
113+
}
114+
115+
if target == Target::Fn {
116+
self.tcx.codegen_fn_attrs(self.tcx.hir().local_def_id(item.hir_id));
112117
}
113118

114119
self.check_repr(item, target);
115120
self.check_used(item, target);
116121
}
117122

118-
/// Checks if an `#[inline]` is applied to a function or a closure.
119-
fn check_inline(&self, attr: &hir::Attribute, span: &Span, target: Target) {
123+
/// Checks if an `#[inline]` is applied to a function or a closure. Returns `true` if valid.
124+
fn check_inline(&self, attr: &hir::Attribute, span: &Span, target: Target) -> bool {
120125
if target != Target::Fn && target != Target::Closure {
121126
struct_span_err!(self.tcx.sess,
122127
attr.span,
123128
E0518,
124129
"attribute should be applied to function or closure")
125130
.span_label(*span, "not a function or closure")
126131
.emit();
132+
false
133+
} else {
134+
true
127135
}
128136
}
129137

130-
/// Checks if the `#[non_exhaustive]` attribute on an `item` is valid.
131-
fn check_non_exhaustive(&self, attr: &hir::Attribute, item: &hir::Item, target: Target) {
138+
/// Checks if the `#[non_exhaustive]` attribute on an `item` is valid. Returns `true` if valid.
139+
fn check_non_exhaustive(
140+
&self,
141+
attr: &hir::Attribute,
142+
item: &hir::Item,
143+
target: Target,
144+
) -> bool {
132145
match target {
133-
Target::Struct | Target::Enum => { /* Valid */ },
146+
Target::Struct | Target::Enum => true,
134147
_ => {
135148
struct_span_err!(self.tcx.sess,
136149
attr.span,
137150
E0701,
138151
"attribute can only be applied to a struct or enum")
139152
.span_label(item.span, "not a struct or enum")
140153
.emit();
141-
return;
154+
false
142155
}
143156
}
144157
}
145158

146-
/// Checks if the `#[marker]` attribute on an `item` is valid.
147-
fn check_marker(&self, attr: &hir::Attribute, item: &hir::Item, target: Target) {
159+
/// Checks if the `#[marker]` attribute on an `item` is valid. Returns `true` if valid.
160+
fn check_marker(&self, attr: &hir::Attribute, item: &hir::Item, target: Target) -> bool {
148161
match target {
149-
Target::Trait => { /* Valid */ },
162+
Target::Trait => true,
150163
_ => {
151164
self.tcx.sess
152165
.struct_span_err(attr.span, "attribute can only be applied to a trait")
153166
.span_label(item.span, "not a trait")
154167
.emit();
155-
return;
168+
false
156169
}
157170
}
158171
}
159172

173+
/// Checks if the `#[target_feature]` attribute on `item` is valid. Returns `true` if valid.
174+
fn check_target_feature(
175+
&self,
176+
attr: &hir::Attribute,
177+
item: &hir::Item,
178+
target: Target,
179+
) -> bool {
180+
match target {
181+
Target::Fn => true,
182+
_ => {
183+
self.tcx.sess
184+
.struct_span_err(attr.span, "attribute should be applied to a function")
185+
.span_label(item.span, "not a function")
186+
.emit();
187+
false
188+
},
189+
}
190+
}
191+
160192
/// Checks if the `#[repr]` attributes on `item` are valid.
161193
fn check_repr(&self, item: &hir::Item, target: Target) {
162194
// Extract the names of all repr hints, e.g., [foo, bar, align] for:

src/librustc/hir/intravisit.rs

-3
Original file line numberDiff line numberDiff line change
@@ -633,9 +633,6 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) {
633633
TyKind::Typeof(ref expression) => {
634634
visitor.visit_anon_const(expression)
635635
}
636-
TyKind::CVarArgs(ref lt) => {
637-
visitor.visit_lifetime(lt)
638-
}
639636
TyKind::Infer | TyKind::Err => {}
640637
}
641638
}

src/librustc/hir/lowering.rs

+21-10
Original file line numberDiff line numberDiff line change
@@ -1335,13 +1335,8 @@ impl<'a> LoweringContext<'a> {
13351335
}
13361336
}
13371337
}
1338-
TyKind::Mac(_) => bug!("`TyMac` should have been expanded by now"),
1339-
TyKind::CVarArgs => {
1340-
// Create the implicit lifetime of the "spoofed" `VaListImpl`.
1341-
let span = self.sess.source_map().next_point(t.span.shrink_to_lo());
1342-
let lt = self.new_implicit_lifetime(span);
1343-
hir::TyKind::CVarArgs(lt)
1344-
},
1338+
TyKind::Mac(_) => bug!("`TyKind::Mac` should have been expanded by now"),
1339+
TyKind::CVarArgs => bug!("`TyKind::CVarArgs` should have been handled elsewhere"),
13451340
};
13461341

13471342
hir::Ty {
@@ -2093,7 +2088,14 @@ impl<'a> LoweringContext<'a> {
20932088
}
20942089

20952090
fn lower_fn_params_to_names(&mut self, decl: &FnDecl) -> hir::HirVec<Ident> {
2096-
decl.inputs
2091+
// Skip the `...` (`CVarArgs`) trailing arguments from the AST,
2092+
// as they are not explicit in HIR/Ty function signatures.
2093+
// (instead, the `c_variadic` flag is set to `true`)
2094+
let mut inputs = &decl.inputs[..];
2095+
if decl.c_variadic() {
2096+
inputs = &inputs[..inputs.len() - 1];
2097+
}
2098+
inputs
20972099
.iter()
20982100
.map(|param| match param.pat.kind {
20992101
PatKind::Ident(_, ident, _) => ident,
@@ -2130,10 +2132,19 @@ impl<'a> LoweringContext<'a> {
21302132
self.anonymous_lifetime_mode
21312133
};
21322134

2135+
let c_variadic = decl.c_variadic();
2136+
21332137
// Remember how many lifetimes were already around so that we can
21342138
// only look at the lifetime parameters introduced by the arguments.
21352139
let inputs = self.with_anonymous_lifetime_mode(lt_mode, |this| {
2136-
decl.inputs
2140+
// Skip the `...` (`CVarArgs`) trailing arguments from the AST,
2141+
// as they are not explicit in HIR/Ty function signatures.
2142+
// (instead, the `c_variadic` flag is set to `true`)
2143+
let mut inputs = &decl.inputs[..];
2144+
if c_variadic {
2145+
inputs = &inputs[..inputs.len() - 1];
2146+
}
2147+
inputs
21372148
.iter()
21382149
.map(|param| {
21392150
if let Some((_, ibty)) = &mut in_band_ty_params {
@@ -2168,7 +2179,7 @@ impl<'a> LoweringContext<'a> {
21682179
P(hir::FnDecl {
21692180
inputs,
21702181
output,
2171-
c_variadic: decl.c_variadic,
2182+
c_variadic,
21722183
implicit_self: decl.inputs.get(0).map_or(
21732184
hir::ImplicitSelfKind::None,
21742185
|arg| {

0 commit comments

Comments
 (0)