Skip to content

Commit

Permalink
Auto merge of rust-lang#116769 - matthiaskrgr:rollup-1ivruaq, r=matth…
Browse files Browse the repository at this point in the history
…iaskrgr

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
  • Loading branch information
bors committed Oct 15, 2023
2 parents 64368d0 + fe8ff72 commit c38ca44
Show file tree
Hide file tree
Showing 47 changed files with 347 additions and 74 deletions.
1 change: 0 additions & 1 deletion compiler/rustc_ast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ pub mod visit;

pub use self::ast::*;
pub use self::ast_traits::{AstDeref, AstNodeWrapper, HasAttrs, HasNodeId, HasSpan, HasTokens};
pub use self::format::*;

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

Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_codegen_llvm/src/debuginfo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ mod utils;

pub use self::create_scope_map::compute_mir_scopes;
pub use self::metadata::build_global_var_di_node;
pub use self::metadata::extend_scope_to_file;

#[allow(non_upper_case_globals)]
const DW_TAG_auto_variable: c_uint = 0x100;
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_codegen_llvm/src/mono_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use crate::llvm;
use crate::type_of::LayoutLlvmExt;
use rustc_codegen_ssa::traits::*;
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
pub use rustc_middle::mir::mono::MonoItem;
use rustc_middle::mir::mono::{Linkage, Visibility};
use rustc_middle::ty::layout::{FnAbiOf, LayoutOf};
use rustc_middle::ty::{self, Instance, TypeVisitableExt};
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ mod arg_matrix;
mod checks;
mod suggestions;

pub use _impl::*;
use rustc_errors::ErrorGuaranteed;
pub use suggestions::*;

use crate::coercion::DynamicCoerceMany;
use crate::{Diverges, EnclosingBreakables, Inherited};
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_infer/src/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use rustc_span::Span;

pub use self::FulfillmentErrorCode::*;
pub use self::ImplSource::*;
pub use self::ObligationCauseCode::*;
pub use self::SelectionError::*;

pub use self::engine::{TraitEngine, TraitEngineExt};
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_middle/src/mir/terminator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ use rustc_hir::LangItem;
use smallvec::SmallVec;

use super::{BasicBlock, InlineAsmOperand, Operand, SourceInfo, TerminatorKind, UnwindAction};
pub use rustc_ast::Mutability;
use rustc_macros::HashStable;
use std::iter;
use std::slice;

pub use super::query::*;
use super::*;

impl SwitchTargets {
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_middle/src/ty/assoc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
pub use self::AssocItemContainer::*;

use crate::ty;
use rustc_data_structures::sorted_map::SortedIndexMultiMap;
use rustc_hir as hir;
Expand Down
8 changes: 8 additions & 0 deletions compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ impl<'tcx> ConstToPat<'tcx> {
// We errored. Signal that in the pattern, so that follow up errors can be silenced.
let kind = PatKind::Error(e);
return Box::new(Pat { span: self.span, ty: cv.ty(), kind });
} else if let ty::Adt(..) = cv.ty().kind() && matches!(cv, mir::Const::Val(..)) {
// This branch is only entered when the current `cv` is `mir::Const::Val`.
// This is because `mir::Const::ty` has already been handled by `Self::recur`
// and the invalid types may be ignored.
let err = TypeNotStructural { span: self.span, non_sm_ty };
let e = self.tcx().sess.emit_err(err);
let kind = PatKind::Error(e);
return Box::new(Pat { span: self.span, ty: cv.ty(), kind });
} else if !self.saw_const_match_lint.get() {
if let Some(mir_structural_match_violation) = mir_structural_match_violation {
match non_sm_ty.kind() {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_dataflow/src/framework/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ mod visitor;
pub use self::cursor::{AnalysisResults, ResultsClonedCursor, ResultsCursor, ResultsRefCursor};
pub use self::direction::{Backward, Direction, Forward};
pub use self::engine::{Engine, EntrySets, Results, ResultsCloned};
pub use self::lattice::{JoinSemiLattice, MaybeReachable, MeetSemiLattice};
pub use self::lattice::{JoinSemiLattice, MaybeReachable};
pub use self::visitor::{visit_results, ResultsVisitable, ResultsVisitor};

/// Analysis domains are all bitsets of various kinds. This trait holds
Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_resolve/src/check_unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ struct UnusedImportCheckVisitor<'a, 'b, 'tcx> {
base_use_tree: Option<&'a ast::UseTree>,
base_id: ast::NodeId,
item_span: Span,
base_use_is_pub: bool,
}

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

if self.base_use_is_pub {
if self.r.effective_visibilities.is_exported(self.r.local_def_id(id)) {
self.check_import_as_underscore(use_tree, id);
return;
}
Expand Down Expand Up @@ -332,7 +330,6 @@ impl Resolver<'_, '_> {
base_use_tree: None,
base_id: ast::DUMMY_NODE_ID,
item_span: DUMMY_SP,
base_use_is_pub: false,
};
visit::walk_crate(&mut visitor, krate);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use std::ops::ControlFlow;

pub use self::infer_ctxt_ext::*;
pub use self::type_err_ctxt_ext::*;
pub use rustc_infer::traits::error_reporting::*;

// When outputting impl candidates, prefer showing those that are more similar.
//
Expand Down
5 changes: 0 additions & 5 deletions compiler/rustc_trait_selection/src/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ use std::ops::ControlFlow;

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

pub use self::FulfillmentErrorCode::*;
pub use self::ImplSource::*;
pub use self::ObligationCauseCode::*;
pub use self::SelectionError::*;

pub use self::coherence::{add_placeholder_note, orphan_check, overlapping_impls};
pub use self::coherence::{OrphanCheckErr, OverlapResult};
pub use self::engine::{ObligationCtxt, TraitEngineExt};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/traits/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustc_middle::ty::{self, ImplSubject, ToPredicate, Ty, TyCtxt, TypeVisitable
use rustc_span::Span;
use smallvec::SmallVec;

pub use rustc_infer::traits::{self, util::*};
pub use rustc_infer::traits::util::*;

///////////////////////////////////////////////////////////////////////////
// `TraitAliasExpander` iterator
Expand Down
23 changes: 13 additions & 10 deletions library/core/src/net/ip_addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,21 +410,24 @@ impl IpAddr {
/// # Examples
///
/// ```
/// #![feature(ip)]
/// use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
///
/// let localhost_v4 = Ipv4Addr::new(127, 0, 0, 1);
///
/// assert_eq!(IpAddr::V4(localhost_v4).to_canonical(), localhost_v4);
/// assert_eq!(IpAddr::V6(localhost_v4.to_ipv6_mapped()).to_canonical(), localhost_v4);
/// assert_eq!(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)).to_canonical().is_loopback(), true);
/// assert_eq!(IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0x7f00, 0x1)).is_loopback(), false);
/// assert_eq!(IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0x7f00, 0x1)).to_canonical().is_loopback(), true);
/// ```
#[inline]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[rustc_const_unstable(feature = "const_ip", issue = "76205")]
#[unstable(feature = "ip", issue = "27709")]
#[stable(feature = "ip_to_canonical", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "ip_to_canonical", since = "CURRENT_RUSTC_VERSION")]
pub const fn to_canonical(&self) -> IpAddr {
match self {
&v4 @ IpAddr::V4(_) => v4,
IpAddr::V4(_) => *self,
IpAddr::V6(v6) => v6.to_canonical(),
}
}
Expand Down Expand Up @@ -1748,11 +1751,11 @@ impl Ipv6Addr {
/// Some(Ipv4Addr::new(192, 10, 2, 255)));
/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1).to_ipv4_mapped(), None);
/// ```
#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]
#[stable(feature = "ipv6_to_ipv4_mapped", since = "1.63.0")]
#[inline]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
#[stable(feature = "ipv6_to_ipv4_mapped", since = "1.63.0")]
#[rustc_const_stable(feature = "const_ipv6_to_ipv4_mapped", since = "CURRENT_RUSTC_VERSION")]
pub const fn to_ipv4_mapped(&self) -> Option<Ipv4Addr> {
match self.octets() {
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, a, b, c, d] => {
Expand Down Expand Up @@ -1817,11 +1820,11 @@ impl Ipv6Addr {
/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0x7f00, 0x1).is_loopback(), false);
/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0x7f00, 0x1).to_canonical().is_loopback(), true);
/// ```
#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]
#[unstable(feature = "ip", issue = "27709")]
#[inline]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
#[stable(feature = "ip_to_canonical", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "ip_to_canonical", since = "CURRENT_RUSTC_VERSION")]
pub const fn to_canonical(&self) -> IpAddr {
if let Some(mapped) = self.to_ipv4_mapped() {
return IpAddr::V4(mapped);
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/ptr/const_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ impl<T: ?Sized> *const T {
where
T: Sized,
{
match intrinsics::ptr_guaranteed_cmp(self as _, other as _) {
match intrinsics::ptr_guaranteed_cmp(self, other) {
2 => None,
other => Some(other == 1),
}
Expand Down
2 changes: 0 additions & 2 deletions library/core/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@
#![deny(unsafe_op_in_unsafe_fn)]
#![deny(fuzzy_provenance_casts)]

extern crate test;

mod alloc;
mod any;
mod array;
Expand Down
2 changes: 0 additions & 2 deletions library/core/tests/num/flt2dec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ use core::num::flt2dec::{
};
use core::num::fmt::{Formatted, Part};

pub use test::Bencher;

mod estimator;
mod strategy {
mod dragon;
Expand Down
1 change: 0 additions & 1 deletion library/portable-simd/crates/core_simd/src/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,5 @@ pub mod simd {
pub use crate::core_simd::masks::*;
pub use crate::core_simd::ord::*;
pub use crate::core_simd::swizzle::*;
pub use crate::core_simd::swizzle_dyn::*;
pub use crate::core_simd::vector::*;
}
1 change: 1 addition & 0 deletions library/std/src/sys/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

pub mod alloc;
pub mod small_c_string;
#[allow(unused_imports)]
pub mod thread_local;

#[cfg(test)]
Expand Down
Loading

0 comments on commit c38ca44

Please sign in to comment.