Skip to content

Commit f2623ac

Browse files
author
The Miri Conjob Bot
committed
Merge from rustc
2 parents 3b091cb + 2ba4eb2 commit f2623ac

Some content is hidden

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

41 files changed

+7348
-137
lines changed

compiler/rustc_feature/src/active.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ declare_features! (
236236
/// Allows using the `#[fundamental]` attribute.
237237
(active, fundamental, "1.0.0", Some(29635), None),
238238
/// Allows using `#[link_name="llvm.*"]`.
239-
(active, link_llvm_intrinsics, "1.0.0", Some(29602), None),
239+
(internal, link_llvm_intrinsics, "1.0.0", Some(29602), None),
240240
/// Allows using the `#[linkage = ".."]` attribute.
241241
(active, linkage, "1.0.0", Some(29603), None),
242242
/// Allows declaring with `#![needs_panic_runtime]` that a panic runtime is needed.
@@ -245,6 +245,8 @@ declare_features! (
245245
(active, packed_bundled_libs, "1.69.0", Some(108081), None),
246246
/// Allows using the `#![panic_runtime]` attribute.
247247
(internal, panic_runtime, "1.10.0", Some(32837), None),
248+
/// Allows `extern "platform-intrinsic" { ... }`.
249+
(internal, platform_intrinsics, "1.4.0", Some(27731), None),
248250
/// Allows using `#[rustc_allow_const_fn_unstable]`.
249251
/// This is an attribute on `const fn` for the same
250252
/// purpose as `#[allow_internal_unstable]`.
@@ -526,8 +528,6 @@ declare_features! (
526528
(active, object_safe_for_dispatch, "1.40.0", Some(43561), None),
527529
/// Allows using `#[optimize(X)]`.
528530
(active, optimize_attribute, "1.34.0", Some(54882), None),
529-
/// Allows `extern "platform-intrinsic" { ... }`.
530-
(active, platform_intrinsics, "1.4.0", Some(27731), None),
531531
/// Allows using `#![plugin(myplugin)]`.
532532
(active, plugin, "1.0.0", Some(29597), None),
533533
/// Allows exhaustive integer pattern matching on `usize` and `isize`.

compiler/rustc_lint/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,14 @@ mod unused;
8686

8787
pub use array_into_iter::ARRAY_INTO_ITER;
8888

89-
use rustc_ast as ast;
9089
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
9190
use rustc_fluent_macro::fluent_messages;
92-
use rustc_hir as hir;
93-
use rustc_hir::def_id::{LocalDefId, LocalModDefId};
91+
use rustc_hir::def_id::LocalModDefId;
9492
use rustc_middle::query::Providers;
9593
use rustc_middle::ty::TyCtxt;
9694
use rustc_session::lint::builtin::{
9795
BARE_TRAIT_OBJECTS, ELIDED_LIFETIMES_IN_PATHS, EXPLICIT_OUTLIVES_REQUIREMENTS,
9896
};
99-
use rustc_span::symbol::Ident;
100-
use rustc_span::Span;
10197

10298
use array_into_iter::ArrayIntoIter;
10399
use builtin::*;

compiler/rustc_lint/src/passes.rs

Lines changed: 77 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,53 @@
11
use crate::context::{EarlyContext, LateContext};
22

3-
use rustc_ast as ast;
4-
use rustc_hir as hir;
53
use rustc_session::lint::builtin::HardwiredLints;
64
use rustc_session::lint::LintPass;
7-
use rustc_span::def_id::LocalDefId;
8-
use rustc_span::symbol::Ident;
9-
use rustc_span::Span;
105

116
#[macro_export]
127
macro_rules! late_lint_methods {
138
($macro:path, $args:tt) => (
149
$macro!($args, [
15-
fn check_body(a: &'tcx hir::Body<'tcx>);
16-
fn check_body_post(a: &'tcx hir::Body<'tcx>);
10+
fn check_body(a: &'tcx rustc_hir::Body<'tcx>);
11+
fn check_body_post(a: &'tcx rustc_hir::Body<'tcx>);
1712
fn check_crate();
1813
fn check_crate_post();
19-
fn check_mod(a: &'tcx hir::Mod<'tcx>, b: hir::HirId);
20-
fn check_foreign_item(a: &'tcx hir::ForeignItem<'tcx>);
21-
fn check_item(a: &'tcx hir::Item<'tcx>);
22-
fn check_item_post(a: &'tcx hir::Item<'tcx>);
23-
fn check_local(a: &'tcx hir::Local<'tcx>);
24-
fn check_block(a: &'tcx hir::Block<'tcx>);
25-
fn check_block_post(a: &'tcx hir::Block<'tcx>);
26-
fn check_stmt(a: &'tcx hir::Stmt<'tcx>);
27-
fn check_arm(a: &'tcx hir::Arm<'tcx>);
28-
fn check_pat(a: &'tcx hir::Pat<'tcx>);
29-
fn check_expr(a: &'tcx hir::Expr<'tcx>);
30-
fn check_expr_post(a: &'tcx hir::Expr<'tcx>);
31-
fn check_ty(a: &'tcx hir::Ty<'tcx>);
32-
fn check_generic_param(a: &'tcx hir::GenericParam<'tcx>);
33-
fn check_generics(a: &'tcx hir::Generics<'tcx>);
34-
fn check_poly_trait_ref(a: &'tcx hir::PolyTraitRef<'tcx>);
14+
fn check_mod(a: &'tcx rustc_hir::Mod<'tcx>, b: rustc_hir::HirId);
15+
fn check_foreign_item(a: &'tcx rustc_hir::ForeignItem<'tcx>);
16+
fn check_item(a: &'tcx rustc_hir::Item<'tcx>);
17+
fn check_item_post(a: &'tcx rustc_hir::Item<'tcx>);
18+
fn check_local(a: &'tcx rustc_hir::Local<'tcx>);
19+
fn check_block(a: &'tcx rustc_hir::Block<'tcx>);
20+
fn check_block_post(a: &'tcx rustc_hir::Block<'tcx>);
21+
fn check_stmt(a: &'tcx rustc_hir::Stmt<'tcx>);
22+
fn check_arm(a: &'tcx rustc_hir::Arm<'tcx>);
23+
fn check_pat(a: &'tcx rustc_hir::Pat<'tcx>);
24+
fn check_expr(a: &'tcx rustc_hir::Expr<'tcx>);
25+
fn check_expr_post(a: &'tcx rustc_hir::Expr<'tcx>);
26+
fn check_ty(a: &'tcx rustc_hir::Ty<'tcx>);
27+
fn check_generic_param(a: &'tcx rustc_hir::GenericParam<'tcx>);
28+
fn check_generics(a: &'tcx rustc_hir::Generics<'tcx>);
29+
fn check_poly_trait_ref(a: &'tcx rustc_hir::PolyTraitRef<'tcx>);
3530
fn check_fn(
3631
a: rustc_hir::intravisit::FnKind<'tcx>,
37-
b: &'tcx hir::FnDecl<'tcx>,
38-
c: &'tcx hir::Body<'tcx>,
39-
d: Span,
40-
e: LocalDefId);
41-
fn check_trait_item(a: &'tcx hir::TraitItem<'tcx>);
42-
fn check_impl_item(a: &'tcx hir::ImplItem<'tcx>);
43-
fn check_impl_item_post(a: &'tcx hir::ImplItem<'tcx>);
44-
fn check_struct_def(a: &'tcx hir::VariantData<'tcx>);
45-
fn check_field_def(a: &'tcx hir::FieldDef<'tcx>);
46-
fn check_variant(a: &'tcx hir::Variant<'tcx>);
47-
fn check_path(a: &hir::Path<'tcx>, b: hir::HirId);
48-
fn check_attribute(a: &'tcx ast::Attribute);
32+
b: &'tcx rustc_hir::FnDecl<'tcx>,
33+
c: &'tcx rustc_hir::Body<'tcx>,
34+
d: rustc_span::Span,
35+
e: rustc_span::def_id::LocalDefId);
36+
fn check_trait_item(a: &'tcx rustc_hir::TraitItem<'tcx>);
37+
fn check_impl_item(a: &'tcx rustc_hir::ImplItem<'tcx>);
38+
fn check_impl_item_post(a: &'tcx rustc_hir::ImplItem<'tcx>);
39+
fn check_struct_def(a: &'tcx rustc_hir::VariantData<'tcx>);
40+
fn check_field_def(a: &'tcx rustc_hir::FieldDef<'tcx>);
41+
fn check_variant(a: &'tcx rustc_hir::Variant<'tcx>);
42+
fn check_path(a: &rustc_hir::Path<'tcx>, b: rustc_hir::HirId);
43+
fn check_attribute(a: &'tcx rustc_ast::Attribute);
4944

5045
/// Called when entering a syntax node that can have lint attributes such
5146
/// as `#[allow(...)]`. Called with *all* the attributes of that node.
52-
fn enter_lint_attrs(a: &'tcx [ast::Attribute]);
47+
fn enter_lint_attrs(a: &'tcx [rustc_ast::Attribute]);
5348

5449
/// Counterpart to `enter_lint_attrs`.
55-
fn exit_lint_attrs(a: &'tcx [ast::Attribute]);
50+
fn exit_lint_attrs(a: &'tcx [rustc_ast::Attribute]);
5651
]);
5752
)
5853
}
@@ -90,8 +85,8 @@ macro_rules! expand_combined_late_lint_pass_method {
9085
#[macro_export]
9186
macro_rules! expand_combined_late_lint_pass_methods {
9287
($passes:tt, [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => (
93-
$(fn $name(&mut self, context: &LateContext<'tcx>, $($param: $arg),*) {
94-
expand_combined_late_lint_pass_method!($passes, self, $name, (context, $($param),*));
88+
$(fn $name(&mut self, context: &$crate::LateContext<'tcx>, $($param: $arg),*) {
89+
$crate::expand_combined_late_lint_pass_method!($passes, self, $name, (context, $($param),*));
9590
})*
9691
)
9792
}
@@ -116,19 +111,19 @@ macro_rules! declare_combined_late_lint_pass {
116111
}
117112
}
118113

119-
$v fn get_lints() -> LintArray {
114+
$v fn get_lints() -> $crate::LintArray {
120115
let mut lints = Vec::new();
121116
$(lints.extend_from_slice(&$pass::get_lints());)*
122117
lints
123118
}
124119
}
125120

126-
impl<'tcx> LateLintPass<'tcx> for $name {
127-
expand_combined_late_lint_pass_methods!([$($pass),*], $methods);
121+
impl<'tcx> $crate::LateLintPass<'tcx> for $name {
122+
$crate::expand_combined_late_lint_pass_methods!([$($pass),*], $methods);
128123
}
129124

130125
#[allow(rustc::lint_pass_impl_without_macro)]
131-
impl LintPass for $name {
126+
impl $crate::LintPass for $name {
132127
fn name(&self) -> &'static str {
133128
panic!()
134129
}
@@ -140,42 +135,45 @@ macro_rules! declare_combined_late_lint_pass {
140135
macro_rules! early_lint_methods {
141136
($macro:path, $args:tt) => (
142137
$macro!($args, [
143-
fn check_param(a: &ast::Param);
144-
fn check_ident(a: Ident);
145-
fn check_crate(a: &ast::Crate);
146-
fn check_crate_post(a: &ast::Crate);
147-
fn check_item(a: &ast::Item);
148-
fn check_item_post(a: &ast::Item);
149-
fn check_local(a: &ast::Local);
150-
fn check_block(a: &ast::Block);
151-
fn check_stmt(a: &ast::Stmt);
152-
fn check_arm(a: &ast::Arm);
153-
fn check_pat(a: &ast::Pat);
154-
fn check_pat_post(a: &ast::Pat);
155-
fn check_expr(a: &ast::Expr);
156-
fn check_expr_post(a: &ast::Expr);
157-
fn check_ty(a: &ast::Ty);
158-
fn check_generic_arg(a: &ast::GenericArg);
159-
fn check_generic_param(a: &ast::GenericParam);
160-
fn check_generics(a: &ast::Generics);
161-
fn check_poly_trait_ref(a: &ast::PolyTraitRef);
162-
fn check_fn(a: rustc_ast::visit::FnKind<'_>, c: Span, d_: ast::NodeId);
163-
fn check_trait_item(a: &ast::AssocItem);
164-
fn check_impl_item(a: &ast::AssocItem);
165-
fn check_variant(a: &ast::Variant);
166-
fn check_attribute(a: &ast::Attribute);
167-
fn check_mac_def(a: &ast::MacroDef);
168-
fn check_mac(a: &ast::MacCall);
138+
fn check_param(a: &rustc_ast::Param);
139+
fn check_ident(a: rustc_span::symbol::Ident);
140+
fn check_crate(a: &rustc_ast::Crate);
141+
fn check_crate_post(a: &rustc_ast::Crate);
142+
fn check_item(a: &rustc_ast::Item);
143+
fn check_item_post(a: &rustc_ast::Item);
144+
fn check_local(a: &rustc_ast::Local);
145+
fn check_block(a: &rustc_ast::Block);
146+
fn check_stmt(a: &rustc_ast::Stmt);
147+
fn check_arm(a: &rustc_ast::Arm);
148+
fn check_pat(a: &rustc_ast::Pat);
149+
fn check_pat_post(a: &rustc_ast::Pat);
150+
fn check_expr(a: &rustc_ast::Expr);
151+
fn check_expr_post(a: &rustc_ast::Expr);
152+
fn check_ty(a: &rustc_ast::Ty);
153+
fn check_generic_arg(a: &rustc_ast::GenericArg);
154+
fn check_generic_param(a: &rustc_ast::GenericParam);
155+
fn check_generics(a: &rustc_ast::Generics);
156+
fn check_poly_trait_ref(a: &rustc_ast::PolyTraitRef);
157+
fn check_fn(
158+
a: rustc_ast::visit::FnKind<'_>,
159+
c: rustc_span::Span,
160+
d_: rustc_ast::NodeId);
161+
fn check_trait_item(a: &rustc_ast::AssocItem);
162+
fn check_impl_item(a: &rustc_ast::AssocItem);
163+
fn check_variant(a: &rustc_ast::Variant);
164+
fn check_attribute(a: &rustc_ast::Attribute);
165+
fn check_mac_def(a: &rustc_ast::MacroDef);
166+
fn check_mac(a: &rustc_ast::MacCall);
169167

170168
/// Called when entering a syntax node that can have lint attributes such
171169
/// as `#[allow(...)]`. Called with *all* the attributes of that node.
172-
fn enter_lint_attrs(a: &[ast::Attribute]);
170+
fn enter_lint_attrs(a: &[rustc_ast::Attribute]);
173171

174172
/// Counterpart to `enter_lint_attrs`.
175-
fn exit_lint_attrs(a: &[ast::Attribute]);
173+
fn exit_lint_attrs(a: &[rustc_ast::Attribute]);
176174

177-
fn enter_where_predicate(a: &ast::WherePredicate);
178-
fn exit_where_predicate(a: &ast::WherePredicate);
175+
fn enter_where_predicate(a: &rustc_ast::WherePredicate);
176+
fn exit_where_predicate(a: &rustc_ast::WherePredicate);
179177
]);
180178
)
181179
}
@@ -202,8 +200,8 @@ macro_rules! expand_combined_early_lint_pass_method {
202200
#[macro_export]
203201
macro_rules! expand_combined_early_lint_pass_methods {
204202
($passes:tt, [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => (
205-
$(fn $name(&mut self, context: &EarlyContext<'_>, $($param: $arg),*) {
206-
expand_combined_early_lint_pass_method!($passes, self, $name, (context, $($param),*));
203+
$(fn $name(&mut self, context: &$crate::EarlyContext<'_>, $($param: $arg),*) {
204+
$crate::expand_combined_early_lint_pass_method!($passes, self, $name, (context, $($param),*));
207205
})*
208206
)
209207
}
@@ -228,19 +226,19 @@ macro_rules! declare_combined_early_lint_pass {
228226
}
229227
}
230228

231-
$v fn get_lints() -> LintArray {
229+
$v fn get_lints() -> $crate::LintArray {
232230
let mut lints = Vec::new();
233231
$(lints.extend_from_slice(&$pass::get_lints());)*
234232
lints
235233
}
236234
}
237235

238-
impl EarlyLintPass for $name {
239-
expand_combined_early_lint_pass_methods!([$($pass),*], $methods);
236+
impl $crate::EarlyLintPass for $name {
237+
$crate::expand_combined_early_lint_pass_methods!([$($pass),*], $methods);
240238
}
241239

242240
#[allow(rustc::lint_pass_impl_without_macro)]
243-
impl LintPass for $name {
241+
impl $crate::LintPass for $name {
244242
fn name(&self) -> &'static str {
245243
panic!()
246244
}

compiler/rustc_middle/src/mir/syntax.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,7 @@ pub enum AggregateKind<'tcx> {
13331333
Generator(DefId, GenericArgsRef<'tcx>, hir::Movability),
13341334
}
13351335

1336-
#[derive(Clone, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
1336+
#[derive(Copy, Clone, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
13371337
pub enum NullOp<'tcx> {
13381338
/// Returns the size of a value of that type
13391339
SizeOf,

compiler/rustc_middle/src/thir.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -732,12 +732,16 @@ pub enum PatKind<'tcx> {
732732
},
733733

734734
/// One of the following:
735-
/// * `&str`, which will be handled as a string pattern and thus exhaustiveness
736-
/// checking will detect if you use the same string twice in different patterns.
737-
/// * integer, bool, char or float, which will be handled by exhaustiveness to cover exactly
738-
/// its own value, similar to `&str`, but these values are much simpler.
739-
/// * Opaque constants, that must not be matched structurally. So anything that does not derive
740-
/// `PartialEq` and `Eq`.
735+
/// * `&str` (represented as a valtree), which will be handled as a string pattern and thus
736+
/// exhaustiveness checking will detect if you use the same string twice in different
737+
/// patterns.
738+
/// * integer, bool, char or float (represented as a valtree), which will be handled by
739+
/// exhaustiveness to cover exactly its own value, similar to `&str`, but these values are
740+
/// much simpler.
741+
/// * Opaque constants (represented as `mir::ConstValue`), that must not be matched
742+
/// structurally. So anything that does not derive `PartialEq` and `Eq`.
743+
///
744+
/// These are always compared with the matched place using (the semantics of) `PartialEq`.
741745
Constant {
742746
value: mir::Const<'tcx>,
743747
},

0 commit comments

Comments
 (0)