Skip to content

Rollup of 9 pull requests #96063

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

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5e76103
Reject `#[thread_local]` attribute on non-static items
tmiasko Mar 16, 2022
8c2353b
remove find_use_placement
kckeiks Mar 18, 2022
abf2b4c
Stabilize `derive_default_enum`
jhpratt Feb 28, 2022
a3dd654
Add documentation
jhpratt Mar 8, 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
849ede1
Update books
ehuss Apr 14, 2022
f6d9577
docs: add link from zip to unzip
beyarkay Apr 14, 2022
d73e328
Remove trailing whitespace
beyarkay Apr 14, 2022
7a35c0f
Use u32 instead of i32 for futexes.
m-ou-se Apr 14, 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
5ab0306
Rollup merge of #94457 - jhpratt:stabilize-derive_default_enum, r=dav…
Dylan-DPC Apr 15, 2022
c149fec
Rollup merge of #95006 - tmiasko:thread-local-static, r=wesleywiser
Dylan-DPC Apr 15, 2022
5f525be
Rollup merge of #95194 - kckeiks:update-algo-in-find-use-placement, r…
Dylan-DPC Apr 15, 2022
d1b8125
Rollup merge of #95859 - rainy-me:unterminated-nested-block-comment, …
Dylan-DPC Apr 15, 2022
89dd3bf
Rollup merge of #96004 - JakobDegen:fix-validator-ice, r=petrochenkov
Dylan-DPC Apr 15, 2022
4ee5130
Rollup merge of #96032 - ehuss:update-books, r=ehuss
Dylan-DPC Apr 15, 2022
d5232f8
Rollup merge of #96038 - beyarkay:patch-1, r=m-ou-se
Dylan-DPC Apr 15, 2022
61a4193
Rollup merge of #96040 - m-ou-se:futex-u32, r=Amanieu
Dylan-DPC Apr 15, 2022
a024036
Rollup merge of #96050 - oli-obk:deaggregator_cleanup, r=RalfJung
Dylan-DPC Apr 15, 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
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
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
10 changes: 10 additions & 0 deletions src/test/ui/mir/issue-95978-validator-lifetime-comparison.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// check-pass
// compile-flags: -Zvalidate-mir

fn foo(_a: &str) {}

fn main() {
let x = foo as fn(&'static str);

let _ = x == foo;
}