mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 11:20:54 +00:00
Merge from rust-lang/rust
This commit is contained in:
commit
f373437c22
@ -489,6 +489,14 @@ impl PatCx for MatchCheckCtx<'_> {
|
||||
fn complexity_exceeded(&self) -> Result<(), Self::Error> {
|
||||
Err(())
|
||||
}
|
||||
|
||||
fn report_mixed_deref_pat_ctors(
|
||||
&self,
|
||||
_deref_pat: &DeconstructedPat<'_>,
|
||||
_normal_pat: &DeconstructedPat<'_>,
|
||||
) {
|
||||
// FIXME(deref_patterns): This could report an error comparable to the one in rustc.
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for MatchCheckCtx<'_> {
|
||||
|
@ -261,7 +261,7 @@ pub fn layout_of_ty_query(
|
||||
}
|
||||
// Potentially-wide pointers.
|
||||
TyKind::Ref(_, _, pointee) | TyKind::Raw(_, pointee) => {
|
||||
let mut data_ptr = scalar_unit(dl, Primitive::Pointer(AddressSpace::DATA));
|
||||
let mut data_ptr = scalar_unit(dl, Primitive::Pointer(AddressSpace::ZERO));
|
||||
if matches!(ty.kind(Interner), TyKind::Ref(..)) {
|
||||
data_ptr.valid_range_mut().start = 1;
|
||||
}
|
||||
@ -285,7 +285,7 @@ pub fn layout_of_ty_query(
|
||||
scalar_unit(dl, Primitive::Int(dl.ptr_sized_integer(), false))
|
||||
}
|
||||
TyKind::Dyn(..) => {
|
||||
let mut vtable = scalar_unit(dl, Primitive::Pointer(AddressSpace::DATA));
|
||||
let mut vtable = scalar_unit(dl, Primitive::Pointer(AddressSpace::ZERO));
|
||||
vtable.valid_range_mut().start = 1;
|
||||
vtable
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
use base_db::Crate;
|
||||
use hir_def::layout::TargetDataLayout;
|
||||
use rustc_abi::{AlignFromBytesError, TargetDataLayoutErrors};
|
||||
use rustc_abi::{AlignFromBytesError, TargetDataLayoutErrors, AddressSpace};
|
||||
use triomphe::Arc;
|
||||
|
||||
use crate::db::HirDatabase;
|
||||
@ -12,7 +12,7 @@ pub fn target_data_layout_query(
|
||||
krate: Crate,
|
||||
) -> Result<Arc<TargetDataLayout>, Arc<str>> {
|
||||
match &krate.workspace_data(db).data_layout {
|
||||
Ok(it) => match TargetDataLayout::parse_from_llvm_datalayout_string(it) {
|
||||
Ok(it) => match TargetDataLayout::parse_from_llvm_datalayout_string(it, AddressSpace::ZERO) {
|
||||
Ok(it) => Ok(Arc::new(it)),
|
||||
Err(e) => {
|
||||
Err(match e {
|
||||
@ -39,6 +39,7 @@ pub fn target_data_layout_query(
|
||||
target,
|
||||
} => format!(r#"inconsistent target specification: "data-layout" claims pointers are {pointer_size}-bit, while "target-pointer-width" is `{target}`"#),
|
||||
TargetDataLayoutErrors::InvalidBitsSize { err } => err,
|
||||
TargetDataLayoutErrors::UnknownPointerSpecification { err } => format!(r#"use of unknown pointer specifer in "data-layout": {err}"#),
|
||||
}.into())
|
||||
}
|
||||
},
|
||||
|
@ -630,7 +630,7 @@ impl Evaluator<'_> {
|
||||
Ok(target_data_layout) => target_data_layout,
|
||||
Err(e) => return Err(MirEvalError::TargetDataLayoutNotAvailable(e)),
|
||||
};
|
||||
let cached_ptr_size = target_data_layout.pointer_size.bytes_usize();
|
||||
let cached_ptr_size = target_data_layout.pointer_size().bytes_usize();
|
||||
Ok(Evaluator {
|
||||
target_data_layout,
|
||||
stack: vec![0],
|
||||
|
@ -4711,9 +4711,9 @@ The tracking issue for this feature is: [#133668]
|
||||
label: "const_trait_impl",
|
||||
description: r##"# `const_trait_impl`
|
||||
|
||||
The tracking issue for this feature is: [#67792]
|
||||
The tracking issue for this feature is: [#143874]
|
||||
|
||||
[#67792]: https://github.com/rust-lang/rust/issues/67792
|
||||
[#143874]: https://github.com/rust-lang/rust/issues/143874
|
||||
|
||||
------------------------
|
||||
"##,
|
||||
|
@ -329,7 +329,7 @@ macro_rules! mcexp {
|
||||
#[deprecated]
|
||||
fn obsolete() {}
|
||||
|
||||
#[deprecated(note = "for awhile")]
|
||||
#[deprecated(note = "for a while")]
|
||||
fn very_obsolete() {}
|
||||
|
||||
// region: Some region name
|
||||
@ -608,8 +608,8 @@ fn let_statements() {
|
||||
StructureNode {
|
||||
parent: None,
|
||||
label: "very_obsolete",
|
||||
navigation_range: 511..524,
|
||||
node_range: 473..529,
|
||||
navigation_range: 512..525,
|
||||
node_range: 473..530,
|
||||
kind: SymbolKind(
|
||||
Function,
|
||||
),
|
||||
@ -621,8 +621,8 @@ fn let_statements() {
|
||||
StructureNode {
|
||||
parent: None,
|
||||
label: "Some region name",
|
||||
navigation_range: 531..558,
|
||||
node_range: 531..558,
|
||||
navigation_range: 532..559,
|
||||
node_range: 532..559,
|
||||
kind: Region,
|
||||
detail: None,
|
||||
deprecated: false,
|
||||
@ -630,8 +630,8 @@ fn let_statements() {
|
||||
StructureNode {
|
||||
parent: None,
|
||||
label: "m",
|
||||
navigation_range: 598..599,
|
||||
node_range: 573..636,
|
||||
navigation_range: 599..600,
|
||||
node_range: 574..637,
|
||||
kind: SymbolKind(
|
||||
Module,
|
||||
),
|
||||
@ -643,8 +643,8 @@ fn let_statements() {
|
||||
22,
|
||||
),
|
||||
label: "dontpanic",
|
||||
navigation_range: 573..593,
|
||||
node_range: 573..593,
|
||||
navigation_range: 574..594,
|
||||
node_range: 574..594,
|
||||
kind: Region,
|
||||
detail: None,
|
||||
deprecated: false,
|
||||
@ -654,8 +654,8 @@ fn let_statements() {
|
||||
22,
|
||||
),
|
||||
label: "f",
|
||||
navigation_range: 605..606,
|
||||
node_range: 602..611,
|
||||
navigation_range: 606..607,
|
||||
node_range: 603..612,
|
||||
kind: SymbolKind(
|
||||
Function,
|
||||
),
|
||||
@ -669,8 +669,8 @@ fn let_statements() {
|
||||
22,
|
||||
),
|
||||
label: "g",
|
||||
navigation_range: 628..629,
|
||||
node_range: 612..634,
|
||||
navigation_range: 629..630,
|
||||
node_range: 613..635,
|
||||
kind: SymbolKind(
|
||||
Function,
|
||||
),
|
||||
@ -682,8 +682,8 @@ fn let_statements() {
|
||||
StructureNode {
|
||||
parent: None,
|
||||
label: "extern \"C\"",
|
||||
navigation_range: 638..648,
|
||||
node_range: 638..651,
|
||||
navigation_range: 639..649,
|
||||
node_range: 639..652,
|
||||
kind: ExternBlock,
|
||||
detail: None,
|
||||
deprecated: false,
|
||||
@ -691,8 +691,8 @@ fn let_statements() {
|
||||
StructureNode {
|
||||
parent: None,
|
||||
label: "let_statements",
|
||||
navigation_range: 656..670,
|
||||
node_range: 653..813,
|
||||
navigation_range: 657..671,
|
||||
node_range: 654..814,
|
||||
kind: SymbolKind(
|
||||
Function,
|
||||
),
|
||||
@ -706,8 +706,8 @@ fn let_statements() {
|
||||
27,
|
||||
),
|
||||
label: "x",
|
||||
navigation_range: 683..684,
|
||||
node_range: 679..690,
|
||||
navigation_range: 684..685,
|
||||
node_range: 680..691,
|
||||
kind: SymbolKind(
|
||||
Local,
|
||||
),
|
||||
@ -719,8 +719,8 @@ fn let_statements() {
|
||||
27,
|
||||
),
|
||||
label: "mut y",
|
||||
navigation_range: 699..704,
|
||||
node_range: 695..709,
|
||||
navigation_range: 700..705,
|
||||
node_range: 696..710,
|
||||
kind: SymbolKind(
|
||||
Local,
|
||||
),
|
||||
@ -732,8 +732,8 @@ fn let_statements() {
|
||||
27,
|
||||
),
|
||||
label: "Foo { .. }",
|
||||
navigation_range: 718..740,
|
||||
node_range: 714..753,
|
||||
navigation_range: 719..741,
|
||||
node_range: 715..754,
|
||||
kind: SymbolKind(
|
||||
Local,
|
||||
),
|
||||
@ -745,8 +745,8 @@ fn let_statements() {
|
||||
27,
|
||||
),
|
||||
label: "_",
|
||||
navigation_range: 803..804,
|
||||
node_range: 799..811,
|
||||
navigation_range: 804..805,
|
||||
node_range: 800..812,
|
||||
kind: SymbolKind(
|
||||
Local,
|
||||
),
|
||||
|
@ -11,8 +11,8 @@
|
||||
use std::ops;
|
||||
|
||||
use rustc_literal_escaper::{
|
||||
EscapeError, Mode, unescape_byte, unescape_byte_str, unescape_c_str, unescape_char,
|
||||
unescape_str,
|
||||
unescape_byte, unescape_byte_str, unescape_c_str, unescape_char, unescape_str, EscapeError,
|
||||
Mode,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
@ -44,7 +44,9 @@ impl<'a> LexedStr<'a> {
|
||||
|
||||
// Re-create the tokenizer from scratch every token because `GuardedStrPrefix` is one token in the lexer
|
||||
// but we want to split it to two in edition <2024.
|
||||
while let Some(token) = rustc_lexer::tokenize(&text[conv.offset..]).next() {
|
||||
while let Some(token) =
|
||||
rustc_lexer::tokenize(&text[conv.offset..], rustc_lexer::FrontmatterAllowed::No).next()
|
||||
{
|
||||
let token_text = &text[conv.offset..][..token.len as usize];
|
||||
|
||||
conv.extend_token(&token.kind, token_text);
|
||||
@ -58,7 +60,7 @@ impl<'a> LexedStr<'a> {
|
||||
return None;
|
||||
}
|
||||
|
||||
let token = rustc_lexer::tokenize(text).next()?;
|
||||
let token = rustc_lexer::tokenize(text, rustc_lexer::FrontmatterAllowed::No).next()?;
|
||||
if token.len as usize != text.len() {
|
||||
return None;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ pub(super) fn literal_from_str<Span: Copy>(
|
||||
use proc_macro::bridge::LitKind;
|
||||
use rustc_lexer::{LiteralKind, Token, TokenKind};
|
||||
|
||||
let mut tokens = rustc_lexer::tokenize(s);
|
||||
let mut tokens = rustc_lexer::tokenize(s, rustc_lexer::FrontmatterAllowed::No);
|
||||
let minus_or_lit = tokens.next().unwrap_or(Token { kind: TokenKind::Eof, len: 0 });
|
||||
|
||||
let lit = if minus_or_lit.kind == TokenKind::Minus {
|
||||
|
@ -25,7 +25,7 @@ impl flags::Scip {
|
||||
eprintln!("Generating SCIP start...");
|
||||
let now = Instant::now();
|
||||
|
||||
let no_progress = &|s| (eprintln!("rust-analyzer: Loading {s}"));
|
||||
let no_progress = &|s| eprintln!("rust-analyzer: Loading {s}");
|
||||
let root =
|
||||
vfs::AbsPathBuf::assert_utf8(std::env::current_dir()?.join(&self.path)).normalize();
|
||||
|
||||
|
@ -579,7 +579,7 @@ where
|
||||
{
|
||||
use rustc_lexer::LiteralKind;
|
||||
|
||||
let token = rustc_lexer::tokenize(text).next_tuple();
|
||||
let token = rustc_lexer::tokenize(text, rustc_lexer::FrontmatterAllowed::No).next_tuple();
|
||||
let Some((rustc_lexer::Token {
|
||||
kind: rustc_lexer::TokenKind::Literal { kind, suffix_start },
|
||||
..
|
||||
|
Loading…
x
Reference in New Issue
Block a user