Skip to content

Commit fbdd1fe

Browse files
authored
Merge pull request #2347 from rust-lang/rustc-pull
Rustc pull update
2 parents 34c41b8 + 2bdabd0 commit fbdd1fe

File tree

6 files changed

+25
-172
lines changed

6 files changed

+25
-172
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ide-db/src/generated/lints.rs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3789,35 +3789,6 @@ The tracking issue for this feature is: [#64797]
37893789
[#64797]: https://github.com/rust-lang/rust/issues/64797
37903790

37913791
------------------------
3792-
"##,
3793-
default_severity: Severity::Allow,
3794-
warn_since: None,
3795-
deny_since: None,
3796-
},
3797-
Lint {
3798-
label: "cfg_boolean_literals",
3799-
description: r##"# `cfg_boolean_literals`
3800-
3801-
The tracking issue for this feature is: [#131204]
3802-
3803-
[#131204]: https://github.com/rust-lang/rust/issues/131204
3804-
3805-
------------------------
3806-
3807-
The `cfg_boolean_literals` feature makes it possible to use the `true`/`false`
3808-
literal as cfg predicate. They always evaluate to true/false respectively.
3809-
3810-
## Examples
3811-
3812-
```rust
3813-
#![feature(cfg_boolean_literals)]
3814-
3815-
#[cfg(true)]
3816-
const A: i32 = 5;
3817-
3818-
#[cfg(all(false))]
3819-
const A: i32 = 58 * 89;
3820-
```
38213792
"##,
38223793
default_severity: Severity::Allow,
38233794
warn_since: None,

crates/ide/src/hover/tests.rs

Lines changed: 8 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -6882,109 +6882,14 @@ pub fn foo() {}
68826882

68836883
#[test]
68846884
fn hover_feature() {
6885-
check(
6886-
r#"#![feature(intrinsics$0)]"#,
6887-
expect![[r#"
6888-
*intrinsics*
6889-
```
6890-
intrinsics
6891-
```
6892-
___
6893-
6894-
# `intrinsics`
6895-
6896-
The tracking issue for this feature is: None.
6897-
6898-
Intrinsics are rarely intended to be stable directly, but are usually
6899-
exported in some sort of stable manner. Prefer using the stable interfaces to
6900-
the intrinsic directly when you can.
6901-
6902-
------------------------
6903-
6904-
6905-
## Intrinsics with fallback logic
6906-
6907-
Many intrinsics can be written in pure rust, albeit inefficiently or without supporting
6908-
some features that only exist on some backends. Backends can simply not implement those
6909-
intrinsics without causing any code miscompilations or failures to compile.
6910-
All intrinsic fallback bodies are automatically made cross-crate inlineable (like `#[inline]`)
6911-
by the codegen backend, but not the MIR inliner.
6912-
6913-
```rust
6914-
#![feature(intrinsics)]
6915-
#![allow(internal_features)]
6916-
6917-
#[rustc_intrinsic]
6918-
const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
6919-
```
6920-
6921-
Since these are just regular functions, it is perfectly ok to create the intrinsic twice:
6922-
6923-
```rust
6924-
#![feature(intrinsics)]
6925-
#![allow(internal_features)]
6926-
6927-
#[rustc_intrinsic]
6928-
const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
6929-
6930-
mod foo {
6931-
#[rustc_intrinsic]
6932-
const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {
6933-
panic!("noisy const dealloc")
6934-
}
6935-
}
6936-
6937-
```
6938-
6939-
The behaviour on backends that override the intrinsic is exactly the same. On other
6940-
backends, the intrinsic behaviour depends on which implementation is called, just like
6941-
with any regular function.
6942-
6943-
## Intrinsics lowered to MIR instructions
6944-
6945-
Various intrinsics have native MIR operations that they correspond to. Instead of requiring
6946-
backends to implement both the intrinsic and the MIR operation, the `lower_intrinsics` pass
6947-
will convert the calls to the MIR operation. Backends do not need to know about these intrinsics
6948-
at all. These intrinsics only make sense without a body, and can either be declared as a "rust-intrinsic"
6949-
or as a `#[rustc_intrinsic]`. The body is never used, as calls to the intrinsic do not exist
6950-
anymore after MIR analyses.
6951-
6952-
## Intrinsics without fallback logic
6953-
6954-
These must be implemented by all backends.
6955-
6956-
### `#[rustc_intrinsic]` declarations
6957-
6958-
These are written like intrinsics with fallback bodies, but the body is irrelevant.
6959-
Use `loop {}` for the body or call the intrinsic recursively and add
6960-
`#[rustc_intrinsic_must_be_overridden]` to the function to ensure that backends don't
6961-
invoke the body.
6962-
6963-
### Legacy extern ABI based intrinsics
6964-
6965-
These are imported as if they were FFI functions, with the special
6966-
`rust-intrinsic` ABI. For example, if one was in a freestanding
6967-
context, but wished to be able to `transmute` between types, and
6968-
perform efficient pointer arithmetic, one would import those functions
6969-
via a declaration like
6970-
6971-
```rust
6972-
#![feature(intrinsics)]
6973-
#![allow(internal_features)]
6974-
# fn main() {}
6975-
6976-
extern "rust-intrinsic" {
6977-
fn transmute<T, U>(x: T) -> U;
6978-
6979-
fn arith_offset<T>(dst: *const T, offset: isize) -> *const T;
6980-
}
6981-
```
6982-
6983-
As with any other FFI functions, these are by default always `unsafe` to call.
6984-
You can add `#[rustc_safe_intrinsic]` to the intrinsic to make it safe to call.
6985-
6986-
"#]],
6987-
)
6885+
let (analysis, position) = fixture::position(r#"#![feature(intrinsics$0)]"#);
6886+
analysis
6887+
.hover(
6888+
&HoverConfig { links_in_hover: true, ..HOVER_BASE_CONFIG },
6889+
FileRange { file_id: position.file_id, range: TextRange::empty(position.offset) },
6890+
)
6891+
.unwrap()
6892+
.unwrap();
69886893
}
69896894

69906895
#[test]

crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::{
1111

1212
use intern::Symbol;
1313
use proc_macro::bridge::{self, server};
14-
use span::{FileId, Span, FIXUP_ERASED_FILE_AST_ID_MARKER};
14+
use span::{Span, FIXUP_ERASED_FILE_AST_ID_MARKER};
1515
use tt::{TextRange, TextSize};
1616

1717
use crate::server_impl::{literal_kind_to_internal, token_stream::TokenStreamBuilder, TopSubtree};
@@ -27,10 +27,6 @@ mod tt {
2727

2828
type TokenStream = crate::server_impl::TokenStream<Span>;
2929

30-
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
31-
pub struct SourceFile {
32-
file_id: FileId,
33-
}
3430
pub struct FreeFunctions;
3531

3632
pub struct RaSpanServer {
@@ -46,7 +42,6 @@ pub struct RaSpanServer {
4642
impl server::Types for RaSpanServer {
4743
type FreeFunctions = FreeFunctions;
4844
type TokenStream = TokenStream;
49-
type SourceFile = SourceFile;
5045
type Span = Span;
5146
type Symbol = Symbol;
5247
}
@@ -245,25 +240,17 @@ impl server::TokenStream for RaSpanServer {
245240
}
246241
}
247242

248-
impl server::SourceFile for RaSpanServer {
249-
fn eq(&mut self, file1: &Self::SourceFile, file2: &Self::SourceFile) -> bool {
250-
file1 == file2
251-
}
252-
fn path(&mut self, _file: &Self::SourceFile) -> String {
253-
// FIXME
254-
String::new()
255-
}
256-
fn is_real(&mut self, _file: &Self::SourceFile) -> bool {
257-
true
258-
}
259-
}
260-
261243
impl server::Span for RaSpanServer {
262244
fn debug(&mut self, span: Self::Span) -> String {
263245
format!("{:?}", span)
264246
}
265-
fn source_file(&mut self, span: Self::Span) -> Self::SourceFile {
266-
SourceFile { file_id: span.anchor.file_id.file_id() }
247+
fn file(&mut self, _: Self::Span) -> String {
248+
// FIXME
249+
String::new()
250+
}
251+
fn local_file(&mut self, _: Self::Span) -> Option<String> {
252+
// FIXME
253+
None
267254
}
268255
fn save_span(&mut self, _span: Self::Span) -> usize {
269256
// FIXME, quote is incompatible with third-party tools

crates/proc-macro-srv/src/server_impl/token_id.rs

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ type Literal = tt::Literal;
2424
type Span = tt::TokenId;
2525
type TokenStream = crate::server_impl::TokenStream<Span>;
2626

27-
#[derive(Clone)]
28-
pub struct SourceFile;
2927
pub struct FreeFunctions;
3028

3129
pub struct TokenIdServer {
@@ -37,7 +35,6 @@ pub struct TokenIdServer {
3735
impl server::Types for TokenIdServer {
3836
type FreeFunctions = FreeFunctions;
3937
type TokenStream = TokenStream;
40-
type SourceFile = SourceFile;
4138
type Span = Span;
4239
type Symbol = Symbol;
4340
}
@@ -223,24 +220,15 @@ impl server::TokenStream for TokenIdServer {
223220
}
224221
}
225222

226-
impl server::SourceFile for TokenIdServer {
227-
fn eq(&mut self, _file1: &Self::SourceFile, _file2: &Self::SourceFile) -> bool {
228-
true
229-
}
230-
fn path(&mut self, _file: &Self::SourceFile) -> String {
231-
String::new()
232-
}
233-
fn is_real(&mut self, _file: &Self::SourceFile) -> bool {
234-
true
235-
}
236-
}
237-
238223
impl server::Span for TokenIdServer {
239224
fn debug(&mut self, span: Self::Span) -> String {
240225
format!("{:?}", span.0)
241226
}
242-
fn source_file(&mut self, _span: Self::Span) -> Self::SourceFile {
243-
SourceFile {}
227+
fn file(&mut self, _span: Self::Span) -> String {
228+
String::new()
229+
}
230+
fn local_file(&mut self, _span: Self::Span) -> Option<String> {
231+
None
244232
}
245233
fn save_span(&mut self, _span: Self::Span) -> usize {
246234
0

crates/proc-macro-srv/src/tests/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ fn test_fn_like_macro_clone_raw_ident() {
9797
}
9898

9999
#[test]
100+
#[cfg(not(bootstrap))]
100101
fn test_fn_like_fn_like_span_join() {
101102
assert_expand(
102103
"fn_like_span_join",
@@ -111,6 +112,7 @@ fn test_fn_like_fn_like_span_join() {
111112
}
112113

113114
#[test]
115+
#[cfg(not(bootstrap))]
114116
fn test_fn_like_fn_like_span_ops() {
115117
assert_expand(
116118
"fn_like_span_ops",

0 commit comments

Comments
 (0)