Skip to content

Commit

Permalink
Auto merge of rust-lang#81461 - JohnTitor:rollup-b0ij25f, r=JohnTitor
Browse files Browse the repository at this point in the history
Rollup of 13 pull requests

Successful merges:

 - rust-lang#70904 (Stabilize `Seek::stream_position` (feature `seek_convenience`))
 - rust-lang#79951 (Refractor a few more types to `rustc_type_ir` )
 - rust-lang#80868 (Print failure message on all tests that should panic, but don't)
 - rust-lang#81062 (Improve diagnostics for Precise Capture)
 - rust-lang#81277 (Make more traits of the From/Into family diagnostic items)
 - rust-lang#81284 (Make `-Z time-passes` less noisy)
 - rust-lang#81379 (Improve URLs handling)
 - rust-lang#81416 (Tweak suggestion for missing field in patterns)
 - rust-lang#81426 (const_evaluatable: expand abstract consts in try_unify)
 - rust-lang#81428 (compiletest: Add two more unit tests)
 - rust-lang#81430 (add const_evaluatable_checked test)
 - rust-lang#81433 (const_evaluatable: stop looking into type aliases)
 - rust-lang#81445 (Update cargo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Jan 28, 2021
2 parents e32f372 + f3dfbfc commit 0e19020
Show file tree
Hide file tree
Showing 95 changed files with 1,928 additions and 733 deletions.
11 changes: 6 additions & 5 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634"

[[package]]
name = "crates-io"
version = "0.31.1"
version = "0.33.0"
dependencies = [
"anyhow",
"curl",
Expand Down Expand Up @@ -1337,9 +1337,9 @@ dependencies = [

[[package]]
name = "git2"
version = "0.13.14"
version = "0.13.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "186dd99cc77576e58344ad614fa9bb27bad9d048f85de3ca850c1f4e8b048260"
checksum = "1d250f5f82326884bd39c2853577e70a121775db76818ffa452ed1e80de12986"
dependencies = [
"bitflags",
"libc",
Expand Down Expand Up @@ -1792,9 +1792,9 @@ dependencies = [

[[package]]
name = "libgit2-sys"
version = "0.12.16+1.1.0"
version = "0.12.18+1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f91b2f931ee975a98155195be8cd82d02e8e029d7d793d2bac1b8181ac97020"
checksum = "3da6a42da88fc37ee1ecda212ffa254c25713532980005d5f7c0b0fbe7e6e885"
dependencies = [
"cc",
"libc",
Expand Down Expand Up @@ -4345,6 +4345,7 @@ dependencies = [
"bitflags",
"rustc_data_structures",
"rustc_index",
"rustc_macros",
"rustc_serialize",
]

Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_codegen_cranelift/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,14 @@ mod vtable;
mod prelude {
pub(crate) use std::convert::{TryFrom, TryInto};

pub(crate) use rustc_ast::ast::{FloatTy, IntTy, UintTy};
pub(crate) use rustc_span::Span;

pub(crate) use rustc_hir::def_id::{DefId, LOCAL_CRATE};
pub(crate) use rustc_middle::bug;
pub(crate) use rustc_middle::mir::{self, *};
pub(crate) use rustc_middle::ty::layout::{self, TyAndLayout};
pub(crate) use rustc_middle::ty::{
self, FnSig, Instance, InstanceDef, ParamEnv, Ty, TyCtxt, TypeAndMut, TypeFoldable,
self, FloatTy, FnSig, Instance, InstanceDef, IntTy, ParamEnv, Ty, TyCtxt, TypeAndMut, TypeFoldable, UintTy,
};
pub(crate) use rustc_target::abi::{Abi, LayoutOf, Scalar, Size, VariantIdx};

Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_codegen_llvm/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,8 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
lhs: Self::Value,
rhs: Self::Value,
) -> (Self::Value, Self::Value) {
use rustc_ast::IntTy::*;
use rustc_ast::UintTy::*;
use rustc_middle::ty::{Int, Uint};
use rustc_middle::ty::{IntTy::*, UintTy::*};

let new_kind = match ty.kind() {
Int(t @ Isize) => Int(t.normalize(self.tcx.sess.target.pointer_width)),
Expand Down
35 changes: 17 additions & 18 deletions compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use crate::llvm::debuginfo::{
};
use crate::value::Value;

use rustc_ast as ast;
use rustc_codegen_ssa::traits::*;
use rustc_data_structures::const_cstr;
use rustc_data_structures::fingerprint::Fingerprint;
Expand Down Expand Up @@ -830,37 +829,37 @@ trait MsvcBasicName {
fn msvc_basic_name(self) -> &'static str;
}

impl MsvcBasicName for ast::IntTy {
impl MsvcBasicName for ty::IntTy {
fn msvc_basic_name(self) -> &'static str {
match self {
ast::IntTy::Isize => "ptrdiff_t",
ast::IntTy::I8 => "__int8",
ast::IntTy::I16 => "__int16",
ast::IntTy::I32 => "__int32",
ast::IntTy::I64 => "__int64",
ast::IntTy::I128 => "__int128",
ty::IntTy::Isize => "ptrdiff_t",
ty::IntTy::I8 => "__int8",
ty::IntTy::I16 => "__int16",
ty::IntTy::I32 => "__int32",
ty::IntTy::I64 => "__int64",
ty::IntTy::I128 => "__int128",
}
}
}

impl MsvcBasicName for ast::UintTy {
impl MsvcBasicName for ty::UintTy {
fn msvc_basic_name(self) -> &'static str {
match self {
ast::UintTy::Usize => "size_t",
ast::UintTy::U8 => "unsigned __int8",
ast::UintTy::U16 => "unsigned __int16",
ast::UintTy::U32 => "unsigned __int32",
ast::UintTy::U64 => "unsigned __int64",
ast::UintTy::U128 => "unsigned __int128",
ty::UintTy::Usize => "size_t",
ty::UintTy::U8 => "unsigned __int8",
ty::UintTy::U16 => "unsigned __int16",
ty::UintTy::U32 => "unsigned __int32",
ty::UintTy::U64 => "unsigned __int64",
ty::UintTy::U128 => "unsigned __int128",
}
}
}

impl MsvcBasicName for ast::FloatTy {
impl MsvcBasicName for ty::FloatTy {
fn msvc_basic_name(self) -> &'static str {
match self {
ast::FloatTy::F32 => "float",
ast::FloatTy::F64 => "double",
ty::FloatTy::F32 => "float",
ty::FloatTy::F64 => "double",
}
}
}
Expand Down
37 changes: 18 additions & 19 deletions compiler/rustc_codegen_llvm/src/type_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ use crate::llvm;
use crate::llvm::{Bool, False, True};
use crate::type_of::LayoutLlvmExt;
use crate::value::Value;
use rustc_ast as ast;
use rustc_codegen_ssa::common::TypeKind;
use rustc_codegen_ssa::traits::*;
use rustc_data_structures::small_c_str::SmallCStr;
use rustc_middle::bug;
use rustc_middle::ty::layout::TyAndLayout;
use rustc_middle::ty::Ty;
use rustc_middle::ty::{self, Ty};
use rustc_target::abi::call::{CastTarget, FnAbi, Reg};
use rustc_target::abi::{AddressSpace, Align, Integer, Size};

Expand Down Expand Up @@ -80,32 +79,32 @@ impl CodegenCx<'ll, 'tcx> {
self.type_i8()
}

crate fn type_int_from_ty(&self, t: ast::IntTy) -> &'ll Type {
crate fn type_int_from_ty(&self, t: ty::IntTy) -> &'ll Type {
match t {
ast::IntTy::Isize => self.type_isize(),
ast::IntTy::I8 => self.type_i8(),
ast::IntTy::I16 => self.type_i16(),
ast::IntTy::I32 => self.type_i32(),
ast::IntTy::I64 => self.type_i64(),
ast::IntTy::I128 => self.type_i128(),
ty::IntTy::Isize => self.type_isize(),
ty::IntTy::I8 => self.type_i8(),
ty::IntTy::I16 => self.type_i16(),
ty::IntTy::I32 => self.type_i32(),
ty::IntTy::I64 => self.type_i64(),
ty::IntTy::I128 => self.type_i128(),
}
}

crate fn type_uint_from_ty(&self, t: ast::UintTy) -> &'ll Type {
crate fn type_uint_from_ty(&self, t: ty::UintTy) -> &'ll Type {
match t {
ast::UintTy::Usize => self.type_isize(),
ast::UintTy::U8 => self.type_i8(),
ast::UintTy::U16 => self.type_i16(),
ast::UintTy::U32 => self.type_i32(),
ast::UintTy::U64 => self.type_i64(),
ast::UintTy::U128 => self.type_i128(),
ty::UintTy::Usize => self.type_isize(),
ty::UintTy::U8 => self.type_i8(),
ty::UintTy::U16 => self.type_i16(),
ty::UintTy::U32 => self.type_i32(),
ty::UintTy::U64 => self.type_i64(),
ty::UintTy::U128 => self.type_i128(),
}
}

crate fn type_float_from_ty(&self, t: ast::FloatTy) -> &'ll Type {
crate fn type_float_from_ty(&self, t: ty::FloatTy) -> &'ll Type {
match t {
ast::FloatTy::F32 => self.type_f32(),
ast::FloatTy::F64 => self.type_f64(),
ty::FloatTy::F32 => self.type_f32(),
ty::FloatTy::F64 => self.type_f64(),
}
}

Expand Down
20 changes: 8 additions & 12 deletions compiler/rustc_codegen_ssa/src/mir/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -875,20 +875,16 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
ty::Uint(_) => value.to_string(),
ty::Int(int_ty) => {
match int_ty.normalize(bx.tcx().sess.target.pointer_width) {
ast::IntTy::I8 => (value as i8).to_string(),
ast::IntTy::I16 => (value as i16).to_string(),
ast::IntTy::I32 => (value as i32).to_string(),
ast::IntTy::I64 => (value as i64).to_string(),
ast::IntTy::I128 => (value as i128).to_string(),
ast::IntTy::Isize => unreachable!(),
ty::IntTy::I8 => (value as i8).to_string(),
ty::IntTy::I16 => (value as i16).to_string(),
ty::IntTy::I32 => (value as i32).to_string(),
ty::IntTy::I64 => (value as i64).to_string(),
ty::IntTy::I128 => (value as i128).to_string(),
ty::IntTy::Isize => unreachable!(),
}
}
ty::Float(ast::FloatTy::F32) => {
f32::from_bits(value as u32).to_string()
}
ty::Float(ast::FloatTy::F64) => {
f64::from_bits(value as u64).to_string()
}
ty::Float(ty::FloatTy::F32) => f32::from_bits(value as u32).to_string(),
ty::Float(ty::FloatTy::F64) => f64::from_bits(value as u64).to_string(),
_ => span_bug!(span, "asm const has bad type {}", ty),
};
InlineAsmOperandRef::Const { string }
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_expand/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -929,15 +929,17 @@ pub struct ExtCtxt<'a> {
pub force_mode: bool,
pub expansions: FxHashMap<Span, Vec<String>>,
/// Called directly after having parsed an external `mod foo;` in expansion.
pub(super) extern_mod_loaded: Option<&'a dyn Fn(&ast::Crate)>,
///
/// `Ident` is the module name.
pub(super) extern_mod_loaded: Option<&'a dyn Fn(&ast::Crate, Ident)>,
}

impl<'a> ExtCtxt<'a> {
pub fn new(
sess: &'a Session,
ecfg: expand::ExpansionConfig<'a>,
resolver: &'a mut dyn ResolverExpand,
extern_mod_loaded: Option<&'a dyn Fn(&ast::Crate)>,
extern_mod_loaded: Option<&'a dyn Fn(&ast::Crate, Ident)>,
) -> ExtCtxt<'a> {
ExtCtxt {
sess,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_expand/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,7 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
proc_macros: vec![],
};
if let Some(extern_mod_loaded) = self.cx.extern_mod_loaded {
extern_mod_loaded(&krate);
extern_mod_loaded(&krate, ident);
}

*old_mod = krate.module;
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_infer/src/infer/combine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ use super::{InferCtxt, MiscVariable, TypeTrace};

use crate::traits::{Obligation, PredicateObligations};

use rustc_ast as ast;
use rustc_data_structures::sso::SsoHashMap;
use rustc_hir::def_id::DefId;
use rustc_middle::traits::ObligationCause;
Expand Down Expand Up @@ -281,7 +280,7 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
&self,
vid_is_expected: bool,
vid: ty::FloatVid,
val: ast::FloatTy,
val: ty::FloatTy,
) -> RelateResult<'tcx, Ty<'tcx>> {
self.inner
.borrow_mut()
Expand Down
17 changes: 12 additions & 5 deletions compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use rustc_session::lint;
use rustc_session::output::{filename_for_input, filename_for_metadata};
use rustc_session::search_paths::PathKind;
use rustc_session::Session;
use rustc_span::symbol::Symbol;
use rustc_span::symbol::{Ident, Symbol};
use rustc_span::{FileName, RealFileName};
use rustc_trait_selection::traits;
use rustc_typeck as typeck;
Expand Down Expand Up @@ -211,8 +211,13 @@ pub fn register_plugins<'a>(
Ok((krate, lint_store))
}

fn pre_expansion_lint(sess: &Session, lint_store: &LintStore, krate: &ast::Crate) {
sess.time("pre_AST_expansion_lint_checks", || {
fn pre_expansion_lint(
sess: &Session,
lint_store: &LintStore,
krate: &ast::Crate,
crate_name: &str,
) {
sess.prof.generic_activity_with_arg("pre_AST_expansion_lint_checks", crate_name).run(|| {
rustc_lint::check_ast_crate(
sess,
lint_store,
Expand All @@ -233,7 +238,7 @@ fn configure_and_expand_inner<'a>(
metadata_loader: &'a MetadataLoaderDyn,
) -> Result<(ast::Crate, Resolver<'a>)> {
tracing::trace!("configure_and_expand_inner");
pre_expansion_lint(sess, lint_store, &krate);
pre_expansion_lint(sess, lint_store, &krate, crate_name);

let mut resolver = Resolver::new(sess, &krate, crate_name, metadata_loader, &resolver_arenas);
rustc_builtin_macros::register_builtin_macros(&mut resolver);
Expand Down Expand Up @@ -295,7 +300,9 @@ fn configure_and_expand_inner<'a>(
..rustc_expand::expand::ExpansionConfig::default(crate_name.to_string())
};

let extern_mod_loaded = |k: &ast::Crate| pre_expansion_lint(sess, lint_store, k);
let extern_mod_loaded = |k: &ast::Crate, ident: Ident| {
pre_expansion_lint(sess, lint_store, k, &*ident.name.as_str())
};
let mut ecx = ExtCtxt::new(&sess, cfg, &mut resolver, Some(&extern_mod_loaded));

// Expand macros now!
Expand Down
Loading

0 comments on commit 0e19020

Please sign in to comment.