Skip to content

Commit c38ca44

Browse files
committed
Auto merge of rust-lang#116769 - matthiaskrgr:rollup-1ivruaq, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang#115955 (Stabilize `{IpAddr, Ipv6Addr}::to_canonical`) - rust-lang#116033 (report `unused_import` for empty reexports even it is pub) - rust-lang#116172 (Broaden the consequences of recursive TLS initialization) - rust-lang#116341 (Implement sys::args for UEFI) - rust-lang#116522 (use `PatKind::Error` when an ADT const value has violation) - rust-lang#116732 (Make x capable of resolving symlinks) - rust-lang#116755 (Remove me from libcore review rotation) - rust-lang#116760 (Remove trivial cast in `guaranteed_eq`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 64368d0 + fe8ff72 commit c38ca44

File tree

47 files changed

+347
-74
lines changed

Some content is hidden

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

47 files changed

+347
-74
lines changed

Diff for: compiler/rustc_ast/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ pub mod visit;
5353

5454
pub use self::ast::*;
5555
pub use self::ast_traits::{AstDeref, AstNodeWrapper, HasAttrs, HasNodeId, HasSpan, HasTokens};
56-
pub use self::format::*;
5756

5857
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
5958

Diff for: compiler/rustc_codegen_llvm/src/debuginfo/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ mod utils;
5050

5151
pub use self::create_scope_map::compute_mir_scopes;
5252
pub use self::metadata::build_global_var_di_node;
53-
pub use self::metadata::extend_scope_to_file;
5453

5554
#[allow(non_upper_case_globals)]
5655
const DW_TAG_auto_variable: c_uint = 0x100;

Diff for: compiler/rustc_codegen_llvm/src/mono_item.rs

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use crate::llvm;
66
use crate::type_of::LayoutLlvmExt;
77
use rustc_codegen_ssa::traits::*;
88
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
9-
pub use rustc_middle::mir::mono::MonoItem;
109
use rustc_middle::mir::mono::{Linkage, Visibility};
1110
use rustc_middle::ty::layout::{FnAbiOf, LayoutOf};
1211
use rustc_middle::ty::{self, Instance, TypeVisitableExt};

Diff for: compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ mod arg_matrix;
44
mod checks;
55
mod suggestions;
66

7-
pub use _impl::*;
87
use rustc_errors::ErrorGuaranteed;
9-
pub use suggestions::*;
108

119
use crate::coercion::DynamicCoerceMany;
1210
use crate::{Diverges, EnclosingBreakables, Inherited};

Diff for: compiler/rustc_infer/src/traits/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use rustc_span::Span;
1919

2020
pub use self::FulfillmentErrorCode::*;
2121
pub use self::ImplSource::*;
22-
pub use self::ObligationCauseCode::*;
2322
pub use self::SelectionError::*;
2423

2524
pub use self::engine::{TraitEngine, TraitEngineExt};

Diff for: compiler/rustc_middle/src/mir/terminator.rs

-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ use rustc_hir::LangItem;
33
use smallvec::SmallVec;
44

55
use super::{BasicBlock, InlineAsmOperand, Operand, SourceInfo, TerminatorKind, UnwindAction};
6-
pub use rustc_ast::Mutability;
76
use rustc_macros::HashStable;
87
use std::iter;
98
use std::slice;
109

11-
pub use super::query::*;
1210
use super::*;
1311

1412
impl SwitchTargets {

Diff for: compiler/rustc_middle/src/ty/assoc.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
pub use self::AssocItemContainer::*;
2-
31
use crate::ty;
42
use rustc_data_structures::sorted_map::SortedIndexMultiMap;
53
use rustc_hir as hir;

Diff for: compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs

+8
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,14 @@ impl<'tcx> ConstToPat<'tcx> {
198198
// We errored. Signal that in the pattern, so that follow up errors can be silenced.
199199
let kind = PatKind::Error(e);
200200
return Box::new(Pat { span: self.span, ty: cv.ty(), kind });
201+
} else if let ty::Adt(..) = cv.ty().kind() && matches!(cv, mir::Const::Val(..)) {
202+
// This branch is only entered when the current `cv` is `mir::Const::Val`.
203+
// This is because `mir::Const::ty` has already been handled by `Self::recur`
204+
// and the invalid types may be ignored.
205+
let err = TypeNotStructural { span: self.span, non_sm_ty };
206+
let e = self.tcx().sess.emit_err(err);
207+
let kind = PatKind::Error(e);
208+
return Box::new(Pat { span: self.span, ty: cv.ty(), kind });
201209
} else if !self.saw_const_match_lint.get() {
202210
if let Some(mir_structural_match_violation) = mir_structural_match_violation {
203211
match non_sm_ty.kind() {

Diff for: compiler/rustc_mir_dataflow/src/framework/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ mod visitor;
4848
pub use self::cursor::{AnalysisResults, ResultsClonedCursor, ResultsCursor, ResultsRefCursor};
4949
pub use self::direction::{Backward, Direction, Forward};
5050
pub use self::engine::{Engine, EntrySets, Results, ResultsCloned};
51-
pub use self::lattice::{JoinSemiLattice, MaybeReachable, MeetSemiLattice};
51+
pub use self::lattice::{JoinSemiLattice, MaybeReachable};
5252
pub use self::visitor::{visit_results, ResultsVisitable, ResultsVisitor};
5353

5454
/// Analysis domains are all bitsets of various kinds. This trait holds

Diff for: compiler/rustc_resolve/src/check_unused.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ struct UnusedImportCheckVisitor<'a, 'b, 'tcx> {
5959
base_use_tree: Option<&'a ast::UseTree>,
6060
base_id: ast::NodeId,
6161
item_span: Span,
62-
base_use_is_pub: bool,
6362
}
6463

6564
struct ExternCrateToLint {
@@ -146,7 +145,6 @@ impl<'a, 'b, 'tcx> Visitor<'a> for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
146145
// because this means that they were generated in some fashion by the
147146
// compiler and we don't need to consider them.
148147
ast::ItemKind::Use(..) if item.span.is_dummy() => return,
149-
ast::ItemKind::Use(..) => self.base_use_is_pub = item.vis.kind.is_pub(),
150148
ast::ItemKind::ExternCrate(orig_name) => {
151149
self.extern_crate_items.push(ExternCrateToLint {
152150
id: item.id,
@@ -173,7 +171,7 @@ impl<'a, 'b, 'tcx> Visitor<'a> for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
173171
self.base_use_tree = Some(use_tree);
174172
}
175173

176-
if self.base_use_is_pub {
174+
if self.r.effective_visibilities.is_exported(self.r.local_def_id(id)) {
177175
self.check_import_as_underscore(use_tree, id);
178176
return;
179177
}
@@ -332,7 +330,6 @@ impl Resolver<'_, '_> {
332330
base_use_tree: None,
333331
base_id: ast::DUMMY_NODE_ID,
334332
item_span: DUMMY_SP,
335-
base_use_is_pub: false,
336333
};
337334
visit::walk_crate(&mut visitor, krate);
338335

Diff for: compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use std::ops::ControlFlow;
2020

2121
pub use self::infer_ctxt_ext::*;
2222
pub use self::type_err_ctxt_ext::*;
23-
pub use rustc_infer::traits::error_reporting::*;
2423

2524
// When outputting impl candidates, prefer showing those that are more similar.
2625
//

Diff for: compiler/rustc_trait_selection/src/traits/mod.rs

-5
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ use std::ops::ControlFlow;
4141

4242
pub(crate) use self::project::{needs_normalization, BoundVarReplacer, PlaceholderReplacer};
4343

44-
pub use self::FulfillmentErrorCode::*;
45-
pub use self::ImplSource::*;
46-
pub use self::ObligationCauseCode::*;
47-
pub use self::SelectionError::*;
48-
4944
pub use self::coherence::{add_placeholder_note, orphan_check, overlapping_impls};
5045
pub use self::coherence::{OrphanCheckErr, OverlapResult};
5146
pub use self::engine::{ObligationCtxt, TraitEngineExt};

Diff for: compiler/rustc_trait_selection/src/traits/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_middle::ty::{self, ImplSubject, ToPredicate, Ty, TyCtxt, TypeVisitable
99
use rustc_span::Span;
1010
use smallvec::SmallVec;
1111

12-
pub use rustc_infer::traits::{self, util::*};
12+
pub use rustc_infer::traits::util::*;
1313

1414
///////////////////////////////////////////////////////////////////////////
1515
// `TraitAliasExpander` iterator

Diff for: library/core/src/net/ip_addr.rs

+13-10
Original file line numberDiff line numberDiff line change
@@ -410,21 +410,24 @@ impl IpAddr {
410410
/// # Examples
411411
///
412412
/// ```
413-
/// #![feature(ip)]
414413
/// use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
415414
///
415+
/// let localhost_v4 = Ipv4Addr::new(127, 0, 0, 1);
416+
///
417+
/// assert_eq!(IpAddr::V4(localhost_v4).to_canonical(), localhost_v4);
418+
/// assert_eq!(IpAddr::V6(localhost_v4.to_ipv6_mapped()).to_canonical(), localhost_v4);
416419
/// assert_eq!(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)).to_canonical().is_loopback(), true);
417420
/// assert_eq!(IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0x7f00, 0x1)).is_loopback(), false);
418421
/// assert_eq!(IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0x7f00, 0x1)).to_canonical().is_loopback(), true);
419422
/// ```
420423
#[inline]
421424
#[must_use = "this returns the result of the operation, \
422425
without modifying the original"]
423-
#[rustc_const_unstable(feature = "const_ip", issue = "76205")]
424-
#[unstable(feature = "ip", issue = "27709")]
426+
#[stable(feature = "ip_to_canonical", since = "CURRENT_RUSTC_VERSION")]
427+
#[rustc_const_stable(feature = "ip_to_canonical", since = "CURRENT_RUSTC_VERSION")]
425428
pub const fn to_canonical(&self) -> IpAddr {
426429
match self {
427-
&v4 @ IpAddr::V4(_) => v4,
430+
IpAddr::V4(_) => *self,
428431
IpAddr::V6(v6) => v6.to_canonical(),
429432
}
430433
}
@@ -1748,11 +1751,11 @@ impl Ipv6Addr {
17481751
/// Some(Ipv4Addr::new(192, 10, 2, 255)));
17491752
/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1).to_ipv4_mapped(), None);
17501753
/// ```
1751-
#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]
1752-
#[stable(feature = "ipv6_to_ipv4_mapped", since = "1.63.0")]
1754+
#[inline]
17531755
#[must_use = "this returns the result of the operation, \
17541756
without modifying the original"]
1755-
#[inline]
1757+
#[stable(feature = "ipv6_to_ipv4_mapped", since = "1.63.0")]
1758+
#[rustc_const_stable(feature = "const_ipv6_to_ipv4_mapped", since = "CURRENT_RUSTC_VERSION")]
17561759
pub const fn to_ipv4_mapped(&self) -> Option<Ipv4Addr> {
17571760
match self.octets() {
17581761
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, a, b, c, d] => {
@@ -1817,11 +1820,11 @@ impl Ipv6Addr {
18171820
/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0x7f00, 0x1).is_loopback(), false);
18181821
/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0x7f00, 0x1).to_canonical().is_loopback(), true);
18191822
/// ```
1820-
#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]
1821-
#[unstable(feature = "ip", issue = "27709")]
1823+
#[inline]
18221824
#[must_use = "this returns the result of the operation, \
18231825
without modifying the original"]
1824-
#[inline]
1826+
#[stable(feature = "ip_to_canonical", since = "CURRENT_RUSTC_VERSION")]
1827+
#[rustc_const_stable(feature = "ip_to_canonical", since = "CURRENT_RUSTC_VERSION")]
18251828
pub const fn to_canonical(&self) -> IpAddr {
18261829
if let Some(mapped) = self.to_ipv4_mapped() {
18271830
return IpAddr::V4(mapped);

Diff for: library/core/src/ptr/const_ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ impl<T: ?Sized> *const T {
842842
where
843843
T: Sized,
844844
{
845-
match intrinsics::ptr_guaranteed_cmp(self as _, other as _) {
845+
match intrinsics::ptr_guaranteed_cmp(self, other) {
846846
2 => None,
847847
other => Some(other == 1),
848848
}

Diff for: library/core/tests/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@
120120
#![deny(unsafe_op_in_unsafe_fn)]
121121
#![deny(fuzzy_provenance_casts)]
122122

123-
extern crate test;
124-
125123
mod alloc;
126124
mod any;
127125
mod array;

Diff for: library/core/tests/num/flt2dec/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ use core::num::flt2dec::{
88
};
99
use core::num::fmt::{Formatted, Part};
1010

11-
pub use test::Bencher;
12-
1311
mod estimator;
1412
mod strategy {
1513
mod dragon;

Diff for: library/portable-simd/crates/core_simd/src/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,5 @@ pub mod simd {
3535
pub use crate::core_simd::masks::*;
3636
pub use crate::core_simd::ord::*;
3737
pub use crate::core_simd::swizzle::*;
38-
pub use crate::core_simd::swizzle_dyn::*;
3938
pub use crate::core_simd::vector::*;
4039
}

Diff for: library/std/src/sys/common/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
pub mod alloc;
1414
pub mod small_c_string;
15+
#[allow(unused_imports)]
1516
pub mod thread_local;
1617

1718
#[cfg(test)]

0 commit comments

Comments
 (0)