Skip to content

Rollup of 8 pull requests #54215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Sep 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ef519c1
Add a implementation of `From` for converting `&'a Option<T>` into
weiznich Aug 9, 2018
0cde1cb
Add stability attribute
weiznich Aug 9, 2018
a7a0225
Also add a `From` implementation for `&mut Option<T>` -> `Option<&mut…
weiznich Aug 10, 2018
0c89243
Fix compiling some rustc crates to wasm
alexcrichton Sep 7, 2018
d02a5ff
renamed emit_nil to emit_unit
kenta7777 Sep 10, 2018
37d0600
renamed read_nil to read_unit
kenta7777 Sep 10, 2018
6f685ff
renamed is_nil to is_unit
kenta7777 Sep 10, 2018
5c3ba4a
renamed mk_nil to mk_unit
kenta7777 Sep 10, 2018
2be5c72
renamed mk_nil_ptr to mk_unit_ptr
kenta7777 Sep 10, 2018
69deed9
renamed t_nil to t_unit
kenta7777 Sep 10, 2018
8c53150
Revert "renamed t_nil to t_unit"
kenta7777 Sep 11, 2018
d7ebc20
Revert "renamed mk_nil_ptr to mk_unit_ptr"
kenta7777 Sep 11, 2018
10b2083
Revert "renamed is_nil to is_unit"
kenta7777 Sep 11, 2018
fa683ac
Revert "renamed read_nil to read_unit"
kenta7777 Sep 11, 2018
7f81604
Revert "renamed emit_nil to emit_unit"
kenta7777 Sep 11, 2018
a0e7b6b
renamed is_nil to is_unit
kenta7777 Sep 11, 2018
8134ee2
renamed emit_nil to emit_unit
kenta7777 Sep 11, 2018
26dbf56
Merge branch 'master' into kenta7777#53719
kenta7777 Sep 12, 2018
1ad0919
Remove println!() statement from HashMap unit test
fintelia Sep 13, 2018
7249a1b
Suggest valid crate type if invalid
phansch Sep 13, 2018
e958362
Eliminate unused variable warning
fintelia Sep 13, 2018
2e75b07
Fix the stable release of os_str_str_ref_eq
cuviper Sep 13, 2018
dda7e0d
re-mark the never docs as unstable
QuietMisdreavus Sep 13, 2018
7a1eed7
Update Cargo
alexcrichton Sep 14, 2018
b3303ed
Rollup merge of #53218 - weiznich:feature/option_ref_into, r=KodrAus
kennytm Sep 14, 2018
33bc6c3
Rollup merge of #54024 - alexcrichton:compile-to-wasm, r=petrochenkov
kennytm Sep 14, 2018
9c0f946
Rollup merge of #54095 - kenta7777:kenta7777#53719, r=davidtwco
kennytm Sep 14, 2018
d51c364
Rollup merge of #54173 - phansch:suggest_valid_crate_type, r=estebank
kennytm Sep 14, 2018
8c999fa
Rollup merge of #54194 - fintelia:patch-3, r=cramertj
kennytm Sep 14, 2018
ae8410b
Rollup merge of #54203 - cuviper:stable-os_str_str_ref_eq, r=estebank
kennytm Sep 14, 2018
585f39f
Rollup merge of #54207 - QuietMisdreavus:never-docs-stab, r=kennytm
kennytm Sep 14, 2018
dd4f5a2
Rollup merge of #54210 - alexcrichton:update-cargo, r=kennytm
kennytm Sep 14, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,20 @@ impl<T> From<T> for Option<T> {
}
}

#[stable(feature = "option_ref_from_ref_option", since = "1.30.0")]
impl<'a, T> From<&'a Option<T>> for Option<&'a T> {
fn from(o: &'a Option<T>) -> Option<&'a T> {
o.as_ref()
}
}

#[stable(feature = "option_ref_from_ref_option", since = "1.30.0")]
impl<'a, T> From<&'a mut Option<T>> for Option<&'a mut T> {
fn from(o: &'a mut Option<T>) -> Option<&'a mut T> {
o.as_mut()
}
}

/////////////////////////////////////////////////////////////////////////////
// The Option Iterators
/////////////////////////////////////////////////////////////////////////////
Expand Down
9 changes: 9 additions & 0 deletions src/librustc/lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ pub enum BuiltinLintDiagnostics {
ProcMacroDeriveResolutionFallback(Span),
MacroExpandedMacroExportsAccessedByAbsolutePaths(Span),
ElidedLifetimesInPaths(usize, Span, bool, Span, String),
UnknownCrateTypes(Span, String, String),
}

impl BuiltinLintDiagnostics {
Expand Down Expand Up @@ -500,6 +501,14 @@ impl BuiltinLintDiagnostics {
Applicability::MachineApplicable
);
}
BuiltinLintDiagnostics::UnknownCrateTypes(span, note, sugg) => {
db.span_suggestion_with_applicability(
span,
&note,
sugg,
Applicability::MaybeIncorrect
);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/traits/error_reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
{
let predicate = trait_predicate.map_bound(|mut trait_pred| {
trait_pred.trait_ref.substs = self.tcx.mk_substs_trait(
self.tcx.mk_nil(),
self.tcx.mk_unit(),
&trait_pred.trait_ref.substs[1..],
);
trait_pred
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2492,7 +2492,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
}

pub fn mk_nil_ptr(self) -> Ty<'tcx> {
self.mk_imm_ptr(self.mk_nil())
self.mk_imm_ptr(self.mk_unit())
}

pub fn mk_array(self, ty: Ty<'tcx>, n: u64) -> Ty<'tcx> {
Expand All @@ -2511,7 +2511,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
iter.intern_with(|ts| self.mk_ty(Tuple(self.intern_type_list(ts))))
}

pub fn mk_nil(self) -> Ty<'tcx> {
pub fn mk_unit(self) -> Ty<'tcx> {
self.intern_tup(&[])
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/ty/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl PrimitiveExt for Primitive {
Int(i, signed) => i.to_ty(tcx, signed),
Float(FloatTy::F32) => tcx.types.f32,
Float(FloatTy::F64) => tcx.types.f64,
Pointer => tcx.mk_mut_ptr(tcx.mk_nil()),
Pointer => tcx.mk_mut_ptr(tcx.mk_unit()),
}
}
}
Expand Down Expand Up @@ -1606,7 +1606,7 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
// (which may have no non-DST form), and will work as long
// as the `Abi` or `FieldPlacement` is checked by users.
if i == 0 {
let nil = tcx.mk_nil();
let nil = tcx.mk_unit();
let ptr_ty = if this.ty.is_unsafe_ptr() {
tcx.mk_mut_ptr(nil)
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/query/on_disk_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ impl<'enc, 'a, 'tcx, E> Encoder for CacheEncoder<'enc, 'a, 'tcx, E>
{
type Error = E::Error;

fn emit_nil(&mut self) -> Result<(), Self::Error> {
fn emit_unit(&mut self) -> Result<(), Self::Error> {
Ok(())
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ impl RegionKind {

/// Type utilities
impl<'a, 'gcx, 'tcx> TyS<'tcx> {
pub fn is_nil(&self) -> bool {
pub fn is_unit(&self) -> bool {
match self.sty {
Tuple(ref tys) => tys.is_empty(),
_ => false,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/util/ppaux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ impl PrintContext {
}
}
write!(f, ")")?;
if !output.is_nil() {
if !output.is_unit() {
print!(f, self, write(" -> "), print_display(output))?;
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/debuginfo/type_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,

output.push(')');

if !sig.output().is_nil() {
if !sig.output().is_unit() {
output.push_str(" -> ");
push_debuginfo_type_name(cx, sig.output(), true, output);
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ fn get_rust_try_fn<'ll, 'tcx>(
let i8p = tcx.mk_mut_ptr(tcx.types.i8);
let fn_ty = tcx.mk_fn_ptr(ty::Binder::bind(tcx.mk_fn_sig(
iter::once(i8p),
tcx.mk_nil(),
tcx.mk_unit(),
false,
hir::Unsafety::Unsafe,
Abi::Rust
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_codegen_llvm/mir/rvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ impl FunctionCx<'a, 'll, 'tcx> {
) -> &'ll Value {
let is_float = input_ty.is_fp();
let is_signed = input_ty.is_signed();
let is_nil = input_ty.is_nil();
let is_unit = input_ty.is_unit();
match op {
mir::BinOp::Add => if is_float {
bx.fadd(lhs, rhs)
Expand Down Expand Up @@ -604,7 +604,7 @@ impl FunctionCx<'a, 'll, 'tcx> {
mir::BinOp::Shl => common::build_unchecked_lshift(bx, lhs, rhs),
mir::BinOp::Shr => common::build_unchecked_rshift(bx, input_ty, lhs, rhs),
mir::BinOp::Ne | mir::BinOp::Lt | mir::BinOp::Gt |
mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => if is_nil {
mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => if is_unit {
C_bool(bx.cx, match op {
mir::BinOp::Ne | mir::BinOp::Lt | mir::BinOp::Gt => false,
mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => true,
Expand Down
Loading