Skip to content
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

Rollup of 9 pull requests #80530

Merged
merged 44 commits into from
Dec 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
613cc9b
Edit rustc_ast::ast::FieldPat docs
pierwill Dec 17, 2020
7ac02bd
Don't give an error when creating a file for the first time
jyn514 Dec 27, 2020
122e91c
promotion: factor some common code into validate_ref
RalfJung Dec 28, 2020
c177e68
merge two match'es for more exhaustiveness
RalfJung Dec 28, 2020
4a90a58
make more matches exhaustive
RalfJung Dec 28, 2020
5182776
refactor: moving vec.rs to vec/mod.rs
DeveloperC286 Dec 4, 2020
434e5d1
refactor: moving DrainFilter into drain_filter.rs
DeveloperC286 Dec 4, 2020
17593f2
refactor: moving Splice into splice.rs
DeveloperC286 Dec 5, 2020
6bf9608
refactor: moving Drain into drain.rs
DeveloperC286 Dec 5, 2020
2580822
refactor: moved Vec impl Cow into cow.rs
DeveloperC286 Dec 5, 2020
9361390
refactor: moved IntoIter into into_iter.rs
DeveloperC286 Dec 5, 2020
2a12489
refactor: moving AsIntoIter into into_iter.rs
DeveloperC286 Dec 5, 2020
840c4e2
refactor: moved IsZero into is_zero.rs
DeveloperC286 Dec 5, 2020
5ac6709
refactor: moving SourceIterMarker into source_iter_marker.rs
DeveloperC286 Dec 5, 2020
dc46013
refactor: moved PartialEq into partial_eq
DeveloperC286 Dec 5, 2020
a2f4bc0
refactor: moved SpecFromElem to spec_from_elem.rs
DeveloperC286 Dec 5, 2020
a3f3fc5
refactor: moved SetLenOnDrop to set_len_on_drop
DeveloperC286 Dec 5, 2020
9e08ce7
refactor: moved InPlaceDrop into in_place_drop.rs
DeveloperC286 Dec 5, 2020
56d82b3
refactor: moved SpecFromIterNested to spec_from_iter_nested.rs
DeveloperC286 Dec 5, 2020
d24a277
refactor: moving SpecFromIter into spec_from_iter.rs
DeveloperC286 Dec 5, 2020
bd49a60
refactor: moved SpecExtend into spec_extend.rs
DeveloperC286 Dec 5, 2020
6002b28
refactor: removing // ignore-tidy-filelength
DeveloperC286 Dec 5, 2020
2de8356
style: applying Rust style
DeveloperC286 Dec 5, 2020
80f10d7
fix: moved import into #[cfg(test)]
DeveloperC286 Dec 5, 2020
f7a6f0c
docs: fixing references
DeveloperC286 Dec 5, 2020
206b2ca
test: updated expected Vec src path
DeveloperC286 Dec 5, 2020
51cec58
fix a comment
RalfJung Dec 29, 2020
81685e9
Do not create dangling &T in Weak<T>::drop
CAD97 Dec 29, 2020
95aed7a
Miri: make size/align_of_val work for dangling raw ptrs
RalfJung Dec 29, 2020
f76bae9
CTFE: test size/align_of_val_raw on dangling pointers
RalfJung Dec 30, 2020
edeac17
Rename kw::Invalid -> kw::Empty
jyn514 Dec 30, 2020
78498d0
Add regression test for #80062
LeSeulArtichaut Dec 30, 2020
16834a8
Fix rustdoc link in vec/into_iter.rs.
m-ou-se Dec 30, 2020
7786a6b
Add Iterator::intersperse
jonas-schievink Aug 21, 2020
40bbb7f
Add tracking issue
camelid Nov 28, 2020
242a252
Rollup merge of #78934 - DeveloperC286:issue_60302_vec, r=m-ou-se
m-ou-se Dec 30, 2020
9cf2438
Rollup merge of #79479 - camelid:intersperse, r=m-ou-se
m-ou-se Dec 30, 2020
3d7cdf6
Rollup merge of #80128 - pierwill:pierwill-docs-fieldpat, r=jyn514
m-ou-se Dec 30, 2020
1975142
Rollup merge of #80424 - jyn514:bootstrap-cleanup, r=Mark-Simulacrum
m-ou-se Dec 30, 2020
46111c1
Rollup merge of #80458 - RalfJung:promotion-refactor, r=oli-obk
m-ou-se Dec 30, 2020
3d93dfd
Rollup merge of #80488 - CAD97:drop-weak-without-reference, r=m-ou-se
m-ou-se Dec 30, 2020
067f1b7
Rollup merge of #80491 - RalfJung:dangling-of-val, r=oli-obk
m-ou-se Dec 30, 2020
9e8edc8
Rollup merge of #80495 - jyn514:rename-empty, r=petrochenkov
m-ou-se Dec 30, 2020
8998e31
Rollup merge of #80513 - LeSeulArtichaut:80062-test, r=lcnr
m-ou-se Dec 30, 2020
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
12 changes: 6 additions & 6 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,16 +630,16 @@ impl Pat {
}
}

/// A single field in a struct pattern
/// A single field in a struct pattern.
///
/// Patterns like the fields of Foo `{ x, ref y, ref mut z }`
/// are treated the same as` x: x, y: ref y, z: ref mut z`,
/// except is_shorthand is true
/// Patterns like the fields of `Foo { x, ref y, ref mut z }`
/// are treated the same as `x: x, y: ref y, z: ref mut z`,
/// except when `is_shorthand` is true.
#[derive(Clone, Encodable, Decodable, Debug)]
pub struct FieldPat {
/// The identifier for the field
/// The identifier for the field.
pub ident: Ident,
/// The pattern the field is destructured to
/// The pattern the field is destructured to.
pub pat: P<Pat>,
pub is_shorthand: bool,
pub attrs: AttrVec,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1767,7 +1767,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
}
self.arena.alloc_from_iter(inputs.iter().map(|param| match param.pat.kind {
PatKind::Ident(_, ident, _) => ident,
_ => Ident::new(kw::Invalid, param.pat.span),
_ => Ident::new(kw::Empty, param.pat.span),
}))
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl<'a> AstValidator<'a> {
}

fn check_lifetime(&self, ident: Ident) {
let valid_names = [kw::UnderscoreLifetime, kw::StaticLifetime, kw::Invalid];
let valid_names = [kw::UnderscoreLifetime, kw::StaticLifetime, kw::Empty];
if !valid_names.contains(&ident.name) && ident.without_first_quote().is_reserved() {
self.err_handler().span_err(ident.span, "lifetimes cannot use keyword names");
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2787,7 +2787,7 @@ impl<'a> State<'a> {
self.print_explicit_self(&eself);
} else {
let invalid = if let PatKind::Ident(_, ident, _) = input.pat.kind {
ident.name == kw::Invalid
ident.name == kw::Empty
} else {
false
};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/llvm_asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ fn parse_inline_asm<'a>(
})
.unwrap_or(tts.len());
let mut p = cx.new_parser_from_tts(tts.trees().skip(first_colon).collect());
let mut asm = kw::Invalid;
let mut asm = kw::Empty;
let mut asm_str_style = None;
let mut outputs = Vec::new();
let mut inputs = Vec::new();
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
// (after #67586 gets fixed).
None
} else {
let name = kw::Invalid;
let name = kw::Empty;
let decl = &self.mir.local_decls[local];
let dbg_var = if full_debug_info {
self.adjusted_span_and_dbg_scope(decl.source_info).map(
Expand Down Expand Up @@ -204,7 +204,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
None
} else {
Some(match whole_local_var.or(fallback_var) {
Some(var) if var.name != kw::Invalid => var.name.to_string(),
Some(var) if var.name != kw::Empty => var.name.to_string(),
_ => format!("{:?}", local),
})
};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub struct Lifetime {
pub span: Span,

/// Either "`'a`", referring to a named lifetime definition,
/// or "``" (i.e., `kw::Invalid`), for elision placeholders.
/// or "``" (i.e., `kw::Empty`), for elision placeholders.
///
/// HIR lowering inserts these placeholders in type paths that
/// refer to type definitions needing lifetime parameters,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ impl EarlyLintPass for AnonymousParameters {
if let ast::AssocItemKind::Fn(_, ref sig, _, _) = it.kind {
for arg in sig.decl.inputs.iter() {
if let ast::PatKind::Ident(_, ident, None) = arg.pat.kind {
if ident.name == kw::Invalid {
if ident.name == kw::Empty {
cx.struct_span_lint(ANONYMOUS_PARAMETERS, arg.pat.span, |lint| {
let ty_snip = cx.sess.source_map().span_to_snippet(arg.ty.span);

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ impl<'tcx> LateContext<'tcx> {

/// Check if a `DefId`'s path matches the given absolute type path usage.
///
/// Anonymous scopes such as `extern` imports are matched with `kw::Invalid`;
/// Anonymous scopes such as `extern` imports are matched with `kw::Empty`;
/// inherent `impl` blocks are matched with the name of the type.
///
/// Instead of using this method, it is often preferable to instead use
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_metadata/src/native_libs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl ItemLikeVisitor<'tcx> for Collector<'tcx> {

impl Collector<'tcx> {
fn register_native_lib(&mut self, span: Option<Span>, lib: NativeLib) {
if lib.name.as_ref().map(|&s| s == kw::Invalid).unwrap_or(false) {
if lib.name.as_ref().map(|&s| s == kw::Empty).unwrap_or(false) {
match span {
Some(span) => {
struct_span_err!(
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ impl<'hir> Map<'hir> {
pub fn body_param_names(&self, id: BodyId) -> impl Iterator<Item = Ident> + 'hir {
self.body(id).params.iter().map(|arg| match arg.pat.kind {
PatKind::Binding(_, _, ident, _) => ident,
_ => Ident::new(kw::Invalid, rustc_span::DUMMY_SP),
_ => Ident::new(kw::Empty, rustc_span::DUMMY_SP),
})
}

Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_middle/src/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,7 @@ impl<F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> {
// FIXME(eddyb) `name` should never be empty, but it
// currently is for `extern { ... }` "foreign modules".
let name = disambiguated_data.data.name();
if name != DefPathDataName::Named(kw::Invalid) {
if name != DefPathDataName::Named(kw::Empty) {
if !self.empty_path {
write!(self, "::")?;
}
Expand Down Expand Up @@ -1608,14 +1608,14 @@ impl<F: fmt::Write> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx, F> {

match *region {
ty::ReEarlyBound(ref data) => {
data.name != kw::Invalid && data.name != kw::UnderscoreLifetime
data.name != kw::Empty && data.name != kw::UnderscoreLifetime
}

ty::ReLateBound(_, ty::BoundRegion { kind: br })
| ty::ReFree(ty::FreeRegion { bound_region: br, .. })
| ty::RePlaceholder(ty::Placeholder { name: br, .. }) => {
if let ty::BrNamed(_, name) = br {
if name != kw::Invalid && name != kw::UnderscoreLifetime {
if name != kw::Empty && name != kw::UnderscoreLifetime {
return true;
}
}
Expand Down Expand Up @@ -1685,7 +1685,7 @@ impl<F: fmt::Write> FmtPrinter<'_, '_, F> {
// `explain_region()` or `note_and_explain_region()`.
match *region {
ty::ReEarlyBound(ref data) => {
if data.name != kw::Invalid {
if data.name != kw::Empty {
p!(write("{}", data.name));
return Ok(self);
}
Expand All @@ -1694,7 +1694,7 @@ impl<F: fmt::Write> FmtPrinter<'_, '_, F> {
| ty::ReFree(ty::FreeRegion { bound_region: br, .. })
| ty::RePlaceholder(ty::Placeholder { name: br, .. }) => {
if let ty::BrNamed(_, name) = br {
if name != kw::Invalid && name != kw::UnderscoreLifetime {
if name != kw::Empty && name != kw::UnderscoreLifetime {
p!(write("{}", name));
return Ok(self);
}
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_mir/src/interpret/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
}

sym::min_align_of_val | sym::size_of_val => {
let place = self.deref_operand(args[0])?;
// Avoid `deref_operand` -- this is not a deref, the ptr does not have to be
// dereferencable!
let place = self.ref_to_mplace(self.read_immediate(args[0])?)?;
let (size, align) = self
.size_and_align_of(place.meta, place.layout)?
.size_and_align_of_mplace(place)?
.ok_or_else(|| err_unsup_format!("`extern type` does not have known layout"))?;

let result = match intrinsic_name {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/interpret/validity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
}
// Make sure this is dereferenceable and all.
let size_and_align = try_validation!(
self.ecx.size_and_align_of(place.meta, place.layout),
self.ecx.size_and_align_of_mplace(place),
self.path,
err_ub!(InvalidMeta(msg)) => { "invalid {} metadata: {}", kind, msg },
);
Expand Down
Loading