77,347 matches across 25 files for error lang:Rust
snippet_mode: grep · sorted by relevance
compiler/rustc/build.rs RUST 1 matches view file →
37 println!("cargo:rustc-link-arg-bin=rustc-main=/MANIFEST:EMBED");
38 println!("cargo:rustc-link-arg-bin=rustc-main=/MANIFESTINPUT:{}", manifest.to_str().unwrap());
39 // Turn linker warnings into errors.
40 println!("cargo:rustc-link-arg-bin=rustc-main=/WX");
41}
compiler/rustc_abi/src/callconv.rs RUST 1 matches view file →
17}
18
19/// Error from the `homogeneous_aggregate` test function, indicating
20/// there are distinct leaf fields passed in different ways,
21/// or this is uninhabited.
compiler/rustc_abi/src/canon_abi.rs RUST 1 matches view file →
80 // convert to the ExternAbi that *shares a string* with this CanonAbi.
81 // FIXME: ideally we'd avoid printing `CanonAbi`, and preserve `ExternAbi` everywhere
82 // that we need to generate error messages.
83 let erased_abi = match self {
84 CanonAbi::C => ExternAbi::C { unwind: false },
compiler/rustc_abi/src/extern_abi.rs RUST 1 matches view file →
268
269#[cfg(feature = "nightly")]
270rustc_error_messages::into_diag_arg_using_display!(ExternAbi);
271
272#[cfg(feature = "nightly")]
compiler/rustc_abi/src/layout.rs RUST 21 matches · showing 5 view file →
107
108#[derive(Copy, Clone, Debug, PartialEq, Eq)]
109pub enum LayoutCalculatorError<F> {
110 /// An unsized type was found in a location where a sized type was expected.
111 ///
· · ·
112 /// This is not always a compile error, for example if there is a `[T]: Sized`
113 /// bound in a where clause.
114 ///
· · ·
135}
136
137impl<F> LayoutCalculatorError<F> {
138 pub fn without_payload(&self) -> LayoutCalculatorError<()> {
139 use LayoutCalculatorError::*;
· · ·
138 pub fn without_payload(&self) -> LayoutCalculatorError<()> {
139 use LayoutCalculatorError::*;
140 match *self {
· · ·
139 use LayoutCalculatorError::*;
140 match *self {
141 UnexpectedUnsized(_) => UnexpectedUnsized(()),
+ 16 more matches in this file
compiler/rustc_abi/src/lib.rs RUST 39 matches · showing 5 view file →
40#[cfg(feature = "nightly")]
41use std::iter::Step;
42use std::num::{NonZeroUsize, ParseIntError};
43use std::ops::{Add, AddAssign, Deref, Mul, RangeFull, Sub};
44use std::range::RangeInclusive;
· · ·
49use rustc_data_structures::stable_hash::StableOrd;
50#[cfg(feature = "nightly")]
51use rustc_error_messages::{DiagArgValue, IntoDiagArg};
52#[cfg(feature = "nightly")]
53use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, msg};
· · ·
53use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, msg};
54use rustc_hashes::Hash64;
55use rustc_index::{Idx, IndexSlice, IndexVec};
· · ·
71pub use extern_abi::CVariadicStatus;
72pub use extern_abi::{ExternAbi, all_names};
73pub use layout::{FIRST_VARIANT, FieldIdx, LayoutCalculator, LayoutCalculatorError, VariantIdx};
74#[cfg(feature = "nightly")]
75pub use layout::{Layout, TyAbiInterface, TyAndLayout};
· · ·
328}
329
330pub enum TargetDataLayoutError<'a> {
331 InvalidAddressSpace { addr_space: &'a str, cause: &'a str, err: ParseIntError },
332 InvalidBits { kind: &'a str, bit: &'a str, cause: &'a str, err: ParseIntError },
+ 34 more matches in this file
compiler/rustc_ast/src/ast.rs RUST 19 matches · showing 5 view file →
33use rustc_span::def_id::LocalDefId;
34use rustc_span::{
35 ByteSymbol, DUMMY_SP, ErrorGuaranteed, Ident, LocalExpnId, Span, Spanned, Symbol, kw, respan,
36 sym,
37};
· · ·
724
725 /// Whether this could be a never pattern, taking into account that a macro invocation can
726 /// return a never pattern. Used to inform errors during parsing.
727 pub fn could_be_never_pattern(&self) -> bool {
728 let mut could_be_never_pattern = false;
· · ·
741 }
742
743 /// Whether this contains a `!` pattern. This in particular means that a feature gate error will
744 /// be raised if the feature is off. Used to avoid gating the feature twice.
745 pub fn contains_never_pattern(&self) -> bool {
· · ·
948
949 /// Placeholder for a pattern that wasn't syntactically well formed in some way.
950 Err(ErrorGuaranteed),
951}
952
· · ·
956 /// `module::StructName { field, ..}`
957 Rest(Span),
958 /// `module::StructName { field, syntax error }`
959 Recovered(ErrorGuaranteed),
960 /// `module::StructName { field }`
+ 14 more matches in this file
compiler/rustc_ast/src/attr/mod.rs RUST 1 matches view file →
602 AttrArgs::Eq { expr, .. } => match expr.kind {
603 ExprKind::Lit(token_lit) => {
604 // Turn failures to `None`, we'll get parse errors elsewhere.
605 MetaItemLit::from_token_lit(token_lit, expr.span)
606 .ok()
compiler/rustc_ast/src/expand/allocator.rs RUST 1 matches view file →
18}
19
20pub const ALLOC_ERROR_HANDLER: Symbol = sym::alloc_error_handler;
21pub const NO_ALLOC_SHIM_IS_UNSTABLE: &str = "__rust_no_alloc_shim_is_unstable_v2";
22
compiler/rustc_ast/src/expand/autodiff_attrs.rs RUST 7 matches · showing 5 view file →
23#[derive(Clone, Copy, Eq, PartialEq, Encodable, Decodable, Debug, StableHash)]
24pub enum DiffMode {
25 /// No autodiff is applied (used during error handling).
26 Error,
27 /// The primal function which we will differentiate.
· · ·
26 Error,
27 /// The primal function which we will differentiate.
28 Source,
· · ·
113 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
114 match self {
115 DiffMode::Error => write!(f, "Error"),
116 DiffMode::Source => write!(f, "Source"),
117 DiffMode::Forward => write!(f, "Forward"),
· · ·
125/// Const is valid for all cases and means that we don't compute derivatives wrt. this output.
126/// That usually means we have a &mut or *mut T output and compute derivatives wrt. that arg,
127/// but this is too complex to verify here. Also it's just a logic error if users get this wrong.
128pub fn valid_ret_activity(mode: DiffMode, activity: DiffActivity) -> bool {
129 if activity == DiffActivity::None {
· · ·
132 }
133 match mode {
134 DiffMode::Error => false,
135 DiffMode::Source => false,
136 DiffMode::Forward => activity.is_dual_or_const(),
+ 2 more matches in this file
compiler/rustc_ast/src/format.rs RUST 1 matches view file →
97 } else if self.names.is_empty() {
98 // Only count the unnamed args before the first named arg.
99 // (Any later ones are errors.)
100 self.num_unnamed_args += 1;
101 }
compiler/rustc_ast/src/token.rs RUST 6 matches · showing 5 view file →
9use rustc_span::edition::Edition;
10use rustc_span::symbol::IdentPrintMode;
11use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, kw, sym};
12#[allow(clippy::useless_attribute)] // FIXME: following use of `hidden_glob_reexports` incorrectly triggers `useless_attribute` lint.
13#[allow(hidden_glob_reexports)]
· · ·
202 CStr,
203 CStrRaw(u8),
204 Err(ErrorGuaranteed),
205}
206
· · ·
302 ByteStr | ByteStrRaw(..) => "byte string",
303 CStr | CStrRaw(..) => "C string",
304 Err(_) => "error",
305 }
306 }
· · ·
580
581 /// Returns tokens that are likely to be typed accidentally instead of the current token.
582 /// Enables better error recovery when the wrong token is found.
583 pub fn similar_tokens(&self) -> &[TokenKind] {
584 match self {
· · ·
682 And | // reference
683 AndAnd | // double reference
684 // DotDotDot is no longer supported, but we need some way to display the error
685 DotDot | DotDotDot | DotDotEq | // range notation
686 Lt | Shl | // associated path
+ 1 more matches in this file
compiler/rustc_ast/src/util/literal.rs RUST 11 matches · showing 5 view file →
33
34#[derive(Debug)]
35pub enum LitError {
36 InvalidSuffix(Symbol),
37 InvalidIntSuffix(Symbol),
· · ·
43impl LitKind {
44 /// Converts literal token into a semantic literal.
45 pub fn from_token_lit(lit: token::Lit) -> Result<LitKind, LitError> {
46 let token::Lit { kind, symbol, suffix } = lit;
47 if let Some(suffix) = suffix
· · ·
48 && !kind.may_have_suffix()
49 {
50 return Err(LitError::InvalidSuffix(suffix));
51 }
52
· · ·
217impl MetaItemLit {
218 /// Converts a token literal into a meta item literal.
219 pub fn from_token_lit(token_lit: token::Lit, span: Span) -> Result<MetaItemLit, LitError> {
220 Ok(MetaItemLit {
221 symbol: token_lit.symbol,
· · ·
268 suffix: Option<Symbol>,
269 base: u32,
270) -> Result<LitKind, LitError> {
271 debug!("filtered_float_lit: {:?}, {:?}, {:?}", symbol, suffix, base);
272 if base != 10 {
+ 6 more matches in this file
compiler/rustc_ast/src/util/parser.rs RUST 2 matches view file →
64 token::OrOr => Some(Binary(BinOpKind::Or)),
65 token::DotDot => Some(Range(RangeLimits::HalfOpen)),
66 // DotDotDot is no longer supported, but we need some way to display the error
67 token::DotDotEq | token::DotDotDot => Some(Range(RangeLimits::Closed)),
68 // `<-` should probably be `< -`
· · ·
114 /// This operator could be used to follow a block unambiguously.
115 ///
116 /// This is used for error recovery at the moment, providing a suggestion to wrap blocks with
117 /// parentheses while having a high degree of confidence on the correctness of the suggestion.
118 pub fn can_continue_expr_unambiguously(&self) -> bool {
compiler/rustc_ast/src/visit.rs RUST 4 matches view file →
370 Mutability,
371 Pinnedness,
372 Result<(), rustc_span::ErrorGuaranteed>,
373 rustc_data_structures::fx::FxHashMap<Symbol, usize>,
374 rustc_span::ErrorGuaranteed,
· · ·
374 rustc_span::ErrorGuaranteed,
375 std::borrow::Cow<'_, str>,
376 Symbol,
· · ·
508 ///
509 /// Every `walk_*` method uses deconstruction to access fields of structs and
510 /// enums. This will result in a compile error if a field is added, which makes
511 /// it more likely the appropriate visit call will be added for it.
512 pub trait $Visitor<$($lt)?> : Sized $(${ignore($mut)} + MutVisitorResult<Result = ()>)? {
· · ·
542 // As well as being more concise, the former is explicit about which fields
543 // are skipped. Furthermore, if a new field is added, the destructuring
544 // version will cause a compile error, which is good. In comparison, the
545 // field access version will continue working and it would be easy to
546 // forget to add handling for it.
compiler/rustc_ast_lowering/src/asm.rs RUST 7 matches · showing 5 view file →
3use rustc_ast::*;
4use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
5use rustc_errors::msg;
6use rustc_hir as hir;
7use rustc_hir::def::{DefKind, Res};
· · ·
8use rustc_session::errors::feature_err;
9use rustc_span::{Span, sym};
10use rustc_target::asm;
· · ·
98 ) {
99 Ok(abi) => {
100 // If the abi was already in the list, emit an error
101 match clobber_abis.get(&abi) {
102 Some((prev_name, prev_sp)) => {
· · ·
132 }
133
134 // Lower operands to HIR. We use dummy register classes if an error
135 // occurs during lowering because we still need to be able to produce a
136 // valid HIR.
· · ·
143 InlineAsmRegOrRegClass::Reg(reg) => {
144 asm::InlineAsmRegOrRegClass::Reg(if let Some(asm_arch) = asm_arch {
145 asm::InlineAsmReg::parse(asm_arch, reg).unwrap_or_else(|error| {
146 self.dcx().emit_err(InvalidRegister {
147 op_span: *op_sp,
+ 2 more matches in this file
compiler/rustc_ast_lowering/src/block.rs RUST 1 matches view file →
80
81 /// Return an `ImplTraitContext` that allows impl trait in bindings if
82 /// the feature gate is enabled, or issues a feature error if it is not.
83 fn impl_trait_in_bindings_ctxt(&self, position: ImplTraitPosition) -> ImplTraitContext {
84 if self.tcx.features().impl_trait_in_bindings() {
compiler/rustc_ast_lowering/src/delegation.rs RUST 13 matches · showing 5 view file →
34//!
35//! Similarly generics, predicates and header are set to the "default" values.
36//! In case of discrepancy with callee function the `UnsupportedDelegation` error will
37//! also be emitted during HIR ty lowering.
38
· · ·
54use rustc_span::def_id::{DefId, LocalDefId};
55use rustc_span::symbol::kw;
56use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol};
57
58use crate::delegation::generics::{GenericsGenerationResult, GenericsGenerationResults};
· · ·
130 }
131
132 fn check_for_cycles(&self, mut def_id: DefId, span: Span) -> Result<(), ErrorGuaranteed> {
133 let mut visited: FxHashSet<DefId> = Default::default();
134
· · ·
169 );
170
171 return self.generate_delegation_error(span, delegation);
172 };
173
· · ·
182 );
183
184 return self.generate_delegation_error(span, delegation);
185 };
186
+ 8 more matches in this file
compiler/rustc_ast_lowering/src/delegation/generics.rs RUST 1 matches view file →
319 // applies to traits, `trait Trait<Self> {}` will be represented as
320 // `trait Trait {}` in HIR and "unexpected keyword `Self` in generic parameters"
321 // error will be emitted.
322 // Note that we do not rename `Self` to `This` after non-recursive reuse
323 // from Trait, in this case the `Self` should not be propagated
compiler/rustc_ast_lowering/src/diagnostics.rs RUST 4 matches view file →
1use rustc_errors::codes::*;
2use rustc_errors::{DiagArgFromDisplay, DiagSymbolList};
3use rustc_macros::{Diagnostic, Subdiagnostic};
· · ·
2use rustc_errors::{DiagArgFromDisplay, DiagSymbolList};
3use rustc_macros::{Diagnostic, Subdiagnostic};
4use rustc_span::{Ident, Span, Symbol};
· · ·
217
218#[derive(Diagnostic)]
219#[diag("invalid register `{$reg}`: {$error}")]
220pub(crate) struct InvalidRegister<'a> {
221 #[primary_span]
· · ·
222 pub op_span: Span,
223 pub reg: Symbol,
224 pub error: &'a str,
225}
226
compiler/rustc_ast_lowering/src/expr.rs RUST 21 matches · showing 5 view file →
6use rustc_ast::*;
7use rustc_data_structures::stack::ensure_sufficient_stack;
8use rustc_errors::msg;
9use rustc_hir as hir;
10use rustc_hir::def::{DefKind, Res};
· · ·
12use rustc_middle::span_bug;
13use rustc_middle::ty::TyCtxt;
14use rustc_session::errors::report_lit_error;
15use rustc_span::{ByteSymbol, DUMMY_SP, DesugaringKind, Ident, Span, Spanned, Symbol, respan, sym};
16use thin_vec::{ThinVec, thin_vec};
· · ·
315 ExprKind::Move(inner, move_kw_span) => {
316 if !self.tcx.features().move_expr() {
317 return self.expr_err(*move_kw_span, self.dcx().has_errors().unwrap());
318 }
319 if let Some(state) = self.move_expr_bindings.last().and_then(Option::as_ref) {
· · ·
457 }
458 StructRest::None => hir::StructTailExpr::None,
459 StructRest::NoneWithError(guar) => hir::StructTailExpr::NoneWithError(guar),
460 };
461 hir::ExprKind::Struct(
· · ·
520 Ok(lit_kind) => lit_kind,
521 Err(err) => {
522 let guar = report_lit_error(&self.tcx.sess.psess, err, *token_lit, span);
523 LitKind::Err(guar)
524 }
+ 16 more matches in this file
compiler/rustc_ast_lowering/src/expr/closure.rs RUST 1 matches view file →
296 // body shape. This path pushes `None` for `move_expr_bindings`, so any
297 // `move(...)` in the coroutine body gets a targeted unsupported-position
298 // error instead of being collected like a plain closure occurrence.
299 fn lower_expr_coroutine_closure(
300 &mut self,
compiler/rustc_ast_lowering/src/item.rs RUST 17 matches · showing 5 view file →
2use rustc_ast::visit::AssocCtxt;
3use rustc_ast::*;
4use rustc_errors::{E0570, ErrorGuaranteed, struct_span_code_err};
5use rustc_hir::attrs::{AttributeKind, EiiImplResolution};
6use rustc_hir::def::{DefKind, PerNS, Res};
· · ·
152 EiiImplResolution::Macro(macro_did)
153 } else {
154 EiiImplResolution::Error(
155 self.dcx().span_delayed_bug(*span, "eii never resolved without errors given"),
156 )
· · ·
155 self.dcx().span_delayed_bug(*span, "eii never resolved without errors given"),
156 )
157 };
· · ·
586 let res = self.get_partial_res(id)?;
587 let Some(did) = res.expect_full_res().opt_def_id() else {
588 self.dcx().span_delayed_bug(path.span, "should have errored in resolve");
589 return None;
590 };
· · ·
639 }
640 Res::Err => {
641 // Propagate the error to all namespaces, just to be sure.
642 let err = Some(Res::Err);
643 PerNS { type_ns: err, value_ns: err, macro_ns: err }
+ 12 more matches in this file
compiler/rustc_ast_lowering/src/lib.rs RUST 22 matches · showing 5 view file →
20//! If you do, you must then set the new node's ID to a fresh one.
21//!
22//! Spans are used for error messages and for tools to map semantics back to
23//! source code. It is therefore not as important with spans as IDs to be strict
24//! about use (you can't break the compiler by screwing up a span). Obviously, a
· · ·
50use rustc_data_structures::tagged_ptr::TaggedRef;
51use rustc_data_structures::unord::ExtendUnord;
52use rustc_errors::codes::*;
53use rustc_errors::{DiagArgFromDisplay, DiagCtxtHandle};
54use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res};
· · ·
53use rustc_errors::{DiagArgFromDisplay, DiagCtxtHandle};
54use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res};
55use rustc_hir::def_id::{DefId, LOCAL_CRATE, LocalDefId, LocalDefIdMap};
· · ·
65use rustc_middle::span_bug;
66use rustc_middle::ty::{PerOwnerResolverData, ResolverAstLowering, TyCtxt};
67use rustc_session::errors::add_feature_diagnostics;
68use rustc_span::symbol::{Ident, Symbol, kw, sym};
69use rustc_span::{DUMMY_SP, DesugaringKind, Span};
· · ·
245 tcx.features(),
246 tcx.registered_tools(()),
247 ShouldEmit::ErrorsAndLints { recovery: Recovery::Allowed },
248 ),
249 delayed_lints: Vec::new(),
+ 17 more matches in this file
compiler/rustc_ast_lowering/src/pat.rs RUST 4 matches view file →
199 // There was a previous sub-tuple pattern; make sure we don't allow more...
200 if pat.is_rest() {
201 // ...but there was one again, so error.
202 self.ban_extra_rest_pat(pat.span, rest.unwrap().1, ctx);
203 } else {
· · ·
214 /// When encountering `($binding_mode $ident @)? ..` (`slice`),
215 /// this is interpreted as a sub-slice pattern semantically.
216 /// Patterns that follow, which are not like `slice` -- or an error occurs, are in `after`.
217 fn lower_pat_slice(&mut self, pats: &[Pat]) -> hir::PatKind<'hir> {
218 let mut before = Vec::new();
· · ·
266 };
267 if let Some(rest_span) = rest_span {
268 // We have e.g., `[a, .., b, ..]`. That's no good, error!
269 self.ban_extra_rest_pat(rest_span, prev_rest_span.unwrap(), "slice");
270 } else {
· · ·
352 }
353
354 /// Emit a friendly error for extra `..` patterns in a tuple/tuple struct/slice pattern.
355 pub(crate) fn ban_extra_rest_pat(&self, sp: Span, prev_sp: Span, ctx: &str) {
356 self.dcx().emit_err(ExtraDoubleDot { span: sp, prev_span: prev_sp, ctx });
Search syntax
auth loginboth terms (AND is implicit)
auth OR logineither term
NOT path:vendorexclude matches
"exact phrase"quoted exact match
/func\s+Test/regex
handler~1fuzzy (Levenshtein 1)
file:*_test.gofilename glob
path:pkg/auth/**full path glob
lang:golanguage filter

Search any public repo from your terminal

This page calls POST /api/v1/code_search. Same tool, available over MCP for Claude/Cursor/Copilot.