-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Use new std::num::NonZero* types instead of deprecated core::nonzero::NonZero #20474
Conversation
Heads up! This PR modifies the following files:
|
@bors-servo r+ |
📌 Commit 970519f has been approved by |
Use new std::num::NonZero* types instead of deprecated core::nonzero::NonZero <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20474) <!-- Reviewable:end -->
💔 Test failed - linux-dev |
|
@bors-servo r=nox |
📌 Commit 7c73d98 has been approved by |
Use new std::num::NonZero* types instead of deprecated core::nonzero::NonZero <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20474) <!-- Reviewable:end -->
💔 Test failed - linux-rel-css |
|
In debug mode:
|
With ASAN:
|
// register for drag and drop operations.
msg_send![(*window as id),
registerForDraggedTypes:NSArray::arrayWithObject(nil, appkit::NSFilenamesPboardType)]; I couldn’t figure out how to make gdb work on OS X, so in lldb, The let sel = sel!($($name:)+);
match $crate::__send_message(&*$obj, sel, ($($arg,)*)) {
Err(s) => panic!("{}", s),
Ok(r) => r,
} Note that the next frame in the ASAN stack trace is pub unsafe fn send_message<T, A, R>(obj: *const T, sel: Sel, args: A)
-> Result<R, MessageError>
where T: Message, A: MessageArguments, R: Any {
send_unverified(obj, sel, args)
} … which itself is based (in the same file) on https://github.com/SSheldon/rust-objc/blob/0.2.2/src/message/mod.rs#L167-L189 #[cfg(feature = "exception")]
macro_rules! objc_try {
($b:block) => (
$crate::exception::try(|| $b).map_err(|exception| match exception {
Some(exception) => MessageError(format!("Uncaught exception {:?}", &*exception)),
None => MessageError("Uncaught exception nil".to_owned()),
})
)
}
#[cfg(not(feature = "exception"))]
macro_rules! objc_try {
($b:block) => (Ok($b))
}
unsafe fn send_unverified<T, A, R>(obj: *const T, sel: Sel, args: A)
-> Result<R, MessageError>
where T: Message, A: MessageArguments, R: Any {
let (msg_send_fn, receiver) = msg_send_fn::<R>(obj as *mut T as *mut Object, sel);
objc_try!({
A::invoke(msg_send_fn, receiver, sel, args)
})
} I don’t see I haven’t managed to reliably get lldb to print return values, but a few times I got things like:
… which says that in our Now, why is fn main() {
foo();
}
fn foo<R>() -> R {
unimplemented!()
} error[E0282]: type annotations needed
--> a.rs:2:5
|
2 | foo();
| ^^^ cannot infer type for `R`
error: aborting due to previous error … but not when the type parameter is used inside of a #![feature(core_intrinsics)]
fn main() {
match send_message() {
Ok(r) => r,
Err(name) => println!("Inferred type: {}", name),
};
}
fn send_message<R>() -> Result<R, &'static str> {
unsafe {
Err(std::intrinsics::type_name::<R>())
}
}
I don’t know why Indeed, the doc-comment of the let _: () = msg_send![obj, setArg1:1 arg2:2]; This is probably the correct fix, but rustc is still doing something surprising here… |
Based on IRC chat with Eddyb the relevant rustc change is most likely the stabilization of the #![feature(core_intrinsics)]
fn main() {
match send_message() {
Ok(r) => r,
Err(name) => panic!("Inferred type: {}", name),
};
}
fn send_message<R>() -> Result<R, &'static str> {
unsafe {
Err(std::intrinsics::type_name::<R>())
}
}
|
The error I was investigating servo/servo#20474 (comment) turned out to be already be fixed by rust-windowing#428, but there was a few more cases of the same problem.
The error I was investigating servo/servo#20474 (comment) turned out to be already be fixed by rust-windowing#428, but there was a few more cases of the same problem.
Fix some unconstrained type parameters being inferred to `!` Similar to rust-windowing/winit#428 CC servo/servo#20474 (comment) <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/devices/26) <!-- Reviewable:end -->
The winit bug turned out to have been already fixed upstream rust-windowing/winit#428, but we had more of the same in @bors-servo r=nox |
📌 Commit 52dceb3 has been approved by |
Use new std::num::NonZero* types instead of deprecated core::nonzero::NonZero <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20474) <!-- Reviewable:end -->
The error I was investigating servo/servo#20474 (comment) turned out to be already be fixed by #428, but there was a few more cases of the same problem.
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
This change is