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 10 pull requests #96101

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d78e3e3
Add platform support document links to tier table
Michcioperz Mar 4, 2022
c1d5c2b
Add missing platform support docs to sidebar
Michcioperz Mar 4, 2022
9cfdb89
Only add codegen backend to dep info if -Zbinary-dep-depinfo is used
bjorn3 Feb 13, 2022
c681a88
Don't include invalid paths in the depinfo for builtin backends
bjorn3 Feb 13, 2022
147e5da
Add test
bjorn3 Mar 24, 2022
d5f3863
Consider lifetimes when comparing types for equality in MIR validator
JakobDegen Apr 13, 2022
4a0f8d5
improve diagnostics for unterminated nested block comment
yue4u Apr 13, 2022
1b7008d
refactor: change to use peekable
yue4u Apr 14, 2022
48029ab
Remove some now-dead code that was only relevant before deaggregation.
oli-obk Apr 14, 2022
9d319f3
update: actions/checkout@v2 to actions/checkout@v3
Gumichocopengin8 Apr 14, 2022
753d567
clarify doc(cfg) wording
euclio Apr 14, 2022
e30d6d9
make unaligned_references lint deny-by-default
RalfJung Mar 27, 2022
1a6c2ff
make unaligned_reference warning visible in future compat report
RalfJung Apr 15, 2022
4117e8c
test: add pop_first() pop_last() test cases for BTreeSet
Gumichocopengin8 Apr 15, 2022
e162602
test: add get_key_value() test cases for BTreeSet
Gumichocopengin8 Apr 15, 2022
3f2f4a3
test: add try_insert() test cases for BTreeSet
Gumichocopengin8 Apr 15, 2022
3f46ba6
chore: formatting
Gumichocopengin8 Apr 15, 2022
5181422
Update mdbook
ehuss Apr 15, 2022
7b8df43
Rollup merge of #93969 - bjorn3:codegen_backend_dep_info, r=pnkfelix
Dylan-DPC Apr 16, 2022
e292641
Rollup merge of #94605 - Michcioperz:patch-1, r=pnkfelix
Dylan-DPC Apr 16, 2022
a21f392
Rollup merge of #95372 - RalfJung:unaligned_references, r=oli-obk
Dylan-DPC Apr 16, 2022
ac01c91
Rollup merge of #95859 - rainy-me:unterminated-nested-block-comment, …
Dylan-DPC Apr 16, 2022
a30dbc2
Rollup merge of #96004 - JakobDegen:fix-validator-ice, r=petrochenkov
Dylan-DPC Apr 16, 2022
466107e
Rollup merge of #96035 - Gumichocopengin8:feature/update-github-actio…
Dylan-DPC Apr 16, 2022
f72689a
Rollup merge of #96050 - oli-obk:deaggregator_cleanup, r=RalfJung
Dylan-DPC Apr 16, 2022
10e8a2a
Rollup merge of #96059 - euclio:doc-cfg, r=manishearth,guillaumegomez
Dylan-DPC Apr 16, 2022
be42af6
Rollup merge of #96070 - Gumichocopengin8:test/btree-map, r=thomcc
Dylan-DPC Apr 16, 2022
45af788
Rollup merge of #96088 - ehuss:update-mdbook, r=Mark-Simulacrum
Dylan-DPC Apr 16, 2022
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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- name: disable git crlf conversion
run: git config --global core.autocrlf false
- name: checkout the source code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: configure the PR in which the error message will be posted
Expand Down Expand Up @@ -454,7 +454,7 @@ jobs:
- name: disable git crlf conversion
run: git config --global core.autocrlf false
- name: checkout the source code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: configure the PR in which the error message will be posted
Expand Down Expand Up @@ -567,7 +567,7 @@ jobs:
- name: disable git crlf conversion
run: git config --global core.autocrlf false
- name: checkout the source code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: configure the PR in which the error message will be posted
Expand Down Expand Up @@ -670,7 +670,7 @@ jobs:
if: "github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'rust-lang-ci/rust'"
steps:
- name: checkout the source code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: publish toolstate
Expand Down
22 changes: 16 additions & 6 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -606,12 +606,22 @@ dependencies = [
"atty",
"bitflags",
"indexmap",
"lazy_static",
"os_str_bytes",
"strsim 0.10.0",
"termcolor",
"textwrap 0.14.2",
]

[[package]]
name = "clap_complete"
version = "3.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df6f3613c0a3cddfd78b41b10203eb322cb29b600cbdf808a7d3db95691b8e25"
dependencies = [
"clap 3.1.1",
]

[[package]]
name = "clippy"
version = "0.1.62"
Expand Down Expand Up @@ -2240,14 +2250,15 @@ dependencies = [

[[package]]
name = "mdbook"
version = "0.4.15"
version = "0.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "241f10687eb3b4e0634b3b4e423f97c5f1efbd69dc9522e24a8b94583eeec3c6"
checksum = "74612ae81a3e5ee509854049dfa4c7975ae033c06f5fc4735c7dfbe60ee2a39d"
dependencies = [
"ammonia",
"anyhow",
"chrono",
"clap 2.34.0",
"clap 3.1.1",
"clap_complete",
"elasticlunr-rs",
"env_logger 0.7.1",
"handlebars",
Expand Down Expand Up @@ -2911,7 +2922,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34f197a544b0c9ab3ae46c359a7ec9cbbb5c7bf97054266fecb7ead794a181d6"
dependencies = [
"bitflags",
"getopts",
"memchr",
"unicase",
]
Expand Down Expand Up @@ -3129,9 +3139,9 @@ dependencies = [

[[package]]
name = "regex"
version = "1.5.4"
version = "1.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
dependencies = [
"aho-corasick",
"memchr",
Expand Down
22 changes: 3 additions & 19 deletions compiler/rustc_const_eval/src/interpret/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,27 +196,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
self.write_immediate(*val, &dest)?;
}

Aggregate(ref kind, ref operands) => {
// active_field_index is for union initialization.
let (dest, active_field_index) = match **kind {
mir::AggregateKind::Adt(adt_did, variant_index, _, _, active_field_index) => {
self.write_discriminant(variant_index, &dest)?;
if self.tcx.adt_def(adt_did).is_enum() {
assert!(active_field_index.is_none());
(self.place_downcast(&dest, variant_index)?, None)
} else {
if active_field_index.is_some() {
assert_eq!(operands.len(), 1);
}
(dest, active_field_index)
}
}
_ => (dest, None),
};
Aggregate(box ref kind, ref operands) => {
assert!(matches!(kind, mir::AggregateKind::Array(..)));

for (i, operand) in operands.iter().enumerate() {
for (field_index, operand) in operands.iter().enumerate() {
let op = self.eval_operand(operand, None)?;
let field_index = active_field_index.unwrap_or(i);
let field_dest = self.place_field(&dest, field_index)?;
self.copy_op(&op, &field_dest)?;
}
Expand Down
7 changes: 3 additions & 4 deletions compiler/rustc_const_eval/src/transform/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,8 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
| ty::FnPtr(..)
)
}
// None of the possible types have lifetimes, so we can just compare
// directly
if a != b {
// The function pointer types can have lifetimes
if !self.mir_assign_valid_types(a, b) {
self.fail(
location,
format!("Cannot compare unequal types {:?} and {:?}", a, b),
Expand Down Expand Up @@ -464,7 +463,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
};
// since CopyNonOverlapping is parametrized by 1 type,
// we only need to check that they are equal and not keep an extra parameter.
if op_src_ty != op_dst_ty {
if !self.mir_assign_valid_types(op_src_ty, op_dst_ty) {
self.fail(location, format!("bad arg ({:?} != {:?})", op_src_ty, op_dst_ty));
}

Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#![feature(thread_id_value)]
#![feature(vec_into_raw_parts)]
#![allow(rustc::default_hash_types)]
#![deny(unaligned_references)]
#![allow(rustc::potential_query_instability)]

#[macro_use]
Expand Down
12 changes: 8 additions & 4 deletions compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,11 +629,15 @@ fn write_out_deps(
});
files.extend(extra_tracked_files);

if let Some(ref backend) = sess.opts.debugging_opts.codegen_backend {
files.push(backend.to_string());
}

if sess.binary_dep_depinfo() {
if let Some(ref backend) = sess.opts.debugging_opts.codegen_backend {
if backend.contains('.') {
// If the backend name contain a `.`, it is the path to an external dynamic
// library. If not, it is not a path.
files.push(backend.to_string());
}
}

boxed_resolver.borrow_mut().access(|resolver| {
for cnum in resolver.cstore().crates_untracked() {
let source = resolver.cstore().crate_source_untracked(cnum);
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1110,8 +1110,6 @@ declare_lint! {
/// ### Example
///
/// ```rust,compile_fail
/// #![deny(unaligned_references)]
///
/// #[repr(packed)]
/// pub struct Foo {
/// field1: u64,
Expand Down Expand Up @@ -1139,10 +1137,11 @@ declare_lint! {
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
/// [issue #82523]: https://github.com/rust-lang/rust/issues/82523
pub UNALIGNED_REFERENCES,
Warn,
Deny,
"detects unaligned references to fields of packed structs",
@future_incompatible = FutureIncompatibleInfo {
reference: "issue #82523 <https://github.com/rust-lang/rust/issues/82523>",
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
};
report_in_external_macro
}
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_middle/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2518,7 +2518,8 @@ pub enum Rvalue<'tcx> {
/// * `Offset` has the same semantics as [`offset`](pointer::offset), except that the second
/// parameter may be a `usize` as well.
/// * The comparison operations accept `bool`s, `char`s, signed or unsigned integers, floats,
/// raw pointers, or function pointers of matching types and return a `bool`.
/// raw pointers, or function pointers and return a `bool`. The types of the operands must be
/// matching, up to the usual caveat of the lifetimes in function pointers.
/// * Left and right shift operations accept signed or unsigned integers not necessarily of the
/// same type and return a value of the same type as their LHS. Like in Rust, the RHS is
/// truncated as needed.
Expand Down
60 changes: 50 additions & 10 deletions compiler/rustc_parse/src/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,7 @@ impl<'a> StringReader<'a> {
}
rustc_lexer::TokenKind::BlockComment { doc_style, terminated } => {
if !terminated {
let msg = match doc_style {
Some(_) => "unterminated block doc-comment",
None => "unterminated block comment",
};
let last_bpos = self.pos;
self.sess.span_diagnostic.span_fatal_with_code(
self.mk_sp(start, last_bpos),
msg,
error_code!(E0758),
);
self.report_unterminated_block_comment(start, doc_style);
}

// Skip non-doc comments
Expand Down Expand Up @@ -553,6 +544,55 @@ impl<'a> StringReader<'a> {
err.emit()
}

fn report_unterminated_block_comment(&self, start: BytePos, doc_style: Option<DocStyle>) {
let msg = match doc_style {
Some(_) => "unterminated block doc-comment",
None => "unterminated block comment",
};
let last_bpos = self.pos;
let mut err = self.sess.span_diagnostic.struct_span_fatal_with_code(
self.mk_sp(start, last_bpos),
msg,
error_code!(E0758),
);
let mut nested_block_comment_open_idxs = vec![];
let mut last_nested_block_comment_idxs = None;
let mut content_chars = self.str_from(start).char_indices().peekable();

while let Some((idx, current_char)) = content_chars.next() {
match content_chars.peek() {
Some((_, '*')) if current_char == '/' => {
nested_block_comment_open_idxs.push(idx);
}
Some((_, '/')) if current_char == '*' => {
last_nested_block_comment_idxs =
nested_block_comment_open_idxs.pop().map(|open_idx| (open_idx, idx));
}
_ => {}
};
}

if let Some((nested_open_idx, nested_close_idx)) = last_nested_block_comment_idxs {
err.span_label(self.mk_sp(start, start + BytePos(2)), msg)
.span_label(
self.mk_sp(
start + BytePos(nested_open_idx as u32),
start + BytePos(nested_open_idx as u32 + 2),
),
"...as last nested comment starts here, maybe you want to close this instead?",
)
.span_label(
self.mk_sp(
start + BytePos(nested_close_idx as u32),
start + BytePos(nested_close_idx as u32 + 2),
),
"...and last nested comment terminates here.",
);
}

err.emit();
}

// RFC 3101 introduced the idea of (reserved) prefixes. As of Rust 2021,
// using a (unknown) prefix is an error. In earlier editions, however, they
// only result in a (allowed by default) lint, and are treated as regular
Expand Down
Loading